@inkeep/open-knowledge 0.71.0-beta.4 → 0.71.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/cli.mjs +6 -6
  2. package/dist/constants-PI7Uk_9U.mjs +1 -0
  3. package/dist/{dist-CfbmVdxm.mjs → dist-Cu24mffC.mjs} +1 -1
  4. package/dist/{dist-Dez6tzlv.mjs → dist-WGEb77w6.mjs} +474 -474
  5. package/dist/index.mjs +69 -69
  6. package/dist/init-Cxs22dc-.mjs +1 -0
  7. package/dist/{init-BOM6Plrv.mjs → init-DJozyAP4.mjs} +2 -2
  8. package/dist/{launch-json-removal-D4kKCI4O.mjs → launch-json-removal-CLXqZ8FV.mjs} +1 -1
  9. package/dist/{loader-BQx6-EcO.mjs → loader-OHqd0KW8.mjs} +1 -1
  10. package/dist/loader-yEu9PpEQ.mjs +1 -0
  11. package/dist/{md-manager-BGnqyqi1-3pT0cZWk.mjs → md-manager-BGnqyqi1-BnHkV2Y4.mjs} +2 -2
  12. package/dist/{open-browser-1dLsj63B.mjs → open-browser-BD03Xcs2.mjs} +1 -1
  13. package/dist/parse-worker.mjs +1 -1
  14. package/dist/preview-DPw19SOR.mjs +1 -0
  15. package/dist/{preview-CXhfioFZ.mjs → preview-Dnpx-15V.mjs} +1 -1
  16. package/dist/public/assets/{ActivityModeContent-DbclQMZK.js → ActivityModeContent-BJdaznjT.js} +1 -1
  17. package/dist/public/assets/{AddPropertiesButton-CMf-KkCT.js → AddPropertiesButton-CWXtIJBB.js} +2 -2
  18. package/dist/public/assets/{AgentDiffPane-qfjnh5w9.js → AgentDiffPane-Bgb-TqdH.js} +1 -1
  19. package/dist/public/assets/{AgentThreadClientBinder-Dv_ylFJd.js → AgentThreadClientBinder-DpyzkD9R.js} +1 -1
  20. package/dist/public/assets/{BugReportHistory-CKNSwMPv.js → BugReportHistory-NoOgL4e-.js} +1 -1
  21. package/dist/public/assets/{BugReportHistoryDialog-ByuUF0Vk.js → BugReportHistoryDialog-DYkbQ_VP.js} +1 -1
  22. package/dist/public/assets/{CodeMirrorPropInput-Bg2M0VGj.js → CodeMirrorPropInput-Btu3mHtw.js} +1 -1
  23. package/dist/public/assets/{ConsentDialogBody-Cma1nkJp.js → ConsentDialogBody-Co7zxbd1.js} +1 -1
  24. package/dist/public/assets/{DiffViewBoundary-B0fcLuH6.js → DiffViewBoundary-CjYhHYXW.js} +1 -1
  25. package/dist/public/assets/{DocumentContext-pm__5kxG.js → DocumentContext-Ds-fn6hr.js} +1 -1
  26. package/dist/public/assets/{EditorModeToggle-DU9-rkBI.js → EditorModeToggle-dclY5DGp.js} +1 -1
  27. package/dist/public/assets/{EnableSyncConfirmDialog-BIWQIL1r.js → EnableSyncConfirmDialog-CY7bePze.js} +1 -1
  28. package/dist/public/assets/{ExcalidrawDocEditor-Dmw0ahkY.js → ExcalidrawDocEditor-7BkV5yaY.js} +1 -1
  29. package/dist/public/assets/FeedbackForm-D6x1Kme5.js +1 -0
  30. package/dist/public/assets/{GraphPanel-vXJr8WRj.js → GraphPanel-CAy7iK1-.js} +1 -1
  31. package/dist/public/assets/{ImageAttachments-DXKklhex.js → ImageAttachments-CckZxudE.js} +1 -1
  32. package/dist/public/assets/{ImportSkillDialog-CCFX_M_a.js → ImportSkillDialog-CM7GHBVC.js} +1 -1
  33. package/dist/public/assets/{LintConfigEditor-CkrB6zf0.js → LintConfigEditor-D2adiJ_F.js} +1 -1
  34. package/dist/public/assets/ManagedArtifactProperties-BjI35KVX.js +1 -0
  35. package/dist/public/assets/{ManagedArtifactProperties-DzX_JRWB.js → ManagedArtifactProperties-biGQX3ij.js} +1 -1
  36. package/dist/public/assets/{MermaidDocEditor-DRgpS3_p.js → MermaidDocEditor-BUTIxTnE.js} +1 -1
  37. package/dist/public/assets/{PropertyDisplayRow-floO6hTm.js → PropertyDisplayRow-fM_A-_6U.js} +1 -1
  38. package/dist/public/assets/{RegisteredAgentIcon-BniGAp0H.js → RegisteredAgentIcon-Bm7qna_x.js} +1 -1
  39. package/dist/public/assets/{ReportBugDialogBody-4TLEormO.js → ReportBugDialogBody-Bv7pQbuO.js} +1 -1
  40. package/dist/public/assets/{ReportBugMenuTrigger-DvYN3NQJ.js → ReportBugMenuTrigger-0PV_UPMP.js} +2 -2
  41. package/dist/public/assets/{SchemaConfigEditor-Dx9HRjqA.js → SchemaConfigEditor-VAFLWTdf.js} +1 -1
  42. package/dist/public/assets/{SessionsHost-B3gqMSx7.js → SessionsHost-ChTej8aQ.js} +2 -2
  43. package/dist/public/assets/{SettingsDialogBody-DgTajMvc.js → SettingsDialogBody-BwNmDXzH.js} +1 -1
  44. package/dist/public/assets/{ShareBranchSwitchDialog-byzfWIrx.js → ShareBranchSwitchDialog-DVGxVZvK.js} +1 -1
  45. package/dist/public/assets/{ShareReceiveDialog-DXGKc-eg.js → ShareReceiveDialog-D4hyoVKV.js} +1 -1
  46. package/dist/public/assets/{ShareReceiveMissDialog-BMpWu47L.js → ShareReceiveMissDialog-AD5BnGhc.js} +1 -1
  47. package/dist/public/assets/{SkillCostValue-kClc0fwb.js → SkillCostValue-DMXVUaE7.js} +1 -1
  48. package/dist/public/assets/{SkillEditBanner-DH_4HoeL.js → SkillEditBanner-D9FB_lST.js} +1 -1
  49. package/dist/public/assets/{SkillForkDialog-D2CyMo9S.js → SkillForkDialog-DtSVNYK4.js} +1 -1
  50. package/dist/public/assets/{SkillInstallMenu-CLaCoUbU.js → SkillInstallMenu-BuFRSp_z.js} +1 -1
  51. package/dist/public/assets/{SkillOriginInline-L0ltzBVq.js → SkillOriginInline-BW_RoHYE.js} +1 -1
  52. package/dist/public/assets/{SkillToolbarControls-BaRzHksM.js → SkillToolbarControls-BKD6xxHt.js} +1 -1
  53. package/dist/public/assets/{SlidesToolbarControls-C5L1N2yM.js → SlidesToolbarControls-8odjAztJ.js} +1 -1
  54. package/dist/public/assets/{SourceEditor-D9SpDdL3.js → SourceEditor-C7uucUJz.js} +1 -1
  55. package/dist/public/assets/{TerminalPanel-CClWTYgq.js → TerminalPanel-CfiR68PD.js} +1 -1
  56. package/dist/public/assets/{TerminalWindowApp-CqCSI-z9.js → TerminalWindowApp-CmC7nqwp.js} +1 -1
  57. package/dist/public/assets/{TextDocEditor-FD-4OL4a.js → TextDocEditor-eGnW8YYf.js} +1 -1
  58. package/dist/public/assets/{ThreadView-Y55Ic9ZL.js → ThreadView-Bzyz7WGW.js} +1 -1
  59. package/dist/public/assets/{TimelineDiffPane-BLuu7rmg.js → TimelineDiffPane-BrwPPIS_.js} +1 -1
  60. package/dist/public/assets/{agent-diff-store-BHRY1k05.js → agent-diff-store-D-0KFcBI.js} +1 -1
  61. package/dist/public/assets/{auth-state-cache-CBn2RxRK.js → auth-state-cache-DI1ZZBIU.js} +1 -1
  62. package/dist/public/assets/{bug-report-send-manager-B4I09buF.js → bug-report-send-manager-B5xbQpHt.js} +1 -1
  63. package/dist/public/assets/client-version-9_WlPld6.js +1 -0
  64. package/dist/public/assets/{comment-chips-CFaS-ywE.js → comment-chips-Ckz0ppef.js} +1 -1
  65. package/dist/public/assets/{config-provider-Dl4a9LPU.js → config-provider-C1jgKj52.js} +1 -1
  66. package/dist/public/assets/{dist-OWwYTCbv.js → dist-DbRnfSz4.js} +2 -2
  67. package/dist/public/assets/{doc-hash-ocGRCVP7.js → doc-hash-xMWnMdX4.js} +1 -1
  68. package/dist/public/assets/{doc-undo-manager-eJ7exf62.js → doc-undo-manager-Ch4SaORf.js} +1 -1
  69. package/dist/public/assets/{documents-events-BzV0avF9.js → documents-events-CgeDb9QZ.js} +1 -1
  70. package/dist/public/assets/{file-tree-adapter-KU9w2isp.js → file-tree-adapter-B41-ZDHD.js} +1 -1
  71. package/dist/public/assets/{file-tree-utils-CBDlYx9T.js → file-tree-utils-DzFH_0CO.js} +1 -1
  72. package/dist/public/assets/{folder-config-api-D7qs-oGb.js → folder-config-api-gItnLltV.js} +1 -1
  73. package/dist/public/assets/i18n-Ca-WWW0i.js +1 -0
  74. package/dist/public/assets/{index-C4_OEpze.js → index-BD5kzJoS.js} +8 -8
  75. package/dist/public/assets/{launcher-selection-D1cxSoBy.js → launcher-selection-CnKhsntZ.js} +1 -1
  76. package/dist/public/assets/{lint-config-client-BdEFVYXo.js → lint-config-client-B2LNzQAQ.js} +1 -1
  77. package/dist/public/assets/{markdownlint-rule-browser-BYoM62zI.js → markdownlint-rule-browser-D1aD4zPr.js} +1 -1
  78. package/dist/public/assets/{page-list-cache-HBCOlbcl.js → page-list-cache-CjTFJKo7.js} +1 -1
  79. package/dist/public/assets/{pending-receive-nav-store-bHuKF2gs.js → pending-receive-nav-store-B95_ZpJ4.js} +1 -1
  80. package/dist/public/assets/{progress-CJNEXykR.js → progress-ByyPqwYa.js} +1 -1
  81. package/dist/public/assets/{project-paths-CFeW8DJd.js → project-paths-OL9RkD5R.js} +1 -1
  82. package/dist/public/assets/{prop-types-BBCouFfv.js → prop-types-CHZ5GpmQ.js} +1 -1
  83. package/dist/public/assets/{receive-store-Bf27vET3.js → receive-store-C6AmiC1-.js} +1 -1
  84. package/dist/public/assets/{selection-context-BepuwbkP.js → selection-context-DXlbV8vJ.js} +1 -1
  85. package/dist/public/assets/{skill-scope-_ny0Srcd.js → skill-scope-BgVsrS6b.js} +1 -1
  86. package/dist/public/assets/{skills-api-BXrK2gM-.js → skills-api-Dk5al98n.js} +1 -1
  87. package/dist/public/assets/{src-D4m5d2fp.js → src-BFdtDZAW.js} +1 -1
  88. package/dist/public/assets/{startup-marks-BfQIYKQG.js → startup-marks-DxOAcnz5.js} +1 -1
  89. package/dist/public/assets/{tag-pill-input-q39U7R1C.js → tag-pill-input-CQfRLAYz.js} +1 -1
  90. package/dist/public/assets/{target-navigation-intent-tHqI_gAU.js → target-navigation-intent-BS7YXP0N.js} +1 -1
  91. package/dist/public/assets/{telemetry-impl-DrMfLmRK.js → telemetry-impl-Bi_SKDTr.js} +1 -1
  92. package/dist/public/assets/{telemetry-startup-mvU41EW9.js → telemetry-startup-DiFIuo5_.js} +1 -1
  93. package/dist/public/assets/{terminal-cli-display-ZEkmxBZM.js → terminal-cli-display-DiFJCQCx.js} +1 -1
  94. package/dist/public/assets/{terminal-command-events-Ihszb2Wb.js → terminal-command-events-Vv4PGtMR.js} +1 -1
  95. package/dist/public/assets/{terminal-telemetry-CAg03OOB.js → terminal-telemetry-BAc42SWB.js} +1 -1
  96. package/dist/public/assets/{typing-burst-detector-5DjdP85Y.js → typing-burst-detector-7NR-qtpk.js} +1 -1
  97. package/dist/public/assets/{uninstall-Bola0Evi.js → uninstall-BqrgrhoX.js} +1 -1
  98. package/dist/public/assets/{use-activity-panel-3vruosY4.js → use-activity-panel-C8_6jEhu.js} +1 -1
  99. package/dist/public/assets/{use-apply-config-color-theme-Nvs2nvyH.js → use-apply-config-color-theme-DkdH-hj1.js} +1 -1
  100. package/dist/public/assets/{use-collab-url-CtNYA00S.js → use-collab-url-m1hL6d8r.js} +1 -1
  101. package/dist/public/assets/{use-conflicts-BMrcvblP.js → use-conflicts-Bn99xsOZ.js} +1 -1
  102. package/dist/public/assets/{use-live-xterm-theme-DapcugRd.js → use-live-xterm-theme-DskS89_F.js} +1 -1
  103. package/dist/public/assets/{use-open-skill-DV7nGrSo.js → use-open-skill-CH8ZramM.js} +1 -1
  104. package/dist/public/assets/{use-settings-route-CxCnZeGY.js → use-settings-route-Dn37NV_v.js} +1 -1
  105. package/dist/public/assets/{use-skill-origin-yFmvknKx.js → use-skill-origin-Ck9TjCRI.js} +1 -1
  106. package/dist/public/assets/{use-skills-DVmDBd0L.js → use-skills-Cb2xrAj_.js} +1 -1
  107. package/dist/public/assets/{use-terminal-enabled-dTpPN8gM.js → use-terminal-enabled-CgDjbKYK.js} +1 -1
  108. package/dist/public/assets/{use-timeline-entry-diff-C8Oz7k1I.js → use-timeline-entry-diff-Ddrq1TdM.js} +1 -1
  109. package/dist/public/assets/{use-workspace-CJEyhPmI.js → use-workspace-BmKjRyd0.js} +1 -1
  110. package/dist/public/index.html +52 -52
  111. package/dist/public/uninstall.html +3 -3
  112. package/dist/{registry-probes-LDNjoSQk.mjs → registry-probes-5hlj224V.mjs} +1 -1
  113. package/dist/{removal-file-path-DDRIMr-a.mjs → removal-file-path-Bov8OpTu.mjs} +1 -1
  114. package/dist/{repair-launch-json-DN6oYFSR.mjs → repair-launch-json-D0ZDjWKk.mjs} +1 -1
  115. package/dist/{repair-mcp-configs-B8yXsDSl.mjs → repair-mcp-configs-BHLHBbhv.mjs} +1 -1
  116. package/dist/src-BC24Oo35.mjs +1 -0
  117. package/dist/{src-hpo84d33.mjs → src-DR9TaQqK.mjs} +1 -1
  118. package/dist/start-B_atGdZj.mjs +1 -0
  119. package/dist/{start-0kX6o6SE.mjs → start-M8sUGkJO.mjs} +3 -3
  120. package/package.json +5 -5
  121. package/dist/constants-BWO2YSzj.mjs +0 -1
  122. package/dist/init-C_S5t6ia.mjs +0 -1
  123. package/dist/loader-q1zQVV2z.mjs +0 -1
  124. package/dist/preview-DCEixtav.mjs +0 -1
  125. package/dist/public/assets/FeedbackForm-62ikbOa4.js +0 -1
  126. package/dist/public/assets/ManagedArtifactProperties-f5EA7YCu.js +0 -1
  127. package/dist/public/assets/client-version-D4vjhPCi.js +0 -1
  128. package/dist/public/assets/i18n-Cvt7OPah.js +0 -1
  129. package/dist/src-ClernGTL.mjs +0 -1
  130. package/dist/start-1SL08R5P.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}=$I(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 tL(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=ZI(i,c),{frontMatterLines:h}=m;i=m.content;let{effectiveConfig:g,enabledRulesPerLineNumber:_,enabledRuleList:v,rulesSeverity:y}=eL(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!==JI.length,C=x?_F(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:DN,lines:Object.freeze(T),frontMatterLines:Object.freeze(h)};SN({...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{SN()}};!b||d?E(b?(0,jN.requireMarkdownItCjs)().getMarkdownItTokens(a(),w,T):[]):Promise.all([Promise.resolve().then(()=>e(ON(),1)),new Promise(e=>e(a()))]).then(([e,t])=>{let n=e.getMarkdownItTokens(t,w,T);E(n)}).catch(p)}function nL(e,t,n,r,i,a,o,s,c,l,u,d){function f(l,f){return l?d(l):tL(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 rL(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=JI.concat(r),a=XI(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=QI(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++,nL(i,g,e,m,l,u,d,f,p,h,t,r);else if(e=c.shift())y++,tL(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 iL(e){let t=null;return rL(e,!0,function(e,n){if(e)throw e;t=n}),t}function aL(e,t=0){return{lineNumber:e.lineNumber||t,editColumn:e.editColumn||1,deleteCount:e.deleteCount||0,insertText:e.insertText||``}}function oL(e,t,n=`
342
342
  `){let{editColumn:r,deleteCount:i,insertText:a}=aL(t),o=r-1;return i===-1?null:e.slice(0,o)+a.replace(/\n/g,n)+e.slice(o+i)}function sL(e,t){let n=Q.getPreferredLineEnding(e,gN),r=e.split(Q.newLineRe),i=t.filter(e=>e.fixInfo).map(e=>aL(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]=oL(r[c],e,n)),o=c,s=l}return r.filter(e=>e!==null).join(n)}function cL(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]=lL(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 lL(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]}new Set(Mo),[{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`]),Fo.filter(e=>e!==`session`);const uL={agent:No},dL={"followup.approve-once":{params:lo(uL)},"followup.enable-manually":{params:lo(uL)},"followup.trust-gated":{params:lo(uL)},"guidance.mcp.user-config":{params:lo(uL)},"guidance.mcp.project-config":{params:lo(uL)},"guidance.mcp.session-injection":{params:lo(uL)},"guidance.mcp.managed-file":{params:lo(uL)},"guidance.skill.project":{params:lo(uL)},"guidance.skill.user":{params:lo(uL)},"guidance.skill.central-store":{params:lo(uL)},"troubleshooting.claude.project-entry-not-approved":{params:lo(uL)},"troubleshooting.claude-desktop.per-tool-approval":{params:lo(uL)},"troubleshooting.cursor.project-entry-not-loaded":{params:lo(uL)},"troubleshooting.codex.desktop-project-config":{params:lo({...uL,honoredByDesktop:L()})},"troubleshooting.copilot.shared-workspace-config":{params:lo({...uL,sourceAgent:No})},"troubleshooting.openclaw.central-store-missing":{params:lo(uL)},"troubleshooting.pi.folder-trust":{params:lo(uL)},"troubleshooting.lm-studio.config-path-mismatch":{params:lo(uL)}};Object.keys(dL).sort(),us.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 fL=U(cn),pL=B({kind:U([`source-read`,`measured`,`vendor-doc`,`upstream-issue`,`observation`]),ref:F().min(1),note:F().optional()}),mL=B({version:F().min(1).optional(),observedAt:F().min(1)}),hL=po(`confidence`,[B({confidence:W(`verified`),evidence:z(pL).min(1),verifiedAgainst:mL.optional()}),B({confidence:W(`assumed`),evidence:z(pL).min(1),verifiedAgainst:mL.optional()}),B({confidence:W(`contested`),evidence:z(pL).min(1),verifiedAgainst:mL})]),gL=B({id:vre,params:H(F(),V([F(),I(),L()])).optional()}),_L=po(`mode`,[B({mode:W(`probeable`),strictness:z(jo).min(1)}),B({mode:W(`unprobeable`),reason:U([`no-readable-state`,`different-machine`,`no-programmatic-path`,`session-scoped`]),note:F().optional()})]),vL=U([`this-project`,`this-user`,`this-machine`]),yL=U([`installable`,`user-completes`,`not-installable`]),bL=B({id:Lo,agent:No,piece:Po,scope:Io,kind:dre,pathId:_re.optional(),sharedWith:z(No).default([]),prerequisites:z(Lo).default([]),consentClass:fre.default(`none`),probe:_L,attestation:hL,audience:vL,installability:yL.default(`installable`),notInstallableReason:U([`no-non-interactive-verb`,`session-scoped`,`no-surface`]).optional(),preferred:L().default(!1),guidance:gL.optional(),followup:gL.optional(),troubleshooting:gL.optional()}),xL=B({piece:Po,level:pre,satisfiedByAny:z(Lo)}),SL=B({acpAgentId:F().min(1),featuredOrder:I().int().nonnegative().nullable(),harnessCli:hre.nullable(),harnessReadsEditorConfig:fL.nullable(),harnessReadsEditorConfigAttestation:hL,verifiedPosture:U([`asks`,`self-managed`,`autonomous`]).nullable()}),CL=B({cliId:F().min(1)}),wL=B({targetId:gre,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()}),TL=B({requirements:z(xL),caveats:z(gL).default([])});B({id:No,setupDocSlug:F().min(1).nullable(),offerOnlyWhenDetected:L().default(!1),offersConnectionRow:L().default(!1),detectionSources:z(F().min(1)).default([]),satisfiers:z(bL),modes:Wne(mre,TL),acp:SL.optional(),terminal:CL.optional(),external:wL.optional()}),B({id:F().min(1),requiredStrictness:jo,scope:Io.optional(),piece:Po,revokedByForeignEntry:L().default(!1),guidance:gL.optional()}),new Ku.default;const EL=B({path:z(V([F(),I()])),message:F(),issueCode:F()});po(`code`,[B({code:W(`SCHEMA_INVALID`),issues:z(EL)}),B({code:W(`WRITE_ERROR`),detail:F()})]),Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function DL(e,t){return e>=(t===`leading`?2:1)?e:0}function OL(e,t){let n={line:e,column:1,offset:t};return{type:`paragraph`,children:[],position:{start:n,end:{...n}}}}function kL(e,t){let n=e.children,r=n.length===0||t.leading===void 0?0:DL(t.leading.length,`leading`),i=n.length===0||t.trailing===void 0?0:DL(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(OL(1+e,e));if(i>0&&typeof a?.offset==`number`&&typeof a.line==`number`)for(let e=0;e<i;e++)s.push(OL(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 AL=new Ku.default;AL.Match_Threshold=.5;function jL(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 ML=new Set([`sourceRaw`,`sourceDirty`,`position`]),NL=new Set([`jsxComponent`,`table`,`tableRow`,`tableCell`,`tableHeader`,`list`,`listItem`,`blockquote`,`codeBlock`,`heading`]),PL={type:`__br__`},FL=/^<br\s*\/?>$/i;function IL(e){let t=VL(e,IL);return(t.type===`tableCell`||t.type===`tableHeader`)&&t.content?{...t,content:LL(t.content)}:t}function LL(e){let t=[];for(let n of e){let e=RL(n);e.length!==0&&(t.length>0&&t.push(PL),t.push(...e))}return t}function RL(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)?LL(e.content):e.content}function zL(e){return e.type===`hardBreak`||e.type===PL.type||e.text!==void 0&&FL.test(e.text.trim())?PL:VL(e,zL)}const BL=[{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:IL},{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:zL}];function VL(e,t){return e.content?{...e,content:e.content.map(t)}:e}function HL(e,t){let n={};e.type!==void 0&&(n.type=e.type),e.text!==void 0&&(n.text=e.text);let r=UL(e.attrs,t);return r&&(n.attrs=r),e.marks&&e.marks.length>0&&(n.marks=[...e.marks].map(e=>({type:e.type,attrs:UL(e.attrs,t)})).sort((e,t)=>GL(e).localeCompare(GL(t)))),e.content&&e.content.length>0&&(n.content=e.content.map(e=>HL(e,t))),n}function UL(e,t){if(!e)return null;let n={};for(let r of Object.keys(e).sort()){if(ML.has(r)||t?.(r))continue;let i=e[r];i!=null&&(n[r]=t?WL(i,t):i)}return Object.keys(n).length>0?n:null}function WL(e,t){if(Array.isArray(e))return e.map(e=>WL(e,t));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))t(r)||(n[r]=WL(i,t));return n}return e}function GL(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 KL(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 qL(e){let t=[],n=e=>{if(e.type&&NL.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 JL(e){let t=e,n=[];for(let e of BL){let r=GL(t),i=e.canonicalize(t);GL(i)!==r&&n.push(e.label),t=i}return{normalized:t,fired:n}}function YL(e,t,n={}){let r=JL(e),i=JL(t),a=[...new Set([...r.fired,...i.fired])],o=jL(KL(r.normalized),KL(i.normalized)),s=!o&&n.rawSourceSide===`expected`&&jL(KL(r.normalized,!0),KL(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=qL(r.normalized),l=qL(i.normalized);if(GL(c)!==GL(l))return{equivalent:!1,level:`L1`,reason:`structural-shatter`,appliedDegrades:a,detail:`container multiset diverged: [${c.join(`, `)}] vs [${l.join(`, `)}]`};let u=HL(r.normalized,n.ignoreAttrs),d=HL(i.normalized,n.ignoreAttrs);return GL(u)===GL(d)?{equivalent:!0,level:a.length>0?`L2`:`L1`,appliedDegrades:a}:{equivalent:!1,level:`L2`,reason:`structural-divergence`,appliedDegrades:a,detail:XL(u,d)}}function XL(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(GL(a[e])!==GL(o[e]))return XL(a[e],o[e],`${n}>${String(r.type)}[${e}]`);return`${n}(${String(r.type)}): attrs or marks differ`}function ZL(e,t,n){return!YL(e,t,{ignoreAttrs:n}).equivalent}const QL=new Set([`src`,`href`,`size`]),$L=new Set([`WikiEmbedImage`,`WikiEmbedVideo`,`WikiEmbedAudio`,`WikiEmbedFile`]);function eR(e){if(Array.isArray(e))return e.map(e=>eR(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))QL.has(n)||(t[n]=eR(r));return t}return e}function tR(e){return e.type===`jsxComponent`&&typeof e.attrs?.componentName==`string`&&$L.has(e.attrs.componentName)?eR(e):e.content?{...e,content:e.content.map(tR)}:e}function nR(e){if(Array.isArray(e))return e.map(e=>nR(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))n!==`position`&&(t[n]=nR(r));return t}return e}function rR(e){if(e.type===`jsxComponent`)return e;if(e.content)for(let t of e.content){let e=rR(t);if(e)return e}}function iR(e){let t=e.cacheLimit??2048,n=new Map,r=r=>{let i=n.get(r);if(i!==void 0)return i;let a=rR(e.parse(r)),o=a?tR(nR(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?ZL(n,tR(nR(e))):!1}}}const aR=`state/bug-reports`,oR=uo({at:F(),transport:F(),outcome:F(),reference:F().optional(),error:F().optional(),errorCode:F().optional()}),sR=uo({reason:F(),at:F(),errorCode:F().optional()});uo({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:sR.optional(),attempts:z(oR).optional(),note:F().optional()}),uo({version:I().int().catch(1),id:F().optional(),sentAt:F().optional(),reference:F().optional()});const cR=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 uR(e){let t=lR(e);return t!==null&&cR.has(t)}function dR(e){let t=lR(e);return t===null?null:cR.get(t)??null}const fR=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function pR(e){fR.lastIndex=0;let t=e.match(fR);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=dR(e);if(t===null)return null;n+=t}return n}const mR=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 hR(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toUpperCase()}function gR(e){return`OK_${(e[0]===`server`?e.slice(1):e).map(hR).join(`_`)}`}function _R(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function vR(e){let{value:t,file:n,source:r,doc:i}=e,a=[],o=(e,t)=>{if(t.length>0){let e=su(iu,t);if(e!==void 0){if(e.scope===`project-local`){let e=gR(t),o;i!=null&&r!=null&&n!=null&&(o=du({file:n,source:r,doc:i,path:t})),a.push({path:[...t],...mR.has(e)?{envVar:e}:{},...o===void 0?{}:{source:o}})}return}}if(_R(e))for(let[n,r]of Object.entries(e))o(r,[...t,n])};return o(t,[]),a}function yR(e,t,n){return bR([e,t,n],[])}function bR(e,t){if(t.length>0){let n=su(iu,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=xR(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=>SR(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]=bR(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function xR(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function SR(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const CR=`(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)`;RegExp(`^127\\.${CR}\\.${CR}\\.${CR}$`);const wR=[`.mdx`,`.md`],TR={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/},ER=new Set([`gitlab.com`,`bitbucket.org`,`codeberg.org`,`gitea.com`,`sr.ht`,`sourcehut.org`]);function DR(e){let t=e.toLowerCase(),n=t===`www.github.com`?`github.com`:t;return ER.has(n)?null:n}const OR=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(OR.map(e=>e.value));const kR=Sb.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}}}}),AR=Fb.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[eb({find:Ab,type:this.type,getAttributes:{sourceDelimiter:`*`}}),eb({find:Mb,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),jR=kb.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[eb({find:wb,type:this.type,getAttributes:{sourceDelimiter:`**`}}),eb({find:Eb,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),MR=By.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),NR=gb.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 PR({node:e}){return``.repeat(e.nodeSize-e.content.size)}const FR=gb.create({name:`footnoteReference`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,renderText:PR,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}})}}}),IR=Lb.extend({marks:`_`,priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`},sourceRaw:{default:null}}}}),LR=zb.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}}}}),RR=gb.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]}}),zR=gb.create({name:`imageReference`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:PR,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 BR(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 VR=Vb.extend({marks:`_`,priority:60,renderText:PR,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=Lv(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=BR(t.src)),[`img`,t]}}),HR=gb.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}})}}}),UR=gb.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,renderText:PR,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]}}),WR=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],GR=WR.map(e=>`${e}:`).join(`|`);RegExp(`^(?:${GR}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function KR(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 qR=new Set(WR.map(e=>`${e}:`));function JR(e){try{let t=new URL(e,`https://placeholder.invalid`);return qR.has(t.protocol.toLowerCase())}catch{return!1}}const YR=`LinkFidelity must be derived from the Link extension`,XR=$b.extend({priority:60,addOptions(){let e=this.parent?.();if(e===void 0)throw Error(YR);return{...e,openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:JR,shouldAutoLink:()=>!0}},addAttributes(){let e=this.parent?.();if(e===void 0)throw Error(YR);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}}}}),ZR=gb.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 QR(e){return e.type.name===`list`&&!e.attrs.ordered}function $R(e){return e.type.name===`list`&&!!e.attrs.ordered}function ez(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function tz(e,t,n,r,i,a,o){let s=Dv(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?Ep(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 Tp(n,a)(e,void 0)?!t||Tp(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 nz(e){return e===`x`||e===`X`}function rz(e){return e===`X`?`X`:null}function iz(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=ff(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 az=/^\s*([-+*])\s$/,oz=/^\s*(\d+)([.)])\s$/,sz=/^\s*[-*+]\s\[([ xX]?)\]\s$/,cz=/^\s*\[([ xX]?)\]\s$/,lz=gb.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,Lv(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:tz(e,t,n,r,e=>QR(e)&&!ez(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:tz(e,t,n,r,e=>$R(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:tz(e,t,n,r,e=>QR(e)&&ez(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[rb({find:az,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]}),joinPredicate:(e,t)=>t.attrs.ordered===!1}),rb({find:oz,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]}),joinPredicate:(e,t)=>t.attrs.ordered===!0}),new Fy({find:sz,handler:({state:e,range:t,match:n})=>iz(e,t,nz(n[1]),rz(n[1]))?void 0:null}),new Fy({find:cz,handler:({state:e,range:t,match:n})=>iz(e,t,nz(n[1]),rz(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()}}}),uz=gb.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`,Lv(t),0]:[`li`,Lv(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(Lv(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}}}}),dz=lz,fz=uz,pz=gb.create({name:`mathInline`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:PR,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}})}}}),mz=gb.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}}}}),hz=boe.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),gz=Coe.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),_z=gb.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)}}}),vz=By.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)}}}),yz=Hy.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}});function bz(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return t;return null}function xz(e){let t=!1;return e.descendants(e=>!t&&(e.type.name===`list`&&(t=!0),!t)),t}function Sz(e){let{selection:t}=e;return t instanceof zf?t.$cursor:null}function Cz(e){let t=Sz(e);if(t?.parentOffset!==0)return!1;let n=bz(t);if(n===null||t.depth!==n+1||t.index(n)!==0)return!1;let r=t.index(n-1);return r!==0&&xz(t.node(n-1).child(r-1))}function wz(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 Tz(e){let t=Sz(e);if(!t||t.parentOffset!==t.parent.content.size)return!1;let n=bz(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=wz(t,n);return r!==null&&r<n}const Ez=Hy.create({name:`listBoundaryMerge`,addKeyboardShortcuts(){let e=()=>{let{editor:e}=this;if(!Cz(e.state))return!1;if(e.commands.undoInputRule())return!0;let{state:t,view:n}=e;return tp(t,n.dispatch,n)},t=()=>{let{editor:e}=this;if(!Tz(e.state))return!1;let{state:t,view:n}=e;return np(t,n.dispatch,n)};return{Backspace:e,"Mod-Backspace":e,Delete:t,"Mod-Delete":t}}}),Dz=Hy.create({name:`plainTextClipboard`,priority:1e3,addProseMirrorPlugins(){return[new Jf({key:new Zf(`okPlainTextClipboard`),props:{clipboardTextSerializer:e=>e.content.textBetween(0,e.content.size,`
343
343
 
344
- `)}})]}}),Oz=By.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 kz(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||Az(n)===r||pR(e)===t}function Az(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const jz=Boe.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),Mz=KS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),Nz=zS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Pz=BS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Fz=gb.create({name:`tag`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:PR,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()}}}),Iz=/^(?:---|—-|___\s|\*\*\*\s)$/;function Lz(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const Rz=Toe.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[tb({find:Iz,type:this.type,getAttributes:e=>({sourceRaw:Lz(e)})})]}}),zz=Hoe.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceForm:{default:`u`,rendered:!1}}}});function Bz(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function Vz(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const Hz=gb.create({name:`wikiLink`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:PR,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:Bz(e.getAttribute(`data-alias`)),anchor:Bz(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:Bz(e.getAttribute(`data-alias`)),anchor:Bz(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=Bz(e.attrs.alias),i=Bz(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`},Vz({target:n,alias:r,anchor:i})]}});function Uz(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function Wz(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const Gz=[HR,mz,UR,pz,Hz,gb.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:PR,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:Bz(e.getAttribute(`data-alias`)),anchor:Bz(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=Bz(e.attrs.alias),i=Bz(e.attrs.anchor),a=Bz(e.attrs.resolvedSrc),o=Uz(n);if(Uc.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`},Wz({target:n,alias:r,anchor:i})]}}),Fz,dz,fz,AR,jR,jz,zz,gz,kR,hz,LR,Rz,XR,RR,ZR,IR,MR,yz,Oz,Dz,fse.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}}),Ez,Mz.configure({resizable:!0}),VS,Pz,Nz,VR.configure({inline:!0}),zR,nx,vz,_z,FR,NR],Kz=B({changes:z(po(`kind`,[B({key:F(),kind:W(`added`),after:hs}).loose(),B({key:F(),kind:W(`removed`),before:hs}).loose(),B({key:F(),kind:W(`changed`),before:hs,after:hs}).loose()])),unparseable:B({before:F(),after:F()}).loose().nullable()}).loose();3072-qz("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 qz(e,t){let n=encodeURIComponent(e);return t===`cursor`?encodeURIComponent(n).length:n.length}function Jz(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 Yz(e,t){let n=Jz(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const Xz=F().superRefine(Yz).optional(),Zz=F().superRefine(Yz),Qz={agentId:F().optional(),agentName:F().optional(),colorSeed:F().optional(),clientName:F().optional(),clientVersion:F().optional(),label:F().optional()},$z=F().optional(),eB=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;po(`kind`,[B({kind:W(`doc`),docPath:F().min(1)}).loose(),B({kind:W(`folder`),folderPath:F()}).loose()]);const tB=U([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),nB=U([`current`,`stale`,`absent`,`empty`]);po(`ok`,[B({ok:W(!0),shareUrl:F().min(1),sharedUrl:F().min(1),branch:F().min(1),freshness:nB.optional().catch(void 0)}).loose(),B({ok:W(!1),error:tB,branch:F().min(1).optional()}).loose()]);const rB=U([`user`,`org`]),iB=B({login:F().min(1),kind:rB,avatarUrl:F().optional()}).loose(),aB=U([`auth-required`,`network`]);po(`ok`,[B({ok:W(!0),owners:z(iB)}).loose(),B({ok:W(!1),error:aB}).loose()]),po(`ok`,[B({ok:W(!0),available:L()}).loose(),B({ok:W(!1),error:aB}).loose()]);const oB=U([`public`,`private`]);B({owner:F().min(1),name:F().min(1),visibility:oB,description:F().optional()}).loose();const sB=U([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]);po(`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:sB}).loose()]);function cB(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const lB=e=>e.refine(cB,`invalid branch name`),uB={shareTargetExists:L(),dirtyConflicts:B({conflicts:L(),files:z(F().min(1))}).loose(),branchIsLocal:L(),shareTargetOnOriginBranch:L().optional()};po(`detached`,[B({detached:W(!1),currentBranch:F().min(1).nullable(),currentHeadSha:oo(),...uB}).loose(),B({detached:W(!0),currentBranch:oo(),currentHeadSha:F().min(1),...uB}).loose()]),B({branch:lB(F().min(1)),principalId:F().optional(),fastForward:L().optional()}).loose();const dB=U([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);po(`ok`,[B({ok:W(!0)}).loose(),B({ok:W(!1),reason:dB,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:lB(F().min(1)),path:F(),kind:U([`doc`,`folder`]),contentRootDepth:I().int().min(1).max(65535).optional()}).loose(),po(`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 fB=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:fB.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 pB=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: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: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:server-open-failed.urn:ok:error:doc-in-conflict.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(`.`)),mB=B({type:pB,title:F().min(1),status:I().int().min(400).max(599),instance:F().regex(eB,`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(cB,`invalid branch name`).optional()}).loose(),B({type:W(`error`),problem:mB}).loose();function hB(e,t){let n=t.map(e=>[zu(e),e]);for(let t of e){let e=zu(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function gB(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=hB([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=hB(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}const _B=[`.ok`,`local`,`installed-skills.json`],vB=U(vs),yB=uo({hosts:z(F()),scope:vB,scripts:L(),installedAt:Da(),projection:U([`symlink`,`copy`]).optional(),contentHash:F().optional()}),bB=uo({schema:W(1),skills:H(F(),yB).default({})});function xB(e){let t;try{t=JSON.parse(e)}catch{return null}let n=bB.safeParse(t);return n.success?n.data:null}const SB=[{name:`github-pat`,regex:/\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:/\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:/\bsk-[A-Za-z0-9]{20,}\b/g,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`,regex:/eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,replacement:`[REDACTED-JWT]`},{name:`url-credentials`,regex:/:\/\/[^/\s:@"]+:[^/\s:@"]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/\bgithub_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:/\bsk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/g,replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/\bxox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/\bAIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:/\b(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/g,replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/\bglpat-[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:`~`}],CB=SB.map(e=>e.name);function wB(e){let t=new Set,n=0;return{redacted:e.split(`
344
+ `)}})]}}),Oz=By.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 kz(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||Az(n)===r||pR(e)===t}function Az(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const jz=Boe.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),Mz=KS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),Nz=zS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Pz=BS.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Fz=gb.create({name:`tag`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:PR,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()}}}),Iz=/^(?:---|—-|___\s|\*\*\*\s)$/;function Lz(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const Rz=Toe.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[tb({find:Iz,type:this.type,getAttributes:e=>({sourceRaw:Lz(e)})})]}}),zz=Hoe.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceForm:{default:`u`,rendered:!1}}}});function Bz(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function Vz(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const Hz=gb.create({name:`wikiLink`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:PR,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:Bz(e.getAttribute(`data-alias`)),anchor:Bz(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:Bz(e.getAttribute(`data-alias`)),anchor:Bz(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=Bz(e.attrs.alias),i=Bz(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`},Vz({target:n,alias:r,anchor:i})]}});function Uz(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function Wz(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const Gz=[HR,mz,UR,pz,Hz,gb.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:PR,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:Bz(e.getAttribute(`data-alias`)),anchor:Bz(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=Bz(e.attrs.alias),i=Bz(e.attrs.anchor),a=Bz(e.attrs.resolvedSrc),o=Uz(n);if(Uc.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`},Wz({target:n,alias:r,anchor:i})]}}),Fz,dz,fz,AR,jR,jz,zz,gz,kR,hz,LR,Rz,XR,RR,ZR,IR,MR,yz,Oz,Dz,fse.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}}),Ez,Mz.configure({resizable:!0}),VS,Pz,Nz,VR.configure({inline:!0}),zR,nx,vz,_z,FR,NR],Kz=B({changes:z(po(`kind`,[B({key:F(),kind:W(`added`),after:hs}).loose(),B({key:F(),kind:W(`removed`),before:hs}).loose(),B({key:F(),kind:W(`changed`),before:hs,after:hs}).loose()])),unparseable:B({before:F(),after:F()}).loose().nullable()}).loose();3072-qz("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 qz(e,t){let n=encodeURIComponent(e);return t===`cursor`?encodeURIComponent(n).length:n.length}function Jz(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 Yz(e,t){let n=Jz(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const Xz=F().superRefine(Yz).optional(),Zz=F().superRefine(Yz),Qz={agentId:F().optional(),agentName:F().optional(),colorSeed:F().optional(),clientName:F().optional(),clientVersion:F().optional(),label:F().optional()},$z=F().optional(),eB=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;po(`kind`,[B({kind:W(`doc`),docPath:F().min(1)}).loose(),B({kind:W(`folder`),folderPath:F()}).loose()]);const tB=U([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`unsupported-share-url`]),nB=U([`current`,`stale`,`absent`,`empty`]);po(`ok`,[B({ok:W(!0),shareUrl:F().min(1),sharedUrl:F().min(1),branch:F().min(1),freshness:nB.optional().catch(void 0)}).loose(),B({ok:W(!1),error:tB,branch:F().min(1).optional()}).loose()]);const rB=U([`user`,`org`]),iB=B({login:F().min(1),kind:rB,avatarUrl:F().optional()}).loose(),aB=U([`auth-required`,`network`]);po(`ok`,[B({ok:W(!0),owners:z(iB)}).loose(),B({ok:W(!1),error:aB}).loose()]),po(`ok`,[B({ok:W(!0),available:L()}).loose(),B({ok:W(!1),error:aB}).loose()]);const oB=U([`public`,`private`]);B({owner:F().min(1),name:F().min(1),visibility:oB,description:F().optional()}).loose();const sB=U([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]);po(`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:sB}).loose()]);function cB(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const lB=e=>e.refine(cB,`invalid branch name`),uB={shareTargetExists:L(),dirtyConflicts:B({conflicts:L(),files:z(F().min(1))}).loose(),branchIsLocal:L(),shareTargetOnOriginBranch:L().optional()};po(`detached`,[B({detached:W(!1),currentBranch:F().min(1).nullable(),currentHeadSha:oo(),...uB}).loose(),B({detached:W(!0),currentBranch:oo(),currentHeadSha:F().min(1),...uB}).loose()]),B({branch:lB(F().min(1)),principalId:F().optional(),fastForward:L().optional()}).loose();const dB=U([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);po(`ok`,[B({ok:W(!0)}).loose(),B({ok:W(!1),reason:dB,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:lB(F().min(1)),path:F(),kind:U([`doc`,`folder`]),contentRootDepth:I().int().min(1).max(65535).optional()}).loose(),po(`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 fB=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:fB.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 pB=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: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:server-open-failed.urn:ok:error:doc-in-conflict.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(`.`)),mB=B({type:pB,title:F().min(1),status:I().int().min(400).max(599),instance:F().regex(eB,`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(cB,`invalid branch name`).optional()}).loose(),B({type:W(`error`),problem:mB}).loose();function hB(e,t){let n=t.map(e=>[zu(e),e]);for(let t of e){let e=zu(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function gB(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=hB([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=hB(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}const _B=[`.ok`,`local`,`installed-skills.json`],vB=U(vs),yB=uo({hosts:z(F()),scope:vB,scripts:L(),installedAt:Da(),projection:U([`symlink`,`copy`]).optional(),contentHash:F().optional()}),bB=uo({schema:W(1),skills:H(F(),yB).default({})});function xB(e){let t;try{t=JSON.parse(e)}catch{return null}let n=bB.safeParse(t);return n.success?n.data:null}const SB=[{name:`github-pat`,regex:/\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:/\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:/\bsk-[A-Za-z0-9]{20,}\b/g,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`,regex:/eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,replacement:`[REDACTED-JWT]`},{name:`url-credentials`,regex:/:\/\/[^/\s:@"]+:[^/\s:@"]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/\bgithub_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:/\bsk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/g,replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/\bxox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/\bAIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:/\b(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/g,replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/\bglpat-[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:`~`}],CB=SB.map(e=>e.name);function wB(e){let t=new Set,n=0;return{redacted:e.split(`
345
345
  `).map(e=>{let r=e,i=!1;for(let{name:e,regex:n,replacement:a}of SB)n.lastIndex=0,n.test(r)&&(t.add(e),i=!0,n.lastIndex=0,r=r.replace(n,a));return i&&n++,r}).join(`
346
346
  `),patterns:[...t],lineCount:n}}function TB(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 EB(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(`
@@ -418,7 +418,7 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
418
418
  `);return i.messages.map(e=>Yq(e,o))}function Zq(e){let t=!1;return vD(e,[`link`,`linkReference`],()=>(t=!0,!1)),t}const Qq=Kq(`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)}vD(e,`listItem`,e=>{e.children.some(e=>e.type===`list`)||Zq(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)})}),$q=/^\s*(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])(?!\d)/;function eJ(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 tJ=/^\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 rJ=Kq(`log-shape`,`**/log`,(e,t)=>{let n;vD(e,`heading`,e=>{if(e.depth!==2)return;let r=zC(e),i=$q.exec(r);if(!i){t.message(tJ.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(!eJ(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})}),iJ=/\[\[[^[\]\n]+\]\]/g;function aJ(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 oJ=Gq(`no-wiki-links`,(e,t)=>{let n=typeof t.value==`string`?t.value:String(t.value);vD(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]===`
419
419
  `?(c+=1,l=1):l+=1;return{line:c,column:l}};for(let e of o.matchAll(iJ)){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(aJ(e[0]),s)}})}),sJ=[`index`,`log`];function cJ(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);if(n<=0)return t;let r=t.slice(n).toLowerCase();return wR.includes(r)?t.slice(0,n):t}const lJ=Gq(`reserved-casing`,(e,t)=>{let n=t.data.okfDocName;if(n===void 0)return;let r=cJ(n),i=r.toLowerCase();sJ.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.`)}),uJ=[{id:`no-wiki-links`,rule:oJ},{id:`log-shape`,rule:rJ},{id:`index-shape`,rule:Qq},{id:`reserved-casing`,rule:lJ}],dJ=uJ.map(e=>e.rule);function fJ(e){return e===void 0?dJ:uJ.filter(t=>Aq(e,t.id)).map(e=>e.rule)}const pJ=V([L(),U(ml),H(F(),R())]),mJ={id:`markdownlint`,sliceSchema:B({enabled:L(),rules:H(F(),pJ)}),defaultSlice:{enabled:!1,rules:$K},async lint(e,t){return wq(e,eq(t.rules))},fix(e,t){return Cq(e,eq(t.rules))}},hJ=B({appliesTo:V([F(),z(F())]).optional(),file:F(),enabled:L().optional(),key:F().optional(),schema:H(F(),R()).optional()}),gJ=[mJ,{id:`frontmatter`,sliceSchema:B({enabled:L(),schemas:z(hJ)}),defaultSlice:{enabled:!1,schemas:[]},async lint(e,t,n){return Sq(e,rq(t.schemas,n.docName))},frontmatter:{schemasForDoc:(e,t)=>rq(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[...Xq(e,fJ(t.rules),n.docName),...Wq(e,t.rules,n.docName)]},frontmatter:{schemasForDoc:(e,t)=>Hq(e.rules,t),narrowSliceToFrontmatter:e=>({...e,rules:{...e.rules,...Vq}}),advertisedMappings:e=>Uq(e.rules)}}];Object.fromEntries(gJ.map(e=>[e.id,e.defaultSlice])),B({docName:Xz,summary:$z,content:F().optional(),...Qz}).loose(),B({docName:Xz,summary:$z,markdown:F(),position:U([`append`,`prepend`,`replace`]).optional(),extension:U(wR).optional(),...Qz}).loose(),B({docName:Xz,summary:$z,find:F().min(1),replace:F(),offset:I().int().nonnegative().optional(),...Qz}).loose(),B({docName:Xz,connectionId:F().min(1),scope:U([`last`,`session`,`file`,`count`]).optional(),count:I().int().positive().optional(),...Qz}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]});const _J=B({value:F(),truncatedFrom:I().int().nonnegative().optional(),hint:F().optional()}).loose(),vJ=po(`kind`,[B({kind:W(`inline`),content:F()}),B({kind:W(`truncated`),byteLength:I().int().nonnegative(),hint:F()})]),yJ=B({kind:W(`content-divergence`),intendedBytes:I().int().nonnegative(),actualBytes:I().int().nonnegative(),byteDelta:I().int(),divergenceType:F().optional(),currentState:vJ.optional(),hint:F().optional()}).loose(),bJ=B({type:W(`orphan`),parentCandidates:z(F()),message:F()}).loose(),xJ=B({kind:W(`disk-edit-reconciled`),intendedBytes:I().int().nonnegative(),actualBytes:I().int().nonnegative(),byteDelta:I().int(),mergeOutcome:F().optional(),hint:F().optional()}).loose();po(`kind`,[yJ,xJ]);const SJ=Object.keys({"content-divergence":!0,"disk-edit-reconciled":!0}),CJ=B({kind:W(`mermaid-parse-error`),fenceIndex:I().int().positive(),fenceFirstLine:F(),message:F(),line:I().int().positive().optional()}).loose(),wJ=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(),TJ=po(`kind`,[yJ,xJ,CJ,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:wJ.optional()}).loose()]),EJ=z(TJ).min(1),DJ=B({href:F(),resolvedTo:F().nullable(),reason:U([`no-such-doc`,`no-such-file`,`unresolvable`]),localTarget:wJ.optional()}).loose(),OJ=z(DJ);B({timestamp:F().min(1),summary:_J.optional(),warnings:EJ.optional()}).loose(),B({timestamp:F().min(1),subscriberCount:I().int().nonnegative(),systemSubscriberCount:I().int().nonnegative(),hints:z(bJ).optional(),summary:_J.optional(),warnings:EJ.optional(),brokenLinks:OJ}).loose(),B({timestamp:F().min(1),subscriberCount:I().int().nonnegative(),systemSubscriberCount:I().int().nonnegative(),summary:_J.optional(),warnings:EJ.optional(),brokenLinks:OJ}).loose(),B({docName:F().min(1),scope:U([`last`,`session`,`count`]),undone:L()}).loose(),B({docs:z(B({docName:Zz,markdown:F(),position:U([`append`,`prepend`,`replace`]).optional(),extension:U(wR).optional(),summary:$z}).loose()).min(1).max(100),...Qz}).loose();const kJ=B({type:pB,title:F(),detail:F().optional()}).loose(),AJ=po(`status`,[B({status:W(`written`),docName:F().min(1),summary:_J.optional(),warnings:EJ.optional(),brokenLinks:OJ}).loose(),B({status:W(`error`),docName:F().min(1),error:kJ}).loose()]);B({timestamp:F().min(1),results:z(AJ),written:I().int().nonnegative(),failed:I().int().nonnegative()}).loose(),B({docName:Xz,patch:H(F(),V([hs,oo()])),types:H(F(),U(ps)).optional(),summary:$z,...Qz}).loose(),B({timestamp:F().min(1),subscriberCount:I().int().nonnegative(),systemSubscriberCount:I().int().nonnegative(),appliedKeys:z(F()),summary:_J.optional(),warnings:EJ.optional(),brokenLinks:OJ}).loose();const jJ=Object.fromEntries(gJ.map(e=>[e.id,e.sliceSchema]));B({effective:B({enabled:L(),plugins:B(jJ)}),configFile:F().nullable().optional(),configProblems:z(F()).optional()});const MJ=V([L(),H(F(),R())]);B({ruleId:F().min(1).max(64).regex(/^[A-Za-z][A-Za-z0-9_-]*$/),value:V([MJ,oo()])}),B({file:F().min(1).max(512),delete:W(!0).optional(),field:F().min(1).max(256).optional(),parentPath:z(V([F().min(1).max(256),B({items:W(!0)}).strict()])).max(8).optional(),removeField:W(!0).optional(),renameTo:F().min(1).max(256).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 NJ=B({line:I(),character:I()}),PJ=B({start:NJ,end:NJ}),FJ=B({range:PJ,severity:U([`error`,`warning`,`info`,`hint`]),source:F(),code:F(),message:F(),fixes:z(B({range:PJ,newText:F()})).optional(),frontmatterScope:U(dl).optional(),frontmatterProperty:F().optional()}),IJ=z(F()).optional();B({files:z(B({file:F(),diagnostics:z(FJ),ran:IJ,warnings:z(F()).optional()})),fileCount:I(),errorCount:I(),warningCount:I(),warnings:z(F()),ran:IJ});const LJ=FJ.extend({linkTarget:F().optional(),localTarget:wJ.optional()});B({files:z(B({file:F(),diagnostics:z(LJ)})),fileCount:I(),errorCount:I(),warningCount:I(),warnings:z(F()),ran:IJ});const RJ=B({errorCount:I().int().nonnegative(),warningCount:I().int().nonnegative()});B({files:z(B({file:F(),lint:RJ,links:RJ})),fileCount:I().int().nonnegative(),errorCount:I().int().nonnegative(),warningCount:I().int().nonnegative(),warnings:z(F())}),B({docName:Xz,summary:$z,...Qz}).loose();const zJ=B({reason:U([`re-lint-threw`,`source-went-blind`]),message:F().min(1)});B({file:F(),fixedCount:I(),diagnostics:z(FJ),errorCount:I(),warningCount:I(),ran:IJ,warnings:z(F()).optional(),diagnosticsArePreFix:L().optional(),reLintFailure:zJ.optional()});const BJ=[{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 BJ){e.set(t.id.toUpperCase(),t.id);for(let n of t.aliases)e.set(n.toUpperCase(),t.id)}return e})();const VJ=new Set([`img`,`video`,`audio`,`mark`,`u`,`ins`]);new Map(yV.flatMap(e=>e.surface===`compat`&&VJ.has(e.rendersAs)?[[e.name,e]]:[])),xse(`<>`);const HJ=[{tagName:`Mirror`,attrName:`src`,resolution:`bare-doc-name`},{tagName:`Excalidraw`,attrName:`src`,resolution:`doc-relative`}];for(let e of HJ){let t=yV.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.`)}cj(),EA(),DA();function UJ(){return yV.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function WJ(){return UJ().filter(e=>{let t=GJ(e);return t!==`fence`&&t!==`html`})}function GJ(e){return e.name===`MermaidFence`?`fence`:e.name===`HtmlAlignBlock`?`html`:e.hasChildren?`jsx-block`:`jsx-void`}function KJ(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:GJ(e)}}function qJ(){return[``,"**Custom canonical components.** OK `.md` / `.mdx` supports the JSX components below. For source syntax + parameter schemas, call `palette({ components: [ids] })`. Arbitrary `<TagName>` JSX falls through as raw MDX when no canonical fits.",``,...WJ().map(KJ).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
420
420
  `)}function JJ(){return[qJ(),``,"Fenced code blocks render naturally and don't need a fetch — including ` ```mermaid ` for diagrams (mermaid label text has sharp edges — `palette({ components: [\"Mermaid\"] })` lists them; parse failures come back as `warnings` entries on write/edit) and ` ```html preview ` for interactive HTML/JS/CSS pages (the fence info-string `preview` token renders the block as a live iframe; works for `html` / `htm` / `xml`; optional `h=` / `w=` tokens set size, e.g. ` ```html preview h=400px `). Use ` ```html preview ` whenever you want anything interactive or JS-powered (charts, demos, calculators, animations) — just author the standalone HTML page in the fence. Call `palette` for the markdown-native component forms (write `> [!NOTE]`, not `<Callout>`), copy-ready themed `html preview` starters, and the theme tokens (`var(--chart-1)`, `var(--foreground)`, …) an embed should reference so it tracks the reader's light/dark theme."].join(`
421
- `)}B({intents:z(B({satisfierId:F().min(1),desired:U([`present`,`absent`])}).loose()),...Qz,summary:$z}).loose();const YJ=B({satisfierId:F(),agentId:F(),piece:F(),scope:F(),kind:F(),pathId:F().optional(),desired:U([`present`,`absent`]),action:U(Mo),errorId:F().optional()}).loose(),XJ=B({kind:F(),satisfierIds:z(F()),agentIds:z(F()),pathId:F().optional(),blockedReason:F().optional()}).loose(),ZJ=B({state:F(),strictness:z(U(Ao)).optional()}).loose(),QJ=B({probes:B({env:U([`desktop`,`local-web`,`remote-web`]),satisfiers:H(F(),ZJ)}).loose(),detection:B({detected:z(F()),probed:L()}).loose()}).loose();B({actions:z(YJ),conflicts:z(XJ),withheld:z(F()),snapshot:QJ}).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 $J=B({exact:F().min(1),prefix:F(),suffix:F(),start:I().int().nonnegative(),end:I().int().nonnegative()}),eY=z(V([F(),I().int().nonnegative()])),tY=po(`kind`,[B({kind:W(`body`)}),B({kind:W(`property`),key:F().min(1),path:eY.default([])})]).default({kind:`body`}),nY=U([`anchored`,`orphaned`,`resolved`]),rY=B({threadId:F().min(1),docName:F().min(1),target:tY,anchor:$J.nullable(),state:nY,queued:L(),latestComment:F(),createdBy:F().min(1),createdAt:I(),updatedAt:I().optional()}),iY=B({docName:F(),instruction:F(),property:F().nullable(),passage:B({exact:F(),prefix:F(),suffix:F()}).nullable(),anchorLost:L(),passageRepeats:L()}).loose(),aY=B({threadId:F(),ok:W(!0)}),oY=B({threadId:F(),ok:W(!1),error:W(`not-found`)});B({threads:z(rY)}).loose(),B({meta:rY,orphaned:L()}).loose(),B({threadId:F()}).loose(),B({meta:rY,payload:iY}).loose(),B({results:z(V([aY.extend({meta:rY,payload:iY}),oY]))}).loose(),B({results:z(V([aY.extend({meta:rY}),oY]))}).loose();const sY=B({status:F().min(1),reason:F()}).loose();B({docName:F().min(1),content:F(),lifecycle:sY.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 cY=B({source:F().min(1),anchor:F().nullable(),title:F(),snippet:F().nullable()}).loose();B({docName:F().min(1),backlinks:z(cY)}).loose(),B({counts:H(F().min(1),I().int().nonnegative())}).loose(),B({counts:H(F().min(1),I().int().nonnegative())}).loose();const lY=po(`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()]),uY=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(lY),localTargets:z(uY).optional()}).loose();const Gme=po(`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()]),Kme=B({source:F().min(1),target:F().min(1)}).loose();B({nodes:z(Gme),links:z(Kme)}).loose();const qme=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(),Jme=B({app:V([W(`cursor`),W(`codex`),W(`claude`),oo()]),signals_fired:z(F())}).loose();B({entries:z(qme),count:I().int().min(0),detection:Jme}).loose();const dY=B({path:F().min(1),code:U([`M`,`A`,`D`,`R`,`C`,`U`,`T`,`?`,`!`,` `]),origPath:F().min(1).optional(),syncScoped:L(),open:po(`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(dY),notStaged:z(dY),untracked:z(dY),incoming:z(dY),truncated:L(),readable:L().default(!0)}).loose(),B({writers:z(B({id:F().min(1),name:F().optional(),email:F().optional()}).loose()).optional(),summary:$z,...Qz}).loose(),B({checkpointRef:F().min(1)}).loose();const Yme=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(Yme),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(po(`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 Xme=B({domain:F().min(1),title:F().optional(),description:F().optional(),siteName:F().optional(),faviconDataUri:F().optional()}).loose();B({url:F()}).loose(),po(`ok`,[B({ok:W(!0),metadata:Xme}).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 Zme=B({source:F().min(1),title:F(),snippet:F().nullable()}).loose();B({deadLinks:z(B({target:F().min(1),sources:z(Zme)}).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 Qme=U([`not-a-git-worktree`,`init-failed`]);po(`ok`,[B({ok:W(!0),projectPath:F().min(1)}).loose(),B({ok:W(!1),reason:Qme,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 $me=U([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]);po(`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:$me,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 ehe=B({stackIndex:I().int().min(0),ts:I().int().min(0),additions:I().int().min(0),deletions:I().int().min(0)}).loose(),the=B({docName:F().min(1),additionsTotal:I().int().min(0),deletionsTotal:I().int().min(0),lastTs:I().int().min(0),bursts:z(ehe)}).loose(),nhe=B({displayName:F().min(1),color:F().min(1),icon:F().optional(),connectionId:F().min(1)}).loose();B({sessionAlive:L(),agent:nhe.nullable(),files:z(the)}).loose(),B({diff:F(),before:F(),after:F(),properties:Kz,generatedAt:I().int().min(0)}).loose(),B({}).loose(),B({}).loose(),B({}).loose(),B({}).loose(),B({}).loose(),B({}).loose();const rhe=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),rhe)}).loose();const ihe=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(ihe)}).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 ahe=B({fromDocName:F().min(1),toDocName:F().min(1)}).loose(),ohe=B({fromPath:F().min(1),toPath:F().min(1)}).loose();B({}).loose(),B({path:F().min(1),...Qz,summary:$z}).loose(),B({docName:F().min(1)}).loose(),B({path:F().min(1),...Qz,summary:$z}).loose(),B({path:F().min(1)}).loose(),B({kind:U([`file`,`folder`]),path:F().min(1),...Qz,summary:$z}).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 she=B({level:I().int().min(1).max(6),text:F(),slug:F()}).loose();B({docName:F().min(1),headings:z(she)}).loose();const che=B({docName:F().min(1),rewrites:I().int().nonnegative()}).loose();B({kind:U([`file`,`folder`,`asset`]),fromPath:F().min(1),toPath:F().min(1),...Qz,summary:$z}).loose(),B({renamed:z(ahe),renamedAssets:z(ohe),rewrittenDocs:z(che).optional(),summary:_J.optional()}).loose(),B({kind:U([`file`,`folder`,`asset`]),path:F().min(1),...Qz}).loose(),B({deletedDocNames:z(F().min(1))}).loose(),B({kind:U([`file`,`folder`,`asset`]),path:F().min(1),...Qz,summary:$z}).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:$z,...Qz}).loose(),B({restoredFrom:F().min(1),timestamp:F().min(1),summary:_J.optional(),warnings:EJ.optional()}).loose();const lhe=/^#[0-9a-fA-F]{6}$/,uhe=B(Object.fromEntries(hl.map(e=>[e,F().regex(lhe,`must be a #rrggbb hex color`)]))),fY=F().min(1).refine(vl,{message:`must contain a non-whitespace character`}),pY=B({name:fY,author:fY.optional(),variant:U([`dark`,`light`]),palette:uhe}).loose();B({name:F().min(1),scheme:pY,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:pY}).loose(),B({id:F().min(1),filename:F().min(1)}).loose(),po(`existed`,[B({existed:W(!1)}).loose(),B({existed:W(!0),filename:F().min(1),scheme:pY}).loose()]),B({themes:z(po(`ok`,[B({ok:W(!0),id:F().min(1),filename:F().min(1),scheme:pY}),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 dhe=U([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),fhe=B({label:F().min(1),webUrl:ro().nullable()}).loose(),phe=po(`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()]),mY=U([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`auth-not-found-as-identity`,`semantic-protected-branch`]),mhe=U(Mc),hhe=U([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]);B({state:dhe,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:fhe.nullable().optional(),pushError:F().optional(),pushErrorCode:mY.optional(),pullError:F().optional(),pullErrorCode:mY.optional(),pausedReason:F().optional(),blockingPaths:z(F().min(1)).optional(),pushPermission:phe.optional(),syncMode:mhe.optional(),lastPullUtc:F().nullable().optional(),lastPullOutcome:hhe.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(),B({conflicts:z(B({file:F().min(1),detectedAt:F().min(1),conflictKind:U([`git`,`stale-external-write`]).optional().catch(void 0),variant:W(`working-tree`).optional().catch(void 0),oursSha:F().optional(),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`]),lifecycleStatus:F().nullable(),conflictKind:U([`git`,`stale-external-write`]).optional()}).loose(),B({plan:Eo(e=>e!==void 0,{message:`plan is required`})}).loose(),B({plan:Eo(e=>e!==void 0,{message:`plan is required`})}).loose(),B({result:Eo(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 ghe=B({path:F().min(1),summary:F().min(1)}).loose(),_he=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(ghe),entryCounts:_he}).loose())}).loose(),B({noOpen:L().optional(),out:F().min(1).optional()}).loose();const vhe=B({reason:U([`unsupported-platform`,`spawn-error`]),message:F()}).loose();po(`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:vhe.optional()}).loose(),B({status:W(`failed`),buildError:F()}).loose(),B({status:W(`skip-current`),skillVersion:F(),recordedAt:F().optional()}).loose()]);const hY=U(fn),yhe=U(xee),bhe=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 xhe=B({docName:F().min(1),title:F(),matchingTags:z(F().min(1)),snippet:F().nullable()}).loose();B({name:F().min(1),docs:z(xhe)}).loose(),B({folder:R(),frontmatter_local:H(F(),R()).nullable()}).loose(),B({path:F(),frontmatter:H(F(),R()).optional()}).loose(),B({applied:R()}).loose();const gY=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:gY,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:gY.optional(),...Qz,summary:$z}).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(),...Qz,summary:$z}).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:gY.optional(),...Qz,summary:$z}).strict(),B({from:F().min(1),to:F().min(1),committed:L()}).strict();const _Y=U(vs),She=/^[a-z0-9-]+$/,vY=B({name:F(),description:F(),metadata:B({pack:F()}).strict().optional()}).strict();B({skill:B({name:F().min(1),scope:_Y,path:F().min(1),frontmatter:vY,body:F(),files:z(B({path:F().min(1),text:F().nullable()})).optional(),managed:L().optional()}).strict()}).strict();const Che=B({source:F().min(1),publisher:F().optional(),skill:F().optional(),marketplaceUrl:F().optional(),importedAt:F().min(1),autoUpdate:L().optional()}).strict(),whe=B({name:F().min(1),description:F().optional(),scope:_Y,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:Che.optional(),pack:F().optional(),modified:L().optional(),revertable:L().optional(),ignored:L().optional(),size:bhe.optional()}).strict();B({name:F().min(1),scope:_Y,apply:L().optional()}).strict(),B({line:F().min(1),gitignorePath:F().min(1),applied:L(),alreadyTracked:L().optional()}).strict(),B({skills:z(whe),truncated:L()}).strict(),B({scope:_Y.default(`project`),name:F().meta({description:`Managed skill name to create or update.`}),body:F().optional(),frontmatter:vY,...Qz,summary:$z}).strict(),B({path:F().min(1),created:L(),warnings:z(F())}).strict(),B({scope:_Y.default(`project`),name:F(),dryRun:L().optional(),setAutoUpdate:L().optional(),...Qz,summary:$z}).strict(),B({name:F().min(1),updated:L(),source:F().min(1),localBody:F().optional(),upstreamBody:F().optional(),gitTracked:L().optional(),warnings:z(F())}).strict(),B({scope:_Y.default(`project`),name:F(),...Qz,summary:$z}).strict(),B({name:F().min(1),baselineRef:F().min(1),restoredFiles:z(F()),warnings:z(F())}).strict(),B({existed:L(),path:F().min(1)}).strict(),B({scope:_Y.default(`project`),fromName:F(),toName:F(),body:F().optional(),frontmatter:vY.optional(),...Qz,summary:$z}).strict(),B({from:F().min(1),to:F().min(1),committed:L()}).strict(),B({name:F(),fromScope:_Y,toScope:_Y,...Qz,summary:$z}).strict(),B({scope:_Y,path:F().optional()}).strict(),B({scope:_Y,name:F(),toName:F(),...Qz,summary:$z}).strict(),B({name:F().min(1)}).strict(),B({name:F(),home:F().min(1)}).strict(),B({docName:F().min(1)}).strict();const yY=U([`reference`,`script`,`file`]);B({scope:_Y.default(`project`),name:F(),path:F().min(1),content:F(),...Qz,summary:$z}).strict(),B({path:F().min(1),created:L(),kind:yY,content:L()}).strict(),B({scope:_Y.default(`project`),name:F(),from:F().min(1),to:F().min(1),...Qz,summary:$z}).strict(),B({from:F().min(1),to:F().min(1),fromDocName:F().optional(),toDocName:F().optional()}).strict(),B({path:F().min(1),kind:yY,text:F()}).strict(),B({path:F().min(1),existed:L(),kind:yY}).strict();const bY=V([yhe,W(`agents`)]),xY=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`}),SY=V([bY,xY]);B({scope:_Y.default(`project`),name:F(),targets:z(bY).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(SY).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(SY).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:SY.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:SY.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(),...Qz,summary:$z,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"}),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([`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`])).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:F().optional(),sourceMovedTo:F().optional()}).strict(),B({scope:_Y.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(hY),configured:L(),folders:z(B({scope:_Y,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 CY=B({action:W(`link`),scope:_Y,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.`})}),wY=B({action:W(`unlink`),scope:_Y,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(),TY=B({action:W(`add-root`),scope:_Y,root:xY.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict(),The=po(`action`,[CY.extend({preview:L().optional().meta({description:`Return the merge plan only (moves, drops, removes, conflicts, strays) — nothing is written.`})}).strict(),wY,TY]);po(`action`,[CY.strict(),wY,TY]),B({folderAction:The}).strict();const Ehe=B({moves:z(F()),drops:z(F()),removes:z(F()),replaces:z(F()),conflicts:z(F()),strays:z(F())}).strict();B({targets:z(hY),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:Ehe.optional()}).strict(),B({scope:_Y.default(`project`),name:F(),version:F().regex(/^[0-9a-f]{40}$/i),...Qz,summary:$z}).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 Dhe=B({kind:U([`page`,`folder`,`content`,`file`]),path:F().min(1),title:F(),score:I(),signals:H(F(),R()),snippet:F().optional()}).loose(),Ohe=B({capable:L(),applied:L(),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(),embedded:I().int().nonnegative(),total:I().int().nonnegative()}).loose(),B({query:F(),intent:U([`autocomplete`,`full_text`,`omnibar`]),results:z(Dhe),elapsedMs:I().nonnegative(),semantic:Ohe.optional(),truncated:L().optional(),ready:L().optional()}).loose();const khe=B({version:F().min(1),recordedAt:F().min(1)}).loose();B({currentVersion:F().min(1),targets:H(F(),khe.nullable())}).loose(),B({scope:_Y.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."}),...Qz,summary:$z}).strict(),B({scope:_Y.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."}),...Qz,summary:$z}).strict(),B({results:z(B({requested:F(),status:U([`imported`,`already-imported`,`not-found`,`failed`]),name:F().optional(),collisionRenamedFrom:F().optional(),warnings:z(F()),error:F().optional()}).loose()),imported:I(),alreadyImported:I(),failed:I()}).loose(),B({scope:_Y.default(`project`),names:z(F().min(1)).min(1).max(100).meta({description:`Managed skill names to refresh from their recorded upstreams.`}),...Qz,summary:$z}).strict(),B({results:z(B({requested:F(),status:U([`updated`,`up-to-date`,`not-found`,`failed`]),source:F().optional(),warnings:z(F()),error:F().optional()}).loose()),updated:I(),upToDate:I(),failed:I()}).loose();const Ahe=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:Ahe,warnings:z(F()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`})}).loose();const jhe=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:jhe,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:wu}).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 EY=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),DY=globalThis;DY[EY]===void 0&&(DY[EY]=Jr());const OY=DY[EY],kY=uo({version:F().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(OY,{description:`Recorded skill version for this target.`}),recordedAt:Da().register(OY,{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(OY,{description:`Install-source surface that recorded this entry.`}).optional()}),Mhe=uo({enabled:L().register(OY,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Da().register(OY,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});uo({schema:W(1).register(OY,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:uo({"claude-cowork":kY.optional(),"cli-hosts":kY.optional()}).register(OY,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:H(F(),Mhe).register(OY,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:z(F()).register(OY,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});const AY=e=>e*8+4;AY(92),AY(40),Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));const jY={fileSystem:`File System`,gitUpstream:`Git (upstream)`,service:`OpenKnowledge (service)`,generator:`OpenKnowledge (generated)`};jc();var Nhe=Object.create,MY=Object.defineProperty,Phe=Object.getOwnPropertyDescriptor,Fhe=Object.getOwnPropertyNames,Ihe=Object.getPrototypeOf,NY=Object.prototype.hasOwnProperty,PY=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Lhe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Fhe(t),a=0,o=i.length,s;a<o;a++)s=i[a],!NY.call(e,s)&&s!==n&&MY(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Phe(t,s))||r.enumerable});return e},FY=(e,t,n)=>(n=e==null?{}:Nhe(Ihe(e)),Lhe(t||!e||!e.__esModule||!NY.call(e,`default`)?MY(n,`default`,{value:e,enumerable:!0}):n,e)),IY=a(import.meta.url),LY=PY(((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+`
421
+ `)}B({intents:z(B({satisfierId:F().min(1),desired:U([`present`,`absent`])}).loose()),...Qz,summary:$z}).loose();const YJ=B({satisfierId:F(),agentId:F(),piece:F(),scope:F(),kind:F(),pathId:F().optional(),desired:U([`present`,`absent`]),action:U(Mo),errorId:F().optional()}).loose(),XJ=B({kind:F(),satisfierIds:z(F()),agentIds:z(F()),pathId:F().optional(),blockedReason:F().optional()}).loose(),ZJ=B({state:F(),strictness:z(U(Ao)).optional()}).loose(),QJ=B({probes:B({env:U([`desktop`,`local-web`,`remote-web`]),satisfiers:H(F(),ZJ)}).loose(),detection:B({detected:z(F()),probed:L()}).loose()}).loose();B({actions:z(YJ),conflicts:z(XJ),withheld:z(F()),snapshot:QJ}).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 $J=B({exact:F().min(1),prefix:F(),suffix:F(),start:I().int().nonnegative(),end:I().int().nonnegative()}),eY=z(V([F(),I().int().nonnegative()])),tY=po(`kind`,[B({kind:W(`body`)}),B({kind:W(`property`),key:F().min(1),path:eY.default([])})]).default({kind:`body`}),nY=U([`anchored`,`orphaned`,`resolved`]),rY=B({threadId:F().min(1),docName:F().min(1),target:tY,anchor:$J.nullable(),state:nY,queued:L(),latestComment:F(),createdBy:F().min(1),createdAt:I(),updatedAt:I().optional()}),iY=B({docName:F(),instruction:F(),property:F().nullable(),passage:B({exact:F(),prefix:F(),suffix:F()}).nullable(),anchorLost:L(),passageRepeats:L()}).loose(),aY=B({threadId:F(),ok:W(!0)}),oY=B({threadId:F(),ok:W(!1),error:W(`not-found`)});B({threads:z(rY)}).loose(),B({meta:rY,orphaned:L()}).loose(),B({threadId:F()}).loose(),B({meta:rY,payload:iY}).loose(),B({results:z(V([aY.extend({meta:rY,payload:iY}),oY]))}).loose(),B({results:z(V([aY.extend({meta:rY}),oY]))}).loose();const sY=B({status:F().min(1),reason:F()}).loose();B({docName:F().min(1),content:F(),lifecycle:sY.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 cY=B({source:F().min(1),anchor:F().nullable(),title:F(),snippet:F().nullable()}).loose();B({docName:F().min(1),backlinks:z(cY)}).loose(),B({counts:H(F().min(1),I().int().nonnegative())}).loose(),B({counts:H(F().min(1),I().int().nonnegative())}).loose();const lY=po(`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()]),uY=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(lY),localTargets:z(uY).optional()}).loose();const Gme=po(`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()]),Kme=B({source:F().min(1),target:F().min(1)}).loose();B({nodes:z(Gme),links:z(Kme)}).loose();const qme=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(),Jme=B({app:V([W(`cursor`),W(`codex`),W(`claude`),oo()]),signals_fired:z(F())}).loose();B({entries:z(qme),count:I().int().min(0),detection:Jme}).loose();const dY=B({path:F().min(1),code:U([`M`,`A`,`D`,`R`,`C`,`U`,`T`,`?`,`!`,` `]),origPath:F().min(1).optional(),syncScoped:L(),open:po(`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(dY),notStaged:z(dY),untracked:z(dY),incoming:z(dY),truncated:L(),readable:L().default(!0)}).loose(),B({writers:z(B({id:F().min(1),name:F().optional(),email:F().optional()}).loose()).optional(),summary:$z,...Qz}).loose(),B({checkpointRef:F().min(1)}).loose();const Yme=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(Yme),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(po(`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 Xme=B({domain:F().min(1),title:F().optional(),description:F().optional(),siteName:F().optional(),faviconDataUri:F().optional()}).loose();B({url:F()}).loose(),po(`ok`,[B({ok:W(!0),metadata:Xme}).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 Zme=B({source:F().min(1),title:F(),snippet:F().nullable()}).loose();B({deadLinks:z(B({target:F().min(1),sources:z(Zme)}).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 Qme=U([`not-a-git-worktree`,`init-failed`]);po(`ok`,[B({ok:W(!0),projectPath:F().min(1)}).loose(),B({ok:W(!1),reason:Qme,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 $me=U([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]);po(`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:$me,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 ehe=B({stackIndex:I().int().min(0),ts:I().int().min(0),additions:I().int().min(0),deletions:I().int().min(0)}).loose(),the=B({docName:F().min(1),additionsTotal:I().int().min(0),deletionsTotal:I().int().min(0),lastTs:I().int().min(0),bursts:z(ehe)}).loose(),nhe=B({displayName:F().min(1),color:F().min(1),icon:F().optional(),connectionId:F().min(1)}).loose();B({sessionAlive:L(),agent:nhe.nullable(),files:z(the)}).loose(),B({diff:F(),before:F(),after:F(),properties:Kz,generatedAt:I().int().min(0)}).loose(),B({}).loose(),B({}).loose(),B({}).loose(),B({}).loose(),B({}).loose(),B({}).loose();const rhe=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),rhe)}).loose();const ihe=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(ihe)}).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 ahe=B({fromDocName:F().min(1),toDocName:F().min(1)}).loose(),ohe=B({fromPath:F().min(1),toPath:F().min(1)}).loose();B({}).loose(),B({path:F().min(1),...Qz,summary:$z}).loose(),B({docName:F().min(1)}).loose(),B({path:F().min(1),...Qz,summary:$z}).loose(),B({path:F().min(1)}).loose(),B({kind:U([`file`,`folder`]),path:F().min(1),...Qz,summary:$z}).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 she=B({level:I().int().min(1).max(6),text:F(),slug:F()}).loose();B({docName:F().min(1),headings:z(she)}).loose();const che=B({docName:F().min(1),rewrites:I().int().nonnegative()}).loose();B({kind:U([`file`,`folder`,`asset`]),fromPath:F().min(1),toPath:F().min(1),...Qz,summary:$z}).loose(),B({renamed:z(ahe),renamedAssets:z(ohe),rewrittenDocs:z(che).optional(),summary:_J.optional()}).loose(),B({kind:U([`file`,`folder`,`asset`]),path:F().min(1),...Qz}).loose(),B({deletedDocNames:z(F().min(1))}).loose(),B({kind:U([`file`,`folder`,`asset`]),path:F().min(1),...Qz,summary:$z}).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:$z,...Qz}).loose(),B({restoredFrom:F().min(1),timestamp:F().min(1),summary:_J.optional(),warnings:EJ.optional()}).loose();const lhe=/^#[0-9a-fA-F]{6}$/,uhe=B(Object.fromEntries(hl.map(e=>[e,F().regex(lhe,`must be a #rrggbb hex color`)]))),fY=F().min(1).refine(vl,{message:`must contain a non-whitespace character`}),pY=B({name:fY,author:fY.optional(),variant:U([`dark`,`light`]),palette:uhe}).loose();B({name:F().min(1),scheme:pY,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:pY}).loose(),B({id:F().min(1),filename:F().min(1)}).loose(),po(`existed`,[B({existed:W(!1)}).loose(),B({existed:W(!0),filename:F().min(1),scheme:pY}).loose()]),B({themes:z(po(`ok`,[B({ok:W(!0),id:F().min(1),filename:F().min(1),scheme:pY}),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 dhe=U([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),fhe=B({label:F().min(1),webUrl:ro().nullable()}).loose(),phe=po(`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()]),mY=U([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`auth-not-found-as-identity`,`semantic-protected-branch`]),mhe=U(Mc),hhe=U([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]);B({state:dhe,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:fhe.nullable().optional(),pushError:F().optional(),pushErrorCode:mY.optional(),pullError:F().optional(),pullErrorCode:mY.optional(),pausedReason:F().optional(),blockingPaths:z(F().min(1)).optional(),pushPermission:phe.optional(),syncMode:mhe.optional(),lastPullUtc:F().nullable().optional(),lastPullOutcome:hhe.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(),B({conflicts:z(B({file:F().min(1),detectedAt:F().min(1),conflictKind:U([`git`,`stale-external-write`]).optional().catch(void 0),variant:W(`working-tree`).optional().catch(void 0),oursSha:F().optional(),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`]),lifecycleStatus:F().nullable(),conflictKind:U([`git`,`stale-external-write`]).optional()}).loose(),B({plan:Eo(e=>e!==void 0,{message:`plan is required`})}).loose(),B({plan:Eo(e=>e!==void 0,{message:`plan is required`})}).loose(),B({result:Eo(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 ghe=B({path:F().min(1),summary:F().min(1)}).loose(),_he=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(ghe),entryCounts:_he}).loose())}).loose(),B({noOpen:L().optional(),out:F().min(1).optional()}).loose();const vhe=B({reason:U([`unsupported-platform`,`spawn-error`]),message:F()}).loose();po(`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:vhe.optional()}).loose(),B({status:W(`failed`),buildError:F()}).loose(),B({status:W(`skip-current`),skillVersion:F(),recordedAt:F().optional()}).loose()]);const hY=U(fn),yhe=U(xee),bhe=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 xhe=B({docName:F().min(1),title:F(),matchingTags:z(F().min(1)),snippet:F().nullable()}).loose();B({name:F().min(1),docs:z(xhe)}).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 gY=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:gY,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:gY.optional(),...Qz,summary:$z}).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(),...Qz,summary:$z}).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:gY.optional(),...Qz,summary:$z}).strict(),B({from:F().min(1),to:F().min(1),committed:L()}).strict();const _Y=U(vs),She=/^[a-z0-9-]+$/,vY=B({name:F(),description:F(),metadata:B({pack:F()}).strict().optional()}).strict();B({skill:B({name:F().min(1),scope:_Y,path:F().min(1),frontmatter:vY,body:F(),files:z(B({path:F().min(1),text:F().nullable()})).optional(),managed:L().optional()}).strict()}).strict();const Che=B({source:F().min(1),publisher:F().optional(),skill:F().optional(),marketplaceUrl:F().optional(),importedAt:F().min(1),autoUpdate:L().optional()}).strict(),whe=B({name:F().min(1),description:F().optional(),scope:_Y,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:Che.optional(),pack:F().optional(),modified:L().optional(),revertable:L().optional(),ignored:L().optional(),size:bhe.optional()}).strict();B({name:F().min(1),scope:_Y,apply:L().optional()}).strict(),B({line:F().min(1),gitignorePath:F().min(1),applied:L(),alreadyTracked:L().optional()}).strict(),B({skills:z(whe),truncated:L()}).strict(),B({scope:_Y.default(`project`),name:F().meta({description:`Managed skill name to create or update.`}),body:F().optional(),frontmatter:vY,...Qz,summary:$z}).strict(),B({path:F().min(1),created:L(),warnings:z(F())}).strict(),B({scope:_Y.default(`project`),name:F(),dryRun:L().optional(),setAutoUpdate:L().optional(),...Qz,summary:$z}).strict(),B({name:F().min(1),updated:L(),source:F().min(1),localBody:F().optional(),upstreamBody:F().optional(),gitTracked:L().optional(),warnings:z(F())}).strict(),B({scope:_Y.default(`project`),name:F(),...Qz,summary:$z}).strict(),B({name:F().min(1),baselineRef:F().min(1),restoredFiles:z(F()),warnings:z(F())}).strict(),B({existed:L(),path:F().min(1)}).strict(),B({scope:_Y.default(`project`),fromName:F(),toName:F(),body:F().optional(),frontmatter:vY.optional(),...Qz,summary:$z}).strict(),B({from:F().min(1),to:F().min(1),committed:L()}).strict(),B({name:F(),fromScope:_Y,toScope:_Y,...Qz,summary:$z}).strict(),B({scope:_Y,path:F().optional()}).strict(),B({scope:_Y,name:F(),toName:F(),...Qz,summary:$z}).strict(),B({name:F().min(1)}).strict(),B({name:F(),home:F().min(1)}).strict(),B({docName:F().min(1)}).strict();const yY=U([`reference`,`script`,`file`]);B({scope:_Y.default(`project`),name:F(),path:F().min(1),content:F(),...Qz,summary:$z}).strict(),B({path:F().min(1),created:L(),kind:yY,content:L()}).strict(),B({scope:_Y.default(`project`),name:F(),from:F().min(1),to:F().min(1),...Qz,summary:$z}).strict(),B({from:F().min(1),to:F().min(1),fromDocName:F().optional(),toDocName:F().optional()}).strict(),B({path:F().min(1),kind:yY,text:F()}).strict(),B({path:F().min(1),existed:L(),kind:yY}).strict();const bY=V([yhe,W(`agents`)]),xY=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`}),SY=V([bY,xY]);B({scope:_Y.default(`project`),name:F(),targets:z(bY).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(SY).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(SY).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:SY.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:SY.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(),...Qz,summary:$z,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"}),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([`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`])).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:F().optional(),sourceMovedTo:F().optional()}).strict(),B({scope:_Y.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(hY),configured:L(),folders:z(B({scope:_Y,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 CY=B({action:W(`link`),scope:_Y,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.`})}),wY=B({action:W(`unlink`),scope:_Y,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(),TY=B({action:W(`add-root`),scope:_Y,root:xY.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict(),The=po(`action`,[CY.extend({preview:L().optional().meta({description:`Return the merge plan only (moves, drops, removes, conflicts, strays) — nothing is written.`})}).strict(),wY,TY]);po(`action`,[CY.strict(),wY,TY]),B({folderAction:The}).strict();const Ehe=B({moves:z(F()),drops:z(F()),removes:z(F()),replaces:z(F()),conflicts:z(F()),strays:z(F())}).strict();B({targets:z(hY),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:Ehe.optional()}).strict(),B({scope:_Y.default(`project`),name:F(),version:F().regex(/^[0-9a-f]{40}$/i),...Qz,summary:$z}).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 Dhe=B({kind:U([`page`,`folder`,`content`,`file`]),path:F().min(1),title:F(),score:I(),signals:H(F(),R()),snippet:F().optional()}).loose(),Ohe=B({capable:L(),applied:L(),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(),embedded:I().int().nonnegative(),total:I().int().nonnegative()}).loose(),B({query:F(),intent:U([`autocomplete`,`full_text`,`omnibar`]),results:z(Dhe),elapsedMs:I().nonnegative(),semantic:Ohe.optional(),truncated:L().optional(),ready:L().optional()}).loose();const khe=B({version:F().min(1),recordedAt:F().min(1)}).loose();B({currentVersion:F().min(1),targets:H(F(),khe.nullable())}).loose(),B({scope:_Y.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."}),...Qz,summary:$z}).strict(),B({scope:_Y.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."}),...Qz,summary:$z}).strict(),B({results:z(B({requested:F(),status:U([`imported`,`already-imported`,`not-found`,`failed`]),name:F().optional(),collisionRenamedFrom:F().optional(),warnings:z(F()),error:F().optional()}).loose()),imported:I(),alreadyImported:I(),failed:I()}).loose(),B({scope:_Y.default(`project`),names:z(F().min(1)).min(1).max(100).meta({description:`Managed skill names to refresh from their recorded upstreams.`}),...Qz,summary:$z}).strict(),B({results:z(B({requested:F(),status:U([`updated`,`up-to-date`,`not-found`,`failed`]),source:F().optional(),warnings:z(F()),error:F().optional()}).loose()),updated:I(),upToDate:I(),failed:I()}).loose();const Ahe=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:Ahe,warnings:z(F()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`})}).loose();const jhe=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:jhe,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:wu}).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 EY=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),DY=globalThis;DY[EY]===void 0&&(DY[EY]=Jr());const OY=DY[EY],kY=uo({version:F().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(OY,{description:`Recorded skill version for this target.`}),recordedAt:Da().register(OY,{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(OY,{description:`Install-source surface that recorded this entry.`}).optional()}),Mhe=uo({enabled:L().register(OY,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Da().register(OY,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});uo({schema:W(1).register(OY,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:uo({"claude-cowork":kY.optional(),"cli-hosts":kY.optional()}).register(OY,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:H(F(),Mhe).register(OY,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:z(F()).register(OY,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});const AY=e=>e*8+4;AY(92),AY(40),Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));const jY={fileSystem:`File System`,gitUpstream:`Git (upstream)`,service:`OpenKnowledge (service)`,generator:`OpenKnowledge (generated)`};jc();var Nhe=Object.create,MY=Object.defineProperty,Phe=Object.getOwnPropertyDescriptor,Fhe=Object.getOwnPropertyNames,Ihe=Object.getPrototypeOf,NY=Object.prototype.hasOwnProperty,PY=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Lhe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Fhe(t),a=0,o=i.length,s;a<o;a++)s=i[a],!NY.call(e,s)&&s!==n&&MY(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Phe(t,s))||r.enumerable});return e},FY=(e,t,n)=>(n=e==null?{}:Nhe(Ihe(e)),Lhe(t||!e||!e.__esModule||!NY.call(e,`default`)?MY(n,`default`,{value:e,enumerable:!0}):n,e)),IY=a(import.meta.url),LY=PY(((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+`
422
422
  causes have become circular...`;let o=r(e);return o?(t.add(e),a+`
423
423
  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)}})),RY=PY(((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}}})),Rhe=PY(((e,t)=>{t.exports=l;let{messageWithCauses:n,stackWithCauses:r,isErrorLike:i}=LY(),{pinoErrProto:a,pinoErrorSymbols:o}=RY(),{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}})),zhe=PY(((e,t)=>{t.exports=s;let{isErrorLike:n}=LY(),{pinoErrProto:r,pinoErrorSymbols:i}=RY(),{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}})),Bhe=PY(((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)}}})),Vhe=PY(((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)}}})),zY=PY(((e,t)=>{let n=Rhe(),r=zhe(),i=Bhe(),a=Vhe();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))}}}})),BY=PY(((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}})),Hhe=PY(((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})),VY=PY(((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}})),HY=PY(((e,t)=>{let n=Hhe(),{redactFmtSym:r,wildcardFirstSym:i}=VY(),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})),Uhe=PY(((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"`}}})),Whe=PY(((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)}})),UY=PY(((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}})),WY=PY(((e,t)=>{let n=IY(`fs`),r=IY(`events`),i=IY(`util`).inherits,a=IY(`path`),o=UY(),s=IY(`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})),GY=PY(((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}})),Ghe=PY(((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`}})),Khe=PY(((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}})),qhe=PY(((e,t)=>{t.exports={WRITE_INDEX:4,READ_INDEX:8,SEQ_INDEX:2}})),Jhe=PY(((e,t)=>{let{version:n}=Ghe(),{EventEmitter:r}=IY(`events`),{Worker:i}=IY(`worker_threads`),{join:a}=IY(`path`),{pathToFileURL:o}=IY(`url`),{wait:s}=Khe(),{WRITE_INDEX:c,READ_INDEX:l,SEQ_INDEX:u}=qhe(),d=IY(`buffer`),f=IY(`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})),KY=PY(((e,t)=>{let{createRequire:n}=IY(`module`),{existsSync:r}=IY(`node:fs`),i=BY(),{join:a,isAbsolute:o,sep:s}=IY(`node:path`),{fileURLToPath:c}=IY(`node:url`),l=UY(),u=GY(),d=Jhe();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()&&IY.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})),qY=PY(((e,t)=>{let n=IY(`node:diagnostics_channel`),r=Whe(),{mapHttpRequest:i,mapHttpResponse:a}=zY(),o=WY(),s=GY(),{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}=VY(),{isMainThread:w}=IY(`worker_threads`),T=KY(),[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}})),JY=PY(((e,t)=>{t.exports={DEFAULT_LEVELS:{trace:10,debug:20,info:30,warn:40,error:50,fatal:60},SORTING_ORDER:{ASC:`ASC`,DESC:`DESC`}}})),YY=PY(((e,t)=>{let{lsCacheSym:n,levelValSym:r,useOnlyCustomLevelsSym:i,streamSym:a,formattersSym:o,hooksSym:s,levelCompSym:c}=VY(),{noop:l,genLog:u}=qY(),{DEFAULT_LEVELS:d,SORTING_ORDER:f}=JY(),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}})),XY=PY(((e,t)=>{t.exports={version:`10.3.1`}})),Yhe=PY(((e,t)=>{let{EventEmitter:n}=IY(`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}=VY(),{getLevel:D,setLevel:O,isLevelEnabled:ee,mappings:te,initialLsCache:ne,genLsCache:re,assertNoLevelCollisions:ie}=YY(),{asChindings:ae,asJson:oe,buildFormatters:se,stringify:k,noop:ce}=qY(),{version:le}=XY(),ue=HY(),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()}})),Xhe=PY(((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}})),Zhe=PY(((e,t)=>{let n=Symbol.for(`pino.metadata`),{DEFAULT_LEVELS:r}=JY(),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})),ZY=PY(((e,t)=>{let n=IY(`node:os`),r=zY(),i=BY(),a=HY(),o=Uhe(),s=Yhe(),c=VY(),{configure:l}=Xhe(),{assertDefaultLevelFound:u,mappings:d,genLsCache:f,genLevelComparison:p,assertLevelComparison:m}=YY(),{DEFAULT_LEVELS:h,SORTING_ORDER:g}=JY(),{createArgsNormalizer:_,asChindings:v,buildSafeSonicBoom:y,buildFormatters:b,stringify:x,normalizeDestFileDescriptor:S,noop:C}=qY(),{version:w}=XY(),{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
424
424
  `:`
@@ -434,25 +434,25 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
434
434
  `){return e.split(n).reduce((e,n)=>{let r=t?n.trim():n;return r&&e.push(r),e},[])}function g$(e,t){return h$(e,!0).map(e=>t(e))}function _$(e){return(0,UQ.exists)(e,UQ.FOLDER)}function v$(e,t){return Array.isArray(e)?e.includes(t)||e.push(t):e.add(t),t}function wye(e,t){return Array.isArray(e)&&!e.includes(t)&&e.push(t),e}function y$(e,t){if(Array.isArray(e)){let n=e.indexOf(t);n>=0&&e.splice(n,1)}else e.delete(t);return t}function b$(e){return Array.isArray(e)?e:[e]}function x$(e){return e.replace(/[\s-]+(.)/g,(e,t)=>t.toUpperCase())}function S$(e){return b$(e).map(e=>e instanceof String?e:String(e))}function C$(e,t=0){if(e==null)return t;let n=parseInt(e,10);return Number.isNaN(n)?t:n}function w$(e,t){let n=[];for(let r=0,i=e.length;r<i;r++)n.push(t,e[r]);return n}function T$(e){return(Array.isArray(e)?Buffer.concat(e):e).toString(`utf-8`)}function Tye(e,t){let n={};return t.forEach(t=>{e[t]!==void 0&&(n[t]=e[t])}),n}function Eye(e=0){return new Promise(t=>setTimeout(t,e))}function E$(e){if(e!==!1)return e}var D$,O$,k$,A$=e$({"src/lib/utils/util.ts"(){B$(),D$=`\0`,O$=()=>{},k$=Object.prototype.toString.call.bind(Object.prototype.toString)}});function j$(e,t,n){return t(e)?e:arguments.length>2?n:void 0}function M$(e,t){let n=KQ(e)?`string`:typeof e;return/number|string|boolean/.test(n)&&(!t||!t.includes(n))}function N$(e){return!!e&&k$(e)===`[object Object]`}function P$(e){return typeof e==`function`}var F$,I$,L$,R$,z$,B$=e$({"src/lib/utils/argument-filters.ts"(){A$(),F$=e=>Array.isArray(e),I$=e=>typeof e==`number`,L$=e=>typeof e==`string`||KQ(e),R$=e=>L$(e)||Array.isArray(e)&&e.every(L$),z$=e=>e==null||`number|boolean|function`.includes(typeof e)?!1:typeof e.length==`number`}}),V$,Dye=e$({"src/lib/utils/exit-codes.ts"(){V$=(e=>(e[e.SUCCESS=0]=`SUCCESS`,e[e.ERROR=1]=`ERROR`,e[e.NOT_FOUND=-2]=`NOT_FOUND`,e[e.UNCLEAN=128]=`UNCLEAN`,e))(V$||{})}}),H$,Oye=e$({"src/lib/utils/git-output-streams.ts"(){H$=class e{constructor(e,t){this.stdOut=e,this.stdErr=t}asStrings(){return new e(this.stdOut.toString(`utf8`),this.stdErr.toString(`utf8`))}}}});function kye(){throw Error(`LineParser:useMatches not implemented`)}var U$,W$,Aye=e$({"src/lib/utils/line-parser.ts"(){U$=class{constructor(e,t){this.matches=[],this.useMatches=kye,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))}},W$=class extends U${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 jye(...e){let t=process.cwd(),n=Object.assign({baseDir:t,...G$},...e.filter(e=>typeof e==`object`&&e));return n.baseDir=n.baseDir||t,n.trimmed=n.trimmed===!0,n}var G$,Mye=e$({"src/lib/utils/simple-git-options.ts"(){G$={binary:`git`,maxConcurrentProcesses:5,config:[],trimmed:!1}}});function K$(e,t=[]){return N$(e)?Object.keys(e).reduce((t,n)=>{let r=e[n];if(KQ(r))t.push(r);else if(M$(r,[`boolean`]))t.push(n+`=`+r);else if(Array.isArray(r))for(let e of r)M$(e,[`string`,`number`])||t.push(n+`=`+e);else t.push(n);return t},t):t}function q$(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 K$(J$(e),r),n||r.push(...Nye(e)),r}function Nye(e){return S$(j$(p$(e,+(typeof p$(e)==`function`)),F$,[]))}function J$(e){return j$(p$(e,+!!P$(p$(e))),N$)}function Y$(e,t=!0){let n=l$(p$(e));return t||u$(n)?n:void 0}var Pye=e$({"src/lib/utils/task-options.ts"(){B$(),A$()}});function X$(e,t){return e(t.stdOut,t.stdErr)}function Z$(e,t,n,r=!0){return b$(n).forEach(n=>{for(let i=h$(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 Fye=e$({"src/lib/utils/task-parser.ts"(){A$()}}),Q$={};t$(Q$,{ExitCodes:()=>V$,GitOutputStreams:()=>H$,LineParser:()=>U$,NOOP:()=>O$,NULL:()=>D$,RemoteLineParser:()=>W$,append:()=>v$,appendTaskOptions:()=>K$,asArray:()=>b$,asCamelCase:()=>x$,asFunction:()=>l$,asNumber:()=>C$,asStringArray:()=>S$,bufferToString:()=>T$,callTaskParser:()=>X$,createInstanceConfig:()=>jye,delay:()=>Eye,filterArray:()=>F$,filterFunction:()=>P$,filterHasLength:()=>z$,filterNumber:()=>I$,filterPlainObject:()=>N$,filterPrimitives:()=>M$,filterString:()=>L$,filterStringOrStringArray:()=>R$,filterType:()=>j$,first:()=>f$,folderExists:()=>_$,forEachLineWithContent:()=>g$,getTrailingOptions:()=>q$,including:()=>wye,isUserFunction:()=>u$,last:()=>p$,objectToString:()=>k$,orVoid:()=>E$,parseStringResponse:()=>Z$,pick:()=>Tye,prefixedArray:()=>w$,remove:()=>y$,splitOn:()=>d$,toLinesWithContent:()=>h$,trailingFunctionArgument:()=>Y$,trailingOptionsArgument:()=>J$});var $$=e$({"src/lib/utils/index.ts"(){B$(),Dye(),Oye(),Aye(),Mye(),Pye(),Fye(),A$()}}),e1={};t$(e1,{CheckRepoActions:()=>r1,checkIsBareRepoTask:()=>n1,checkIsRepoRootTask:()=>t1,checkIsRepoTask:()=>Iye});function Iye(e){switch(e){case`bare`:return n1();case`root`:return t1()}return{commands:[`rev-parse`,`--is-inside-work-tree`],format:`utf-8`,onError:i1,parser:a1}}function t1(){return{commands:[`rev-parse`,`--git-dir`],format:`utf-8`,onError:i1,parser(e){return/^\.(git)?$/.test(e.trim())}}}function n1(){return{commands:[`rev-parse`,`--is-bare-repository`],format:`utf-8`,onError:i1,parser:a1}}function Lye(e){return/(Not a git repository|Kein Git-Repository)/i.test(String(e))}var r1,i1,a1,o1=e$({"src/lib/tasks/check-is-repo.ts"(){$$(),r1=(e=>(e.BARE=`bare`,e.IN_TREE=`tree`,e.IS_REPO_ROOT=`root`,e))(r1||{}),i1=({exitCode:e},t,n,r)=>{if(e===128&&Lye(t))return n(Buffer.from(`false`));r(t)},a1=e=>e.trim()===`true`}});function Rye(e,t){let n=new s1(e),r=e?l1:c1;return h$(t).forEach(e=>{let t=e.replace(r,``);n.paths.push(t),(u1.test(t)?n.folders:n.files).push(t)}),n}var s1,c1,l1,u1,zye=e$({"src/lib/responses/CleanSummary.ts"(){$$(),s1=class{constructor(e){this.dryRun=e,this.paths=[],this.files=[],this.folders=[]}},c1=/^[a-z]+\s*/i,l1=/^[a-z]+\s+[a-z]+\s*/i,u1=/\/$/}}),d1={};t$(d1,{EMPTY_COMMANDS:()=>v1,adhocExecTask:()=>f1,configurationErrorTask:()=>p1,isBufferTask:()=>g1,isEmptyTask:()=>_1,straightThroughBufferTask:()=>h1,straightThroughStringTask:()=>m1});function f1(e){return{commands:v1,format:`empty`,parser:e}}function p1(e){return{commands:v1,format:`empty`,parser(){throw typeof e==`string`?new s$(e):e}}}function m1(e,t=!1){return{commands:e,format:`utf-8`,parser(e){return t?String(e).trim():e}}}function h1(e){return{commands:e,format:`buffer`,parser(e){return e}}}function g1(e){return e.format===`buffer`}function _1(e){return e.format===`empty`||!e.commands.length}var v1,y1=e$({"src/lib/tasks/task.ts"(){c$(),v1=[]}}),b1={};t$(b1,{CONFIG_ERROR_INTERACTIVE_MODE:()=>S1,CONFIG_ERROR_MODE_REQUIRED:()=>C1,CONFIG_ERROR_UNKNOWN_OPTION:()=>w1,CleanOptions:()=>T1,cleanTask:()=>x1,cleanWithOptionsTask:()=>Bye,isCleanOptionsArray:()=>Vye});function Bye(e,t){let{cleanMode:n,options:r,valid:i}=Hye(e);return n?i.options?(r.push(...t),r.some(Gye)?p1(S1):x1(n,r)):p1(w1+JSON.stringify(e)):p1(C1)}function x1(e,t){return{commands:[`clean`,`-${e}`,...t],format:`utf-8`,parser(t){return Rye(e===`n`,t)}}}function Vye(e){return Array.isArray(e)&&e.every(e=>E1.has(e))}function Hye(e){let t,n=[],r={cleanMode:!1,options:!0};return e.replace(/[^a-z]i/g,``).split(``).forEach(e=>{Uye(e)?(t=e,r.cleanMode=!0):r.options=r.options&&Wye(n[n.length]=`-${e}`)}),{cleanMode:t,options:n,valid:r}}function Uye(e){return e===`f`||e===`n`}function Wye(e){return/^-[a-z]$/i.test(e)&&E1.has(e.charAt(1))}function Gye(e){return/^-[^\-]/.test(e)?e.indexOf(`i`)>0:e===`--interactive`}var S1,C1,w1,T1,E1,D1=e$({"src/lib/tasks/clean.ts"(){zye(),$$(),y1(),S1=`Git clean interactive mode is not supported`,C1=`Git clean mode parameter ("n" or "f") is required`,w1=`Git clean unknown option found in: `,T1=(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))(T1||{}),E1=new Set([`i`,...S$(Object.values(T1))])}});function Kye(e){let t=new k1;for(let n of O1(e))t.addValue(n.file,String(n.key),n.value);return t}function qye(e,t){let n=null,r=[],i=new Map;for(let a of O1(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 Jye(e){return e.replace(/^(file):/,``)}function*O1(e,t=null){let n=e.split(`\0`);for(let e=0,r=n.length-1;e<r;){let r=Jye(n[e++]),i=n[e++],a=t;if(i.includes(`
435
435
  `)){let e=d$(i,`
436
436
  `);a=e[0],i=e[1]}yield{file:r,key:a,value:i}}}var k1,Yye=e$({"src/lib/responses/ConfigList.ts"(){$$(),k1=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=p$(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 A1(e,t){return typeof e==`string`&&Object.hasOwn(j1,e)?e:t}function Xye(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 Zye(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 qye(t,e)}}}function Qye(e){let t=[`config`,`--list`,`--show-origin`,`--null`];return e&&t.push(`--${e}`),{commands:t,format:`utf-8`,parser(e){return Kye(e)}}}function $ye(){return{addConfig(e,t,...n){return this._runTask(Xye(e,t,n[0]===!0,A1(n[1],`local`)),Y$(arguments))},getConfig(e,t){return this._runTask(Zye(e,A1(t,void 0)),Y$(arguments))},listConfig(...e){return this._runTask(Qye(A1(e[0],void 0)),Y$(arguments))}}}var j1,M1=e$({"src/lib/tasks/config.ts"(){Yye(),$$(),j1=(e=>(e.system=`system`,e.global=`global`,e.local=`local`,e.worktree=`worktree`,e))(j1||{})}});function ebe(e){return P1.has(e)}var N1,P1,F1=e$({"src/lib/tasks/diff-name-status.ts"(){N1=(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))(N1||{}),P1=new Set(Object.values(N1))}});function tbe(...e){return new z1().param(...e)}function nbe(e){let t=new Set,n={};return g$(e,e=>{let[r,i,a]=e.split(D$);t.add(r),(n[r]=n[r]||[]).push({line:C$(i),path:r,preview:a})}),{paths:t,results:n}}function rbe(){return{grep(e){let t=Y$(arguments),n=q$(arguments);for(let e of I1)if(n.includes(e))return this._runTask(p1(`git.grep: use of "${e}" is not supported.`),t);typeof e==`string`&&(e=tbe().param(e));let r=[`grep`,`--null`,`-n`,`--full-name`,...n,...e];return this._runTask({commands:r,format:`utf-8`,parser(e){return nbe(e)}},t)}}}var I1,L1,R1,z1,B1=e$({"src/lib/tasks/grep.ts"(){$$(),y1(),I1=[`-h`],L1=Symbol(`grepQuery`),z1=class{constructor(){this[R1]=[]}*[(R1=L1,Symbol.iterator)](){for(let e of this[L1])yield e}and(...e){return e.length&&this[L1].push(`--and`,`(`,...w$(e,`-e`),`)`),this}param(...e){return this[L1].push(...w$(e,`-e`)),this}}}}),V1={};t$(V1,{ResetMode:()=>U1,getResetMode:()=>abe,resetTask:()=>ibe});function ibe(e,t){let n=[`reset`];return H1(e)&&n.push(`--${e}`),n.push(...t),m1(n)}function abe(e){if(H1(e))return e;switch(typeof e){case`string`:case`undefined`:return`soft`}}function H1(e){return typeof e==`string`&&W1.includes(e)}var U1,W1,G1=e$({"src/lib/tasks/reset.ts"(){$$(),y1(),U1=(e=>(e.MIXED=`mixed`,e.SOFT=`soft`,e.HARD=`hard`,e.MERGE=`merge`,e.KEEP=`keep`,e))(U1||{}),W1=S$(Object.values(U1))}});function obe(){return(0,qQ.default)(`simple-git`)}function K1(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 sbe(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 q1(e,t,n,r=obe()){let i=e&&`[${e}]`||``,a=[],o=typeof t==`string`?r.extend(t):t,s=sbe(j$(t,L$),o,r);return l(n);function c(t,n){return v$(a,q1(e,s.replace(/^[^:]+/,t),n,r))}function l(t){let n=t&&`[${t}]`||``,a=o&&K1(o,n)||O$,s=K1(r,`${i} ${n}`,a);return Object.assign(o?a:s,{label:e,sibling:c,info:s,step:l})}}var J1=e$({"src/lib/git-logger.ts"(){$$(),qQ.default.formatters.L=e=>String(z$(e)?e.length:`-`),qQ.default.formatters.B=e=>Buffer.isBuffer(e)?e.toString(`utf8`):k$(e)}}),Y1,cbe=e$({"src/lib/runners/tasks-pending-queue.ts"(){i$(),J1(),Y1=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:q1(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 r$(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 X1(e,t){return{method:f$(e.commands)||``,commands:t}}function lbe(e,t){return n=>{t(`[ERROR] child process exception %o`,n),e.push(Buffer.from(String(n.stack),`ascii`))}}function Z1(e,t,n,r){return i=>{n(`%s received %L bytes`,t,i),r(`%B`,i),e.push(i)}}var Q1,ube=e$({"src/lib/runners/git-executor-chain.ts"(){i$(),y1(),$$(),cbe(),Q1=class{constructor(e,t,n){this._executor=e,this._scheduler=t,this._plugins=n,this._chain=Promise.resolve(),this._queue=new Y1}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(_1(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 r$?Object.assign(t,{task:e}):new r$(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`,``,X1(e,e.commands)),r=this._plugins.exec(`spawn.args`,[...e.commands],{...X1(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),g1(e)?X$(e.parser,a):X$(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},{...X1(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`,k$(e)),c(new H$(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 H$(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},X1(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,{...X1(e,n),kill(e){u=e||u}});let d=Ie(t,n,o);d.stdout.on(`data`,Z1(c,`stdOut`,i,a.step(`stdOut`))),d.stderr.on(`data`,Z1(l,`stdErr`,i,a.step(`stdErr`))),d.on(`error`,lbe(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,{...X1(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,{...X1(e,t),kill(e){n=e||n}}),n}}}}),$1={};t$($1,{GitExecutor:()=>e0});var e0,dbe=e$({"src/lib/runners/git-executor.ts"(){ube(),e0=class{constructor(e,t,n){this.cwd=e,this._scheduler=t,this._plugins=n,this._chain=new Q1(this,this._scheduler,this._plugins)}chain(){return new Q1(this,this._scheduler,this._plugins)}push(e){return this._chain.push(e)}}}});function fbe(e,t,n=O$){t.then(e=>{n(null,e)},t=>{t?.task===e&&n(t instanceof a$?pbe(t):t,void 0)})}function pbe(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=O$};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 mbe=e$({"src/lib/task-callback.ts"(){o$(),$$()}});function t0(e,t){return f1(n=>{if(!_$(e))throw Error(`Git.cwd: cannot change to non-directory "${e}"`);return(t||n).cwd=e})}var hbe=e$({"src/lib/tasks/change-working-directory.ts"(){$$(),y1()}});function n0(e){let t=[`checkout`,...e];return t[1]===`-b`&&t.includes(`-B`)&&(t[1]=y$(t,`-B`)),m1(t)}function gbe(){return{checkout(){return this._runTask(n0(q$(arguments,1)),Y$(arguments))},checkoutBranch(e,t){return this._runTask(n0([`-b`,e,t,...q$(arguments)]),Y$(arguments))},checkoutLocalBranch(e){return this._runTask(n0([`-b`,e,...q$(arguments)]),Y$(arguments))}}}var _be=e$({"src/lib/tasks/checkout.ts"(){$$(),y1()}});function vbe(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function ybe(){return{countObjects(){return this._runTask({commands:[`count-objects`,`--verbose`],format:`utf-8`,parser(e){return Z$(vbe(),[r0],e)}})}}}var r0,bbe=e$({"src/lib/tasks/count-objects.ts"(){$$(),r0=new U$(/([a-z-]+): (\d+)$/,(e,[t,n])=>{let r=x$(t);Object.hasOwn(e,r)&&(e[r]=C$(n))})}});function xbe(e){return Z$({author:null,branch:``,commit:``,root:!1,summary:{changes:0,insertions:0,deletions:0}},i0,e)}var i0,Sbe=e$({"src/lib/parsers/parse-commit.ts"(){$$(),i0=[new U$(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(e,[t,n,r])=>{e.branch=t,e.commit=r,e.root=!!n}),new U$(/\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 U$(/(\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 U$(/^(\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 Cbe(e,t,n){return{commands:[`-c`,`core.abbrev=40`,`commit`,...w$(e,`-m`),...t,...n],format:`utf-8`,parser:xbe}}function wbe(){return{commit(t,...n){let r=Y$(arguments),i=e(t)||Cbe(b$(t),b$(j$(n[0],R$,[])),[...S$(j$(n[1],F$,[])),...q$(arguments,0,!0)]);return this._runTask(i,r)}};function e(e){return!R$(e)&&p1(`git.commit: requires the commit message to be supplied as a string/string[]`)}}var Tbe=e$({"src/lib/tasks/commit.ts"(){Sbe(),$$(),y1()}});function Ebe(){return{firstCommit(){return this._runTask(m1([`rev-list`,`--max-parents=0`,`HEAD`],!0),Y$(arguments))}}}var Dbe=e$({"src/lib/tasks/first-commit.ts"(){$$(),y1()}});function Obe(e,t){let n=[`hash-object`,e];return t&&n.push(`-w`),m1(n,!0)}var kbe=e$({"src/lib/tasks/hash-object.ts"(){y1()}});function Abe(e,t,n){let r=String(n).trim(),i;if(i=o0.exec(r))return new a0(e,t,!1,i[1]);if(i=s0.exec(r))return new a0(e,t,!0,i[1]);let a=``,o=r.split(` `);for(;o.length;)if(o.shift()===`in`){a=o.join(` `);break}return new a0(e,t,/^re/i.test(r),a)}var a0,o0,s0,jbe=e$({"src/lib/responses/InitSummary.ts"(){a0=class{constructor(e,t,n,r){this.bare=e,this.path=t,this.existing=n,this.gitDir=r}},o0=/^Init.+ repository in (.+)$/,s0=/^Rein.+ in (.+)$/}});function Mbe(e){return e.includes(c0)}function Nbe(e=!1,t,n){let r=[`init`,...n];return e&&!Mbe(r)&&r.splice(1,0,c0),{commands:r,format:`utf-8`,parser(e){return Abe(r.includes(`--bare`),t,e)}}}var c0,Pbe=e$({"src/lib/tasks/init.ts"(){jbe(),c0=`--bare`}});function l0(e){for(let t=0;t<e.length;t++){let n=u0.exec(e[t]);if(n)return`--${n[1]}`}return``}function Fbe(e){return u0.test(e)}var u0,d0=e$({"src/lib/args/log-format.ts"(){u0=/^--(stat|numstat|name-only|name-status)(=|$)/}}),f0,Ibe=e$({"src/lib/responses/DiffSummary.ts"(){f0=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function p0(e=``){let t=v0[e];return e=>Z$(new f0,t,e,!1)}var m0,h0,g0,_0,v0,y0=e$({"src/lib/parsers/parse-diff-summary.ts"(){d0(),Ibe(),F1(),$$(),m0=[new U$(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(e,[t,n,r=``])=>{e.files.push({file:t.trim(),changes:C$(n),insertions:r.replace(/[^+]/g,``).length,deletions:r.replace(/[^-]/g,``).length,binary:!1})}),new U$(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(e,[t,n,r])=>{e.files.push({file:t.trim(),before:C$(n),after:C$(r),binary:!0})}),new U$(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(e,[t,n])=>{let r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);e.changed=C$(t),e.insertions=C$(r?.[1]),e.deletions=C$(i?.[1])})],h0=[new U$(/(\d+)\t(\d+)\t(.+)$/,(e,[t,n,r])=>{let i=C$(t),a=C$(n);e.changed++,e.insertions+=i,e.deletions+=a,e.files.push({file:r,changes:i+a,insertions:i,deletions:a,binary:!1})}),new U$(/-\t-\t(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,after:0,before:0,binary:!0})})],g0=[new U$(/(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,changes:0,insertions:0,deletions:0,binary:!1})})],_0=[new U$(/([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:E$(ebe(t)&&t),from:E$(!!a&&r!==a&&r),similarity:C$(n)})})],v0={"":m0,"--stat":m0,"--numstat":h0,"--name-status":_0,"--name-only":g0}}});function Lbe(e,t){return t.reduce((t,n,r)=>(t[n]=e[r]||``,t),Object.create({diff:null}))}function b0(e=C0,t=w0,n=``){let r=p0(n);return function(n){let i=h$(n.trim(),!1,x0).map(function(n){let i=n.split(S0),a=Lbe(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 x0,S0,C0,w0,T0=e$({"src/lib/parsers/parse-list-log-summary.ts"(){$$(),y0(),d0(),x0=`òòòòòò `,S0=` òò`,C0=` ò `,w0=[`hash`,`date`,`message`,`refs`,`author_name`,`author_email`]}}),E0={};t$(E0,{diffSummaryTask:()=>Rbe,validateLogFormatConfig:()=>D0});function Rbe(e){let t=l0(e),n=[`diff`];return t===``&&(t=`--stat`,n.push(`--stat=4096`)),n.push(...e),D0(n)||{commands:n,format:`utf-8`,parser:p0(t)}}function D0(e){let t=e.filter(Fbe);if(t.length>1)return p1(`Summary flags are mutually exclusive - pick one of ${t.join(`,`)}`);if(t.length&&e.includes(`-z`))return p1(`Summary flag ${t} parsing is not compatible with null termination option '-z'`)}var O0=e$({"src/lib/tasks/diff.ts"(){d0(),y0(),y1()}});function zbe(e,t){let n=[],r=[];return Object.keys(e).forEach(t=>{n.push(t),r.push(String(e[t]))}),[n,r.join(t)]}function Bbe(e){return Object.keys(e).reduce((t,n)=>(n in A0||(t[n]=e[n]),t),{})}function k0(e={},t=[]){let n=j$(e.splitter,L$,C0),[r,i]=zbe(N$(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:${x0}${i}${S0}`,...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 L$(e.file)&&o.push(`--follow`,GQ(e.file)),K$(Bbe(e),o),{fields:r,splitter:n,commands:[...o,...a]}}function Vbe(e,t,n){let r=b0(e,t,l0(n));return{commands:[`log`,...n],format:`utf-8`,parser:r}}function Hbe(){return{log(...n){let r=Y$(arguments),i=k0(J$(arguments),S$(j$(arguments[0],F$,[]))),a=t(...n)||D0(i.commands)||e(i);return this._runTask(a,r)}};function e(e){return Vbe(e.splitter,e.fields,e.commands)}function t(e,t){return L$(e)&&L$(t)&&p1(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`)}}var A0,j0=e$({"src/lib/tasks/log.ts"(){d0(),T0(),$$(),y1(),O0(),A0=(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))(A0||{})}}),M0,N0,Ube=e$({"src/lib/responses/MergeSummary.ts"(){M0=class{constructor(e,t=null,n){this.reason=e,this.file=t,this.meta=n}toString(){return`${this.file}:${this.reason}`}},N0=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`}}}}),P0,F0,Wbe=e$({"src/lib/responses/PullSummary.ts"(){P0=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},F0=class{constructor(){this.remote=``,this.hash={local:``,remote:``},this.branch={local:``,remote:``},this.message=``}toString(){return this.message}}}});function I0(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 L0(e){let t=/^\s*(\d+)/.exec(e),n=/delta (\d+)/i.exec(e);return{count:C$(t&&t[1]||`0`),delta:C$(n&&n[1]||`0`)}}var R0,Gbe=e$({"src/lib/parsers/parse-remote-objects.ts"(){$$(),R0=[new W$(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=I0(e.remoteMessages);Object.assign(i,{[r]:C$(n)})}),new W$(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=I0(e.remoteMessages);Object.assign(i,{[r]:C$(n)})}),new W$(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(e,[t,n,r])=>{let i=I0(e.remoteMessages);i.total=L0(t),i.reused=L0(n),i.packReused=C$(r)})]}});function z0(e,t){return Z$({remoteMessages:new V0},B0,t)}var B0,V0,H0=e$({"src/lib/parsers/parse-remote-messages.ts"(){$$(),Gbe(),B0=[new W$(/^remote:\s*(.+)$/,(e,[t])=>(e.remoteMessages.all.push(t.trim()),!1)),...R0,new W$([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(e,[t])=>{e.remoteMessages.pullRequestUrl=t}),new W$([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(e,[t,n,r])=>{e.remoteMessages.vulnerabilities={count:C$(t),summary:n,url:r}})],V0=class{constructor(){this.all=[]}}}});function Kbe(e,t){let n=Z$(new F0,q0,[e,t]);return n.message&&n}var U0,W0,G0,K0,q0,J0,Y0,X0=e$({"src/lib/parsers/parse-pull.ts"(){Wbe(),$$(),H0(),U0=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,W0=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,G0=/^(create|delete) mode \d+ (.+)/,K0=[new U$(U0,(e,[t,n,r])=>{e.files.push(t),n&&(e.insertions[t]=n.length),r&&(e.deletions[t]=r.length)}),new U$(W0,(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 U$(G0,(e,[t,n])=>{v$(e.files,n),v$(t===`create`?e.created:e.deleted,n)})],q0=[new U$(/^from\s(.+)$/i,(e,[t])=>void(e.remote=t)),new U$(/^fatal:\s(.+)$/,(e,[t])=>void(e.message=t)),new U$(/([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})],J0=(e,t)=>Z$(new P0,K0,[e,t]),Y0=(e,t)=>Object.assign(new P0,J0(e,t),z0(e,t))}}),Z0,Q0,$0,qbe=e$({"src/lib/parsers/parse-merge.ts"(){Ube(),$$(),X0(),Z0=[new U$(/^Auto-merging\s+(.+)$/,(e,[t])=>{e.merges.push(t)}),new U$(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(e,[t,n])=>{e.conflicts.push(new M0(t,n))}),new U$(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(e,[t,n,r])=>{e.conflicts.push(new M0(t,n,{deleteRef:r}))}),new U$(/^CONFLICT\s+\((.+)\):/,(e,[t])=>{e.conflicts.push(new M0(t,null))}),new U$(/^Automatic merge failed;\s+(.+)$/,(e,[t])=>{e.result=t})],Q0=(e,t)=>Object.assign($0(e,t),Y0(e,t)),$0=e=>Z$(new N0,Z0,e)}});function e2(e){return e.length?{commands:[`merge`,...e],format:`utf-8`,parser(e,t){let n=Q0(e,t);if(n.failed)throw new a$(n);return n}}:p1(`Git.merge requires at least one option`)}var Jbe=e$({"src/lib/tasks/merge.ts"(){o$(),qbe(),y1()}});function Ybe(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 t2,n2,r2,Xbe=e$({"src/lib/parsers/parse-push.ts"(){$$(),H0(),t2=[new U$(/^Pushing to (.+)$/,(e,[t])=>{e.repo=t}),new U$(/^updating local tracking ref '(.+)'/,(e,[t])=>{e.ref={...e.ref||{},local:t}}),new U$(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(e,[t,n,r])=>{e.pushed.push(Ybe(t,n,r))}),new U$(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(e,[t,n,r])=>{e.branch={...e.branch||{},local:t,remote:n,remoteName:r}}),new U$(/^([^:]+):(\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}}})],n2=(e,t)=>{let n=r2(e,t),r=z0(e,t);return{...n,...r}},r2=(e,t)=>Z$({pushed:[]},t2,[e,t])}}),i2={};t$(i2,{pushTagsTask:()=>Zbe,pushTask:()=>a2});function Zbe(e={},t){return v$(t,`--tags`),a2(e,t)}function a2(e={},t){let n=[`push`,...t];return e.branch&&n.splice(1,0,e.branch),e.remote&&n.splice(1,0,e.remote),y$(n,`-v`),v$(n,`--verbose`),v$(n,`--porcelain`),{commands:n,format:`utf-8`,parser:n2}}var o2=e$({"src/lib/tasks/push.ts"(){Xbe(),$$()}});function Qbe(){return{showBuffer(){let e=[`show`,...q$(arguments,1)];return e.includes(`--binary`)||e.splice(1,0,`--binary`),this._runTask(h1(e),Y$(arguments))},show(){let e=[`show`,...q$(arguments,1)];return this._runTask(m1(e),Y$(arguments))}}}var $be=e$({"src/lib/tasks/show.ts"(){$$(),y1()}}),s2,c2,exe=e$({"src/lib/responses/FileStatusSummary.ts"(){s2=/^(.+)\0(.+)$/,c2=class{constructor(e,t,n){if(this.path=e,this.index=t,this.working_dir=n,t===`R`||n===`R`){let t=s2.exec(e)||[null,e,e];this.from=t[2]||``,this.path=t[1]||``}}}}});function l2(e){let[t,n]=e.split(D$);return{from:n||t,to:t}}function u2(e,t,n){return[`${e}${t}`,n]}function d2(e,...t){return t.map(t=>u2(e,t,(e,t)=>e.conflicted.push(t)))}function txe(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=p2.get(i);a&&a(e,r),i!==`##`&&i!==`!!`&&e.files.push(new c2(r,t,n))}}var f2,p2,m2,nxe=e$({"src/lib/responses/StatusSummary.ts"(){$$(),exe(),f2=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}},p2=new Map([u2(` `,`A`,(e,t)=>e.created.push(t)),u2(` `,`D`,(e,t)=>e.deleted.push(t)),u2(` `,`M`,(e,t)=>e.modified.push(t)),u2(`A`,` `,(e,t)=>{e.created.push(t),e.staged.push(t)}),u2(`A`,`M`,(e,t)=>{e.created.push(t),e.staged.push(t),e.modified.push(t)}),u2(`D`,` `,(e,t)=>{e.deleted.push(t),e.staged.push(t)}),u2(`M`,` `,(e,t)=>{e.modified.push(t),e.staged.push(t)}),u2(`M`,`M`,(e,t)=>{e.modified.push(t),e.staged.push(t)}),u2(`R`,` `,(e,t)=>{e.renamed.push(l2(t))}),u2(`R`,`M`,(e,t)=>{let n=l2(t);e.renamed.push(n),e.modified.push(n.to)}),u2(`!`,`!`,(e,t)=>{(e.ignored=e.ignored||[]).push(t)}),u2(`?`,`?`,(e,t)=>e.not_added.push(t)),...d2(`A`,`A`,`U`),...d2(`D`,`D`,`U`),...d2(`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=j$(s?.[1],L$,null),s=a.exec(t),e.tracking=j$(s?.[1],L$,null),s=o.exec(t),s&&(e.current=j$(s?.[1],L$,e.current)),e.detached=/\(no branch\)/.test(t)}]]),m2=function(e){let t=e.split(D$),n=new f2;for(let e=0,r=t.length;e<r;){let r=t[e++].trim();r&&(r.charAt(0)===`R`&&(r+=D$+(t[e++]||``)),txe(n,r))}return n}}});function rxe(e){return{format:`utf-8`,commands:[`status`,`--porcelain`,`-b`,`-u`,`--null`,...e.filter(e=>!h2.includes(e))],parser(e){return m2(e)}}}var h2,ixe=e$({"src/lib/tasks/status.ts"(){nxe(),h2=[`--null`,`-z`]}});function g2(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 axe(){return g2(0,0,0,``,!1)}function oxe(){return{version(){return this._runTask({commands:[`--version`],format:`utf-8`,parser:sxe,onError(e,t,n,r){if(e.exitCode===-2)return n(Buffer.from(_2));r(t)}})}}}function sxe(e){return e===_2?axe():Z$(g2(0,0,0,e),v2,e)}var _2,v2,cxe=e$({"src/lib/tasks/version.ts"(){$$(),_2=`installed=false`,v2=[new U$(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(e,[t,n,r,i=``])=>{Object.assign(e,g2(C$(t),C$(n),C$(r),i))}),new U$(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(e,[t,n,r,i=``])=>{Object.assign(e,g2(C$(t),C$(n),r,i))})]}});function y2(e,t,n,...r){return L$(n)?t(n,j$(r[0],L$),q$(arguments)):p1(`git.${e}() requires a string 'repoPath'`)}function lxe(){return{clone(e,...t){return this._runTask(y2(`clone`,b2,j$(e,L$),...t),Y$(arguments))},mirror(e,...t){return this._runTask(y2(`mirror`,x2,j$(e,L$),...t),Y$(arguments))}}}var b2,x2,uxe=e$({"src/lib/tasks/clone.ts"(){y1(),$$(),b2=(e,t,n)=>{let r=[`clone`,...n];return L$(e)&&r.push(GQ(e)),L$(t)&&r.push(GQ(t)),m1(r)},x2=(e,t,n)=>(v$(n,`--mirror`),b2(e,t,n))}}),S2={};t$(S2,{SimpleGitApi:()=>C2});var C2,dxe=e$({"src/lib/simple-git-api.ts"(){mbe(),hbe(),_be(),bbe(),Tbe(),M1(),Dbe(),B1(),kbe(),Pbe(),j0(),Jbe(),o2(),$be(),ixe(),y1(),cxe(),$$(),uxe(),C2=class{constructor(e){this._executor=e}_runTask(e,t){let n=this._executor.chain(),r=n.push(e);return t&&fbe(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(m1([`add`,...b$(e)]),Y$(arguments))}cwd(e){let t=Y$(arguments);return typeof e==`string`?this._runTask(t0(e,this._executor),t):typeof e?.path==`string`?this._runTask(t0(e.path,e.root&&this._executor||void 0),t):this._runTask(p1(`Git.cwd: workingDirectory must be supplied as a string`),t)}hashObject(e,t){return this._runTask(Obe(e,t===!0),Y$(arguments))}init(e){return this._runTask(Nbe(e===!0,this._executor.cwd,q$(arguments)),Y$(arguments))}merge(){return this._runTask(e2(q$(arguments)),Y$(arguments))}mergeFromTo(e,t){return L$(e)&&L$(t)?this._runTask(e2([e,t,...q$(arguments)]),Y$(arguments,!1)):this._runTask(p1(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`))}outputHandler(e){return this._executor.outputHandler=e,this}push(){let e=a2({remote:j$(arguments[0],L$),branch:j$(arguments[1],L$)},q$(arguments));return this._runTask(e,Y$(arguments))}stash(){return this._runTask(m1([`stash`,...q$(arguments)]),Y$(arguments))}status(){return this._runTask(rxe(q$(arguments)),Y$(arguments))}},Object.assign(C2.prototype,gbe(),lxe(),wbe(),$ye(),ybe(),Ebe(),rbe(),Hbe(),Qbe(),oxe())}}),w2={};t$(w2,{Scheduler:()=>E2});var T2,E2,fxe=e$({"src/lib/runners/scheduler.ts"(){$$(),J1(),T2=(()=>{let e=0;return()=>{e++;let{promise:t,done:n}=(0,JQ.createDeferred)();return{promise:t,done:n,id:e}}})(),E2=class{constructor(e=2){this.concurrency=e,this.logger=q1(``,`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=v$(this.running,this.pending.shift());this.logger(`Attempting id=%s`,e.id),e.done(()=>{this.logger(`Completing id=`,e.id),y$(this.running,e),this.schedule()})}next(){let{promise:e,id:t}=v$(this.pending,T2());return this.logger(`Scheduling id=%s`,t),this.schedule(),e}}}}),D2={};t$(D2,{applyPatchTask:()=>pxe});function pxe(e,t){return m1([`apply`,...t,...e])}var mxe=e$({"src/lib/tasks/apply-patch.ts"(){y1()}});function hxe(e,t){return{branch:e,hash:t,success:!0}}function gxe(e){return{branch:e,hash:null,success:!1}}var O2,_xe=e$({"src/lib/responses/BranchDeleteSummary.ts"(){O2=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function k2(e,t){return t===1&&j2.test(e)}var A2,j2,M2,N2,vxe=e$({"src/lib/parsers/parse-branch-delete.ts"(){_xe(),$$(),A2=/(\S+)\s+\(\S+\s([^)]+)\)/,j2=/^error[^']+'([^']+)'/m,M2=[new U$(A2,(e,[t,n])=>{let r=hxe(t,n);e.all.push(r),e.branches[t]=r}),new U$(j2,(e,[t])=>{let n=gxe(t);e.errors.push(n),e.all.push(n),e.branches[t]=n})],N2=(e,t)=>Z$(new O2,M2,[e,t])}}),P2,yxe=e$({"src/lib/responses/BranchSummary.ts"(){P2=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 F2(e){return e?e.charAt(0):``}function I2(e,t=!1){return Z$(new P2,t?[R2]:L2,e)}var L2,R2,bxe=e$({"src/lib/parsers/parse-branch.ts"(){yxe(),$$(),L2=[new U$(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(e,[t,n,r,i])=>{e.push(F2(t),!0,n,r,i)}),new U$(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(e,[t,n,r,i])=>{e.push(F2(t),!1,n,r,i)})],R2=new U$(/^(\S+)$/s,(e,[t])=>{e.push(`*`,!1,t,``,``)})}}),z2={};t$(z2,{branchLocalTask:()=>Sxe,branchTask:()=>xxe,containsDeleteBranchCommand:()=>B2,deleteBranchTask:()=>wxe,deleteBranchesTask:()=>Cxe});function B2(e){let t=[`-d`,`-D`,`--delete`];return e.some(e=>t.includes(e))}function xxe(e){let t=B2(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?N2(e,r).all[0]:I2(e,n)}}}function Sxe(){return{format:`utf-8`,commands:[`branch`,`-v`],parser(e){return I2(e)}}}function Cxe(e,t=!1){return{format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,...e],parser(e,t){return N2(e,t)},onError({exitCode:e,stdOut:t},n,r,i){if(!k2(String(n),e))return i(n);r(t)}}}function wxe(e,t=!1){let n={format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,e],parser(t,n){return N2(t,n).branches[e]},onError({exitCode:e,stdErr:t,stdOut:r},i,a,o){if(!k2(String(i),e))return o(i);throw new a$(n.parser(T$(r),T$(t)),String(i))}};return n}var Txe=e$({"src/lib/tasks/branch.ts"(){o$(),vxe(),bxe(),$$()}});function Exe(e){let t=e.trim().replace(/^["']|["']$/g,``);return t&&_e(t)}var V2,Dxe=e$({"src/lib/responses/CheckIgnore.ts"(){V2=e=>e.split(/\n/g).map(Exe).filter(Boolean)}}),H2={};t$(H2,{checkIgnoreTask:()=>Oxe});function Oxe(e){return{commands:[`check-ignore`,...e],format:`utf-8`,parser:V2}}var kxe=e$({"src/lib/tasks/check-ignore.ts"(){Dxe()}});function Axe(e,t){return Z$({raw:e,remote:null,branches:[],tags:[],updated:[],deleted:[]},U2,[e,t])}var U2,jxe=e$({"src/lib/parsers/parse-fetch.ts"(){$$(),U2=[new U$(/From (.+)$/,(e,[t])=>{e.remote=t}),new U$(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.branches.push({name:t,tracking:n})}),new U$(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.tags.push({name:t,tracking:n})}),new U$(/- \[deleted]\s+\S+\s*-> (.+)$/,(e,[t])=>{e.deleted.push({tracking:t})}),new U$(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(e,[t,n,r,i])=>{e.updated.push({name:r,tracking:i,to:n,from:t})})]}}),W2={};t$(W2,{fetchTask:()=>Nxe});function Mxe(e){return/^--upload-pack(=|$)/.test(e)}function Nxe(e,t,n){let r=[`fetch`,...n];return e&&t&&r.push(e,t),r.find(Mxe)?p1(`git.fetch: potential exploit argument blocked.`):{commands:r,format:`utf-8`,parser:Axe}}var Pxe=e$({"src/lib/tasks/fetch.ts"(){jxe(),y1()}});function Fxe(e){return Z$({moves:[]},G2,e)}var G2,Ixe=e$({"src/lib/parsers/parse-move.ts"(){$$(),G2=[new U$(/^Renaming (.+) to (.+)$/,(e,[t,n])=>{e.moves.push({from:t,to:n})})]}}),K2={};t$(K2,{moveTask:()=>Lxe});function Lxe(e,t){return{commands:[`mv`,`-v`,...b$(e),t],format:`utf-8`,parser:Fxe}}var Rxe=e$({"src/lib/tasks/move.ts"(){Ixe(),$$()}}),q2={};t$(q2,{pullTask:()=>zxe});function zxe(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 Y0(e,t)},onError(e,t,n,r){let i=Kbe(T$(e.stdOut),T$(e.stdErr));if(i)return r(new a$(i));r(t)}}}var Bxe=e$({"src/lib/tasks/pull.ts"(){o$(),X0(),$$()}});function Vxe(e){let t={};return J2(e,([e])=>t[e]={name:e}),Object.values(t)}function Hxe(e){let t={};return J2(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 J2(e,t){g$(e,e=>t(e.split(/\s+/)))}var Uxe=e$({"src/lib/responses/GetRemoteSummary.ts"(){$$()}}),Y2={};t$(Y2,{addRemoteTask:()=>Wxe,getRemotesTask:()=>Gxe,listRemotesTask:()=>Kxe,remoteTask:()=>qxe,removeRemoteTask:()=>Jxe});function Wxe(e,t,n){return m1([`remote`,`add`,...n,e,t])}function Gxe(e){let t=[`remote`];return e&&t.push(`-v`),{commands:t,format:`utf-8`,parser:e?Hxe:Vxe}}function Kxe(e){let t=[...e];return t[0]!==`ls-remote`&&t.unshift(`ls-remote`),m1(t)}function qxe(e){let t=[...e];return t[0]!==`remote`&&t.unshift(`remote`),m1(t)}function Jxe(e){return m1([`remote`,`remove`,e])}var Yxe=e$({"src/lib/tasks/remote.ts"(){Uxe(),y1()}}),X2={};t$(X2,{stashListTask:()=>Xxe});function Xxe(e={},t){let n=k0(e),r=[`stash`,`list`,...n.commands,...t],i=b0(n.splitter,n.fields,l0(r));return D0(r)||{commands:r,format:`utf-8`,parser:i}}var Zxe=e$({"src/lib/tasks/stash-list.ts"(){d0(),T0(),O0(),j0()}}),Z2={};t$(Z2,{addSubModuleTask:()=>Qxe,initSubModuleTask:()=>$xe,subModuleTask:()=>Q2,updateSubModuleTask:()=>eSe});function Qxe(e,t){return Q2([`add`,e,t])}function $xe(e){return Q2([`init`,...e])}function Q2(e){let t=[...e];return t[0]!==`submodule`&&t.unshift(`submodule`),m1(t)}function eSe(e){return Q2([`update`,...e])}var tSe=e$({"src/lib/tasks/sub-module.ts"(){y1()}});function nSe(e,t){let n=Number.isNaN(e);return n===Number.isNaN(t)?n?$2(e,t):0:n?1:-1}function $2(e,t){return e===t?0:e>t?1:-1}function rSe(e){return e.trim()}function e4(e){return typeof e==`string`&&parseInt(e.replace(/^\D+/g,``),10)||0}var t4,n4,iSe=e$({"src/lib/responses/TagList.ts"(){t4=class{constructor(e,t){this.all=e,this.latest=t}},n4=function(e,t=!1){let n=e.split(`
437
- `).map(rSe).filter(Boolean);t||n.sort(function(e,t){let n=e.split(`.`),r=t.split(`.`);if(n.length===1||r.length===1)return nSe(e4(n[0]),e4(r[0]));for(let e=0,t=Math.max(n.length,r.length);e<t;e++){let t=$2(e4(n[e]),e4(r[e]));if(t)return t}return 0});let r=t?n[0]:[...n].reverse().find(e=>e.indexOf(`.`)>=0);return new t4(n,r)}}}),r4={};t$(r4,{addAnnotatedTagTask:()=>sSe,addTagTask:()=>oSe,tagListTask:()=>aSe});function aSe(e=[]){let t=e.some(e=>/^--sort=/.test(e));return{format:`utf-8`,commands:[`tag`,`-l`,...e],parser(e){return n4(e,t)}}}function oSe(e){return{format:`utf-8`,commands:[`tag`,e],parser(){return{name:e}}}}function sSe(e,t){return{format:`utf-8`,commands:[`tag`,`-a`,`-m`,t,e],parser(){return{name:e}}}}var cSe=e$({"src/lib/tasks/tag.ts"(){iSe()}}),lSe=Sye({"src/git.js"(e,t){var{GitExecutor:n}=(dbe(),n$($1)),{SimpleGitApi:r}=(dxe(),n$(S2)),{Scheduler:i}=(fxe(),n$(w2)),{adhocExecTask:a,configurationErrorTask:o}=(y1(),n$(d1)),{asArray:s,filterArray:c,filterPrimitives:l,filterString:u,filterStringOrStringArray:d,filterType:f,getTrailingOptions:p,trailingFunctionArgument:m,trailingOptionsArgument:h}=($$(),n$(Q$)),{applyPatchTask:g}=(mxe(),n$(D2)),{branchTask:_,branchLocalTask:v,deleteBranchesTask:y,deleteBranchTask:b}=(Txe(),n$(z2)),{checkIgnoreTask:x}=(kxe(),n$(H2)),{checkIsRepoTask:S}=(o1(),n$(e1)),{cleanWithOptionsTask:C,isCleanOptionsArray:w}=(D1(),n$(b1)),{diffSummaryTask:T}=(O0(),n$(E0)),{fetchTask:E}=(Pxe(),n$(W2)),{moveTask:D}=(Rxe(),n$(K2)),{pullTask:O}=(Bxe(),n$(q2)),{pushTagsTask:ee}=(o2(),n$(i2)),{addRemoteTask:te,getRemotesTask:ne,listRemotesTask:re,remoteTask:ie,removeRemoteTask:ae}=(Yxe(),n$(Y2)),{getResetMode:oe,resetTask:se}=(G1(),n$(V1)),{stashListTask:k}=(Zxe(),n$(X2)),{addSubModuleTask:ce,initSubModuleTask:le,subModuleTask:ue,updateSubModuleTask:A}=(tSe(),n$(Z2)),{addAnnotatedTagTask:j,addTagTask:de,tagListTask:fe}=(cSe(),n$(r4)),{straightThroughBufferTask:pe,straightThroughStringTask:me}=(y1(),n$(d1));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}});i$(),i$(),i$(),o$(),c$(),o1(),D1(),M1(),F1(),B1(),G1(),$$(),$$(),(0,JQ.deferred)().promise,$$(),i$(),$$(),$$(),$$(),$$(),lSe(),o$(),Re(o);const uSe=uo({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:Da(),autoUpdate:L().optional()});uo({schema:W(1),skills:H(F(),uSe).default({})}),new Set(Object.values(xs)),[...new Set([`.git`,`node_modules`])];const i4=[`agents`,`claude`,`cursor`,`codex`,`opencode`,`pi`,`copilot`];var dSe=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))}})),fSe=i((e=>{var n=t(`fs`),r=t(`util`),i=t(`stream`),a=i.Readable,o=i.PassThrough,s=dSe(),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`)}})),pSe=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})),mSe=i((e=>{t(`fs`);var n=t(`zlib`);fSe();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:pSe();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}})),hSe=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)})),a4=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=hSe();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}}})),gSe=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)}}));mSe();var _Se=e(a4(),1),o4=e(gSe(),1);function s4(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&&u4(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46){if(r++,r<e.length&&u4(e.charCodeAt(r)))for(r++;r<e.length&&u4(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&&u4(e.charCodeAt(r))){for(r++;r<e.length&&u4(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+=`
438
- `;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(l4(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(c4(t)){do r++,i+=String.fromCharCode(t),t=e.charCodeAt(r);while(c4(t));return o=15}if(l4(t))return r++,i+=String.fromCharCode(t),t===13&&e.charCodeAt(r)===10&&(r++,i+=`
439
- `),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&&!l4(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++,l4(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||!u4(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(c4(e)||l4(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 c4(e){return e===32||e===9}function l4(e){return e===10||e===13}function u4(e){return e>=48&&e<=57}var vSe;(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`})(vSe||={});const d4=Array(20).fill(0).map((e,t)=>` `.repeat(t)),f4={" ":{"\n":Array(200).fill(0).map((e,t)=>`
437
+ `).map(rSe).filter(Boolean);t||n.sort(function(e,t){let n=e.split(`.`),r=t.split(`.`);if(n.length===1||r.length===1)return nSe(e4(n[0]),e4(r[0]));for(let e=0,t=Math.max(n.length,r.length);e<t;e++){let t=$2(e4(n[e]),e4(r[e]));if(t)return t}return 0});let r=t?n[0]:[...n].reverse().find(e=>e.indexOf(`.`)>=0);return new t4(n,r)}}}),r4={};t$(r4,{addAnnotatedTagTask:()=>sSe,addTagTask:()=>oSe,tagListTask:()=>aSe});function aSe(e=[]){let t=e.some(e=>/^--sort=/.test(e));return{format:`utf-8`,commands:[`tag`,`-l`,...e],parser(e){return n4(e,t)}}}function oSe(e){return{format:`utf-8`,commands:[`tag`,e],parser(){return{name:e}}}}function sSe(e,t){return{format:`utf-8`,commands:[`tag`,`-a`,`-m`,t,e],parser(){return{name:e}}}}var cSe=e$({"src/lib/tasks/tag.ts"(){iSe()}}),lSe=Sye({"src/git.js"(e,t){var{GitExecutor:n}=(dbe(),n$($1)),{SimpleGitApi:r}=(dxe(),n$(S2)),{Scheduler:i}=(fxe(),n$(w2)),{adhocExecTask:a,configurationErrorTask:o}=(y1(),n$(d1)),{asArray:s,filterArray:c,filterPrimitives:l,filterString:u,filterStringOrStringArray:d,filterType:f,getTrailingOptions:p,trailingFunctionArgument:m,trailingOptionsArgument:h}=($$(),n$(Q$)),{applyPatchTask:g}=(mxe(),n$(D2)),{branchTask:_,branchLocalTask:v,deleteBranchesTask:y,deleteBranchTask:b}=(Txe(),n$(z2)),{checkIgnoreTask:x}=(kxe(),n$(H2)),{checkIsRepoTask:S}=(o1(),n$(e1)),{cleanWithOptionsTask:C,isCleanOptionsArray:w}=(D1(),n$(b1)),{diffSummaryTask:T}=(O0(),n$(E0)),{fetchTask:E}=(Pxe(),n$(W2)),{moveTask:D}=(Rxe(),n$(K2)),{pullTask:O}=(Bxe(),n$(q2)),{pushTagsTask:ee}=(o2(),n$(i2)),{addRemoteTask:te,getRemotesTask:ne,listRemotesTask:re,remoteTask:ie,removeRemoteTask:ae}=(Yxe(),n$(Y2)),{getResetMode:oe,resetTask:se}=(G1(),n$(V1)),{stashListTask:k}=(Zxe(),n$(X2)),{addSubModuleTask:ce,initSubModuleTask:le,subModuleTask:ue,updateSubModuleTask:A}=(tSe(),n$(Z2)),{addAnnotatedTagTask:j,addTagTask:de,tagListTask:fe}=(cSe(),n$(r4)),{straightThroughBufferTask:pe,straightThroughStringTask:me}=(y1(),n$(d1));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}});i$(),i$(),i$(),o$(),c$(),o1(),D1(),M1(),F1(),B1(),G1(),$$(),$$(),(0,JQ.deferred)().promise,$$(),i$(),$$(),$$(),$$(),$$(),lSe(),o$(),Re(o);const uSe=uo({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:Da(),autoUpdate:L().optional()});uo({schema:W(1),skills:H(F(),uSe).default({})}),new Set(Object.values(xs)),[...new Set([`.git`,`node_modules`])];const i4=[`agents`,`claude`,`cursor`,`codex`,`opencode`,`pi`,`copilot`];var dSe=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)})),a4=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=dSe();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}}})),fSe=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))}})),pSe=i((e=>{var n=t(`fs`),r=t(`util`),i=t(`stream`),a=i.Readable,o=i.PassThrough,s=fSe(),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`)}})),mSe=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})),hSe=i((e=>{t(`fs`);var n=t(`zlib`);pSe();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:mSe();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}})),o4=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}})),gSe=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})),_Se=i(((e,n)=>{let{Readable:r,Writable:i}=t(`stream`),a=gSe(),{basename:o,convertToUTF8:s,getDecoder:c,parseContentType:l,parseDisposition:u}=o4(),d=Buffer.from(`\r
438
+ `),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})),vSe=i(((e,n)=>{let{Writable:r}=t(`stream`),{getDecoder:i}=o4();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})),ySe=i(((e,t)=>{let{parseContentType:n}=o4();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=[_Se(),vSe()].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)}})),bSe=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)}})),xSe=e(a4(),1);hSe(),ySe();var s4=e(bSe(),1);function c4(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&&d4(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46){if(r++,r<e.length&&d4(e.charCodeAt(r)))for(r++;r<e.length&&d4(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&&d4(e.charCodeAt(r))){for(r++;r<e.length&&d4(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+=`
439
+ `;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(u4(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(l4(t)){do r++,i+=String.fromCharCode(t),t=e.charCodeAt(r);while(l4(t));return o=15}if(u4(t))return r++,i+=String.fromCharCode(t),t===13&&e.charCodeAt(r)===10&&(r++,i+=`
440
+ `),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&&!u4(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++,u4(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||!d4(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(l4(e)||u4(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 l4(e){return e===32||e===9}function u4(e){return e===10||e===13}function d4(e){return e>=48&&e<=57}var SSe;(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`})(SSe||={});const f4=Array(20).fill(0).map((e,t)=>` `.repeat(t)),p4={" ":{"\n":Array(200).fill(0).map((e,t)=>`
440
441
  `+` `.repeat(t)),"\r":Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
441
442
  `+` `.repeat(t))}," ":{"\n":Array(200).fill(0).map((e,t)=>`
442
443
  `+` `.repeat(t)),"\r":Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
443
- `+` `.repeat(t))}},ySe=[`
444
+ `+` `.repeat(t))}},CSe=[`
444
445
  `,`\r`,`\r
445
- `];function bSe(e,t,n){let r,i,a,o,s;if(t){for(o=t.offset,s=o+t.length,a=o;a>0&&!m4(e,a-1);)a--;let c=s;for(;c<e.length&&!m4(e,c);)c++;i=e.substring(a,c),r=xSe(i,n)}else i=e,r=0,a=0,o=0,s=e.length;let c=SSe(n,e),l=ySe.includes(c),u=0,d=0,f;f=n.insertSpaces?d4[n.tabSize||4]??p4(d4[1],n.tabSize||4):` `;let p=f===` `?` `:` `,m=s4(i,!1),h=!1;function g(){if(u>1)return p4(c,u)+p4(f,r+d);let e=f.length*(r+d);return!l||e>f4[p][c].length?c+p4(f,r+d):e<=0?c:f4[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(p4(c,u),0,0),b!==17){let e=m.getTokenOffset()+a;y(f.length*r<20&&n.insertSpaces?d4[f.length*r]:p4(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(d4[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=d4[1]);else if(t===4)b!==3&&d--,n.keepLines&&u>0||!n.keepLines&&b!==3?r=g():n.keepLines&&(r=d4[1]);else{switch(b){case 3:case 1:d++,r=n.keepLines&&u>0||!n.keepLines?g():d4[1];break;case 5:r=n.keepLines&&u>0||!n.keepLines?g():d4[1];break;case 12:r=g();break;case 13:u>0?r=g():i||(r=d4[1]);break;case 6:n.keepLines&&u>0?r=g():i||(r=d4[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=d4[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 p4(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}function xSe(e,t){let n=0,r=0,i=t.tabSize||4;for(;n<e.length;){let t=e.charAt(n);if(t===d4[1])r++;else if(t===` `)r+=i;else break;n++}return Math.floor(r/i)}function SSe(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)===`
446
+ `];function wSe(e,t,n){let r,i,a,o,s;if(t){for(o=t.offset,s=o+t.length,a=o;a>0&&!h4(e,a-1);)a--;let c=s;for(;c<e.length&&!h4(e,c);)c++;i=e.substring(a,c),r=TSe(i,n)}else i=e,r=0,a=0,o=0,s=e.length;let c=ESe(n,e),l=CSe.includes(c),u=0,d=0,f;f=n.insertSpaces?f4[n.tabSize||4]??m4(f4[1],n.tabSize||4):` `;let p=f===` `?` `:` `,m=c4(i,!1),h=!1;function g(){if(u>1)return m4(c,u)+m4(f,r+d);let e=f.length*(r+d);return!l||e>p4[p][c].length?c+m4(f,r+d):e<=0?c:p4[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(m4(c,u),0,0),b!==17){let e=m.getTokenOffset()+a;y(f.length*r<20&&n.insertSpaces?f4[f.length*r]:m4(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(f4[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=f4[1]);else if(t===4)b!==3&&d--,n.keepLines&&u>0||!n.keepLines&&b!==3?r=g():n.keepLines&&(r=f4[1]);else{switch(b){case 3:case 1:d++,r=n.keepLines&&u>0||!n.keepLines?g():f4[1];break;case 5:r=n.keepLines&&u>0||!n.keepLines?g():f4[1];break;case 12:r=g();break;case 13:u>0?r=g():i||(r=f4[1]);break;case 6:n.keepLines&&u>0?r=g():i||(r=f4[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=f4[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 m4(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}function TSe(e,t){let n=0,r=0,i=t.tabSize||4;for(;n<e.length;){let t=e.charAt(n);if(t===f4[1])r++;else if(t===` `)r+=i;else break;n++}return Math.floor(r/i)}function ESe(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)===`
446
447
  `?`\r
447
448
  `:`\r`;if(n===`
448
449
  `)return`
449
450
  `}return e&&e.eol||`
450
- `}function m4(e,t){return`\r
451
- `.indexOf(e.charAt(t))!==-1}var h4;(function(e){e.DEFAULT={allowTrailingComma:!1}})(h4||={});function CSe(e,t=[],n=h4.DEFAULT){let r=null,i=[],a=[];function o(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return y4(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 g4(e,t=[],n=h4.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}y4(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:wSe(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 _4(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 v4(e){switch(e.type){case`array`:return e.children.map(v4);case`object`:let t=Object.create(null);for(let n of e.children){let e=n.children[1];e&&(t[n.children[0].value]=v4(e))}return t;case`null`:case`string`:case`number`:case`boolean`:return e.value;default:return}}function y4(e,t,n=h4.DEFAULT){let r=s4(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 wSe(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 TSe(e,t,n,r){let i=t.slice(),a=g4(e,[]),o,s;for(;i.length>0&&(s=i.pop(),o=_4(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 b4(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=_4(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 b4(e,{offset:i,length:a-i,content:``},r)}return b4(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 b4(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 b4(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 b4(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 b4(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 b4(e,t,n){if(!n.formattingOptions)return[t];let r=x4(e,t),i=t.offset,a=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;i>0&&!m4(r,i-1);)i--;for(;a<r.length&&!m4(r,a);)a++}let o=bSe(r,{offset:i,length:a-i},{...n.formattingOptions,keepLines:!1});for(let e=o.length-1;e>=0;e--){let t=o[e];r=x4(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 x4(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var ESe;(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`})(ESe||={});var DSe;(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`})(DSe||={});const OSe=CSe,kSe=g4,S4=v4;var ASe;(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`})(ASe||={});function C4(e,t,n,r){return TSe(e,t,n,r)}function w4(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=x4(e,i);else throw Error(`Overlapping edit`);r=i.offset}return e}var T4=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}})),jSe=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})),MSe=i(((e,n)=>{let{Readable:r,Writable:i}=t(`stream`),a=jSe(),{basename:o,convertToUTF8:s,getDecoder:c,parseContentType:l,parseDisposition:u}=T4(),d=Buffer.from(`\r
452
- `),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})),NSe=i(((e,n)=>{let{Writable:r}=t(`stream`),{getDecoder:i}=T4();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}));i(((e,t)=>{let{parseContentType:n}=T4();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=[MSe(),NSe()].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)}}))();const PSe=global.Request;var E4=class extends PSe{constructor(e,t){if(typeof e==`object`&&P4 in e){let n=t!==void 0&&`body`in t&&t.body!=null;if(e[U4]&&!n)throw TypeError(`Cannot construct a Request with a Request object that has already been used.`);e=e[P4]()}t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}};const D4=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)},FSe=Symbol(`wrapBodyStream`),ISe=new Set([`latin1`,`binary`,`hex`,`base64`,`base64url`]),LSe=e=>e===null||ISe.has(e),O4=Symbol(`bodyBufferedBeforeDisconnect`),k4=Symbol(`bodyBufferedLengthBeforeDisconnect`),A4=(e,t)=>Buffer.isBuffer(e)?e:Buffer.from(e,t??`utf8`),j4=e=>!(e instanceof Be)&&!!e.complete&&!!e.readableAborted&&typeof e.read==`function`&&LSe(e.readableEncoding),M4=(e,t)=>{if(e.readableDidRead&&!t||!j4(e))return;let n=e;if(n[O4]!==void 0)return n[O4];let r,i=e.errored;if(i&&i.code!==`ECONNRESET`)r=i;else if(n[k4]!==void 0&&e.readableLength!==n[k4])r=K4();else{let n=t??[],i=e.read();i!==null&&n.push(A4(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=K4())}}return n[O4]=r,r},N4=(e,t)=>{if(t instanceof Error){e.error(t);return}t.length>0&&e.enqueue(t),e.close()},RSe=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new E4(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[FSe]){let e;a.body=new ReadableStream({async pull(t){try{if(!e){let e=M4(r);if(e!==void 0){N4(t,e);return}}e||=Ae.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=M4(r);a.body=e===void 0?Ae.toWeb(r):new ReadableStream({start(t){N4(t,e)}})}}return new E4(t,a)},P4=Symbol(`getRequestCache`),F4=Symbol(`requestCache`),I4=Symbol(`incomingKey`),L4=Symbol(`urlKey`),zSe=Symbol(`methodKey`),R4=Symbol(`headersKey`),z4=Symbol(`abortControllerKey`),B4=Symbol(`getAbortController`),BSe=Symbol(`abortRequest`),V4=Symbol(`bodyBuffer`),H4=Symbol(`bodyReadPromise`),U4=Symbol(`bodyConsumedDirectly`),W4=Symbol(`bodyLockReader`),G4=Symbol(`abortReason`),K4=()=>TypeError(`Body is unusable`),q4=()=>Promise.reject(K4()),VSe=new TextDecoder,HSe=e=>{if(e[U4])return q4();e[U4]=!0},USe=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),WSe=e=>(e[R4]||=D4(e[I4])).get(`content-type`)||``,GSe=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,KSe=e=>{if(!GSe.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.`)},J4=(e,t,n)=>{if(e[U4])return q4();let r=e.method;if(r===`GET`||r===`HEAD`)return e[P4]()[t]();let i=KSe(r);if(i)return Promise.reject(i);if(e[F4]&&r!==`TRACE`)return e[F4][t]();let a=HSe(e);if(a)return a;let o=qSe(e);if(o){let t=Promise.resolve(n(o,e));return e[V4]=void 0,t}return JSe(e).then(t=>{let r=n(t,e);return e[V4]=void 0,r})},qSe=e=>{let t=e[I4];if(`rawBody`in t&&t.rawBody instanceof Buffer)return t.rawBody},Y4=(e,t)=>{if(t.errored)return t.errored;let n=e[G4];return n===void 0?Error(`Client connection prematurely closed.`):n instanceof Error?n:Error(String(n))},JSe=e=>{if(e[V4])return Promise.resolve(e[V4]);if(e[H4])return e[H4];let t=e[I4];if(t.readableDidRead)return q4();let n=M4(t);if(n!==void 0)return n instanceof Error?Promise.reject(n):(e[V4]=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!j4(t)||s&&s.code!==`ECONNRESET`?!1:(o(()=>{let o=M4(t,i);o instanceof Error?r(o):o===void 0?r(a??Y4(e,t)):(e[V4]=o,n(o))}),!0)},c=e=>{i.push(A4(e,t.readableEncoding))},l=()=>{o(()=>{let t=i.length===1?i[0]:Buffer.concat(i);e[V4]=t,n(t)})},u=e=>{s(e)||o(()=>{r(e)})},d=()=>{if(t.readableEnded){l();return}s()||o(()=>{r(Y4(e,t))})},f=()=>{t.off(`data`,c),t.off(`end`,l),t.off(`error`,u),t.off(`close`,d),e[H4]=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[H4]=r,r},X4={get method(){return this[zSe]},get url(){return this[L4]},get headers(){return this[R4]||=D4(this[I4])},[BSe](e){this[G4]===void 0&&(this[G4]=e);let t=this[z4];t&&!t.signal.aborted&&t.abort(e)},[B4](){return this[z4]||=new AbortController,this[G4]!==void 0&&!this[z4].signal.aborted&&this[z4].abort(this[G4]),this[z4]},[P4](){let e=this[B4]();if(this[F4])return this[F4];let t=this.method;if(this[U4]&&t!==`GET`&&t!==`HEAD`){this[V4]=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 E4(this[L4],n);return t===`TRACE`&&Object.defineProperty(r,"method",{get(){return`TRACE`}}),this[F4]=r}return this[F4]=RSe(this.method,this[L4],this.headers,this[I4],e)},get body(){if(!this[U4])return this[P4]().body;let e=this[P4]();return!this[W4]&&e.body&&(this[W4]=e.body.getReader()),e.body},get bodyUsed(){return this[U4]?!0:this[F4]?this[F4].bodyUsed:!1}};Object.defineProperty(X4,"signal",{get(){return this[B4]().signal}}),[`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`keepalive`].forEach(e=>{Object.defineProperty(X4,e,{get(){return this[P4]()[e]}})}),[`clone`,`formData`].forEach(e=>{Object.defineProperty(X4,e,{value:function(){if(this[U4]){if(e===`clone`)throw K4();return q4()}return this[P4]()[e]()}})}),Object.defineProperty(X4,"text",{value:function(){return J4(this,`text`,e=>VSe.decode(e))}}),Object.defineProperty(X4,"arrayBuffer",{value:function(){return J4(this,`arrayBuffer`,e=>USe(e))}}),Object.defineProperty(X4,"blob",{value:function(){return J4(this,`blob`,(e,t)=>{let n=WSe(t);return new Response(e,n?{headers:{"content-type":n}}:void 0).blob()})}}),Object.defineProperty(X4,"json",{value:function(){return this[U4]?q4():this.text().then(JSON.parse)}}),Object.defineProperty(X4,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[F4]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(X4,E4.prototype);const Z4=Symbol(`responseCache`),Q4=Symbol(`getResponseCache`),$4=Symbol(`cache`),e3=global.Response;var t3=class e{#e;#t;[Q4](){let e=this[$4],t=e&&e[2]instanceof Headers?e[2]:void 0;return delete this[$4],this[Z4]||=new e3(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 e3){let t=n[Z4];if(t){this.#t=t,this[Q4]();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[$4]=[n?.status||200,t??null,r||n?.headers])}get headers(){let e=this[$4];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[Q4]().headers}get status(){return this[$4]?.[0]??this[Q4]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(t3.prototype,e,{get(){return this[Q4]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(t3.prototype,e,{value:function(){return this[Q4]()[e]()}})}),Object.defineProperty(t3.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[Z4]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(t3,e3),Object.setPrototypeOf(t3.prototype,e3.prototype);const YSe=/^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/,XSe=e=>e instanceof URL?e.href:YSe.test(e)?e:new URL(e).href,ZSe=new Set([301,302,303,307,308]);Object.defineProperty(t3,"redirect",{value:function(e,t=302){if(!ZSe.has(t))throw RangeError(`Invalid status code`);return new t3(null,{status:t,headers:{location:XSe(e)}})},writable:!0,configurable:!0}),Object.defineProperty(t3,"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 t3(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 QSe(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 $Se={"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`},n3=Eo(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),r3=V([F(),I().int()]),i3=F();uo({ttl:I().optional(),pollInterval:I().optional()});const eCe=B({ttl:I().optional()}),tCe=B({taskId:F()}),a3=uo({progressToken:r3.optional(),"io.modelcontextprotocol/related-task":tCe.optional()}),o3=B({_meta:a3.optional()}),s3=o3.extend({task:eCe.optional()}),c3=B({method:F(),params:o3.loose().optional()}),l3=B({_meta:a3.optional()}),u3=B({method:F(),params:l3.loose().optional()}),d3=uo({_meta:a3.optional()}),f3=V([F(),I().int()]),nCe=B({jsonrpc:W(`2.0`),id:f3,...c3.shape}).strict(),rCe=B({jsonrpc:W(`2.0`),...u3.shape}).strict(),p3=B({jsonrpc:W(`2.0`),id:f3,result:d3}).strict();var iCe;(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`})(iCe||={});const m3=B({jsonrpc:W(`2.0`),id:f3.optional(),error:B({code:I().int(),message:F(),data:R().optional()})}).strict();V([nCe,rCe,p3,m3]),V([p3,m3]);const h3=d3.strict(),aCe=l3.extend({requestId:f3.optional(),reason:F().optional()}),g3=u3.extend({method:W(`notifications/cancelled`),params:aCe}),_3=B({icons:z(B({src:F(),mimeType:F().optional(),sizes:z(F()).optional(),theme:U([`light`,`dark`]).optional()})).optional()}),v3=B({name:F(),title:F().optional()}),y3=v3.extend({...v3.shape,..._3.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),oCe=Do(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,mo(B({form:mo(B({applyDefaults:L().optional()}),H(F(),R())).optional(),url:n3.optional()}),H(F(),R()).optional())),sCe=uo({list:n3.optional(),cancel:n3.optional(),requests:uo({sampling:uo({createMessage:n3.optional()}).optional(),elicitation:uo({create:n3.optional()}).optional()}).optional()}),cCe=uo({list:n3.optional(),cancel:n3.optional(),requests:uo({tools:uo({call:n3.optional()}).optional()}).optional()}),lCe=B({experimental:H(F(),n3).optional(),sampling:B({context:n3.optional(),tools:n3.optional()}).optional(),elicitation:oCe.optional(),roots:B({listChanged:L().optional()}).optional(),tasks:sCe.optional(),extensions:H(F(),n3).optional()}),uCe=o3.extend({protocolVersion:F(),capabilities:lCe,clientInfo:y3}),dCe=c3.extend({method:W(`initialize`),params:uCe}),fCe=B({experimental:H(F(),n3).optional(),logging:n3.optional(),completions:n3.optional(),prompts:B({listChanged:L().optional()}).optional(),resources:B({subscribe:L().optional(),listChanged:L().optional()}).optional(),tools:B({listChanged:L().optional()}).optional(),tasks:cCe.optional(),extensions:H(F(),n3).optional()}),pCe=d3.extend({protocolVersion:F(),capabilities:fCe,serverInfo:y3,instructions:F().optional()}),mCe=u3.extend({method:W(`notifications/initialized`),params:l3.optional()}),b3=c3.extend({method:W(`ping`),params:o3.optional()}),hCe=B({progress:I(),total:yo(I()),message:yo(F())}),gCe=B({...l3.shape,...hCe.shape,progressToken:r3}),x3=u3.extend({method:W(`notifications/progress`),params:gCe}),_Ce=o3.extend({cursor:i3.optional()}),S3=c3.extend({params:_Ce.optional()}),C3=d3.extend({nextCursor:i3.optional()}),vCe=U([`working`,`input_required`,`completed`,`failed`,`cancelled`]),w3=B({taskId:F(),status:vCe,ttl:V([I(),oo()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:yo(I()),statusMessage:yo(F())}),T3=d3.extend({task:w3}),yCe=l3.merge(w3),E3=u3.extend({method:W(`notifications/tasks/status`),params:yCe}),D3=c3.extend({method:W(`tasks/get`),params:o3.extend({taskId:F()})}),O3=d3.merge(w3),k3=c3.extend({method:W(`tasks/result`),params:o3.extend({taskId:F()})});d3.loose();const A3=S3.extend({method:W(`tasks/list`)}),j3=C3.extend({tasks:z(w3)}),M3=c3.extend({method:W(`tasks/cancel`),params:o3.extend({taskId:F()})});d3.merge(w3);const N3=B({uri:F(),mimeType:yo(F()),_meta:H(F(),R()).optional()}),P3=N3.extend({text:F()}),F3=F().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),I3=N3.extend({blob:F3}),L3=U([`user`,`assistant`]),R3=B({audience:z(L3).optional(),priority:I().min(0).max(1).optional(),lastModified:Da({offset:!0}).optional()}),z3=B({...v3.shape,..._3.shape,uri:F(),description:yo(F()),mimeType:yo(F()),size:yo(I()),annotations:R3.optional(),_meta:yo(uo({}))}),bCe=B({...v3.shape,..._3.shape,uriTemplate:F(),description:yo(F()),mimeType:yo(F()),annotations:R3.optional(),_meta:yo(uo({}))}),xCe=S3.extend({method:W(`resources/list`)}),SCe=C3.extend({resources:z(z3)}),CCe=S3.extend({method:W(`resources/templates/list`)}),wCe=C3.extend({resourceTemplates:z(bCe)}),B3=o3.extend({uri:F()}),TCe=B3,ECe=c3.extend({method:W(`resources/read`),params:TCe}),DCe=d3.extend({contents:z(V([P3,I3]))}),OCe=u3.extend({method:W(`notifications/resources/list_changed`),params:l3.optional()}),kCe=B3,ACe=c3.extend({method:W(`resources/subscribe`),params:kCe}),jCe=B3,MCe=c3.extend({method:W(`resources/unsubscribe`),params:jCe}),NCe=l3.extend({uri:F()}),PCe=u3.extend({method:W(`notifications/resources/updated`),params:NCe}),FCe=B({name:F(),description:yo(F()),required:yo(L())}),ICe=B({...v3.shape,..._3.shape,description:yo(F()),arguments:yo(z(FCe)),_meta:yo(uo({}))}),LCe=S3.extend({method:W(`prompts/list`)}),RCe=C3.extend({prompts:z(ICe)}),zCe=o3.extend({name:F(),arguments:H(F(),F()).optional()}),BCe=c3.extend({method:W(`prompts/get`),params:zCe}),V3=B({type:W(`text`),text:F(),annotations:R3.optional(),_meta:H(F(),R()).optional()}),H3=B({type:W(`image`),data:F3,mimeType:F(),annotations:R3.optional(),_meta:H(F(),R()).optional()}),U3=B({type:W(`audio`),data:F3,mimeType:F(),annotations:R3.optional(),_meta:H(F(),R()).optional()}),VCe=B({type:W(`tool_use`),name:F(),id:F(),input:H(F(),R()),_meta:H(F(),R()).optional()}),HCe=B({type:W(`resource`),resource:V([P3,I3]),annotations:R3.optional(),_meta:H(F(),R()).optional()}),W3=V([V3,H3,U3,z3.extend({type:W(`resource_link`)}),HCe]),UCe=B({role:L3,content:W3}),WCe=d3.extend({description:F().optional(),messages:z(UCe)}),GCe=u3.extend({method:W(`notifications/prompts/list_changed`),params:l3.optional()}),KCe=B({title:F().optional(),readOnlyHint:L().optional(),destructiveHint:L().optional(),idempotentHint:L().optional(),openWorldHint:L().optional()}),qCe=B({taskSupport:U([`required`,`optional`,`forbidden`]).optional()}),G3=B({...v3.shape,..._3.shape,description:F().optional(),inputSchema:B({type:W(`object`),properties:H(F(),n3).optional(),required:z(F()).optional()}).catchall(R()),outputSchema:B({type:W(`object`),properties:H(F(),n3).optional(),required:z(F()).optional()}).catchall(R()).optional(),annotations:KCe.optional(),execution:qCe.optional(),_meta:H(F(),R()).optional()}),JCe=S3.extend({method:W(`tools/list`)}),YCe=C3.extend({tools:z(G3)}),K3=d3.extend({content:z(W3).default([]),structuredContent:H(F(),R()).optional(),isError:L().optional()});K3.or(d3.extend({toolResult:R()}));const XCe=s3.extend({name:F(),arguments:H(F(),R()).optional()}),ZCe=c3.extend({method:W(`tools/call`),params:XCe}),QCe=u3.extend({method:W(`notifications/tools/list_changed`),params:l3.optional()});B({autoRefresh:L().default(!0),debounceMs:I().int().nonnegative().default(300)});const q3=U([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),$Ce=o3.extend({level:q3}),ewe=c3.extend({method:W(`logging/setLevel`),params:$Ce}),twe=l3.extend({level:q3,logger:F().optional(),data:R()}),nwe=u3.extend({method:W(`notifications/message`),params:twe}),rwe=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()}),iwe=B({mode:U([`auto`,`required`,`none`]).optional()}),awe=B({type:W(`tool_result`),toolUseId:F().describe(`The unique identifier for the corresponding tool call.`),content:z(W3).default([]),structuredContent:B({}).loose().optional(),isError:L().optional(),_meta:H(F(),R()).optional()}),owe=po(`type`,[V3,H3,U3]),J3=po(`type`,[V3,H3,U3,VCe,awe]),swe=B({role:L3,content:V([J3,z(J3)]),_meta:H(F(),R()).optional()}),cwe=s3.extend({messages:z(swe),modelPreferences:rwe.optional(),systemPrompt:F().optional(),includeContext:U([`none`,`thisServer`,`allServers`]).optional(),temperature:I().optional(),maxTokens:I().int(),stopSequences:z(F()).optional(),metadata:n3.optional(),tools:z(G3).optional(),toolChoice:iwe.optional()}),lwe=c3.extend({method:W(`sampling/createMessage`),params:cwe}),uwe=d3.extend({model:F(),stopReason:yo(U([`endTurn`,`stopSequence`,`maxTokens`]).or(F())),role:L3,content:owe}),dwe=d3.extend({model:F(),stopReason:yo(U([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(F())),role:L3,content:V([J3,z(J3)])}),fwe=B({type:W(`boolean`),title:F().optional(),description:F().optional(),default:L().optional()}),pwe=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()}),mwe=B({type:U([`number`,`integer`]),title:F().optional(),description:F().optional(),minimum:I().optional(),maximum:I().optional(),default:I().optional()}),hwe=B({type:W(`string`),title:F().optional(),description:F().optional(),enum:z(F()),default:F().optional()}),gwe=B({type:W(`string`),title:F().optional(),description:F().optional(),oneOf:z(B({const:F(),title:F()})),default:F().optional()}),_we=V([V([B({type:W(`string`),title:F().optional(),description:F().optional(),enum:z(F()),enumNames:z(F()).optional(),default:F().optional()}),V([hwe,gwe]),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()})])]),fwe,pwe,mwe]),vwe=V([s3.extend({mode:W(`form`).optional(),message:F(),requestedSchema:B({type:W(`object`),properties:H(F(),_we),required:z(F()).optional()})}),s3.extend({mode:W(`url`),message:F(),elicitationId:F(),url:F().url()})]),ywe=c3.extend({method:W(`elicitation/create`),params:vwe}),bwe=l3.extend({elicitationId:F()}),xwe=u3.extend({method:W(`notifications/elicitation/complete`),params:bwe}),Swe=d3.extend({action:U([`accept`,`decline`,`cancel`]),content:Do(e=>e===null?void 0:e,H(F(),V([F(),I(),L(),z(F())])).optional())}),Cwe=B({type:W(`ref/resource`),uri:F()}),wwe=B({type:W(`ref/prompt`),name:F()}),Twe=o3.extend({ref:V([wwe,Cwe]),argument:B({name:F(),value:F()}),context:B({arguments:H(F(),F()).optional()}).optional()}),Ewe=c3.extend({method:W(`completion/complete`),params:Twe}),Dwe=d3.extend({completion:uo({values:z(F()).max(100),total:yo(I().int()),hasMore:yo(L())})}),Owe=B({uri:F().startsWith(`file://`),name:F().optional(),_meta:H(F(),R()).optional()}),kwe=c3.extend({method:W(`roots/list`),params:o3.optional()}),Awe=d3.extend({roots:z(Owe)}),jwe=u3.extend({method:W(`notifications/roots/list_changed`),params:l3.optional()});V([b3,dCe,Ewe,ewe,BCe,LCe,xCe,CCe,ECe,ACe,MCe,ZCe,JCe,D3,k3,A3,M3]),V([g3,x3,mCe,jwe,E3]),V([h3,uwe,dwe,Swe,Awe,O3,j3,T3]),V([b3,lwe,ywe,kwe,D3,k3,A3,M3]),V([g3,x3,nwe,PCe,OCe,QCe,GCe,E3,xwe]),V([h3,pCe,Dwe,WCe,RCe,SCe,wCe,DCe,K3,YCe,O3,j3,T3]);var Mwe;(function(e){e.Completable=`McpCompletable`})(Mwe||={});var Nwe=global.Request,Y3=class extends Nwe{constructor(e,t){typeof e==`object`&&X3 in e&&(e=e[X3]()),t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}},Pwe=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)},Fwe=Symbol(`wrapBodyStream`),Iwe=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new Y3(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[Fwe]){let e;a.body=new ReadableStream({async pull(t){try{e||=Fe.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=Fe.toWeb(r)}return new Y3(t,a)},X3=Symbol(`getRequestCache`),Z3=Symbol(`requestCache`),Q3=Symbol(`incomingKey`),$3=Symbol(`urlKey`),Lwe=Symbol(`headersKey`),e6=Symbol(`abortControllerKey`),t6={get method(){return this[Q3].method||`GET`},get url(){return this[$3]},get headers(){return this[Lwe]||=Pwe(this[Q3])},[Symbol(`getAbortController`)](){return this[X3](),this[e6]},[X3](){return this[e6]||=new AbortController,this[Z3]||=Iwe(this.method,this[$3],this.headers,this[Q3],this[e6])}};[`body`,`bodyUsed`,`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`signal`,`keepalive`].forEach(e=>{Object.defineProperty(t6,e,{get(){return this[X3]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(t6,e,{value:function(){return this[X3]()[e]()}})}),Object.defineProperty(t6,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[Z3]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(t6,Y3.prototype);var n6=Symbol(`responseCache`),r6=Symbol(`getResponseCache`),i6=Symbol(`cache`),a6=global.Response,o6=class e{#e;#t;[r6](){return delete this[i6],this[n6]||=new a6(this.#e,this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof e){let e=n[n6];if(e){this.#t=e,this[r6]();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[i6]=[n?.status||200,t,r||n?.headers])}get headers(){let e=this[i6];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":`text/plain; charset=UTF-8`})),e[2]):this[r6]().headers}get status(){return this[i6]?.[0]??this[r6]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(o6.prototype,e,{get(){return this[r6]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(o6.prototype,e,{value:function(){return this[r6]()[e]()}})}),Object.defineProperty(o6.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[n6]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(o6,a6),Object.setPrototypeOf(o6.prototype,a6.prototype),global.crypto===void 0&&(global.crypto=Me);var Rwe=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(` `)}})),zwe=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?`
451
+ `}function h4(e,t){return`\r
452
+ `.indexOf(e.charAt(t))!==-1}var g4;(function(e){e.DEFAULT={allowTrailingComma:!1}})(g4||={});function DSe(e,t=[],n=g4.DEFAULT){let r=null,i=[],a=[];function o(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return b4(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 _4(e,t=[],n=g4.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}b4(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:OSe(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 v4(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 y4(e){switch(e.type){case`array`:return e.children.map(y4);case`object`:let t=Object.create(null);for(let n of e.children){let e=n.children[1];e&&(t[n.children[0].value]=y4(e))}return t;case`null`:case`string`:case`number`:case`boolean`:return e.value;default:return}}function b4(e,t,n=g4.DEFAULT){let r=c4(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 OSe(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 kSe(e,t,n,r){let i=t.slice(),a=_4(e,[]),o,s;for(;i.length>0&&(s=i.pop(),o=v4(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 x4(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=v4(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 x4(e,{offset:i,length:a-i,content:``},r)}return x4(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 x4(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 x4(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 x4(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 x4(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 x4(e,t,n){if(!n.formattingOptions)return[t];let r=S4(e,t),i=t.offset,a=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;i>0&&!h4(r,i-1);)i--;for(;a<r.length&&!h4(r,a);)a++}let o=wSe(r,{offset:i,length:a-i},{...n.formattingOptions,keepLines:!1});for(let e=o.length-1;e>=0;e--){let t=o[e];r=S4(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 S4(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var ASe;(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`})(ASe||={});var jSe;(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`})(jSe||={});const MSe=DSe,NSe=_4,C4=y4;var PSe;(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`})(PSe||={});function w4(e,t,n,r){return kSe(e,t,n,r)}function T4(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=S4(e,i);else throw Error(`Overlapping edit`);r=i.offset}return e}const FSe=global.Request;var E4=class extends FSe{constructor(e,t){if(typeof e==`object`&&P4 in e){let n=t!==void 0&&`body`in t&&t.body!=null;if(e[U4]&&!n)throw TypeError(`Cannot construct a Request with a Request object that has already been used.`);e=e[P4]()}t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}};const D4=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)},ISe=Symbol(`wrapBodyStream`),LSe=new Set([`latin1`,`binary`,`hex`,`base64`,`base64url`]),RSe=e=>e===null||LSe.has(e),O4=Symbol(`bodyBufferedBeforeDisconnect`),k4=Symbol(`bodyBufferedLengthBeforeDisconnect`),A4=(e,t)=>Buffer.isBuffer(e)?e:Buffer.from(e,t??`utf8`),j4=e=>!(e instanceof Be)&&!!e.complete&&!!e.readableAborted&&typeof e.read==`function`&&RSe(e.readableEncoding),M4=(e,t)=>{if(e.readableDidRead&&!t||!j4(e))return;let n=e;if(n[O4]!==void 0)return n[O4];let r,i=e.errored;if(i&&i.code!==`ECONNRESET`)r=i;else if(n[k4]!==void 0&&e.readableLength!==n[k4])r=K4();else{let n=t??[],i=e.read();i!==null&&n.push(A4(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=K4())}}return n[O4]=r,r},N4=(e,t)=>{if(t instanceof Error){e.error(t);return}t.length>0&&e.enqueue(t),e.close()},zSe=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new E4(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[ISe]){let e;a.body=new ReadableStream({async pull(t){try{if(!e){let e=M4(r);if(e!==void 0){N4(t,e);return}}e||=Ae.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=M4(r);a.body=e===void 0?Ae.toWeb(r):new ReadableStream({start(t){N4(t,e)}})}}return new E4(t,a)},P4=Symbol(`getRequestCache`),F4=Symbol(`requestCache`),I4=Symbol(`incomingKey`),L4=Symbol(`urlKey`),BSe=Symbol(`methodKey`),R4=Symbol(`headersKey`),z4=Symbol(`abortControllerKey`),B4=Symbol(`getAbortController`),VSe=Symbol(`abortRequest`),V4=Symbol(`bodyBuffer`),H4=Symbol(`bodyReadPromise`),U4=Symbol(`bodyConsumedDirectly`),W4=Symbol(`bodyLockReader`),G4=Symbol(`abortReason`),K4=()=>TypeError(`Body is unusable`),q4=()=>Promise.reject(K4()),HSe=new TextDecoder,USe=e=>{if(e[U4])return q4();e[U4]=!0},WSe=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),GSe=e=>(e[R4]||=D4(e[I4])).get(`content-type`)||``,KSe=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,qSe=e=>{if(!KSe.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.`)},J4=(e,t,n)=>{if(e[U4])return q4();let r=e.method;if(r===`GET`||r===`HEAD`)return e[P4]()[t]();let i=qSe(r);if(i)return Promise.reject(i);if(e[F4]&&r!==`TRACE`)return e[F4][t]();let a=USe(e);if(a)return a;let o=JSe(e);if(o){let t=Promise.resolve(n(o,e));return e[V4]=void 0,t}return YSe(e).then(t=>{let r=n(t,e);return e[V4]=void 0,r})},JSe=e=>{let t=e[I4];if(`rawBody`in t&&t.rawBody instanceof Buffer)return t.rawBody},Y4=(e,t)=>{if(t.errored)return t.errored;let n=e[G4];return n===void 0?Error(`Client connection prematurely closed.`):n instanceof Error?n:Error(String(n))},YSe=e=>{if(e[V4])return Promise.resolve(e[V4]);if(e[H4])return e[H4];let t=e[I4];if(t.readableDidRead)return q4();let n=M4(t);if(n!==void 0)return n instanceof Error?Promise.reject(n):(e[V4]=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!j4(t)||s&&s.code!==`ECONNRESET`?!1:(o(()=>{let o=M4(t,i);o instanceof Error?r(o):o===void 0?r(a??Y4(e,t)):(e[V4]=o,n(o))}),!0)},c=e=>{i.push(A4(e,t.readableEncoding))},l=()=>{o(()=>{let t=i.length===1?i[0]:Buffer.concat(i);e[V4]=t,n(t)})},u=e=>{s(e)||o(()=>{r(e)})},d=()=>{if(t.readableEnded){l();return}s()||o(()=>{r(Y4(e,t))})},f=()=>{t.off(`data`,c),t.off(`end`,l),t.off(`error`,u),t.off(`close`,d),e[H4]=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[H4]=r,r},X4={get method(){return this[BSe]},get url(){return this[L4]},get headers(){return this[R4]||=D4(this[I4])},[VSe](e){this[G4]===void 0&&(this[G4]=e);let t=this[z4];t&&!t.signal.aborted&&t.abort(e)},[B4](){return this[z4]||=new AbortController,this[G4]!==void 0&&!this[z4].signal.aborted&&this[z4].abort(this[G4]),this[z4]},[P4](){let e=this[B4]();if(this[F4])return this[F4];let t=this.method;if(this[U4]&&t!==`GET`&&t!==`HEAD`){this[V4]=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 E4(this[L4],n);return t===`TRACE`&&Object.defineProperty(r,"method",{get(){return`TRACE`}}),this[F4]=r}return this[F4]=zSe(this.method,this[L4],this.headers,this[I4],e)},get body(){if(!this[U4])return this[P4]().body;let e=this[P4]();return!this[W4]&&e.body&&(this[W4]=e.body.getReader()),e.body},get bodyUsed(){return this[U4]?!0:this[F4]?this[F4].bodyUsed:!1}};Object.defineProperty(X4,"signal",{get(){return this[B4]().signal}}),[`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`keepalive`].forEach(e=>{Object.defineProperty(X4,e,{get(){return this[P4]()[e]}})}),[`clone`,`formData`].forEach(e=>{Object.defineProperty(X4,e,{value:function(){if(this[U4]){if(e===`clone`)throw K4();return q4()}return this[P4]()[e]()}})}),Object.defineProperty(X4,"text",{value:function(){return J4(this,`text`,e=>HSe.decode(e))}}),Object.defineProperty(X4,"arrayBuffer",{value:function(){return J4(this,`arrayBuffer`,e=>WSe(e))}}),Object.defineProperty(X4,"blob",{value:function(){return J4(this,`blob`,(e,t)=>{let n=GSe(t);return new Response(e,n?{headers:{"content-type":n}}:void 0).blob()})}}),Object.defineProperty(X4,"json",{value:function(){return this[U4]?q4():this.text().then(JSON.parse)}}),Object.defineProperty(X4,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[F4]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(X4,E4.prototype);const Z4=Symbol(`responseCache`),Q4=Symbol(`getResponseCache`),$4=Symbol(`cache`),e3=global.Response;var t3=class e{#e;#t;[Q4](){let e=this[$4],t=e&&e[2]instanceof Headers?e[2]:void 0;return delete this[$4],this[Z4]||=new e3(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 e3){let t=n[Z4];if(t){this.#t=t,this[Q4]();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[$4]=[n?.status||200,t??null,r||n?.headers])}get headers(){let e=this[$4];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[Q4]().headers}get status(){return this[$4]?.[0]??this[Q4]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(t3.prototype,e,{get(){return this[Q4]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(t3.prototype,e,{value:function(){return this[Q4]()[e]()}})}),Object.defineProperty(t3.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[Z4]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(t3,e3),Object.setPrototypeOf(t3.prototype,e3.prototype);const XSe=/^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/,ZSe=e=>e instanceof URL?e.href:XSe.test(e)?e:new URL(e).href,QSe=new Set([301,302,303,307,308]);Object.defineProperty(t3,"redirect",{value:function(e,t=302){if(!QSe.has(t))throw RangeError(`Invalid status code`);return new t3(null,{status:t,headers:{location:ZSe(e)}})},writable:!0,configurable:!0}),Object.defineProperty(t3,"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 t3(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 $Se(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 eCe={"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`},n3=Eo(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),r3=V([F(),I().int()]),i3=F();uo({ttl:I().optional(),pollInterval:I().optional()});const tCe=B({ttl:I().optional()}),nCe=B({taskId:F()}),a3=uo({progressToken:r3.optional(),"io.modelcontextprotocol/related-task":nCe.optional()}),o3=B({_meta:a3.optional()}),s3=o3.extend({task:tCe.optional()}),c3=B({method:F(),params:o3.loose().optional()}),l3=B({_meta:a3.optional()}),u3=B({method:F(),params:l3.loose().optional()}),d3=uo({_meta:a3.optional()}),f3=V([F(),I().int()]),rCe=B({jsonrpc:W(`2.0`),id:f3,...c3.shape}).strict(),iCe=B({jsonrpc:W(`2.0`),...u3.shape}).strict(),p3=B({jsonrpc:W(`2.0`),id:f3,result:d3}).strict();var aCe;(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`})(aCe||={});const m3=B({jsonrpc:W(`2.0`),id:f3.optional(),error:B({code:I().int(),message:F(),data:R().optional()})}).strict();V([rCe,iCe,p3,m3]),V([p3,m3]);const h3=d3.strict(),oCe=l3.extend({requestId:f3.optional(),reason:F().optional()}),g3=u3.extend({method:W(`notifications/cancelled`),params:oCe}),_3=B({icons:z(B({src:F(),mimeType:F().optional(),sizes:z(F()).optional(),theme:U([`light`,`dark`]).optional()})).optional()}),v3=B({name:F(),title:F().optional()}),y3=v3.extend({...v3.shape,..._3.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),sCe=Do(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,mo(B({form:mo(B({applyDefaults:L().optional()}),H(F(),R())).optional(),url:n3.optional()}),H(F(),R()).optional())),cCe=uo({list:n3.optional(),cancel:n3.optional(),requests:uo({sampling:uo({createMessage:n3.optional()}).optional(),elicitation:uo({create:n3.optional()}).optional()}).optional()}),lCe=uo({list:n3.optional(),cancel:n3.optional(),requests:uo({tools:uo({call:n3.optional()}).optional()}).optional()}),uCe=B({experimental:H(F(),n3).optional(),sampling:B({context:n3.optional(),tools:n3.optional()}).optional(),elicitation:sCe.optional(),roots:B({listChanged:L().optional()}).optional(),tasks:cCe.optional(),extensions:H(F(),n3).optional()}),dCe=o3.extend({protocolVersion:F(),capabilities:uCe,clientInfo:y3}),fCe=c3.extend({method:W(`initialize`),params:dCe}),pCe=B({experimental:H(F(),n3).optional(),logging:n3.optional(),completions:n3.optional(),prompts:B({listChanged:L().optional()}).optional(),resources:B({subscribe:L().optional(),listChanged:L().optional()}).optional(),tools:B({listChanged:L().optional()}).optional(),tasks:lCe.optional(),extensions:H(F(),n3).optional()}),mCe=d3.extend({protocolVersion:F(),capabilities:pCe,serverInfo:y3,instructions:F().optional()}),hCe=u3.extend({method:W(`notifications/initialized`),params:l3.optional()}),b3=c3.extend({method:W(`ping`),params:o3.optional()}),gCe=B({progress:I(),total:yo(I()),message:yo(F())}),_Ce=B({...l3.shape,...gCe.shape,progressToken:r3}),x3=u3.extend({method:W(`notifications/progress`),params:_Ce}),vCe=o3.extend({cursor:i3.optional()}),S3=c3.extend({params:vCe.optional()}),C3=d3.extend({nextCursor:i3.optional()}),yCe=U([`working`,`input_required`,`completed`,`failed`,`cancelled`]),w3=B({taskId:F(),status:yCe,ttl:V([I(),oo()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:yo(I()),statusMessage:yo(F())}),T3=d3.extend({task:w3}),bCe=l3.merge(w3),E3=u3.extend({method:W(`notifications/tasks/status`),params:bCe}),D3=c3.extend({method:W(`tasks/get`),params:o3.extend({taskId:F()})}),O3=d3.merge(w3),k3=c3.extend({method:W(`tasks/result`),params:o3.extend({taskId:F()})});d3.loose();const A3=S3.extend({method:W(`tasks/list`)}),j3=C3.extend({tasks:z(w3)}),M3=c3.extend({method:W(`tasks/cancel`),params:o3.extend({taskId:F()})});d3.merge(w3);const N3=B({uri:F(),mimeType:yo(F()),_meta:H(F(),R()).optional()}),P3=N3.extend({text:F()}),F3=F().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),I3=N3.extend({blob:F3}),L3=U([`user`,`assistant`]),R3=B({audience:z(L3).optional(),priority:I().min(0).max(1).optional(),lastModified:Da({offset:!0}).optional()}),z3=B({...v3.shape,..._3.shape,uri:F(),description:yo(F()),mimeType:yo(F()),size:yo(I()),annotations:R3.optional(),_meta:yo(uo({}))}),xCe=B({...v3.shape,..._3.shape,uriTemplate:F(),description:yo(F()),mimeType:yo(F()),annotations:R3.optional(),_meta:yo(uo({}))}),SCe=S3.extend({method:W(`resources/list`)}),CCe=C3.extend({resources:z(z3)}),wCe=S3.extend({method:W(`resources/templates/list`)}),TCe=C3.extend({resourceTemplates:z(xCe)}),B3=o3.extend({uri:F()}),ECe=B3,DCe=c3.extend({method:W(`resources/read`),params:ECe}),OCe=d3.extend({contents:z(V([P3,I3]))}),kCe=u3.extend({method:W(`notifications/resources/list_changed`),params:l3.optional()}),ACe=B3,jCe=c3.extend({method:W(`resources/subscribe`),params:ACe}),MCe=B3,NCe=c3.extend({method:W(`resources/unsubscribe`),params:MCe}),PCe=l3.extend({uri:F()}),FCe=u3.extend({method:W(`notifications/resources/updated`),params:PCe}),ICe=B({name:F(),description:yo(F()),required:yo(L())}),LCe=B({...v3.shape,..._3.shape,description:yo(F()),arguments:yo(z(ICe)),_meta:yo(uo({}))}),RCe=S3.extend({method:W(`prompts/list`)}),zCe=C3.extend({prompts:z(LCe)}),BCe=o3.extend({name:F(),arguments:H(F(),F()).optional()}),VCe=c3.extend({method:W(`prompts/get`),params:BCe}),V3=B({type:W(`text`),text:F(),annotations:R3.optional(),_meta:H(F(),R()).optional()}),H3=B({type:W(`image`),data:F3,mimeType:F(),annotations:R3.optional(),_meta:H(F(),R()).optional()}),U3=B({type:W(`audio`),data:F3,mimeType:F(),annotations:R3.optional(),_meta:H(F(),R()).optional()}),HCe=B({type:W(`tool_use`),name:F(),id:F(),input:H(F(),R()),_meta:H(F(),R()).optional()}),UCe=B({type:W(`resource`),resource:V([P3,I3]),annotations:R3.optional(),_meta:H(F(),R()).optional()}),W3=V([V3,H3,U3,z3.extend({type:W(`resource_link`)}),UCe]),WCe=B({role:L3,content:W3}),GCe=d3.extend({description:F().optional(),messages:z(WCe)}),KCe=u3.extend({method:W(`notifications/prompts/list_changed`),params:l3.optional()}),qCe=B({title:F().optional(),readOnlyHint:L().optional(),destructiveHint:L().optional(),idempotentHint:L().optional(),openWorldHint:L().optional()}),JCe=B({taskSupport:U([`required`,`optional`,`forbidden`]).optional()}),G3=B({...v3.shape,..._3.shape,description:F().optional(),inputSchema:B({type:W(`object`),properties:H(F(),n3).optional(),required:z(F()).optional()}).catchall(R()),outputSchema:B({type:W(`object`),properties:H(F(),n3).optional(),required:z(F()).optional()}).catchall(R()).optional(),annotations:qCe.optional(),execution:JCe.optional(),_meta:H(F(),R()).optional()}),YCe=S3.extend({method:W(`tools/list`)}),XCe=C3.extend({tools:z(G3)}),K3=d3.extend({content:z(W3).default([]),structuredContent:H(F(),R()).optional(),isError:L().optional()});K3.or(d3.extend({toolResult:R()}));const ZCe=s3.extend({name:F(),arguments:H(F(),R()).optional()}),QCe=c3.extend({method:W(`tools/call`),params:ZCe}),$Ce=u3.extend({method:W(`notifications/tools/list_changed`),params:l3.optional()});B({autoRefresh:L().default(!0),debounceMs:I().int().nonnegative().default(300)});const q3=U([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),ewe=o3.extend({level:q3}),twe=c3.extend({method:W(`logging/setLevel`),params:ewe}),nwe=l3.extend({level:q3,logger:F().optional(),data:R()}),rwe=u3.extend({method:W(`notifications/message`),params:nwe}),iwe=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()}),awe=B({mode:U([`auto`,`required`,`none`]).optional()}),owe=B({type:W(`tool_result`),toolUseId:F().describe(`The unique identifier for the corresponding tool call.`),content:z(W3).default([]),structuredContent:B({}).loose().optional(),isError:L().optional(),_meta:H(F(),R()).optional()}),swe=po(`type`,[V3,H3,U3]),J3=po(`type`,[V3,H3,U3,HCe,owe]),cwe=B({role:L3,content:V([J3,z(J3)]),_meta:H(F(),R()).optional()}),lwe=s3.extend({messages:z(cwe),modelPreferences:iwe.optional(),systemPrompt:F().optional(),includeContext:U([`none`,`thisServer`,`allServers`]).optional(),temperature:I().optional(),maxTokens:I().int(),stopSequences:z(F()).optional(),metadata:n3.optional(),tools:z(G3).optional(),toolChoice:awe.optional()}),uwe=c3.extend({method:W(`sampling/createMessage`),params:lwe}),dwe=d3.extend({model:F(),stopReason:yo(U([`endTurn`,`stopSequence`,`maxTokens`]).or(F())),role:L3,content:swe}),fwe=d3.extend({model:F(),stopReason:yo(U([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(F())),role:L3,content:V([J3,z(J3)])}),pwe=B({type:W(`boolean`),title:F().optional(),description:F().optional(),default:L().optional()}),mwe=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()}),hwe=B({type:U([`number`,`integer`]),title:F().optional(),description:F().optional(),minimum:I().optional(),maximum:I().optional(),default:I().optional()}),gwe=B({type:W(`string`),title:F().optional(),description:F().optional(),enum:z(F()),default:F().optional()}),_we=B({type:W(`string`),title:F().optional(),description:F().optional(),oneOf:z(B({const:F(),title:F()})),default:F().optional()}),vwe=V([V([B({type:W(`string`),title:F().optional(),description:F().optional(),enum:z(F()),enumNames:z(F()).optional(),default:F().optional()}),V([gwe,_we]),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()})])]),pwe,mwe,hwe]),ywe=V([s3.extend({mode:W(`form`).optional(),message:F(),requestedSchema:B({type:W(`object`),properties:H(F(),vwe),required:z(F()).optional()})}),s3.extend({mode:W(`url`),message:F(),elicitationId:F(),url:F().url()})]),bwe=c3.extend({method:W(`elicitation/create`),params:ywe}),xwe=l3.extend({elicitationId:F()}),Swe=u3.extend({method:W(`notifications/elicitation/complete`),params:xwe}),Cwe=d3.extend({action:U([`accept`,`decline`,`cancel`]),content:Do(e=>e===null?void 0:e,H(F(),V([F(),I(),L(),z(F())])).optional())}),wwe=B({type:W(`ref/resource`),uri:F()}),Twe=B({type:W(`ref/prompt`),name:F()}),Ewe=o3.extend({ref:V([Twe,wwe]),argument:B({name:F(),value:F()}),context:B({arguments:H(F(),F()).optional()}).optional()}),Dwe=c3.extend({method:W(`completion/complete`),params:Ewe}),Owe=d3.extend({completion:uo({values:z(F()).max(100),total:yo(I().int()),hasMore:yo(L())})}),kwe=B({uri:F().startsWith(`file://`),name:F().optional(),_meta:H(F(),R()).optional()}),Awe=c3.extend({method:W(`roots/list`),params:o3.optional()}),jwe=d3.extend({roots:z(kwe)}),Mwe=u3.extend({method:W(`notifications/roots/list_changed`),params:l3.optional()});V([b3,fCe,Dwe,twe,VCe,RCe,SCe,wCe,DCe,jCe,NCe,QCe,YCe,D3,k3,A3,M3]),V([g3,x3,hCe,Mwe,E3]),V([h3,dwe,fwe,Cwe,jwe,O3,j3,T3]),V([b3,uwe,bwe,Awe,D3,k3,A3,M3]),V([g3,x3,rwe,FCe,kCe,$Ce,KCe,E3,Swe]),V([h3,mCe,Owe,GCe,zCe,CCe,TCe,OCe,K3,XCe,O3,j3,T3]);var Nwe;(function(e){e.Completable=`McpCompletable`})(Nwe||={});var Pwe=global.Request,Y3=class extends Pwe{constructor(e,t){typeof e==`object`&&X3 in e&&(e=e[X3]()),t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}},Fwe=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)},Iwe=Symbol(`wrapBodyStream`),Lwe=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new Y3(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[Iwe]){let e;a.body=new ReadableStream({async pull(t){try{e||=Fe.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=Fe.toWeb(r)}return new Y3(t,a)},X3=Symbol(`getRequestCache`),Z3=Symbol(`requestCache`),Q3=Symbol(`incomingKey`),$3=Symbol(`urlKey`),Rwe=Symbol(`headersKey`),e6=Symbol(`abortControllerKey`),t6={get method(){return this[Q3].method||`GET`},get url(){return this[$3]},get headers(){return this[Rwe]||=Fwe(this[Q3])},[Symbol(`getAbortController`)](){return this[X3](),this[e6]},[X3](){return this[e6]||=new AbortController,this[Z3]||=Lwe(this.method,this[$3],this.headers,this[Q3],this[e6])}};[`body`,`bodyUsed`,`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`signal`,`keepalive`].forEach(e=>{Object.defineProperty(t6,e,{get(){return this[X3]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(t6,e,{value:function(){return this[X3]()[e]()}})}),Object.defineProperty(t6,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[Z3]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(t6,Y3.prototype);var n6=Symbol(`responseCache`),r6=Symbol(`getResponseCache`),i6=Symbol(`cache`),a6=global.Response,o6=class e{#e;#t;[r6](){return delete this[i6],this[n6]||=new a6(this.#e,this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof e){let e=n[n6];if(e){this.#t=e,this[r6]();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[i6]=[n?.status||200,t,r||n?.headers])}get headers(){let e=this[i6];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":`text/plain; charset=UTF-8`})),e[2]):this[r6]().headers}get status(){return this[i6]?.[0]??this[r6]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(o6.prototype,e,{get(){return this[r6]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(o6.prototype,e,{value:function(){return this[r6]()[e]()}})}),Object.defineProperty(o6.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[n6]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(o6,a6),Object.setPrototypeOf(o6.prototype,a6.prototype),global.crypto===void 0&&(global.crypto=Me);var zwe=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(` `)}})),Bwe=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?`
453
453
  `: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===`
454
454
  `?0:1:D!==` `&&D!==` `&&D!==`
455
- `&&(_+=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=Rwe(),e.parse=zwe()}))();var s6;(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`})(s6||={}),s6.IF,s6.THEN,s6.ELSE,s6.ELIF,s6.FI,s6.FOR,s6.WHILE,s6.UNTIL,s6.DO,s6.DONE,s6.CASE,s6.ESAC,s6.IN,s6.FUNCTION,s6.SELECT,s6.TIME,s6.COPROC,s6.SEMI_SEMI_AND,s6.TLESS,s6.AND_DGREAT,s6.DBRACK_START,s6.DBRACK_END,s6.DPAREN_START,s6.DPAREN_END,s6.AND_AND,s6.OR_OR,s6.DSEMI,s6.SEMI_AND,s6.PIPE_AMP,s6.DGREAT,s6.LESSAND,s6.GREATAND,s6.LESSGREAT,s6.CLOBBER,s6.AND_GREAT,s6.PIPE,s6.AMP,s6.SEMICOLON,s6.LPAREN,s6.RPAREN,s6.LESS,s6.GREAT,s6.LESS,s6.GREAT,s6.DLESS,s6.DGREAT,s6.LESSAND,s6.GREATAND,s6.LESSGREAT,s6.DLESSDASH,s6.CLOBBER,s6.TLESS,s6.AND_GREAT,s6.AND_DGREAT,s6.LESS,s6.GREAT,s6.DLESS,s6.DGREAT,s6.LESSAND,s6.GREATAND,s6.LESSGREAT,s6.DLESSDASH,s6.CLOBBER,s6.TLESS,s6.LESS,s6.GREAT,s6.DLESS,s6.DGREAT,s6.LESSAND,s6.GREATAND,s6.LESSGREAT,s6.DLESSDASH,s6.CLOBBER,s6.TLESS,s6.AND_GREAT,s6.AND_DGREAT,s6.AMP,s6.PIPE,s6.PIPE_AMP,s6.SEMICOLON,s6.AND_AND,s6.OR_OR,s6.DSEMI,s6.SEMI_AND,s6.SEMI_SEMI_AND;var c6=[{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__)&&(c6.push({name:`tar`,load:async()=>(await import(`./tar-MZQD7NO4-JRjaVj6V.mjs`)).tarCommand}),c6.push({name:`yq`,load:async()=>(await import(`./yq-OAKYHSXH-KGmxWF1Q.mjs`)).yqCommand}),c6.push({name:`xan`,load:async()=>(await import(`./xan-UD7JYIL2-DmdWvgSg.mjs`)).xanCommand}),c6.push({name:`sqlite3`,load:async()=>(await import(`./sqlite3-TE5AIOTF-DVwda1Ow.mjs`)).sqlite3Command}));var l6=[];(typeof __BROWSER__>`u`||!__BROWSER__)&&(l6.push({name:`python3`,load:async()=>(await import(`./python3-DNGS4G3E-CixyRGKv.mjs`)).python3Command}),l6.push({name:`python`,load:async()=>(await import(`./python3-DNGS4G3E-CixyRGKv.mjs`)).pythonCommand}));var u6=[];(typeof __BROWSER__>`u`||!__BROWSER__)&&(u6.push({name:`js-exec`,load:async()=>(await import(`./js-exec-VXN6TZ7U-Z8_USGOo.mjs`)).jsExecCommand}),u6.push({name:`node`,load:async()=>(await import(`./js-exec-VXN6TZ7U-Z8_USGOo.mjs`)).nodeStubCommand})),new TextEncoder,Object.freeze({stdout:``,stderr:``,exitCode:0}),[...new Map([[`:`,[`: [arguments]`,`Null command.
455
+ `&&(_+=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=zwe(),e.parse=Bwe()}))();var s6;(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`})(s6||={}),s6.IF,s6.THEN,s6.ELSE,s6.ELIF,s6.FI,s6.FOR,s6.WHILE,s6.UNTIL,s6.DO,s6.DONE,s6.CASE,s6.ESAC,s6.IN,s6.FUNCTION,s6.SELECT,s6.TIME,s6.COPROC,s6.SEMI_SEMI_AND,s6.TLESS,s6.AND_DGREAT,s6.DBRACK_START,s6.DBRACK_END,s6.DPAREN_START,s6.DPAREN_END,s6.AND_AND,s6.OR_OR,s6.DSEMI,s6.SEMI_AND,s6.PIPE_AMP,s6.DGREAT,s6.LESSAND,s6.GREATAND,s6.LESSGREAT,s6.CLOBBER,s6.AND_GREAT,s6.PIPE,s6.AMP,s6.SEMICOLON,s6.LPAREN,s6.RPAREN,s6.LESS,s6.GREAT,s6.LESS,s6.GREAT,s6.DLESS,s6.DGREAT,s6.LESSAND,s6.GREATAND,s6.LESSGREAT,s6.DLESSDASH,s6.CLOBBER,s6.TLESS,s6.AND_GREAT,s6.AND_DGREAT,s6.LESS,s6.GREAT,s6.DLESS,s6.DGREAT,s6.LESSAND,s6.GREATAND,s6.LESSGREAT,s6.DLESSDASH,s6.CLOBBER,s6.TLESS,s6.LESS,s6.GREAT,s6.DLESS,s6.DGREAT,s6.LESSAND,s6.GREATAND,s6.LESSGREAT,s6.DLESSDASH,s6.CLOBBER,s6.TLESS,s6.AND_GREAT,s6.AND_DGREAT,s6.AMP,s6.PIPE,s6.PIPE_AMP,s6.SEMICOLON,s6.AND_AND,s6.OR_OR,s6.DSEMI,s6.SEMI_AND,s6.SEMI_SEMI_AND;var c6=[{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__)&&(c6.push({name:`tar`,load:async()=>(await import(`./tar-MZQD7NO4-JRjaVj6V.mjs`)).tarCommand}),c6.push({name:`yq`,load:async()=>(await import(`./yq-OAKYHSXH-KGmxWF1Q.mjs`)).yqCommand}),c6.push({name:`xan`,load:async()=>(await import(`./xan-UD7JYIL2-DmdWvgSg.mjs`)).xanCommand}),c6.push({name:`sqlite3`,load:async()=>(await import(`./sqlite3-TE5AIOTF-DVwda1Ow.mjs`)).sqlite3Command}));var l6=[];(typeof __BROWSER__>`u`||!__BROWSER__)&&(l6.push({name:`python3`,load:async()=>(await import(`./python3-DNGS4G3E-CixyRGKv.mjs`)).python3Command}),l6.push({name:`python`,load:async()=>(await import(`./python3-DNGS4G3E-CixyRGKv.mjs`)).pythonCommand}));var u6=[];(typeof __BROWSER__>`u`||!__BROWSER__)&&(u6.push({name:`js-exec`,load:async()=>(await import(`./js-exec-VXN6TZ7U-Z8_USGOo.mjs`)).jsExecCommand}),u6.push({name:`node`,load:async()=>(await import(`./js-exec-VXN6TZ7U-Z8_USGOo.mjs`)).nodeStubCommand})),new TextEncoder,Object.freeze({stdout:``,stderr:``,exitCode:0}),[...new Map([[`:`,[`: [arguments]`,`Null command.
456
456
  No effect; the command does nothing.
457
457
  Exit Status:
458
458
  Always succeeds.`]],[`.`,[`. filename [arguments]`,`Execute commands from a file in the current shell.
@@ -799,31 +799,31 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
799
799
  job specification, and reports its termination status.
800
800
  Exit Status:
801
801
  Returns the status of the last ID; fails if ID is invalid or an invalid
802
- option is given.`]]]).keys()].sort(),new TextDecoder(`utf-8`,{fatal:!0});var d6=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:()=>{}}})),f6=i(((e,n)=>{let{EMPTY_BUFFER:r}=d6(),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{}})),Bwe=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])}}}})),p6=i(((e,n)=>{let r=t(`zlib`),i=f6(),a=Bwe(),{kStatusCode:o}=d6(),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)}})),m6=i(((e,n)=>{let{isUtf8:r}=t(`buffer`),{hasBlob:i}=d6(),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{}})),h6=i(((e,n)=>{let{Writable:r}=t(`stream`),i=p6(),{BINARY_TYPES:a,EMPTY_BUFFER:o,kStatusCode:s,kWebSocket:c}=d6(),{concat:l,toArrayBuffer:u,unmask:d}=f6(),{isValidStatusCode:f,isValidUTF8:p}=m6(),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}}})),g6=i(((e,n)=>{let{Duplex:r}=t(`stream`),{randomFillSync:i}=t(`crypto`),{types:{isUint8Array:a}}=t(`util`),o=p6(),{EMPTY_BUFFER:s,kWebSocket:c,NOOP:l}=d6(),{isBlob:u,isValidStatusCode:d}=m6(),{mask:f,toBuffer:p}=f6(),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)}})),Vwe=i(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=d6(),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)}})),_6=i(((e,t)=>{let{tokenChars:n}=m6();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}})),v6=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=p6(),m=h6(),h=g6(),{isBlob:g}=m6(),{BINARY_TYPES:_,CLOSE_TIMEOUT:v,EMPTY_BUFFER:y,GUID:b,kForOnEventAttribute:x,kListener:S,kStatusCode:C,kWebSocket:w,NOOP:T}=d6(),{EventTarget:{addEventListener:E,removeEventListener:D}}=Vwe(),{format:O,parse:ee}=_6(),{toBuffer:te}=f6(),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())}})),Hwe=i(((e,n)=>{v6();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})),y6=i(((e,t)=>{let{tokenChars:n}=m6();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}})),Uwe=i(((e,n)=>{let r=t(`events`),i=t(`http`),{Duplex:a}=t(`stream`),{createHash:o}=t(`crypto`),s=_6(),c=p6(),l=y6(),u=v6(),{CLOSE_TIMEOUT:d,GUID:f,kWebSocket:p}=d6(),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
802
+ option is given.`]]]).keys()].sort(),new TextDecoder(`utf-8`,{fatal:!0});var d6=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:()=>{}}})),f6=i(((e,n)=>{let{EMPTY_BUFFER:r}=d6(),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{}})),Vwe=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])}}}})),p6=i(((e,n)=>{let r=t(`zlib`),i=f6(),a=Vwe(),{kStatusCode:o}=d6(),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)}})),m6=i(((e,n)=>{let{isUtf8:r}=t(`buffer`),{hasBlob:i}=d6(),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{}})),h6=i(((e,n)=>{let{Writable:r}=t(`stream`),i=p6(),{BINARY_TYPES:a,EMPTY_BUFFER:o,kStatusCode:s,kWebSocket:c}=d6(),{concat:l,toArrayBuffer:u,unmask:d}=f6(),{isValidStatusCode:f,isValidUTF8:p}=m6(),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}}})),g6=i(((e,n)=>{let{Duplex:r}=t(`stream`),{randomFillSync:i}=t(`crypto`),{types:{isUint8Array:a}}=t(`util`),o=p6(),{EMPTY_BUFFER:s,kWebSocket:c,NOOP:l}=d6(),{isBlob:u,isValidStatusCode:d}=m6(),{mask:f,toBuffer:p}=f6(),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)}})),Hwe=i(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=d6(),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)}})),_6=i(((e,t)=>{let{tokenChars:n}=m6();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}})),v6=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=p6(),m=h6(),h=g6(),{isBlob:g}=m6(),{BINARY_TYPES:_,CLOSE_TIMEOUT:v,EMPTY_BUFFER:y,GUID:b,kForOnEventAttribute:x,kListener:S,kStatusCode:C,kWebSocket:w,NOOP:T}=d6(),{EventTarget:{addEventListener:E,removeEventListener:D}}=Hwe(),{format:O,parse:ee}=_6(),{toBuffer:te}=f6(),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())}})),Uwe=i(((e,n)=>{v6();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})),y6=i(((e,t)=>{let{tokenChars:n}=m6();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}})),Wwe=i(((e,n)=>{let r=t(`events`),i=t(`http`),{Duplex:a}=t(`stream`),{createHash:o}=t(`crypto`),s=_6(),c=p6(),l=y6(),u=v6(),{CLOSE_TIMEOUT:d,GUID:f,kWebSocket:p}=d6(),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
803
803
  `).join(`\r
804
804
  `)),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
805
805
  `)+`\r
806
806
  \r
807
- `+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)}}));Hwe(),_6(),p6(),h6(),g6(),y6(),v6(),Uwe();let b6,x6,S6,C6,w6=!0;typeof process<`u`&&({FORCE_COLOR:b6,NODE_DISABLE_COLORS:x6,NO_COLOR:S6,TERM:C6}=process.env||{},w6=process.stdout&&process.stdout.isTTY);const T6={enabled:!x6&&S6==null&&C6!==`dumb`&&(b6!=null&&b6!==`0`||w6),reset:D6(0,0),bold:D6(1,22),dim:D6(2,22),italic:D6(3,23),underline:D6(4,24),inverse:D6(7,27),hidden:D6(8,28),strikethrough:D6(9,29),black:D6(30,39),red:D6(31,39),green:D6(32,39),yellow:D6(33,39),blue:D6(34,39),magenta:D6(35,39),cyan:D6(36,39),white:D6(37,39),gray:D6(90,39),grey:D6(90,39),bgBlack:D6(40,49),bgRed:D6(41,49),bgGreen:D6(42,49),bgYellow:D6(43,49),bgBlue:D6(44,49),bgMagenta:D6(45,49),bgCyan:D6(46,49),bgWhite:D6(47,49)};function E6(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 Wwe(e,t){let n={has:e,keys:t};return n.reset=T6.reset.bind(n),n.bold=T6.bold.bind(n),n.dim=T6.dim.bind(n),n.italic=T6.italic.bind(n),n.underline=T6.underline.bind(n),n.inverse=T6.inverse.bind(n),n.hidden=T6.hidden.bind(n),n.strikethrough=T6.strikethrough.bind(n),n.black=T6.black.bind(n),n.red=T6.red.bind(n),n.green=T6.green.bind(n),n.yellow=T6.yellow.bind(n),n.blue=T6.blue.bind(n),n.magenta=T6.magenta.bind(n),n.cyan=T6.cyan.bind(n),n.white=T6.white.bind(n),n.gray=T6.gray.bind(n),n.grey=T6.grey.bind(n),n.bgBlack=T6.bgBlack.bind(n),n.bgRed=T6.bgRed.bind(n),n.bgGreen=T6.bgGreen.bind(n),n.bgYellow=T6.bgYellow.bind(n),n.bgBlue=T6.bgBlue.bind(n),n.bgMagenta=T6.bgMagenta.bind(n),n.bgCyan=T6.bgCyan.bind(n),n.bgWhite=T6.bgWhite.bind(n),n}function D6(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:T6.enabled?E6(this.keys,t+``):t+``):t===void 0?Wwe([e],[n]):T6.enabled?E6([n],t+``):t+``}}Number.isNaN,Number.isInteger,Number.isNaN,Number.parseInt,Array.from,Array.isArray;const Gwe=String.fromCharCode;String.fromCodePoint,Gwe(65535);const O6=typeof TextEncoder<`u`?new TextEncoder:null;let k6=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});k6&&k6.decode(new Uint8Array).length===1&&(k6=null);const A6=e=>Error(e);new Uint8Array(3e4).length/3,O6&&O6.encodeInto,A6(`Unexpected end of array`),A6(`Integer out of Range`),Date.now;var j6=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),M6=a(import.meta.url),N6=j6(((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:()=>{}}})),P6=j6(((e,t)=>{let{EMPTY_BUFFER:n}=N6(),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=M6(`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{}})),Kwe=j6(((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])}}}})),F6=j6(((e,t)=>{let n=M6(`zlib`),r=P6(),i=Kwe(),{kStatusCode:a}=N6(),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)}})),I6=j6(((e,t)=>{let{isUtf8:n}=M6(`buffer`),{hasBlob:r}=N6(),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=M6(`utf-8-validate`);t.exports.isValidUTF8=function(t){return t.length<32?o(t):e(t)}}catch{}})),L6=j6(((e,t)=>{let{Writable:n}=M6(`stream`),r=F6(),{BINARY_TYPES:i,EMPTY_BUFFER:a,kStatusCode:o,kWebSocket:s}=N6(),{concat:c,toArrayBuffer:l,unmask:u}=P6(),{isValidStatusCode:d,isValidUTF8:f}=I6(),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}}})),R6=j6(((e,t)=>{let{Duplex:n}=M6(`stream`),{randomFillSync:r}=M6(`crypto`),i=F6(),{EMPTY_BUFFER:a,kWebSocket:o,NOOP:s}=N6(),{isBlob:c,isValidStatusCode:l}=I6(),{mask:u,toBuffer:d}=P6(),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)}})),qwe=j6(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=N6(),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)}})),z6=j6(((e,t)=>{let{tokenChars:n}=I6();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}})),B6=j6(((e,t)=>{let n=M6(`events`),r=M6(`https`),i=M6(`http`),a=M6(`net`),o=M6(`tls`),{randomBytes:s,createHash:c}=M6(`crypto`),{Duplex:l,Readable:u}=M6(`stream`),{URL:d}=M6(`url`),f=F6(),p=L6(),m=R6(),{isBlob:h}=I6(),{BINARY_TYPES:g,CLOSE_TIMEOUT:_,EMPTY_BUFFER:v,GUID:y,kForOnEventAttribute:b,kListener:x,kStatusCode:S,kWebSocket:C,NOOP:w}=N6(),{EventTarget:{addEventListener:T,removeEventListener:E}}=qwe(),{format:D,parse:O}=z6(),{toBuffer:ee}=P6(),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())}})),Jwe=j6(((e,t)=>{B6();let{Duplex:n}=M6(`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})),Ywe=j6(((e,t)=>{let{tokenChars:n}=I6();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}})),Xwe=j6(((e,t)=>{let n=M6(`events`),r=M6(`http`),{Duplex:i}=M6(`stream`),{createHash:a}=M6(`crypto`),o=z6(),s=F6(),c=Ywe(),l=B6(),{CLOSE_TIMEOUT:u,GUID:d,kWebSocket:f}=N6(),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
807
+ `+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)}}));Uwe(),_6(),p6(),h6(),g6(),y6(),v6(),Wwe();let b6,x6,S6,C6,w6=!0;typeof process<`u`&&({FORCE_COLOR:b6,NODE_DISABLE_COLORS:x6,NO_COLOR:S6,TERM:C6}=process.env||{},w6=process.stdout&&process.stdout.isTTY);const T6={enabled:!x6&&S6==null&&C6!==`dumb`&&(b6!=null&&b6!==`0`||w6),reset:D6(0,0),bold:D6(1,22),dim:D6(2,22),italic:D6(3,23),underline:D6(4,24),inverse:D6(7,27),hidden:D6(8,28),strikethrough:D6(9,29),black:D6(30,39),red:D6(31,39),green:D6(32,39),yellow:D6(33,39),blue:D6(34,39),magenta:D6(35,39),cyan:D6(36,39),white:D6(37,39),gray:D6(90,39),grey:D6(90,39),bgBlack:D6(40,49),bgRed:D6(41,49),bgGreen:D6(42,49),bgYellow:D6(43,49),bgBlue:D6(44,49),bgMagenta:D6(45,49),bgCyan:D6(46,49),bgWhite:D6(47,49)};function E6(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 Gwe(e,t){let n={has:e,keys:t};return n.reset=T6.reset.bind(n),n.bold=T6.bold.bind(n),n.dim=T6.dim.bind(n),n.italic=T6.italic.bind(n),n.underline=T6.underline.bind(n),n.inverse=T6.inverse.bind(n),n.hidden=T6.hidden.bind(n),n.strikethrough=T6.strikethrough.bind(n),n.black=T6.black.bind(n),n.red=T6.red.bind(n),n.green=T6.green.bind(n),n.yellow=T6.yellow.bind(n),n.blue=T6.blue.bind(n),n.magenta=T6.magenta.bind(n),n.cyan=T6.cyan.bind(n),n.white=T6.white.bind(n),n.gray=T6.gray.bind(n),n.grey=T6.grey.bind(n),n.bgBlack=T6.bgBlack.bind(n),n.bgRed=T6.bgRed.bind(n),n.bgGreen=T6.bgGreen.bind(n),n.bgYellow=T6.bgYellow.bind(n),n.bgBlue=T6.bgBlue.bind(n),n.bgMagenta=T6.bgMagenta.bind(n),n.bgCyan=T6.bgCyan.bind(n),n.bgWhite=T6.bgWhite.bind(n),n}function D6(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:T6.enabled?E6(this.keys,t+``):t+``):t===void 0?Gwe([e],[n]):T6.enabled?E6([n],t+``):t+``}}Number.isNaN,Number.isInteger,Number.isNaN,Number.parseInt,Array.from,Array.isArray;const Kwe=String.fromCharCode;String.fromCodePoint,Kwe(65535);const O6=typeof TextEncoder<`u`?new TextEncoder:null;let k6=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});k6&&k6.decode(new Uint8Array).length===1&&(k6=null);const A6=e=>Error(e);new Uint8Array(3e4).length/3,O6&&O6.encodeInto,A6(`Unexpected end of array`),A6(`Integer out of Range`),Date.now;var j6=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),M6=a(import.meta.url),N6=j6(((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:()=>{}}})),P6=j6(((e,t)=>{let{EMPTY_BUFFER:n}=N6(),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=M6(`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{}})),qwe=j6(((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])}}}})),F6=j6(((e,t)=>{let n=M6(`zlib`),r=P6(),i=qwe(),{kStatusCode:a}=N6(),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)}})),I6=j6(((e,t)=>{let{isUtf8:n}=M6(`buffer`),{hasBlob:r}=N6(),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=M6(`utf-8-validate`);t.exports.isValidUTF8=function(t){return t.length<32?o(t):e(t)}}catch{}})),L6=j6(((e,t)=>{let{Writable:n}=M6(`stream`),r=F6(),{BINARY_TYPES:i,EMPTY_BUFFER:a,kStatusCode:o,kWebSocket:s}=N6(),{concat:c,toArrayBuffer:l,unmask:u}=P6(),{isValidStatusCode:d,isValidUTF8:f}=I6(),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}}})),R6=j6(((e,t)=>{let{Duplex:n}=M6(`stream`),{randomFillSync:r}=M6(`crypto`),i=F6(),{EMPTY_BUFFER:a,kWebSocket:o,NOOP:s}=N6(),{isBlob:c,isValidStatusCode:l}=I6(),{mask:u,toBuffer:d}=P6(),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)}})),Jwe=j6(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=N6(),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)}})),z6=j6(((e,t)=>{let{tokenChars:n}=I6();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}})),B6=j6(((e,t)=>{let n=M6(`events`),r=M6(`https`),i=M6(`http`),a=M6(`net`),o=M6(`tls`),{randomBytes:s,createHash:c}=M6(`crypto`),{Duplex:l,Readable:u}=M6(`stream`),{URL:d}=M6(`url`),f=F6(),p=L6(),m=R6(),{isBlob:h}=I6(),{BINARY_TYPES:g,CLOSE_TIMEOUT:_,EMPTY_BUFFER:v,GUID:y,kForOnEventAttribute:b,kListener:x,kStatusCode:S,kWebSocket:C,NOOP:w}=N6(),{EventTarget:{addEventListener:T,removeEventListener:E}}=Jwe(),{format:D,parse:O}=z6(),{toBuffer:ee}=P6(),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())}})),Ywe=j6(((e,t)=>{B6();let{Duplex:n}=M6(`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})),Xwe=j6(((e,t)=>{let{tokenChars:n}=I6();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}})),Zwe=j6(((e,t)=>{let n=M6(`events`),r=M6(`http`),{Duplex:i}=M6(`stream`),{createHash:a}=M6(`crypto`),o=z6(),s=F6(),c=Xwe(),l=B6(),{CLOSE_TIMEOUT:u,GUID:d,kWebSocket:f}=N6(),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
808
808
  `).join(`\r
809
809
  `)),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
810
810
  `)+`\r
811
811
  \r
812
- `+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)}}));Jwe(),L6(),R6(),B6(),Xwe(),jc();const Zwe=new Set;function V6(e){Zwe.add(e)}function Qwe(){return kc.getTracer(`open-knowledge-server`)}async function $we(e,t,n){return Qwe().startActiveSpan(e,t??{},async e=>{try{let t=await n(e);return e.isRecording(),t}catch(t){throw e.recordException(t),e.setStatus({code:Sc.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}AX(`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()}),AX(`checkpoint-chain`);function H6(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function eTe(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}AX(`shadow-lock`),AX(`shadow-op-gate`),AX(`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})(),jY.fileSystem,jY.gitUpstream,jY.service,jY.generator,AX(`bridge-loss-detector`),AX(`checkpoint`);function U6(e){let t=he(e).toLowerCase();return wR.includes(t)}function tTe(e){let t=e.toLowerCase();for(let n of wR)if(t.endsWith(n))return e.slice(0,-n.length);return e}function nTe(e){return e===`__system__`}const rTe=new Set(kre);function iTe(e){return rTe.has(e)}function aTe(e){return Are(e)}function oTe(e){return nTe(e)||iTe(e)||aTe(e)}AX(`parse-pool`),Math.max(1,Math.min(4,oe()-1)),V6(()=>{}),AX(`bridge-watchdog`),V6(()=>{}),AX(`server-observers`),AX(`server-observers`),AX(`agent-sessions`);function W6(e){return{...e,windowsHide:!0}}function sTe(){try{let e=M(we(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`}sTe(),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`),Object.freeze({source:`local`,skipStoreHooks:!0,context:Object.freeze({origin:`effect-capture`,paired:!1})});const G6={discovery:`open-knowledge-discovery`,project:`open-knowledge`,"write-skill":`open-knowledge-write-skill`};new Set(Object.values(G6));const cTe=Object.keys(G6),lTe={discovery:`user`,project:`project`,"write-skill":`user`},K6=cTe.filter(e=>lTe[e]===`user`);new Set(K6.map(e=>G6[e])),Re(x),AX(`agent-registry-apply`);const q6=`OpenKnowledge.app/Contents/Resources/cli/dist/assets/skills`;function J6(e,t={}){let n=t.platform??process.platform,r=t.checkDesktop??!1,i=t.home??k(),a=[],o=process.env.NODE_ENV===`test`;r&&n===`darwin`&&(o||a.push(N(`/Applications`,q6,e)),(!o||t.home!==void 0)&&a.push(N(i,`Applications`,q6,e))),a.push(we(new URL(`../dist/assets/skills/${e}`,import.meta.url))),a.push(we(new URL(`../assets/skills/${e}`,import.meta.url))),a.push(we(new URL(`./assets/skills/${e}`,import.meta.url)));for(let e of a)if(g(e))return e;throw Error(`Bundled skill asset directory not found for bundle '${e}'. Tried: ${a.join(`, `)}. This usually means the CLI build did not copy packages/server/assets into dist/assets. Run \`cd packages/cli && bun run build\` before publishing.`)}function Y6(e){return e.replace(/\\/g,`/`)}AX(`installed-skills-marker`),RegExp(`<(${HJ.map(e=>e.tagName).join(`|`)})\\b([^>]*)\\/>`,`y`);const uTe=String.raw`\[\[([^\n#[\]|]+)(?:#([^\n[\]|]+))?(?:\|([^\n[\]]+))?\]\]`,dTe=String.raw`\((<[^>\n]+>|[^)\s\n]+)((?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?)\)`,X6=String.raw`([^\]\n]*)`,Z6=String.raw`([^\]\n]*(?:\][^[\]\n]*)?)`,Q6=e=>RegExp(`(!?)${uTe}`,e),$6=(e,t)=>RegExp(`(!?)\\[${e}\\]${dTe}`,t);Q6(`y`),Q6(`g`),$6(X6,`y`),$6(Z6,`y`),$6(X6,`g`),$6(Z6,`g`);const fTe=String.raw`(!?)\[([^\]\n]*)\](?:\[([^\]\n]*)\])?`;new RegExp(fTe,`y`);function e8(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}}const t8=AX(`content-filter`);Re(o);const n8=[`.claude`,`.cursor`,`.codex`,`.agents`,`.opencode`,`.pi`],r8=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`,...n8,`Library`,`Applications`,`.Trash`]),pTe=new Set([`.git`,`node_modules`,`.ok`,`.open-knowledge`,`.openknowledge`,...n8]),i8=new Set([`worktrees`,`local`]);function a8(e){let t=nu(e);if(!ru(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 mTe(e){throw Error(`[AttachmentFolderShape] unhandled variant: ${JSON.stringify(e)}`)}function hTe(e,t,n){let r=he(e).slice(1).toLowerCase();if(!ol.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 mTe(t)}function o8(e,t){let n=e.split(`/`);for(let e=0;e<n.length;e++){let r=n[e],i=r.toLowerCase()===`.ok`?`.ok`:r;if(pTe.has(i)&&!(t&&i===`.ok`&&!i8.has((n[e+1]??``).toLowerCase())))return!0}return!1}function s8(e){return e.startsWith(`${ys}/`)}function gTe(e){return e===`.ok`||e===`.ok/skills`||e.startsWith(`.ok/skills/`)}const c8=new Set([`.ok`,...n8]),_Te=new Set([...r8].filter(e=>!c8.has(e))),vTe=[`.git`,`node_modules`,`.ok/local`,`.ok/worktrees`].flatMap(e=>[e,`${e}/**`,`**/${e}`,`**/${e}/**`]);function yTe(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``).split(`/`);return t.includes(`..`)?!1:t.some(e=>_Te.has(e))?!0:t.some((e,n)=>e.toLowerCase()===`.ok`&&i8.has((t[n+1]??``).toLowerCase()))}const bTe=[`.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`,...n8.flatMap(e=>[e,`${e}/skills/example/SKILL.md`])];function xTe(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(yTe(t))return!1;if(n.some(e=>c8.has(e)))return!0;try{let e=(0,o4.default)().add(t);return bTe.some(t=>e.ignores(t))}catch{return!0}}function STe(e){let t=e.filter(e=>e.length>0&&!e.startsWith(`!`)&&!e.startsWith(`#`)&&!xTe(e));return[...new Set([...t,...vTe])]}function l8(e,t){for(let n=0;n<t;n++)if(r8.has(e[n])||e[n].toLowerCase()===`.ok`)return!0;return!1}function u8(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:!l8(t,n-3)}function d8(e){let t=e.split(`/`),n=t.length;return t[n-1]===`.ok`?!l8(t,n-1):n>=2&&t[n-1]===`templates`&&t[n-2]===`.ok`&&!l8(t,n-2)}function CTe(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`))||u8(e)?!0:n>=2&&t[n-1]===`frontmatter.yml`&&t[n-2]===`.ok`&&!l8(t,n-2)}function wTe(e){return e===`.ok`||e===`.ok/schemas`||d8(e)}function TTe(e,t){for(let n of t)if(e===n||e.startsWith(`${n}/`))return!0;return!1}function f8(e,t){if(t.size===0)return!1;for(let n of t)if(e.startsWith(`${n}/`))return!0;return!1}function ETe(e,t){if(t.size===0)return!1;for(let n of t)if(n===e||n.startsWith(`${e}/`)||e.startsWith(`${n}/`))return!0;return!1}const DTe=new Set([`.ds_store`,`.localized`,`thumbs.db`,`desktop.ini`,`.directory`]);function p8(e){return DTe.has(e.slice(e.lastIndexOf(`/`)+1).toLowerCase())}const OTe=new Set([`.ssh`,`.aws`,`.gnupg`,`.kube`,`.docker`]);function m8(e){for(let t of e.split(`/`))if(OTe.has(t.toLowerCase()))return!0;return!1}const kTe=new Set([`credentials`,`.netrc`,`.npmrc`,`.pgpass`,`.git-credentials`]),ATe=[`.pem`,`.key`,`.p12`,`.pfx`,`.keystore`,`.jks`,`.ppk`];function h8(e){let t=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();if(t===`.env`||t.startsWith(`.env.`)||kTe.has(t)||t.startsWith(`id_rsa`)||t.startsWith(`id_ed25519`)||t.startsWith(`id_ecdsa`)||t.startsWith(`id_dsa`))return!0;for(let e of ATe)if(t.endsWith(e))return!0;return!1}function jTe(e,t){return t===e||t.startsWith(`${e}/`)}function MTe(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=e8(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 g8=[`.gitignore`,`.okignore`];function NTe(e,t){let n=PTe(e);if(n===null)return[];let r=[];_8(N(n,`info`,`exclude`),t,r,`info/exclude`);let i=FTe(e);return i&&_8(i,t,r,`global excludesfile`),r}function PTe(e){let t=l(`git`,[`rev-parse`,`--git-common-dir`],W6({cwd:e,encoding:`utf-8`,timeout:5e3}));return t.status!==0||!t.stdout?null:be(e,t.stdout.trim())}function FTe(e){let t=l(`git`,[`config`,`--get`,`--type=path`,`core.excludesfile`],W6({cwd:e,encoding:`utf-8`,timeout:5e3}));if(t.status===0&&t.stdout){let e=t.stdout.trim();if(e)return e}return ITe()}function ITe(){let e=process.env.XDG_CONFIG_HOME?.trim(),t=e&&e.length>0?e:N(k(),`.config`);return N(t,`git`,`ignore`)}function _8(e,t,n,r){if(g(e))try{let r=S(e,`utf-8`);t.value+=r.length,n.push(...y8(r))}catch(t){t8.warn({path:e,err:t},`Failed to read ${r} at ${e}`)}}function LTe(e){let{projectDir:t,contentDir:n,onAfterRebuild:r,singleDocRelPath:i}=e,a=e.inPlaceSkillDirs??new Set,o=a8(e.attachmentFolderPath??`./`),s=e.skillRootPaths??new Set,c=MTe(t,n,i),l=Y6(ye(t,n)),u=l.startsWith(`..`),d,f,p,m,h=0,_=0,v=0;function y(){let e=(0,o4.default)(),r=(0,o4.default)();e.add(`.git`);let i=[],a=0,o=0;for(let n of g8){let o=N(t,n);if(g(o))try{let t=S(o,`utf-8`);a+=t.length;let s=y8(t);i.push(...s),e.add(s),n===`.okignore`&&r.add(s)}catch(e){t8.warn({path:o,err:e},`Failed to read ${n} at ${o}`)}}if(l&&!u)for(let t of g8){let i=N(n,t);if(g(i))try{let n=S(i,`utf-8`);a+=n.length,o++;let s=y8(n).map(e=>b8(e,l));e.add(s),t===`.okignore`&&r.add(s)}catch(e){t8.warn({path:i,err:e},`Failed to read ${t} at ${i}`)}}let s={value:a};o+=x8(n,t,e,r,s),a=s.value;let c=NTe(t,s);a=s.value,c.length>0&&(i.push(...c),e.add(c));let y=STe(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&&v8(n,``,x,b)};T();function E(e){return oTe(tTe(e))}function D(e){for(let t of e.split(`/`))if(r8.has(t))return!0;return!u&&x(e)}let O=null,ee=null;return{isExcluded(e,t){if(E(e)||h8(e)||m8(e)||c.isInside(e,t?.syncScope)||!t?.bypassFilters&&TTe(e,s)&&!f8(e,a))return!0;if(!t?.bypassFilters&&(s8(e)||f8(e,a)&&!x(e))){if(i!==void 0)return e!==i;if(U6(e))return!1;let t=he(e).slice(1).toLowerCase();return!ol.has(t)}if(!t?.bypassFilters&&u8(e)||!t?.bypassFilters&&t?.syncScope!==void 0&&CTe(C(e,t.syncScope))&&!x(e,t.syncScope))return i!==void 0&&e!==i;if(o8(e,t?.showOk)||p8(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(U6(e)||hTe(e,o,e=>(b.get(e)??0)>0))return!1;let n=he(e).slice(1).toLowerCase();if(ol.has(n)){let t=M(e),n=t===`.`?``:t;if((b.get(n)??0)>0)return!1}return!0},isDirExcluded(e,t){if(m8(e)||c.isInside(e,t?.syncScope))return!0;if(!t?.bypassFilters&&(gTe(e)||d8(e)||t?.syncScope!==void 0&&wTe(C(e,t.syncScope))||ETe(e,a)))return!1;if(o8(e,t?.showOk))return!0;if(i!==void 0)return!jTe(e,i);if(t?.bypassFilters)return t.respectOkignore===!0&&(w(e)||w(`${e}/`));for(let t of e.split(`/`))if(r8.has(t))return!0;return u?!1:x(e,t?.syncScope)||x(`${e}/`,t?.syncScope)},isPathIgnored(e,t){return E(e)||h8(e)||m8(e)?!0:s8(e)||f8(e,a)&&!x(e)||u8(e)?!1:o8(e)||p8(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);t8.warn({err:t instanceof Error?t:Error(String(t))},`content-filter rebuildDirCount walk failed — retaining previous counts`)}},setAttachmentFolderPath(e){o=a8(e)},refreshInPlaceSkillDirs(){if(e.rescanInPlaceSkillDirs)try{a=e.rescanInPlaceSkillDirs()}catch(e){t8.warn({err:e},`in-place skill re-scan failed — keeping previous allow-list`)}},inPlaceSkillDirsFingerprint(){return[...a].sort().join(`
812
+ `+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)}}));Ywe(),L6(),R6(),B6(),Zwe(),jc();const Qwe=new Set;function V6(e){Qwe.add(e)}function $we(){return kc.getTracer(`open-knowledge-server`)}async function eTe(e,t,n){return $we().startActiveSpan(e,t??{},async e=>{try{let t=await n(e);return e.isRecording(),t}catch(t){throw e.recordException(t),e.setStatus({code:Sc.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}AX(`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()}),AX(`checkpoint-chain`);function H6(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function tTe(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}AX(`shadow-lock`),AX(`shadow-op-gate`),AX(`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})(),jY.fileSystem,jY.gitUpstream,jY.service,jY.generator,AX(`bridge-loss-detector`),AX(`checkpoint`);function U6(e){let t=he(e).toLowerCase();return wR.includes(t)}function nTe(e){let t=e.toLowerCase();for(let n of wR)if(t.endsWith(n))return e.slice(0,-n.length);return e}function rTe(e){return e===`__system__`}const iTe=new Set(kre);function aTe(e){return iTe.has(e)}function oTe(e){return Are(e)}function sTe(e){return rTe(e)||aTe(e)||oTe(e)}AX(`parse-pool`),Math.max(1,Math.min(4,oe()-1)),V6(()=>{}),AX(`bridge-watchdog`),V6(()=>{}),AX(`server-observers`),AX(`server-observers`),AX(`agent-sessions`);function W6(e){return{...e,windowsHide:!0}}function cTe(){try{let e=M(we(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`}cTe(),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`),Object.freeze({source:`local`,skipStoreHooks:!0,context:Object.freeze({origin:`effect-capture`,paired:!1})});const G6={discovery:`open-knowledge-discovery`,project:`open-knowledge`,"write-skill":`open-knowledge-write-skill`};new Set(Object.values(G6));const lTe=Object.keys(G6),uTe={discovery:`user`,project:`project`,"write-skill":`user`},K6=lTe.filter(e=>uTe[e]===`user`);new Set(K6.map(e=>G6[e])),Re(x),AX(`agent-registry-apply`);const q6=`OpenKnowledge.app/Contents/Resources/cli/dist/assets/skills`;function J6(e,t={}){let n=t.platform??process.platform,r=t.checkDesktop??!1,i=t.home??k(),a=[],o=process.env.NODE_ENV===`test`;r&&n===`darwin`&&(o||a.push(N(`/Applications`,q6,e)),(!o||t.home!==void 0)&&a.push(N(i,`Applications`,q6,e))),a.push(we(new URL(`../dist/assets/skills/${e}`,import.meta.url))),a.push(we(new URL(`../assets/skills/${e}`,import.meta.url))),a.push(we(new URL(`./assets/skills/${e}`,import.meta.url)));for(let e of a)if(g(e))return e;throw Error(`Bundled skill asset directory not found for bundle '${e}'. Tried: ${a.join(`, `)}. This usually means the CLI build did not copy packages/server/assets into dist/assets. Run \`cd packages/cli && bun run build\` before publishing.`)}function Y6(e){return e.replace(/\\/g,`/`)}AX(`local-op-security`),AX(`installed-skills-marker`);function X6(e){return mn.filter(t=>g(N(e,t.hostDir)))}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),TR.cursor,TR.codex,TR[`claude-desktop`],V6(()=>{});function Z6(e,t){return[...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({editor:e,root:t})),{editor:`agents`,root:t}]}Z6(ln,bs),[...Z6(un,bs)].sort((e,t)=>{let n=i4.indexOf(e.editor),r=i4.indexOf(t.editor);return(n===-1?i4.length:n)-(r===-1?i4.length:r)||e.editor.localeCompare(t.editor)}),AX(`skill-import`),RegExp(`<(${HJ.map(e=>e.tagName).join(`|`)})\\b([^>]*)\\/>`,`y`);const dTe=String.raw`\[\[([^\n#[\]|]+)(?:#([^\n[\]|]+))?(?:\|([^\n[\]]+))?\]\]`,fTe=String.raw`\((<[^>\n]+>|[^)\s\n]+)((?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?)\)`,Q6=String.raw`([^\]\n]*)`,$6=String.raw`([^\]\n]*(?:\][^[\]\n]*)?)`,e8=e=>RegExp(`(!?)${dTe}`,e),t8=(e,t)=>RegExp(`(!?)\\[${e}\\]${fTe}`,t);e8(`y`),e8(`g`),t8(Q6,`y`),t8($6,`y`),t8(Q6,`g`),t8($6,`g`);const pTe=String.raw`(!?)\[([^\]\n]*)\](?:\[([^\]\n]*)\])?`;new RegExp(pTe,`y`);function n8(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}}const r8=AX(`content-filter`);Re(o);const i8=[`.claude`,`.cursor`,`.codex`,`.agents`,`.opencode`,`.pi`],a8=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`,...i8,`Library`,`Applications`,`.Trash`]),mTe=new Set([`.git`,`node_modules`,`.ok`,`.open-knowledge`,`.openknowledge`,...i8]),o8=new Set([`worktrees`,`local`]);function s8(e){let t=nu(e);if(!ru(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 hTe(e){throw Error(`[AttachmentFolderShape] unhandled variant: ${JSON.stringify(e)}`)}function gTe(e,t,n){let r=he(e).slice(1).toLowerCase();if(!ol.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 hTe(t)}function c8(e,t){let n=e.split(`/`);for(let e=0;e<n.length;e++){let r=n[e],i=r.toLowerCase()===`.ok`?`.ok`:r;if(mTe.has(i)&&!(t&&i===`.ok`&&!o8.has((n[e+1]??``).toLowerCase())))return!0}return!1}function l8(e){return e.startsWith(`${ys}/`)}function _Te(e){return e===`.ok`||e===`.ok/skills`||e.startsWith(`.ok/skills/`)}const u8=new Set([`.ok`,...i8]),vTe=new Set([...a8].filter(e=>!u8.has(e))),yTe=[`.git`,`node_modules`,`.ok/local`,`.ok/worktrees`].flatMap(e=>[e,`${e}/**`,`**/${e}`,`**/${e}/**`]);function bTe(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``).split(`/`);return t.includes(`..`)?!1:t.some(e=>vTe.has(e))?!0:t.some((e,n)=>e.toLowerCase()===`.ok`&&o8.has((t[n+1]??``).toLowerCase()))}const xTe=[`.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`,...i8.flatMap(e=>[e,`${e}/skills/example/SKILL.md`])];function STe(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(bTe(t))return!1;if(n.some(e=>u8.has(e)))return!0;try{let e=(0,s4.default)().add(t);return xTe.some(t=>e.ignores(t))}catch{return!0}}function CTe(e){let t=e.filter(e=>e.length>0&&!e.startsWith(`!`)&&!e.startsWith(`#`)&&!STe(e));return[...new Set([...t,...yTe])]}function d8(e,t){for(let n=0;n<t;n++)if(a8.has(e[n])||e[n].toLowerCase()===`.ok`)return!0;return!1}function f8(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:!d8(t,n-3)}function p8(e){let t=e.split(`/`),n=t.length;return t[n-1]===`.ok`?!d8(t,n-1):n>=2&&t[n-1]===`templates`&&t[n-2]===`.ok`&&!d8(t,n-2)}function wTe(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`))||f8(e)?!0:n>=2&&t[n-1]===`frontmatter.yml`&&t[n-2]===`.ok`&&!d8(t,n-2)}function TTe(e){return e===`.ok`||e===`.ok/schemas`||p8(e)}function ETe(e,t){for(let n of t)if(e===n||e.startsWith(`${n}/`))return!0;return!1}function m8(e,t){if(t.size===0)return!1;for(let n of t)if(e.startsWith(`${n}/`))return!0;return!1}function DTe(e,t){if(t.size===0)return!1;for(let n of t)if(n===e||n.startsWith(`${e}/`)||e.startsWith(`${n}/`))return!0;return!1}const OTe=new Set([`.ds_store`,`.localized`,`thumbs.db`,`desktop.ini`,`.directory`]);function h8(e){return OTe.has(e.slice(e.lastIndexOf(`/`)+1).toLowerCase())}const kTe=new Set([`.ssh`,`.aws`,`.gnupg`,`.kube`,`.docker`]);function g8(e){for(let t of e.split(`/`))if(kTe.has(t.toLowerCase()))return!0;return!1}const ATe=new Set([`credentials`,`.netrc`,`.npmrc`,`.pgpass`,`.git-credentials`]),jTe=[`.pem`,`.key`,`.p12`,`.pfx`,`.keystore`,`.jks`,`.ppk`];function _8(e){let t=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();if(t===`.env`||t.startsWith(`.env.`)||ATe.has(t)||t.startsWith(`id_rsa`)||t.startsWith(`id_ed25519`)||t.startsWith(`id_ecdsa`)||t.startsWith(`id_dsa`))return!0;for(let e of jTe)if(t.endsWith(e))return!0;return!1}function MTe(e,t){return t===e||t.startsWith(`${e}/`)}function NTe(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=n8(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 v8=[`.gitignore`,`.okignore`];function PTe(e,t){let n=FTe(e);if(n===null)return[];let r=[];y8(N(n,`info`,`exclude`),t,r,`info/exclude`);let i=ITe(e);return i&&y8(i,t,r,`global excludesfile`),r}function FTe(e){let t=l(`git`,[`rev-parse`,`--git-common-dir`],W6({cwd:e,encoding:`utf-8`,timeout:5e3}));return t.status!==0||!t.stdout?null:be(e,t.stdout.trim())}function ITe(e){let t=l(`git`,[`config`,`--get`,`--type=path`,`core.excludesfile`],W6({cwd:e,encoding:`utf-8`,timeout:5e3}));if(t.status===0&&t.stdout){let e=t.stdout.trim();if(e)return e}return LTe()}function LTe(){let e=process.env.XDG_CONFIG_HOME?.trim(),t=e&&e.length>0?e:N(k(),`.config`);return N(t,`git`,`ignore`)}function y8(e,t,n,r){if(g(e))try{let r=S(e,`utf-8`);t.value+=r.length,n.push(...x8(r))}catch(t){r8.warn({path:e,err:t},`Failed to read ${r} at ${e}`)}}function RTe(e){let{projectDir:t,contentDir:n,onAfterRebuild:r,singleDocRelPath:i}=e,a=e.inPlaceSkillDirs??new Set,o=s8(e.attachmentFolderPath??`./`),s=e.skillRootPaths??new Set,c=NTe(t,n,i),l=Y6(ye(t,n)),u=l.startsWith(`..`),d,f,p,m,h=0,_=0,v=0;function y(){let e=(0,s4.default)(),r=(0,s4.default)();e.add(`.git`);let i=[],a=0,o=0;for(let n of v8){let o=N(t,n);if(g(o))try{let t=S(o,`utf-8`);a+=t.length;let s=x8(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 v8){let i=N(n,t);if(g(i))try{let n=S(i,`utf-8`);a+=n.length,o++;let s=x8(n).map(e=>S8(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+=C8(n,t,e,r,s),a=s.value;let c=PTe(t,s);a=s.value,c.length>0&&(i.push(...c),e.add(c));let y=CTe(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&&b8(n,``,x,b)};T();function E(e){return sTe(nTe(e))}function D(e){for(let t of e.split(`/`))if(a8.has(t))return!0;return!u&&x(e)}let O=null,ee=null;return{isExcluded(e,t){if(E(e)||_8(e)||g8(e)||c.isInside(e,t?.syncScope)||!t?.bypassFilters&&ETe(e,s)&&!m8(e,a))return!0;if(!t?.bypassFilters&&(l8(e)||m8(e,a)&&!x(e))){if(i!==void 0)return e!==i;if(U6(e))return!1;let t=he(e).slice(1).toLowerCase();return!ol.has(t)}if(!t?.bypassFilters&&f8(e)||!t?.bypassFilters&&t?.syncScope!==void 0&&wTe(C(e,t.syncScope))&&!x(e,t.syncScope))return i!==void 0&&e!==i;if(c8(e,t?.showOk)||h8(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(U6(e)||gTe(e,o,e=>(b.get(e)??0)>0))return!1;let n=he(e).slice(1).toLowerCase();if(ol.has(n)){let t=M(e),n=t===`.`?``:t;if((b.get(n)??0)>0)return!1}return!0},isDirExcluded(e,t){if(g8(e)||c.isInside(e,t?.syncScope))return!0;if(!t?.bypassFilters&&(_Te(e)||p8(e)||t?.syncScope!==void 0&&TTe(C(e,t.syncScope))||DTe(e,a)))return!1;if(c8(e,t?.showOk))return!0;if(i!==void 0)return!MTe(e,i);if(t?.bypassFilters)return t.respectOkignore===!0&&(w(e)||w(`${e}/`));for(let t of e.split(`/`))if(a8.has(t))return!0;return u?!1:x(e,t?.syncScope)||x(`${e}/`,t?.syncScope)},isPathIgnored(e,t){return E(e)||_8(e)||g8(e)?!0:l8(e)||m8(e,a)&&!x(e)||f8(e)?!1:c8(e)||h8(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=s8(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(`
813
813
  `)},peekFreshInPlaceSkillDirsFingerprint(){if(!e.rescanInPlaceSkillDirs)return[...a].sort().join(`
814
814
  `);try{return[...e.rescanInPlaceSkillDirs()].sort().join(`
815
815
  `)}catch{return[...a].sort().join(`
816
- `)}},async rebuildIgnorePatterns(){let t=e=>(O=e().finally(()=>{O=null}),O),o=async()=>{if(c.reset(),e.rescanInPlaceSkillDirs)try{a=e.rescanInPlaceSkillDirs()}catch(e){t8.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 $we(`config.ignore.rebuild`,{attributes:{}},async e=>{try{let t=y();b.clear(),i===void 0&&await RTe(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}),t8.info({patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:a},`content-filter rebuild succeeded`),r)try{r()}catch(e){t8.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){t8.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 t8.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 RTe(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){t8.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(r8.has(i.name)||t(o)||t(`${o}/`))continue;r.push({dir:N(e,i.name),relPath:o})}else i.isFile()&&U6(i.name)&&!t(o)&&n.set(a,(n.get(a)??0)+1)}}}function v8(e,t,n,r){let i;try{i=w(e,{withFileTypes:!0})}catch(t){t8.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(r8.has(a.name)||n(i)||n(`${i}/`))continue;v8(N(e,a.name),i,n,r)}else a.isFile()&&U6(a.name)&&!n(i)&&r.set(t,(r.get(t)??0)+1)}}function y8(e){return e.split(`
817
- `).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`#`))}function b8(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 x8(e,t,n,r,i){let a;try{a=w(e,{withFileTypes:!0})}catch(t){return t8.warn({dir:e,err:t},`Failed to read directory ${e}`),0}let o=0;for(let s of a){if(!s.isDirectory()||r8.has(s.name))continue;let a=N(e,s.name),c=Y6(ye(t,a));if(!c.startsWith(`..`)&&!(n.ignores(c)||n.ignores(`${c}/`))){for(let e of g8){let t=N(a,e);if(g(t))try{let a=S(t,`utf-8`);i.value+=a.length;let s=y8(a).map(e=>b8(e,c));n.add(s),e===`.okignore`&&r.add(s),o++}catch(n){t8.warn({path:t,err:n},`Failed to read nested ${e} at ${t}`)}}o+=x8(a,t,n,r,i)}}return o}AX(`mermaid-validator`);function S8(e){return mn.filter(t=>g(N(e,t.hostDir)))}function C8(e,t){return[...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({editor:e,root:t})),{editor:`agents`,root:t}]}C8(ln,bs),[...C8(un,bs)].sort((e,t)=>{let n=i4.indexOf(e.editor),r=i4.indexOf(t.editor);return(n===-1?i4.length:n)-(r===-1?i4.length:r)||e.editor.localeCompare(t.editor)}),AX(`backlinks`),AX(`tag-index`),AX(`derived-document-index`),AX(`external-change-attribution`),AX(`file-watcher`),new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}},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),TR.cursor,TR.codex,TR[`claude-desktop`],V6(()=>{});const w8={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),...w8,propertyKey:F().min(1).optional(),propertyPath:z(V([F(),I().int().nonnegative()])).optional(),body:F(),queue:L().optional(),summary:F().optional()});const T8=bne();po(`action`,[B({action:W(`edit`),id:T8,body:F(),summary:F().optional()}),B({action:W(`resolve`),id:T8,summary:F().optional()}),B({action:W(`reopen`),id:T8,summary:F().optional()}),B({action:W(`replace`),id:T8,...w8,summary:F().optional()}),B({action:W(`queue`),id:T8,summary:F().optional()}),B({action:W(`unqueue`),id:T8,summary:F().optional()}),B({action:W(`dispatch-prepare`),id:T8,summary:F().optional()}),B({action:W(`dispatch-complete`),id:T8,summary:F().optional()}),B({action:W(`dispatch-prepare-batch`),ids:z(T8).min(1).max(200),summary:F().optional()}),B({action:W(`dispatch-complete-batch`),ids:z(T8).min(1).max(200),summary:F().optional()})]),AX(`embeddings`),AX(`embeddings`);function zTe(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,``);return`${t.protocol}//${t.host.toLowerCase()}${n}`}catch{return e.trim().replace(/\/+$/,``)}}zTe(Kl),AX(`embeddings`),AX(`embeddings`);const BTe=/^[A-Za-z0-9-]{8,64}$/;let E8=null;function VTe(e){return N(e??k(),`.ok`,`machine-id`)}function HTe(e){if(e===void 0&&E8!==null)return E8;let t=VTe(e),n=null;try{let e=S(t,`utf-8`).trim();BTe.test(e)&&(n=e)}catch{}if(n===null){n=Pe();try{v(M(t),{recursive:!0}),re(t,`${n}\n`,{encoding:`utf-8`,mode:384})}catch(e){AX(`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&&(E8=n),n}AX(`process-lock`);function UTe(e,t){return be(e,`${t}.lock`)}function WTe(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 GTe(e,t){if(typeof e.url==`string`&&e.url.length>0){let t=WTe(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}AX(`asset-references`),AX(`file-ops`),AX(`upload-streaming`);const D8="Absolute host path inside the target OpenKnowledge project. Required when the MCP server is registered globally (e.g. `npx @inkeep/open-knowledge mcp` once at the host level, routing per call), unless the MCP client advertises exactly one root via the `roots` capability — that single root is then used as the implicit `cwd`. Optional when the server is anchored to a single project (the per-project HTTP MCP server defaults to its configured project root).";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 KTe=B({value:F(),truncatedFrom:I().optional(),hint:F().optional()}).describe(`Normalized change-note summary, when one was recorded.`),qTe=z(H(F(),R()));H(F(),R()).optional().describe("Preview-attach hint (`{ action, previewUrl?, message? }`) when relevant."),z(DJ).describe('Outbound internal links in the just-written doc that do not resolve. Always present — `[]` means every link resolves. 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.'),KTe.optional(),z(TJ).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 JTe=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 O8(e){return{text:JTe,...e}}AX(`git-checkout`),AX(`git-worktree-status`),AX(`git-context`),AX(`rename-log`),AX(`managed-artifact-persistence`),AX(`timeline`),AX(`suggest-links`);function k8(e){try{return E.native(e)}catch{return e}}AX(`local-op-security`),AX(`clone-flow`),Re(o),G6.project,Object.fromEntries(Object.entries(xs).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(`
818
- `),AX(`skills-leaderboard`),AX(`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(),AX(`link-preview.guarded-fetch`),AX(`link-preview.cache`),AX(`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(),AX(`managed-rename`),Object.assign($Se,{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`}),AX(`search`),AX(`skill-import`),AX(`skill-install`),AX(`history`),AX(`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(),AX(`conflict-storage`),new Ve,V6(()=>{}),[`[Requires: Hocuspocus server] Unified validation audit: every content problem — markdown-lint violations AND broken internal links — in one read-only call, grouped by the file to fix.`,``,"- No args → audit every in-scope `.md`/`.mdx` doc; pass `path` to scope to a folder or a single file.","- The result reports `ran`, the source families selected for this run. Project audit can report `markdownlint`, `frontmatter`, `okf`, and `links`. A family absent from `ran` was not checked. `okf` covers both document and project-tree OKF checks here.","- A selected family stays in `ran` if it degrades, with the reason in `warnings`. A partial degradation may still have contributed findings.","- To CHECK whether links resolve, use this tool: each broken link is reported under the SOURCE doc that contains it, at the offending line. (The `links` tool is the navigation/graph reader — backlinks, forward links, orphans, hubs — not the validation surface.)",``,"Each diagnostic carries a `source` naming the validator ('markdownlint' rule violations; 'links' broken internal links), a `code` (e.g. MD010, dead-link), `message`, a 0-based LSP `range` (for links: line exact, column approximate), and `severity` ('error' | 'warning' — broken links default to warnings; the project's `validation.links` setting can raise them to errors or hide them). Only files with at least one problem are listed, plus `fileCount`/`errorCount`/`warningCount` totals. Output (text and structured) is capped at 10 files × 10 diagnostics per file and project-wide at 10 warnings, with explicit '… and N more' indicators and `omittedWarningCount` when warnings are dropped; the counts always reflect the full scan — re-run with `path` scoped to a folder or file to see what was omitted.",``,"Read-only: nothing is modified. Auto-fix fixable lint findings with `lint({ document, fix: true })`; broken links need content edits via `edit`/`write`."].join(`
816
+ `)}},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 eTe(`config.ignore.rebuild`,{attributes:{}},async e=>{try{let t=y();b.clear(),i===void 0&&await zTe(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 zTe(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(a8.has(i.name)||t(o)||t(`${o}/`))continue;r.push({dir:N(e,i.name),relPath:o})}else i.isFile()&&U6(i.name)&&!t(o)&&n.set(a,(n.get(a)??0)+1)}}}function b8(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(a8.has(a.name)||n(i)||n(`${i}/`))continue;b8(N(e,a.name),i,n,r)}else a.isFile()&&U6(a.name)&&!n(i)&&r.set(t,(r.get(t)??0)+1)}}function x8(e){return e.split(`
817
+ `).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`#`))}function S8(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 C8(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()||a8.has(s.name))continue;let a=N(e,s.name),c=Y6(ye(t,a));if(!c.startsWith(`..`)&&!(n.ignores(c)||n.ignores(`${c}/`))){for(let e of v8){let t=N(a,e);if(g(t))try{let a=S(t,`utf-8`);i.value+=a.length;let s=x8(a).map(e=>S8(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+=C8(a,t,n,r,i)}}return o}AX(`mermaid-validator`),AX(`backlinks`),AX(`tag-index`),AX(`derived-document-index`),AX(`external-change-attribution`),AX(`file-watcher`),new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}};const w8={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),...w8,propertyKey:F().min(1).optional(),propertyPath:z(V([F(),I().int().nonnegative()])).optional(),body:F(),queue:L().optional(),summary:F().optional()});const T8=bne();po(`action`,[B({action:W(`edit`),id:T8,body:F(),summary:F().optional()}),B({action:W(`resolve`),id:T8,summary:F().optional()}),B({action:W(`reopen`),id:T8,summary:F().optional()}),B({action:W(`replace`),id:T8,...w8,summary:F().optional()}),B({action:W(`queue`),id:T8,summary:F().optional()}),B({action:W(`unqueue`),id:T8,summary:F().optional()}),B({action:W(`dispatch-prepare`),id:T8,summary:F().optional()}),B({action:W(`dispatch-complete`),id:T8,summary:F().optional()}),B({action:W(`dispatch-prepare-batch`),ids:z(T8).min(1).max(200),summary:F().optional()}),B({action:W(`dispatch-complete-batch`),ids:z(T8).min(1).max(200),summary:F().optional()})]),AX(`embeddings`),AX(`embeddings`);function BTe(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,``);return`${t.protocol}//${t.host.toLowerCase()}${n}`}catch{return e.trim().replace(/\/+$/,``)}}BTe(Kl),AX(`embeddings`),AX(`embeddings`);const VTe=/^[A-Za-z0-9-]{8,64}$/;let E8=null;function HTe(e){return N(e??k(),`.ok`,`machine-id`)}function UTe(e){if(e===void 0&&E8!==null)return E8;let t=HTe(e),n=null;try{let e=S(t,`utf-8`).trim();VTe.test(e)&&(n=e)}catch{}if(n===null){n=Pe();try{v(M(t),{recursive:!0}),re(t,`${n}\n`,{encoding:`utf-8`,mode:384})}catch(e){AX(`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&&(E8=n),n}AX(`process-lock`);function WTe(e,t){return be(e,`${t}.lock`)}function GTe(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 KTe(e,t){if(typeof e.url==`string`&&e.url.length>0){let t=GTe(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}AX(`asset-references`),AX(`file-ops`),AX(`upload-streaming`);const D8="Absolute host path inside the target OpenKnowledge project. Required when the MCP server is registered globally (e.g. `npx @inkeep/open-knowledge mcp` once at the host level, routing per call), unless the MCP client advertises exactly one root via the `roots` capability — that single root is then used as the implicit `cwd`. Optional when the server is anchored to a single project (the per-project HTTP MCP server defaults to its configured project root).";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 qTe=B({value:F(),truncatedFrom:I().optional(),hint:F().optional()}).describe(`Normalized change-note summary, when one was recorded.`),JTe=z(H(F(),R()));H(F(),R()).optional().describe("Preview-attach hint (`{ action, previewUrl?, message? }`) when relevant."),z(DJ).describe('Outbound internal links in the just-written doc that do not resolve. Always present — `[]` means every link resolves. 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.'),qTe.optional(),z(TJ).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 YTe=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 O8(e){return{text:YTe,...e}}AX(`git-checkout`),AX(`git-worktree-status`),AX(`git-context`),AX(`rename-log`),AX(`managed-artifact-persistence`),AX(`timeline`),AX(`suggest-links`);function k8(e){try{return E.native(e)}catch{return e}}AX(`clone-flow`),Re(o),G6.project,Object.fromEntries(Object.entries(xs).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(`
818
+ `),AX(`skills-leaderboard`),AX(`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(),AX(`link-preview.guarded-fetch`),AX(`link-preview.cache`),AX(`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(),AX(`managed-rename`),Object.assign(eCe,{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`}),AX(`search`),AX(`skill-install`),AX(`history`),AX(`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(),AX(`conflict-storage`),new Ve,V6(()=>{}),[`[Requires: Hocuspocus server] Unified validation audit: every content problem — markdown-lint violations AND broken internal links — in one read-only call, grouped by the file to fix.`,``,"- No args → audit every in-scope `.md`/`.mdx` doc; pass `path` to scope to a folder or a single file.","- The result reports `ran`, the source families selected for this run. Project audit can report `markdownlint`, `frontmatter`, `okf`, and `links`. A family absent from `ran` was not checked. `okf` covers both document and project-tree OKF checks here.","- A selected family stays in `ran` if it degrades, with the reason in `warnings`. A partial degradation may still have contributed findings.","- To CHECK whether links resolve, use this tool: each broken link is reported under the SOURCE doc that contains it, at the offending line. (The `links` tool is the navigation/graph reader — backlinks, forward links, orphans, hubs — not the validation surface.)",``,"Each diagnostic carries a `source` naming the validator ('markdownlint' rule violations; 'links' broken internal links), a `code` (e.g. MD010, dead-link), `message`, a 0-based LSP `range` (for links: line exact, column approximate), and `severity` ('error' | 'warning' — broken links default to warnings; the project's `validation.links` setting can raise them to errors or hide them). Only files with at least one problem are listed, plus `fileCount`/`errorCount`/`warningCount` totals. Output (text and structured) is capped at 10 files × 10 diagnostics per file and project-wide at 10 warnings, with explicit '… and N more' indicators and `omittedWarningCount` when warnings are dropped; the counts always reflect the full scan — re-run with `path` scoped to a folder or file to see what was omitted.",``,"Read-only: nothing is modified. Auto-fix fixable lint findings with `lint({ document, fix: true })`; broken links need content edits via `edit`/`write`."].join(`
819
819
  `),[`[Requires: Hocuspocus server] Save a project-wide checkpoint of every document — a single restore point you can return to.`,``,`**Parameters:**`,'- `summary` — Optional one-line label for the checkpoint (≤80 chars). Defaults to "Checkpoint version". Appears as the checkpoint subject in `history`. Avoid secrets or PII — persisted to git history.',``,"Returns `{ version }` — the 40-char checkpoint SHA. Find checkpoints later via `history`; restore a single doc with `restore_version({ document, version })`."].join(`
820
820
  `),[`[Operates on disk; no running OK server required] Read the effective merged OpenKnowledge config (defaults → user → project).`,``,`Use this when you need to inspect the config mid-session — e.g., after a write that may have changed disk state, or to re-confirm the value of a field before reading it again.`,``,"Read returns the FULL merged config or a sub-tree when `key` is provided. There is no allowlist on reads — every field is readable.",``,"Note: the `server.*`, `mcp.*`, and `github.*` config sub-trees, plus `preview.baseUrl` and `preview.scriptSrc`, were removed; their values are now built-in constants in `@inkeep/open-knowledge-core` (or, for the preview iframe, a fixed open network policy). Reading those keys returns `exists: false`. (`appearance.preview.autoOpen` is still a live key.)",``,"This tool is a pure READ. Folder-level skill topology (link / unlink / add-root) moved to the `install` tool's `skillFolders` argument, so this one keeps its read-only annotation and stays auto-approvable.",``,`**Parameters:**`,'- `key` (optional) — Dotted config key. `"content"` returns the content sub-tree; `"appearance.theme"` returns just that leaf. Omit for full config.',"- `cwd` (optional) — Project root (see `cwd` description below)."].join(`
821
821
  `),F().optional().describe(`Dotted config key (e.g. "appearance.theme"). Omit to return the full merged config.`),F().optional().describe(D8),O8({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).`)}),["[Requires: Hocuspocus server] Read Git merge conflicts and local stale external-write conflicts. Dispatches on `kind`:",``,'- `kind: "list"` — enumerate every tracked conflict. Returns `{ list: [{ file, detectedAt, conflictKind, ... }] }` (empty when none). The entry point to the resolve flow.','- `kind: "content"` — fetch the versions for one `file`. Returns `{ content: { file, base, ours, theirs, shape, conflictKind, lifecycleStatus } }`. `ours` reflects the live Y.Text (what the human sees) when the doc is loaded server-side.','- `conflictKind: "git"` uses Git versions. `conflictKind: "stale-external-write"` means a known older disk version was refused: `base` is the last reconciled version, `ours` is the protected live or recovered version, and `theirs` is the rejected disk version. Resolving this local conflict does not create a Git commit.','- A Git list entry with `variant: "working-tree"` is a local overlay conflict: resolution changes the working tree without a resolution commit. Other Git entries use index stages and commit only when the last conflict clears. The content response does not distinguish these two Git variants; inspect the list entry.',``,`**Parameters:**`,"- `kind` — `list` | `content`.",'- `file` — Required for `kind: "content"`. Relative path WITH the `.md`/`.mdx` extension (e.g. `notes/sso.md`) — git stages key on the exact path, so do NOT strip the extension.',``,"The `shape` field discriminates the conflict: `both-modified` (both sides edited), `delete-modify` (you deleted, they edited — `ours` empty), or `modify-delete` (you edited, they deleted — `theirs` empty). Use it to pick the `resolve_conflict` strategy."].join(`
822
- `);const YTe=[`lock`],XTe=V([hs,oo()]),ZTe=V([F(),I(),L(),z(R()),H(F(),R()),oo()]);H(F(),ZTe).superRefine((e,t)=>{for(let[n,r]of Object.entries(e))XTe.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(wR).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(vs).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.`),["Delete one thing. Pass EXACTLY ONE of `document`, `folder`, `template`, `skill`, or `asset`.",``,"- `document` — Doc path(s) to delete (a single path or an array). Inbound links become redlinks. Irreversible. [Requires: Hocuspocus server]","- `folder` — Folder path to delete (recursive). [Requires: Hocuspocus server]",'- `template` — `{ path: "<folder>/<name>" }` — a template to delete (server-routed, attributed; auto-cleans empty `.ok/`). [Requires: Hocuspocus server]','- `skill` — `{ name }` deletes a whole SKILL; `{ name, files: ["references/x.md"] }` deletes specific bundle files (server-routed, attributed; auto-cleans empty `.ok/`). [Requires: Hocuspocus server]','- `asset` — `{ path: "<folder>/<file.ext>" }` — a binary asset to delete. [Requires: Hocuspocus server]',``,'Call `links({ kind: "backlinks", document })` BEFORE deleting a doc to see what links here.'].join(`
822
+ `);const XTe=[`lock`],ZTe=V([hs,oo()]),QTe=V([F(),I(),L(),z(R()),H(F(),R()),oo()]);H(F(),QTe).superRefine((e,t)=>{for(let[n,r]of Object.entries(e))ZTe.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(wR).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(vs).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.`),["Delete one thing. Pass EXACTLY ONE of `document`, `folder`, `template`, `skill`, or `asset`.",``,"- `document` — Doc path(s) to delete (a single path or an array). Inbound links become redlinks. Irreversible. [Requires: Hocuspocus server]","- `folder` — Folder path to delete (recursive). [Requires: Hocuspocus server]",'- `template` — `{ path: "<folder>/<name>" }` — a template to delete (server-routed, attributed; auto-cleans empty `.ok/`). [Requires: Hocuspocus server]','- `skill` — `{ name }` deletes a whole SKILL; `{ name, files: ["references/x.md"] }` deletes specific bundle files (server-routed, attributed; auto-cleans empty `.ok/`). [Requires: Hocuspocus server]','- `asset` — `{ path: "<folder>/<file.ext>" }` — a binary asset to delete. [Requires: Hocuspocus server]',``,'Call `links({ kind: "backlinks", document })` BEFORE deleting a doc to see what links here.'].join(`
823
823
  `),[...SJ],`${["Edit one thing in place. Pass EXACTLY ONE of `document`, `folder`, `template`, or `skill`. Within each: a body edit (`find` + `replace`) OR a metadata patch — not both in one call.",``,"- `document` — Edit a doc [Requires: Hocuspocus server]. Body: `{ path, find, replace, occurrence? }` (occurrence = which match, 1 = first). Metadata: `{ path, frontmatter }` (merge-patch; `null` deletes a key). Body find/replace is body-only; frontmatter-intersecting finds are rejected.","- `folder` — Edit a folder (folders have no body): `{ path, frontmatter }` (merge-patch).",'- `template` — Edit a template: `{ path: "<folder>/<name>", ... }`; body `find`/`replace`/`occurrence?` or metadata `frontmatter`.',"- `skill` — Edit a SKILL: `{ name, ... }`; body `find`/`replace`/`occurrence?` OR a `description` change (a skill's only metadata leaf). Every recorded copy re-syncs from the source, so there is nothing to re-install.","- `summary` — Optional one-line user-outcome (≤80 chars) recorded in the timeline for any `document`, `folder`, `template`, or `skill` edit. Avoid secrets or PII — persisted to git history.",``,'Responses may include `structuredContent.document.warnings` — advisory entries discriminated by `kind`: `content-divergence` / `disk-edit-reconciled` (write-integrity — re-read the doc with `exec("cat <path>")`) and `mermaid-parse-error` (the edit landed but that fence will not render — fix it and re-edit).'].join(`
824
- `)}${qJ()}`;const QTe=[`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(QTe),AX(`mcp:exec`),["**STOP — when the project has `.ok/`, do NOT use native `Read`/`Grep`/`Glob` on in-scope `.md`/`.mdx`; use `exec` (this tool).** Native tools skip the frontmatter, backlinks, unresolved comments, shadow-repo activity, and git history `exec` returns per wiki file. Reserve native tools for source code, non-markdown, and projects without `.ok/`. (Full rule + escape hatch: the `open-knowledge` skill.)",``,`Run a read-only bash-like command against the project content directory. Returns raw stdout plus enriched metadata for every wiki file referenced (frontmatter, backlink/forward-link counts, shadow-repo activity with agent/human attribution).`,``,"`⚠ N unresolved comment(s)` = open human review requests — factor in before editing, and report them.",``,"Allowlist: cat, ls, grep, find, head, tail, wc, sort, uniq, cut. One command or a pipe (|) per call — NOT a shell: `&&`, `;`, subshells, writes, and ALL redirection are rejected, `<` too (read via `cat a.md`, not `< a.md`). For several things use separate exec calls or multiple paths (`cat a b c`).",``,"cwd: the command runs in the explicit absolute `cwd` you pass, or in the MCP client's only advertised root when there is exactly one. If the client has zero or multiple roots, pass `cwd` explicitly. Paths inside the command resolve relative to that cwd; traversal above it is rejected.",``,"Stdout provenance headers (GNU-style): `ls <dir>/` prepends `<dir>/:`, single-file `cat`/`head`/`tail` prepends `==> <path> <==`. Multi-file `cat a b` emits no header — the `enrichedPaths` array still lists every file. `head`/`tail` used as pipe trimmers (no file arg) defer to the upstream producer.",``,`Examples:`,'- `exec({ command: "cat articles/auth.md" })` — file contents + full enrichment','- `exec({ command: "ls articles/" })` — listing + per-file enrichment (slim)','- `exec({ command: "grep -rn oauth articles/ | head -5" })` — pipe with enrichment on matched files','- `exec({ command: "ls", cwd: "/abs/path/to/other-repo" })` — run in a different project'].join(`
824
+ `)}${qJ()}`;const $Te=[`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($Te),AX(`mcp:exec`),["**STOP — when the project has `.ok/`, do NOT use native `Read`/`Grep`/`Glob` on in-scope `.md`/`.mdx`; use `exec` (this tool).** Native tools skip the frontmatter, backlinks, unresolved comments, shadow-repo activity, and git history `exec` returns per wiki file. Reserve native tools for source code, non-markdown, and projects without `.ok/`. (Full rule + escape hatch: the `open-knowledge` skill.)",``,`Run a read-only bash-like command against the project content directory. Returns raw stdout plus enriched metadata for every wiki file referenced (frontmatter, backlink/forward-link counts, shadow-repo activity with agent/human attribution).`,``,"`⚠ N unresolved comment(s)` = open human review requests — factor in before editing, and report them.",``,"Allowlist: cat, ls, grep, find, head, tail, wc, sort, uniq, cut. One command or a pipe (|) per call — NOT a shell: `&&`, `;`, subshells, writes, and ALL redirection are rejected, `<` too (read via `cat a.md`, not `< a.md`). For several things use separate exec calls or multiple paths (`cat a b c`).",``,"cwd: the command runs in the explicit absolute `cwd` you pass, or in the MCP client's only advertised root when there is exactly one. If the client has zero or multiple roots, pass `cwd` explicitly. Paths inside the command resolve relative to that cwd; traversal above it is rejected.",``,"Stdout provenance headers (GNU-style): `ls <dir>/` prepends `<dir>/:`, single-file `cat`/`head`/`tail` prepends `==> <path> <==`. Multi-file `cat a b` emits no header — the `enrichedPaths` array still lists every file. `head`/`tail` used as pipe trimmers (no file arg) defer to the upstream producer.",``,`Examples:`,'- `exec({ command: "cat articles/auth.md" })` — file contents + full enrichment','- `exec({ command: "ls articles/" })` — listing + per-file enrichment (slim)','- `exec({ command: "grep -rn oauth articles/ | head -5" })` — pipe with enrichment on matched files','- `exec({ command: "ls", cwd: "/abs/path/to/other-repo" })` — run in a different project'].join(`
825
825
  `),["Resolve the browser-reachable preview URL for an OpenKnowledge project (optionally for a specific doc). Opening a preview counts as demand: when no OK server is running for the project, this call auto-starts one (same `OK_MCP_AUTOSTART` gate and spawn timeout as the read/write tools) and waits briefly for the preview UI to bind — a cold first call can take a few seconds; calls against a running system answer immediately.",``,"Per-response `previewUrl` fields on read/write tools are ROUTE-ONLY (`/#/<doc>`, no host:port) — they identify which doc to preview, not a URL to open by itself. Call this tool to get the full, openable URL.",``,"This is THE way to open a doc OR a loose file in a browser, and the only way to force a browser when the OK Desktop app is installed (the `ok open` CLI prefers Desktop). Use it when YOUR host opens the URL itself: navigate your in-app / embedded browser to the returned `url`, or — only on a stdio host with no browser tool — `open` it in the system browser. Do not hunt for the URL via `ok ps`/`ok status` or by guessing a port — this tool returns it. Claude Code Desktop opens its in-app Browser pane with `preview_start({url})` then `navigate({url})` to move; a pure stdio CLI with no browser uses `ok open <doc>` to open in the OK Desktop app.",``,"If you are running INSIDE an OpenKnowledge surface — the desktop app’s built-in terminal or its in-app agent panel — the response leads with an `ok open …` steer and returns it as `okOpenCommand`. Run that instead: the user is already looking at the app, so a localhost URL in your reply is noise at best and a dead link at worst. Never paste `url` into your answer in that case.",``,"Returns `{ url: null, baseUrl: null, running: false, autoOpen }` + a recovery hint only when no UI could be reached (auto-start disabled via `OK_MCP_AUTOSTART=0`, no spawn authority in this registration, or the UI did not bind in time) — the hint names the right command for the actual state.",``,"To open a single markdown file that may live OUTSIDE any Open Knowledge project (a loose file, or a doc in a different git worktree), pass `file` with an absolute path: the tool finds the running session whose content directory contains it and returns that session’s URL, then navigate your in-app browser there. `document`/`folder` are for a doc in the current project; `file` is the out-of-project form.",``,`**Parameters:**`,"- `document` (optional) — Extension-less doc path in the current project (e.g. `specs/foo/SPEC`). Omit for the UI root URL.","- `folder` (optional) — Folder path in the current project (e.g. `specs/foo`); returns the `…/#/<folder>/` route. Mutually exclusive with `document`.","- `skill` (optional) — A skill to open in the editor: `{ name, scope? }` (scope `project` default). Returns the `…/#/__skill__/<scope>/<name>` route. Mutually exclusive with `document`/`folder`/`file`.","- `file` (optional) — Absolute path to a single markdown file, including one outside any project. Resolves to the running single-file / worktree session serving it. Mutually exclusive with `document`/`folder`/`skill`; `cwd` is ignored when set.","- `cwd` (optional) — Project root (see `cwd` description below)."].join(`
826
- `),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(She,`Skill name must be lowercase letters, digits, and hyphens only.`).describe(`Skill name (the bundle-dir identity, wherever the skill lives).`),scope:U(vs).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(D8),O8({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:qTe.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.`)}),[`[Requires: Hocuspocus server] List version history for a document, or the activity timeline for a folder.`,`Returns timeline entries from the shadow repo, sorted by timestamp descending.`,"Each entry carries a `version` (40-char commit SHA) you pass straight to `restore_version({ document, version })` — same field name on both sides.",``,"**Parameters (pass EXACTLY ONE of `document` / `folder` / `skill`):**","- `document` — Document name to query history for, typically without extension. A trailing `.md` or `.mdx` is stripped automatically.",'- `folder` — Folder path for the FOLDER timeline: attributed activity over the folder\'s `.ok/` artifacts (templates + frontmatter) — who created / edited / renamed / moved / deleted them, when. `""` = project root.',"- `skill` — Skill NAME to query version history for (the skill folder's attributed versions). PROJECT-scope skills only — global skills are unversioned. Pass an entry's `version` to `restore_version({ skill, version })`.","- `branch` (optional) — Branch name (default: current branch)","- `limit` (optional) — Maximum entries to return (default 50, max 200)","- `offset` (optional) — Number of entries to skip for pagination (default 0)",'- `kind` (optional) — Filter by entry type: "checkpoint", "upstream", or "wip"',"- `author` (optional) — Filter to entries by this author name or email","- `excludeAuthor` (optional) — Exclude entries by this author name or email"].join(`
826
+ `),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(She,`Skill name must be lowercase letters, digits, and hyphens only.`).describe(`Skill name (the bundle-dir identity, wherever the skill lives).`),scope:U(vs).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(D8),O8({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:JTe.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.`)}),[`[Requires: Hocuspocus server] List version history for a document, or the activity timeline for a folder.`,`Returns timeline entries from the shadow repo, sorted by timestamp descending.`,"Each entry carries a `version` (40-char commit SHA) you pass straight to `restore_version({ document, version })` — same field name on both sides.",``,"**Parameters (pass EXACTLY ONE of `document` / `folder` / `skill`):**","- `document` — Document name to query history for, typically without extension. A trailing `.md` or `.mdx` is stripped automatically.",'- `folder` — Folder path for the FOLDER timeline: attributed activity over the folder\'s `.ok/` artifacts (templates + frontmatter) — who created / edited / renamed / moved / deleted them, when. `""` = project root.',"- `skill` — Skill NAME to query version history for (the skill folder's attributed versions). PROJECT-scope skills only — global skills are unversioned. Pass an entry's `version` to `restore_version({ skill, version })`.","- `branch` (optional) — Branch name (default: current branch)","- `limit` (optional) — Maximum entries to return (default 50, max 200)","- `offset` (optional) — Number of entries to skip for pagination (default 0)",'- `kind` (optional) — Filter by entry type: "checkpoint", "upstream", or "wip"',"- `author` (optional) — Filter to entries by this author name or email","- `excludeAuthor` (optional) — Exclude entries by this author name or email"].join(`
827
827
  `),[`[Requires: Hocuspocus server] Import a skill into this project as versioned content.`,``,"Fetches an agentskills.io / skills.sh skill-dir from a `source` and writes it into the vendor-neutral `.agents/skills/<name>/` hub — where it gains history, search, attribution, and cross-harness projection (via `install`) for free. Provenance (source, commit, content hash, publisher) is recorded in `.ok/skills-lock.json`. Scripts are imported as content and are NEVER executed. `add` says where it goes — an import always places the skill somewhere, so `install` afterwards is only for changing WHERE it lives (add/remove/convert/source).",``,`**Parameters:**`,"- `source` — paste the 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), or pass `owner/repo[/subpath]` (GitHub), a git URL, or a local / `file://` path.","- `skill` — Pick ONE skill when the source bundles several.","- `scope` — `project` (default, versioned + shared) or `global` (user-global, unversioned).",``,"On a name collision with an existing skill the import lands under `<name>-imported` (never overwrites). An identical re-import (same content hash) is a no-op."].join(`
828
828
  `),['[Requires: Hocuspocus server] Manage WHERE a skill is available. A skill is ONE real folder (its SOURCE — the skill itself) plus managed copies/symlinks at other locations. `add`/`remove` change the other locations; `mode` flips copies↔symlinks; `source` moves the real folder. There is NO "uninstall everywhere" and no draft state — a skill with no extra locations still lives (and loads) at its source folder; to make a skill stop existing, use `delete`.',``,"Location ids: editor host ids (`claude` | `cursor` | `codex` | `copilot` | `opencode` | `pi`), `agents` (the vendor-neutral `.agents/skills` hub), or a base-relative custom root path containing `/` (e.g. `.team/skills`; home-relative at global scope). The source is validated FIRST — a SKILL.md with git conflict markers, missing/invalid frontmatter, XML tags in name/description, or a reserved `open-knowledge*` name is refused (never fanned into your agent context).",``,`**Parameters:**`,'- `name` — Skill name — the skill\'s identity AND its bundle-dir name, wherever the skill lives (e.g. `.agents/skills/<name>/`). Lowercase letters, digits, hyphens only (≤64 chars; no slashes, dots, spaces, or uppercase). Example: "trip-log".',"- `add` — Locations to ADD the skill to (everything else untouched). Editor ids fan out a copy/symlink; a custom root path places the bundle there. Omitting both `add` and `remove` installs into the project-configured editors.","- `remove` — Locations to REMOVE it from (lossless only: a hand-edited fork is refused, never deleted). Works however the agent gets the skill: removing an editor that reads it through a folder alias (its skills folder symlinked into a shared root) automatically unfollows that folder from the root MINUS this skill — the editor keeps its other skills. The SOURCE cannot be removed — its folder is the skill; move it with `source` or use `delete`.",'- `mode` — `"link"`: a live symlink to the source. `"copy"`: an independent folder, auto-refreshed from the source until hand-edited (a hand-edit forks that copy). Applies ONLY to the locations this call names — the ones in `add`, or the ones in `convert` — and sets no skill-wide default. Omit it on `add` and the new location takes the form the skill already uses.',"- `convert` — Existing locations to change the FORM of, leaving membership alone. Requires `mode`. Pass every location to make them uniform. Lossless both ways; a hand-edited copy is refused rather than overwritten.","- `source` — Move the skill's REAL folder to this location; the old source becomes a symlink to it. Run alone (not with add/remove).","- `scope` — `project` (default, shared via git) or `global` (user-level, every project on this machine).",``,"- `skillFolders` — Folder-level topology instead of one skill (the Settings → Folders surface). Run alone; `name` is not used with it. One action per call:",' - `{ action: "link", scope, root, target }` — merge the skills folder `root` into `target` and replace `root` with a symlink, so its agent reads everything placed in `target`. Same-content entries drop; a DIFFERENT skill in both folders aborts with a conflict list; an interrupted merge is resumable by re-running. `target` is required — nothing is ever assumed.',' - `{ action: "unlink", scope, root, exclude? }` — turn a linked folder back into a real directory holding one per-skill symlink per skill it sees (lossless, reversible). `exclude: ["<skill>"]` leaves named skills out — "this agent should not get that skill": the folder keeps everything else but stops following the root.',' - `{ action: "add-root", scope, root }` — declare a NEW custom skills root (base-relative, e.g. ".team/skills"); it becomes a folder row and an install/link target immediately.',``,"Copies auto-refresh when the source changes — you do NOT need to re-run install after editing a skill. After `delete({skill})` every location is removed with the source."].join(`
829
829
  `),["[Requires: Hocuspocus server] Read the wiki-link graph. `kind` takes one value, or an array for a one-call audit — results merge into a single payload; any per-kind failure lands in an `errors` map.",``,'- `backlinks` / `forward` / `suggest` — operate on one page; require `document`. `suggest` finds prose mentions of the page not yet wrapped in link syntax. Each mention returns an `excerpt` (a normalized, `…`-trimmed snippet for context — NOT an edit-ready literal) plus an `offset`. To wrap one: re-read the doc (`exec("cat …")`), find the real mention text, and `edit` it into a `[[wiki-link]]`.',"- `dead` — missing internal link targets corpus-wide; optional `sourceDocuments` filter (OR semantics).","- `orphans` — disconnected pages; optional `mode`: `incoming` | `outgoing` | `both`.","- `hubs` — most-linked pages; optional `limit` (default 20)."].join(`
@@ -833,10 +833,10 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
833
833
  `),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(D8),O8({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.")}),['[Requires: Hocuspocus server] Resolve a tracked Git merge or local stale external-write conflict. Inspect `conflictKind` and any `variant` from conflicts({ kind: "list" }), then fetch conflicts({ kind: "content", file }) to choose exact versions.',``,`Strategy:`,"- `mine` — for a stale external write, keeps the protected live or recovered version. For a Git index conflict, selects committed stage 2; for a working-tree conflict, keeps the current working-tree file. A missing Git stage requires `delete` instead.","- `theirs` — for a stale external write, accepts the rejected disk version. For a Git conflict, selects the incoming version (stage 3 for index conflicts). A missing Git stage requires `delete` instead.",'- `content` — writes the exact provided string, including `""` to keep an empty file. Use this to preserve the live Y.Text bytes returned as `ours`, which can differ from the Git version selected by `mine`. Omitted content is rejected.',"- `delete` — removes the file explicitly. For Git index conflicts, stages the deletion. For stale external writes and Git working-tree overlays, clears the conflict without a resolution commit.",``,'Returns 200 on success. 422 (`urn:ok:error:unresolved-conflict-markers`) means the provided content still contains an unresolved conflict block. A 500 can indicate disk, bridge, recovery-snapshot, or Git commit failure. Re-call conflicts({ kind: "list" }) and inspect content before retrying: resolution is best-effort and non-atomic. Local stale-write protection remains until resolution succeeds.',``,`**DESTRUCTIVE:** this modifies the working tree. Git index resolutions stage each file and commit when the last conflict clears. Local stale external-write and Git working-tree overlay resolutions do not create a resolution commit.`,``,`**Parameters:**`,"- `file` — Exact relative-to-projectDir path WITH .md or .mdx extension (e.g. `notes/sso.md`).","- `strategy` — One of `mine` | `theirs` | `content` | `delete`.",'- `content` — Required when `strategy === "content"`; an empty string keeps an empty file. Ignored otherwise.'].join(`
834
834
  `),O8({ok:L(),file:F()}),["[Requires: Hocuspocus server] Restore a DOCUMENT (CRDT, append-only) or a SKILL (fs-direct) to a historical version. Pass EXACTLY ONE of `document` or `skill`.",``,`**Parameters:**`,"- `document` — The document to restore (path, no extension; trailing `.md`/`.mdx` is stripped). Append-only via the CRDT layer; all connected editors see the change live.","- `skill` — The skill NAME to restore (PROJECT-scope skills only — global skills are unversioned). Rewrites the skill folder to the target version (fs-direct); every recorded copy re-syncs from it, so there is nothing to re-install.","- `version` — The 40-character commit SHA to restore to. Copy it from the `history` tool (same field name there).","- `summary` — Optional one-line summary (≤80 chars). Avoid secrets or PII — persisted to git history.",``,'A response may include `structuredContent.warnings` (kind `content-divergence`) when the restored `Y.Text` does not byte-match the target-version bytes. The restore still landed; re-read the doc with `exec("cat <document>")` to see what converged.'].join(`
835
835
  `),["[Requires: Hocuspocus server] Ranked retrieval across ALL non-ignored files (markdown by title/body, other file types by name/path, plus folders) — pair with `exec` `grep` for exhaustive content search. The cmd-K engine (title boost + body BM25 + recency).",``,"NAMES/paths are indexed for all files; BODY content for markdown only. Two-tier agent model: run this fast indexed `search` (all files by name/path + markdown content) IN PARALLEL with `exec` (`grep`) for exhaustive literal-string content search across every file — instant ranked hits plus full content coverage. Reach for `exec` grep when you need to match content inside code/config/data files.",``,"When semantic search is enabled for the workspace (an opt-in setting with an API key), an embeddings signal is additionally fused into `full_text` ranking, surfacing conceptually-related pages that share no keywords. This tool opts in by default; the `semantic` block in the response reports coverage. Note: with semantic enabled, the query and matching page content are sent to the configured embeddings provider (content egress). Set `semantic: false` to force pure-lexical ranking for a call.",``,"Returns scored `page`, `folder`, and name-only `file` hits, each with a `signals` breakdown (lexical / fullText / recency / vector); markdown `page` hits also carry a body snippet (`file` hits never do — name-only).",``,'Cold start: right after the server boots, the response may carry `ready: false` with an empty `results` while the index is still building. That empty set is NOT authoritative — wait ~2-3 seconds, then retry (agents have no built-in delay, so do not retry in immediate succession). If it is still `ready: false` after 2-3 retries (e.g. a very large workspace), fall back to `exec("grep ...")` rather than polling further. Once `ready` is true/omitted the results are complete.',``,`**Parameters:**`,"- `query` — Free-form; tokenized across title, name, path segments, and (with `full_text`) body.","- `intent` (optional) — `omnibar` searches title/path/folders only (fast); `full_text` includes body. Default `full_text`.","- `scopes` (optional) — Result scope: `page` | `folder` | `file` | `content`. Defaults derive from `intent`.","- `limit` (optional) — Max rows; default 20, max 100.","- `semantic` (optional) — Set `false` to force pure-lexical ranking even when semantic search is enabled. Omit to use semantic when available.",``,'If the server is down, the tool returns a recovery hint — use `exec("grep ...")` as the server-free fallback.'].join(`
836
- `),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(D8);const $Te=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(YTe).optional()}),eEe=B({capable:L(),applied:L(),coverage:B({embedded:I().int(),total:I().int()})});O8({cwd:F(),query:F(),intent:F(),resultCount:I().int(),results:z($Te),elapsedMs:I().nullable(),semantic:eEe.optional(),ready:W(!1).optional()}),["[Requires: Hocuspocus server] Build a shareable GitHub-substrate URL (`https://openknowledge.ai/d/...`) pinned to the project's current branch + the focused target (a doc or a folder). Read-only against the working tree — no commits, no pushes, no `git fetch`.",``,`Use this when the user asks for a share link / shareable link / URL to send to a teammate. Recipients open the link to receive the doc (or folder subtree) into their own OpenKnowledge install.`,``,"**Publishing is a user act.** Agents do NOT publish projects to GitHub from this tool. When the project has no GitHub remote, this tool returns an error pointing the user at the Share wizard (or `gh repo create` + `git push`) — it does not run those steps itself.",``,`**Parameters:**`,'- `path` — Content-dir-relative target. For a doc, extension-less (trailing `.md`/`.mdx` is stripped; the on-disk file is probed automatically). For a folder, the directory path. The empty string `""` is the content-root sentinel (folder-only).',"- `kind` (optional) — `'doc'` or `'folder'`. Omit to auto-probe disk (`.mdx` → `.md` → directory, first hit wins). REQUIRED when `path` is empty (`\"\"`), since auto-probe cannot disambiguate the root.","- `cwd` (optional) — Project root (see `cwd` description below).",``,"**Preconditions:** project on a named branch (not detached HEAD); origin set to a GitHub remote (`github.com` or a GitHub Enterprise Server host); the branch already pushed to origin."].join(`
837
- `),O8({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:nB.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([...tB.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 A8="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).",tEe=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, auto-refreshed from the source until hand-edited (then it forks); 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(A8),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(tEe).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 nEe=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(A8),description:F().describe(`The skill's one-line description (empty if none).`),body:F().describe(`The SKILL.md body (markdown, frontmatter stripped).`),files:z(nEe).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.`)}),["[Requires: Hocuspocus server] Read-only discovery for SKILLS — the read half of the skill vocabulary (`write`/`edit`/`delete`/`move`/`install` are the mutate half).",``,"This is how you search the marketplace, list managed skills, and read managed skill content. Managed skills are addressed by `name` + `scope`, NOT by path — do NOT `ls`/`cat` `.ok/skills/` or pass raw `.ok/...` paths; `.ok/` is opaque internal state.",``,"Marketplace rows are external candidates; they are NOT managed content until you call `import({ source, skill: name })`, and they are NOT active in editors until `install` projects them.",``,"OpenKnowledge's own built-in `open-knowledge*` skills (e.g. the `open-knowledge` project skill) are runtime skills already loaded in your skill list — they are NOT here, and you never fetch them through this tool.",``,`**Four modes:**`,"- **Marketplace search** (pass `query`): search skills.sh and return import-ready rows (`name`, `source`, `description`, `publisher`, installs). Use when a user asks to find/browse/add an external skill. Then call `import({ source, skill: name })` on the chosen row.","- **List** (omit `name`): every skill across BOTH levels — Project (this KB) and Global (user-level). Returns name, scope, description, installed/hosts.","- **Read skill** (pass `name`): that skill's description + body + a `files` list (`{ path, kind }`, no inline text) of its bundle files (`references/**`, `scripts/**`, and any other file the skill ships). `scope` optional — omitted, it resolves by name (preferring Project when a name exists at both levels).","- **Read file** (pass `name` + `file`): one bundle file's text — the universal read path for references + scripts (no native `cat`)."].join(`
836
+ `),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(D8);const eEe=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(XTe).optional()}),tEe=B({capable:L(),applied:L(),coverage:B({embedded:I().int(),total:I().int()})});O8({cwd:F(),query:F(),intent:F(),resultCount:I().int(),results:z(eEe),elapsedMs:I().nullable(),semantic:tEe.optional(),ready:W(!1).optional()}),["[Requires: Hocuspocus server] Build a shareable GitHub-substrate URL (`https://openknowledge.ai/d/...`) pinned to the project's current branch + the focused target (a doc or a folder). Read-only against the working tree — no commits, no pushes, no `git fetch`.",``,`Use this when the user asks for a share link / shareable link / URL to send to a teammate. Recipients open the link to receive the doc (or folder subtree) into their own OpenKnowledge install.`,``,"**Publishing is a user act.** Agents do NOT publish projects to GitHub from this tool. When the project has no GitHub remote, this tool returns an error pointing the user at the Share wizard (or `gh repo create` + `git push`) — it does not run those steps itself.",``,`**Parameters:**`,'- `path` — Content-dir-relative target. For a doc, extension-less (trailing `.md`/`.mdx` is stripped; the on-disk file is probed automatically). For a folder, the directory path. The empty string `""` is the content-root sentinel (folder-only).',"- `kind` (optional) — `'doc'` or `'folder'`. Omit to auto-probe disk (`.mdx` → `.md` → directory, first hit wins). REQUIRED when `path` is empty (`\"\"`), since auto-probe cannot disambiguate the root.","- `cwd` (optional) — Project root (see `cwd` description below).",``,"**Preconditions:** project on a named branch (not detached HEAD); origin set to a GitHub remote (`github.com` or a GitHub Enterprise Server host); the branch already pushed to origin."].join(`
837
+ `),O8({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:nB.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([...tB.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 A8="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).",nEe=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, auto-refreshed from the source until hand-edited (then it forks); 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(A8),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(nEe).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 rEe=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(A8),description:F().describe(`The skill's one-line description (empty if none).`),body:F().describe(`The SKILL.md body (markdown, frontmatter stripped).`),files:z(rEe).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.`)}),["[Requires: Hocuspocus server] Read-only discovery for SKILLS — the read half of the skill vocabulary (`write`/`edit`/`delete`/`move`/`install` are the mutate half).",``,"This is how you search the marketplace, list managed skills, and read managed skill content. Managed skills are addressed by `name` + `scope`, NOT by path — do NOT `ls`/`cat` `.ok/skills/` or pass raw `.ok/...` paths; `.ok/` is opaque internal state.",``,"Marketplace rows are external candidates; they are NOT managed content until you call `import({ source, skill: name })`, and they are NOT active in editors until `install` projects them.",``,"OpenKnowledge's own built-in `open-knowledge*` skills (e.g. the `open-knowledge` project skill) are runtime skills already loaded in your skill list — they are NOT here, and you never fetch them through this tool.",``,`**Four modes:**`,"- **Marketplace search** (pass `query`): search skills.sh and return import-ready rows (`name`, `source`, `description`, `publisher`, installs). Use when a user asks to find/browse/add an external skill. Then call `import({ source, skill: name })` on the chosen row.","- **List** (omit `name`): every skill across BOTH levels — Project (this KB) and Global (user-level). Returns name, scope, description, installed/hosts.","- **Read skill** (pass `name`): that skill's description + body + a `files` list (`{ path, kind }`, no inline text) of its bundle files (`references/**`, `scripts/**`, and any other file the skill ships). `scope` optional — omitted, it resolves by name (preferring Project when a name exists at both levels).","- **Read file** (pass `name` + `file`): one bundle file's text — the universal read path for references + scripts (no native `cat`)."].join(`
838
838
  `),`${["Create or replace one thing. Pass EXACTLY ONE of `document`, `folder`, `template`, `skill`, or `asset` (or `documents` for a batch of docs).",``,'- `document` — Create or overwrite a doc via the CRDT layer [Requires: Hocuspocus server]. `{ path, content }`, or `{ path, template }` to instantiate from a folder template (mutually exclusive with `content`). Optional `frontmatter` (its own YAML) and `position` (`replace` default for a new doc; required for an existing one) — note supplying `frontmatter` alongside literal `content` forces `position: replace` (the only position that persists a YAML block), overriding an explicit `append`/`prepend`. Example: `{ document: { path: "meetings/standup", content: "# Standup\\n..." } }`.','- `folder` — Create a NEW folder (optionally with its own properties) [Requires: Hocuspocus server]. `{ path, frontmatter? }`. To change an EXISTING folder use `edit`. Example: `{ folder: { path: "ideas" } }`.','- `template` — Create a reusable starting shape for new docs in a folder. `{ path: "<folder>/<name>", content, frontmatter: { title, description?, tags? } }`.','- `skill` — Create or overwrite an agent SKILL: reusable agent guidance you author in OK and `install` into your editors. A NEW skill lands at the project\'s default skill home (e.g. `.agents/skills/<name>/`); an existing one is edited at its real folder. `{ name, description, body, scope? }`. `name` is the identity (lowercase-hyphen); `description` is the trigger (when to use it). Example: `{ skill: { name: "trip-log", description: "Use when logging a fishing trip.", body: "# Steps\\n..." } }`.','- `asset` — Upload a binary (image/file) via the media route [Requires: Hocuspocus server]. `{ path: "<folder>/<file.ext>", content(base64) | source(local path) }`.',"- `documents` — Batch: `[{ path, content?|template?, frontmatter?, position?, summary? }, ...]` written in order; the response reports each.","- `summary` — Optional one-line user-outcome (≤80 chars) for the timeline, for a single `document`/`folder`/`template`/`asset` write. For a `documents` batch, give each entry its own `summary` instead (a top-level `summary` is ignored on the batch path). Avoid secrets or PII — persisted to git history.",``,"Responses may include `structuredContent.document.warnings` (batch: per-entry under `documents[]`) — advisory entries discriminated by `kind`: `content-divergence` / `disk-edit-reconciled` (write-integrity — re-read the doc) and `mermaid-parse-error` (the write landed but that fence will not render — fix it and re-edit)."].join(`
839
- `)}${JJ()}`,AX(`config-persistence`),AX(`generated-index-git-attributes`),AX(`head-watcher`),AX(`shadow-gc`),AX(`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})(),AX(`mermaid-persistence`),AX(`persistence`),AX(`persistence-staleness`),AX(`recovered-file-target`),AX(`removed-docs-journal`),AX(`server-observers`),AX(`github-permissions`),AX(`github-account`),AX(`sync-engine`),Re(o),(()=>{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 j8=null;V6(()=>{j8?.disable(),j8=null}),AX(`skill-migrate`);function M8(e){return[{host:`agents`,root:bs},...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({host:e,root:t}))].sort((e,t)=>{let n=i4.indexOf(e.host),r=i4.indexOf(t.host);return(n===-1?i4.length:n)-(r===-1?i4.length:r)||e.host.localeCompare(t.host)})}M8(ln),M8(un),AX(`skill-reconcile`),[...fn],Number(process.env.OK_DESTROY_STEP_TIMEOUT_MS);const rEe=iu;ZY(),N(k(),`.ok`,`logs`),Re(o),AX(`project-git`);
839
+ `)}${JJ()}`,AX(`config-persistence`),AX(`generated-index-git-attributes`),AX(`head-watcher`),AX(`shadow-gc`),AX(`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})(),AX(`mermaid-persistence`),AX(`persistence`),AX(`persistence-staleness`),AX(`recovered-file-target`),AX(`removed-docs-journal`),AX(`server-observers`),AX(`github-permissions`),AX(`github-account`),AX(`sync-engine`),Re(o),(()=>{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 j8=null;V6(()=>{j8?.disable(),j8=null}),AX(`skill-migrate`);function M8(e){return[{host:`agents`,root:bs},...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({host:e,root:t}))].sort((e,t)=>{let n=i4.indexOf(e.host),r=i4.indexOf(t.host);return(n===-1?i4.length:n)-(r===-1?i4.length:r)||e.host.localeCompare(t.host)})}M8(ln),M8(un),AX(`skill-reconcile`),[...fn],Number(process.env.OK_DESTROY_STEP_TIMEOUT_MS);const iEe=iu;ZY(),N(k(),`.ok`,`logs`),Re(o),AX(`project-git`);
840
840
  /*!
841
841
  * Copyright (c) Squirrel Chat et al., All rights reserved.
842
842
  * SPDX-License-Identifier: BSD-3-Clause
@@ -864,7 +864,7 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
864
864
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
865
865
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
866
866
  */
867
- let iEe=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;var aEe=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(iEe);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}};
867
+ let aEe=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;var oEe=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(aEe);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}};
868
868
  /*!
869
869
  * Copyright (c) Squirrel Chat et al., All rights reserved.
870
870
  * SPDX-License-Identifier: BSD-3-Clause
@@ -892,9 +892,9 @@ let iEe=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+
892
892
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
893
893
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
894
894
  */
895
- function oEe(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function sEe(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+=`
895
+ function sEe(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function cEe(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+=`
896
896
  `,e===t&&(i+=` `.repeat(a+n+2),i+=`^
897
- `))}return i}var N8=class extends Error{line;column;codeblock;constructor(e,t){let[n,r]=oEe(t.toml,t.ptr),i=sEe(t.toml,n,r);super(`Invalid TOML document: ${e}\n\n${i}`,t),this.line=n,this.column=r,this.codeblock=i}};
897
+ `))}return i}var N8=class extends Error{line;column;codeblock;constructor(e,t){let[n,r]=sEe(t.toml,t.ptr),i=cEe(t.toml,n,r);super(`Invalid TOML document: ${e}\n\n${i}`,t),this.line=n,this.column=r,this.codeblock=i}};
898
898
  /*!
899
899
  * Copyright (c) Squirrel Chat et al., All rights reserved.
900
900
  * SPDX-License-Identifier: BSD-3-Clause
@@ -922,12 +922,12 @@ function oEe(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop(
922
922
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
923
923
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
924
924
  */
925
- let cEe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,lEe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,uEe=/^[+-]?0[0-9_]/;function P8(e,t){let n=e[t++],r=n,i=n===`'`,a=n===e[t]&&n===e[t+1];a&&(e[t+=2]===`
925
+ let lEe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,uEe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,dEe=/^[+-]?0[0-9_]/;function P8(e,t){let n=e[t++],r=n,i=n===`'`,a=n===e[t]&&n===e[t+1];a&&(e[t+=2]===`
926
926
  `?t++:e[t]===`\r`&&e[t+1]===`
927
927
  `&&(t+=2));let o=``,s=t,c=0;for(let l=t;l<e.length;l++)if(n=e[l],a&&(n===`
928
928
  `||n===`\r`&&e[l+1]===`
929
929
  `))c&&=3;else if(n<` `&&n!==` `||n===``)throw new N8(`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 N8(`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 N8(`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+=`
930
- `;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 N8(`unrecognized escape sequence`,{toml:e,ptr:l});s=l+1,c=0}}else if(n!==` `&&n!==` `){if(c===2)throw new N8(`invalid escape: only line-ending whitespace may be escaped`,{toml:e,ptr:s});c=+(!i&&n===`\\`),s=l}throw new N8(`unfinished string`,{toml:e,ptr:t})}function dEe(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=cEe.test(e);if(i||lEe.test(e)){if(uEe.test(e))throw new N8(`leading zeroes are not allowed`,{toml:t,ptr:n});e=e.replace(/_/g,``);let a=+e;if(isNaN(a))throw new N8(`invalid number`,{toml:t,ptr:n});if(i){if((i=!Number.isSafeInteger(a))&&!r)throw new N8(`integer value cannot be represented losslessly`,{toml:t,ptr:n});(i||r===!0)&&(a=BigInt(e))}return a}let a=new aEe(e);if(!a.isValid())throw new N8(`invalid value`,{toml:t,ptr:n});return a}
930
+ `;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 N8(`unrecognized escape sequence`,{toml:e,ptr:l});s=l+1,c=0}}else if(n!==` `&&n!==` `){if(c===2)throw new N8(`invalid escape: only line-ending whitespace may be escaped`,{toml:e,ptr:s});c=+(!i&&n===`\\`),s=l}throw new N8(`unfinished string`,{toml:e,ptr:t})}function fEe(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=lEe.test(e);if(i||uEe.test(e)){if(dEe.test(e))throw new N8(`leading zeroes are not allowed`,{toml:t,ptr:n});e=e.replace(/_/g,``);let a=+e;if(isNaN(a))throw new N8(`invalid number`,{toml:t,ptr:n});if(i){if((i=!Number.isSafeInteger(a))&&!r)throw new N8(`integer value cannot be represented losslessly`,{toml:t,ptr:n});(i||r===!0)&&(a=BigInt(e))}return a}let a=new oEe(e);if(!a.isValid())throw new N8(`invalid value`,{toml:t,ptr:n});return a}
931
931
  /*!
932
932
  * Copyright (c) Squirrel Chat et al., All rights reserved.
933
933
  * SPDX-License-Identifier: BSD-3-Clause
@@ -960,7 +960,7 @@ function F8(e,t=0,n=e.length){let r=e.indexOf(`
960
960
  `)return n;if(r===`\r`&&e[n+1]===`
961
961
  `)return n+1;if(r<` `&&r!==` `||r===``)throw new N8(`control characters are not allowed in comments`,{toml:e,ptr:t})}return e.length}function L8(e,t,n,r){let i;for(;;){for(;(i=e[t])===` `||i===` `||!n&&(i===`
962
962
  `||i===`\r`&&e[t+1]===`
963
- `);)t++;if(r||i!==`#`)break;t=I8(e,t)}return t}function fEe(e,t,n,r,i=!1){if(!r)return t=F8(e,t),t<0?e.length:t;for(let a=t;a<e.length;a++){let t=e[a];if(t===`#`)a=F8(e,a);else if(t===n)return a+1;else if(t===r||i&&(t===`
963
+ `);)t++;if(r||i!==`#`)break;t=I8(e,t)}return t}function pEe(e,t,n,r,i=!1){if(!r)return t=F8(e,t),t<0?e.length:t;for(let a=t;a<e.length;a++){let t=e[a];if(t===`#`)a=F8(e,a);else if(t===n)return a+1;else if(t===r||i&&(t===`
964
964
  `||t===`\r`&&e[a+1]===`
965
965
  `))return a}throw new N8(`cannot find end of structure`,{toml:e,ptr:t})}
966
966
  /*!
@@ -990,8 +990,8 @@ function F8(e,t=0,n=e.length){let r=e.indexOf(`
990
990
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
991
991
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
992
992
  */
993
- function pEe(e,t,n){let r=e.slice(t,n),i=r.indexOf(`#`);return i>-1&&(I8(e,i),r=r.slice(0,i)),[r.trimEnd(),i]}function R8(e,t,n,r,i){if(r===0)throw new N8(`document contains excessively nested structures. aborting.`,{toml:e,ptr:t});let a=e[t];if(a===`[`||a===`{`){let[o,s]=a===`[`?gEe(e,t,r,i):hEe(e,t,r,i);if(n){if(s=L8(e,s),e[s]===`,`)s++;else if(e[s]!==n)throw new N8(`expected comma or end of structure`,{toml:e,ptr:s})}return[o,s]}if(a===`"`||a===`'`){let[r,i]=P8(e,t);if(n){if(i=L8(e,i),e[i]&&e[i]!==`,`&&e[i]!==n&&e[i]!==`
994
- `&&e[i]!==`\r`)throw new N8(`unexpected character encountered`,{toml:e,ptr:i});e[i]===`,`&&i++}return[r,i]}let o=fEe(e,t,`,`,n),s=pEe(e,t,o-+(e[o-1]===`,`));if(!s[0])throw new N8(`incomplete key-value declaration: no value specified`,{toml:e,ptr:t});return n&&s[1]>-1&&(o=L8(e,t+s[1]),e[o]===`,`&&o++),[dEe(s[0],e,t,i),o]}
993
+ function mEe(e,t,n){let r=e.slice(t,n),i=r.indexOf(`#`);return i>-1&&(I8(e,i),r=r.slice(0,i)),[r.trimEnd(),i]}function R8(e,t,n,r,i){if(r===0)throw new N8(`document contains excessively nested structures. aborting.`,{toml:e,ptr:t});let a=e[t];if(a===`[`||a===`{`){let[o,s]=a===`[`?_Ee(e,t,r,i):gEe(e,t,r,i);if(n){if(s=L8(e,s),e[s]===`,`)s++;else if(e[s]!==n)throw new N8(`expected comma or end of structure`,{toml:e,ptr:s})}return[o,s]}if(a===`"`||a===`'`){let[r,i]=P8(e,t);if(n){if(i=L8(e,i),e[i]&&e[i]!==`,`&&e[i]!==n&&e[i]!==`
994
+ `&&e[i]!==`\r`)throw new N8(`unexpected character encountered`,{toml:e,ptr:i});e[i]===`,`&&i++}return[r,i]}let o=pEe(e,t,`,`,n),s=mEe(e,t,o-+(e[o-1]===`,`));if(!s[0])throw new N8(`incomplete key-value declaration: no value specified`,{toml:e,ptr:t});return n&&s[1]>-1&&(o=L8(e,t+s[1]),e[o]===`,`&&o++),[fEe(s[0],e,t,i),o]}
995
995
  /*!
996
996
  * Copyright (c) Squirrel Chat et al., All rights reserved.
997
997
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1019,8 +1019,8 @@ function pEe(e,t,n){let r=e.slice(t,n),i=r.indexOf(`#`);return i>-1&&(I8(e,i),r=
1019
1019
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1020
1020
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1021
1021
  */
1022
- let mEe=/^[a-zA-Z0-9-_]+[ \t]*$/;function z8(e,t,n=`=`){let r=t-1,i=[],a=e.indexOf(n,t);if(a<0)throw new N8(`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 N8(`multiline strings are not allowed in keys`,{toml:e,ptr:t});let[s,c]=P8(e,t);r=e.indexOf(`.`,c);let l=e.slice(c,r<0||r>a?a:r),u=F8(l);if(u>-1)throw new N8(`newlines are not allowed in keys`,{toml:e,ptr:t+r+u});if(l.trimStart())throw new N8(`found extra tokens after the string part`,{toml:e,ptr:c});if(a<c&&(a=e.indexOf(n,c),a<0))throw new N8(`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(!mEe.test(n))throw new N8(`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,L8(e,a+1,!0,!0)]}function hEe(e,t,n,r){let i={},a=new Set,o;for(t++;(o=e[t++])!==`}`&&o;)if(o===`,`)throw new N8(`expected value, found comma`,{toml:e,ptr:t-1});else if(o===`#`)t=I8(e,t);else if(o!==` `&&o!==` `&&o!==`
1023
- `&&o!==`\r`){let o,s=i,c=!1,[l,u]=z8(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 N8(`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 N8(`trying to redefine an already defined value`,{toml:e,ptr:t});let[d,f]=R8(e,u,`}`,n-1,r);a.add(d),s[o]=d,t=f}if(!o)throw new N8(`unfinished table encountered`,{toml:e,ptr:t});return[i,t]}function gEe(e,t,n,r){let i=[],a;for(t++;(a=e[t++])!==`]`&&a;)if(a===`,`)throw new N8(`expected value, found comma`,{toml:e,ptr:t-1});else if(a===`#`)t=I8(e,t);else if(a!==` `&&a!==` `&&a!==`
1022
+ let hEe=/^[a-zA-Z0-9-_]+[ \t]*$/;function z8(e,t,n=`=`){let r=t-1,i=[],a=e.indexOf(n,t);if(a<0)throw new N8(`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 N8(`multiline strings are not allowed in keys`,{toml:e,ptr:t});let[s,c]=P8(e,t);r=e.indexOf(`.`,c);let l=e.slice(c,r<0||r>a?a:r),u=F8(l);if(u>-1)throw new N8(`newlines are not allowed in keys`,{toml:e,ptr:t+r+u});if(l.trimStart())throw new N8(`found extra tokens after the string part`,{toml:e,ptr:c});if(a<c&&(a=e.indexOf(n,c),a<0))throw new N8(`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(!hEe.test(n))throw new N8(`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,L8(e,a+1,!0,!0)]}function gEe(e,t,n,r){let i={},a=new Set,o;for(t++;(o=e[t++])!==`}`&&o;)if(o===`,`)throw new N8(`expected value, found comma`,{toml:e,ptr:t-1});else if(o===`#`)t=I8(e,t);else if(o!==` `&&o!==` `&&o!==`
1023
+ `&&o!==`\r`){let o,s=i,c=!1,[l,u]=z8(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 N8(`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 N8(`trying to redefine an already defined value`,{toml:e,ptr:t});let[d,f]=R8(e,u,`}`,n-1,r);a.add(d),s[o]=d,t=f}if(!o)throw new N8(`unfinished table encountered`,{toml:e,ptr:t});return[i,t]}function _Ee(e,t,n,r){let i=[],a;for(t++;(a=e[t++])!==`]`&&a;)if(a===`,`)throw new N8(`expected value, found comma`,{toml:e,ptr:t-1});else if(a===`#`)t=I8(e,t);else if(a!==` `&&a!==` `&&a!==`
1024
1024
  `&&a!==`\r`){let a=R8(e,t-1,`]`,n-1,r);i.push(a[0]),t=a[1]}if(!a)throw new N8(`unfinished array encountered`,{toml:e,ptr:t});return[i,t]}
1025
1025
  /*!
1026
1026
  * Copyright (c) Squirrel Chat et al., All rights reserved.
@@ -1049,7 +1049,7 @@ let mEe=/^[a-zA-Z0-9-_]+[ \t]*$/;function z8(e,t,n=`=`){let r=t-1,i=[],a=e.index
1049
1049
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1050
1050
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1051
1051
  */
1052
- function B8(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 _Ee(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let r={},i={},a=r,o=i;for(let s=L8(e,0);s<e.length;){if(e[s]===`[`){let t=e[++s]===`[`,n=z8(e,s+=+t,`]`);if(t){if(e[n[1]-1]!==`]`)throw new N8(`expected end of table declaration`,{toml:e,ptr:n[1]-1});n[1]++}let c=B8(n[0],r,i,t?2:1);if(!c)throw new N8(`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=z8(e,s),i=B8(r[0],a,o,0);if(!i)throw new N8(`trying to redefine an already defined table or value`,{toml:e,ptr:s});let c=R8(e,r[1],void 0,t,n);i[1][i[0]]=c[0],s=c[1]}if(s=L8(e,s,!0),e[s]&&e[s]!==`
1052
+ function B8(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 vEe(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let r={},i={},a=r,o=i;for(let s=L8(e,0);s<e.length;){if(e[s]===`[`){let t=e[++s]===`[`,n=z8(e,s+=+t,`]`);if(t){if(e[n[1]-1]!==`]`)throw new N8(`expected end of table declaration`,{toml:e,ptr:n[1]-1});n[1]++}let c=B8(n[0],r,i,t?2:1);if(!c)throw new N8(`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=z8(e,s),i=B8(r[0],a,o,0);if(!i)throw new N8(`trying to redefine an already defined table or value`,{toml:e,ptr:s});let c=R8(e,r[1],void 0,t,n);i[1][i[0]]=c[0],s=c[1]}if(s=L8(e,s,!0),e[s]&&e[s]!==`
1053
1053
  `&&e[s]!==`\r`)throw new N8(`each key-value declaration must be followed by an end-of-line`,{toml:e,ptr:s});s=L8(e,s)}return r}
1054
1054
  /*!
1055
1055
  * Copyright (c) Squirrel Chat et al., All rights reserved.
@@ -1078,13 +1078,13 @@ function B8(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
1078
1078
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1079
1079
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1080
1080
  */
1081
- let V8=/^[a-z0-9-_]+$/i;function H8(e){let t=typeof e;if(t===`object`){if(Array.isArray(e))return`array`;if(e instanceof Date)return`date`}return t}function vEe(e){for(let t=0;t<e.length;t++)if(H8(e[t])!==`object`)return!1;return e.length!=0}function U8(e){return JSON.stringify(e).replace(/\x7f/g,`\\u007f`)}function W8(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 U8(e);if(t===`date`){if(isNaN(e.getTime()))throw TypeError(`cannot serialize invalid date`);return e.toISOString()}if(t===`object`)return yEe(e,n,r);if(t===`array`)return bEe(e,n,r)}function yEe(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+=V8.test(o)?o:U8(o),i+=` = `,i+=W8(e[o],H8(e[o]),t-1,n)}return i+` }`}function bEe(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+=W8(e[i],H8(e[i]),t-1,n)}return r+` ]`}function xEe(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&&`
1082
- `}[[${t}]]\n`,i+=G8(0,e[a],t,n,r);return i}function G8(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=H8(t[c]);if(e===`symbol`||e===`function`)throw TypeError(`cannot serialize values of type '${e}'`);let s=V8.test(c)?c:U8(c);if(e===`array`&&vEe(t[c]))o+=(o&&`
1083
- `)+xEe(t[c],n?`${n}.${s}`:s,r-1,i);else if(e===`object`){let e=n?`${n}.${s}`:s;o+=(o&&`
1081
+ let V8=/^[a-z0-9-_]+$/i;function H8(e){let t=typeof e;if(t===`object`){if(Array.isArray(e))return`array`;if(e instanceof Date)return`date`}return t}function yEe(e){for(let t=0;t<e.length;t++)if(H8(e[t])!==`object`)return!1;return e.length!=0}function U8(e){return JSON.stringify(e).replace(/\x7f/g,`\\u007f`)}function W8(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 U8(e);if(t===`date`){if(isNaN(e.getTime()))throw TypeError(`cannot serialize invalid date`);return e.toISOString()}if(t===`object`)return bEe(e,n,r);if(t===`array`)return xEe(e,n,r)}function bEe(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+=V8.test(o)?o:U8(o),i+=` = `,i+=W8(e[o],H8(e[o]),t-1,n)}return i+` }`}function xEe(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+=W8(e[i],H8(e[i]),t-1,n)}return r+` ]`}function SEe(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&&`
1082
+ `}[[${t}]]\n`,i+=G8(0,e[a],t,n,r);return i}function G8(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=H8(t[c]);if(e===`symbol`||e===`function`)throw TypeError(`cannot serialize values of type '${e}'`);let s=V8.test(c)?c:U8(c);if(e===`array`&&yEe(t[c]))o+=(o&&`
1083
+ `)+SEe(t[c],n?`${n}.${s}`:s,r-1,i);else if(e===`object`){let e=n?`${n}.${s}`:s;o+=(o&&`
1084
1084
  `)+G8(e,t[c],e,r-1,i)}else a+=s,a+=` = `,a+=W8(t[c],e,r,i),a+=`
1085
- `}}return e&&(a||!o)&&(a=a?`[${e}]\n${a}`:`[${e}]`),a&&o?`${a}\n${o}`:a||o}function SEe(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(H8(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let r=G8(0,e,``,t,n);return r[r.length-1]===`
1085
+ `}}return e&&(a||!o)&&(a=a?`[${e}]\n${a}`:`[${e}]`),a&&o?`${a}\n${o}`:a||o}function CEe(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(H8(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let r=G8(0,e,``,t,n);return r[r.length-1]===`
1086
1086
  `?r:r+`
1087
- `}function K8(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q8(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 J8(e,t){if(!process.env.OK_DEBUG_NATIVE)return;let n=t instanceof Error?t.message:String(t);process.stderr.write(`[ok] native-config ${e}: ${n}\n`)}const CEe=[`native`,`index.js`];function Y8(e={}){let t=e.moduleUrl??import.meta.url,n=e.requireModule??a(t);try{let e=M(we(t));return n(N(e,...CEe))}catch(e){q8(e)||J8(`bundled loader failed to load`,e)}try{return n(`@inkeep/open-knowledge-native-config`)}catch(e){return q8(e)||J8(`workspace addon failed to load`,e),null}}function wEe(){let e=Y8();return e&&typeof e.parseTomlToJson==`function`?e:null}function TEe(e){try{let t=e.parseTomlToJson(`probe = 1`);return typeof t==`string`&&t.includes(`probe`)}catch(e){return J8(`addon loaded but probe failed`,e),!1}}function X8(e){if(!K8(e))throw Error(`TOML root is not a table`);return e}function EEe(e){return{backend:`native`,parseToObject(t){return X8(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 DEe(){return{backend:`fallback`,parseToObject(e){return X8(_Ee(e))}}}function OEe(e=wEe){let t=e();return t&&TEe(t)?EEe(t):DEe()}let Z8=null;function Q8(){return Z8===null&&(Z8=OEe()),Z8}function kEe(){let e=Q8();return e.backend===`native`?e:void 0}const $8=cn,e5=bee,AEe=See,t5=`node`,n5={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`},r5=`# ok-mcp-v2`,i5=`# ok-mcp-v2
1087
+ `}function K8(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q8(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 J8(e,t){if(!process.env.OK_DEBUG_NATIVE)return;let n=t instanceof Error?t.message:String(t);process.stderr.write(`[ok] native-config ${e}: ${n}\n`)}const wEe=[`native`,`index.js`];function Y8(e={}){let t=e.moduleUrl??import.meta.url,n=e.requireModule??a(t);try{let e=M(we(t));return n(N(e,...wEe))}catch(e){q8(e)||J8(`bundled loader failed to load`,e)}try{return n(`@inkeep/open-knowledge-native-config`)}catch(e){return q8(e)||J8(`workspace addon failed to load`,e),null}}function TEe(){let e=Y8();return e&&typeof e.parseTomlToJson==`function`?e:null}function EEe(e){try{let t=e.parseTomlToJson(`probe = 1`);return typeof t==`string`&&t.includes(`probe`)}catch(e){return J8(`addon loaded but probe failed`,e),!1}}function X8(e){if(!K8(e))throw Error(`TOML root is not a table`);return e}function DEe(e){return{backend:`native`,parseToObject(t){return X8(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 OEe(){return{backend:`fallback`,parseToObject(e){return X8(vEe(e))}}}function kEe(e=TEe){let t=e();return t&&EEe(t)?DEe(t):OEe()}let Z8=null;function Q8(){return Z8===null&&(Z8=kEe()),Z8}function AEe(){let e=Q8();return e.backend===`native`?e:void 0}const $8=cn,e5=bee,jEe=See,t5=`node`,n5={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`},r5=`# ok-mcp-v2`,i5=`# ok-mcp-v2
1088
1088
  USER_BUNDLE="$HOME/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
1089
1089
  [ -f "$USER_BUNDLE" ] && [ -x "$USER_BUNDLE" ] && exec "$USER_BUNDLE" mcp
1090
1090
  BUNDLE="/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
@@ -1120,7 +1120,7 @@ foreach ($d in $dirs) {
1120
1120
  if (Test-Path -LiteralPath $probe -PathType Leaf) { & $probe -y '@inkeep/open-knowledge@latest' mcp; exit $LASTEXITCODE }
1121
1121
  }
1122
1122
  [Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g @inkeep/open-knowledge), then restart your editor')
1123
- exit 127`,c5=`// ok-pi-bridge`,l5=`${c5}-v1`;function u5(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command===`/bin/sh`){if(!Array.isArray(t.args)||t.args[0]!==`-l`||t.args[1]!==`-c`)return!1;let e=t.args[2];return _5(e,r5)}if(t.command===`powershell`){if(!Array.isArray(t.args)||t.args[0]!==`-NoProfile`||t.args[1]!==`-NonInteractive`||t.args[2]!==`-Command`)return!1;let e=t.args[3];return _5(e,a5)}if(t.type===`local`&&Array.isArray(t.command)){if(t.command[0]===`/bin/sh`){if(t.command[1]!==`-l`||t.command[2]!==`-c`)return!1;let e=t.command[3];return _5(e,r5)}if(t.command[0]===`powershell`){if(t.command[1]!==`-NoProfile`||t.command[2]!==`-NonInteractive`||t.command[3]!==`-Command`)return!1;let e=t.command[4];return _5(e,a5)}return!1}if(t.command===`ok-pi-managed-extension`){if(!Array.isArray(t.args))return!1;let e=t.args[0];return typeof e==`string`&&e.startsWith(l5)}return!1}function d5(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 f5(e={}){return e.mode===`dev`?{command:t5,args:[d5(),`mcp`],env:{...n5}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,s5]}:{command:`/bin/sh`,args:[`-l`,`-c`,i5]}}function jEe(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[t5,d5(),`mcp`],environment:{...n5}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,s5]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,i5]}}function p5(e){if(typeof e!=`object`||!e)return!1;let t=e;return m5(t,f5({mode:`published`,platformName:`darwin`}))||m5(t,f5({mode:`published`,platformName:`win32`}))}function m5(e,t){return Object.keys(e).length===Object.keys(t).length&&MEe(e,t)}function MEe(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 h5(e,t){let n=e=>v5(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 NEe(e){return e.format===`toml`?Q8().backend===`native`:e.format===`json`||e.format===`yaml`}function g5(e){return Array.isArray(e.command)?e.command:[e.command,...Array.isArray(e.args)?e.args:[]]}function _5(e,t){return typeof e==`string`&&e.trimStart().startsWith(t)}function v5(e){return _5(e,`# ok-mcp`)}function PEe(e){return typeof e==`string`&&(e===o5||e.startsWith(`${o5}@`))}function y5(e){if(typeof e!=`object`||!e)return!1;let t=g5(e),n=t.findIndex(e=>e===`-c`||e===`-Command`);return n>=0&&v5(t[n+1])?!0:t.some(PEe)}function FEe(e){if(typeof e!=`object`||!e)return!1;let t=g5(e);if(t[0]!==t5||t[2]!==`mcp`)return!1;try{return t[1]===d5()}catch{return!1}}const IEe=[`command`,`args`,`env`],LEe=[`type`,`command`,`environment`];function b5(e){return e.type===`local`&&Array.isArray(e.command)?LEe:IEe}function x5(e,t){if(typeof e!=`object`||!e)return[];let n=e;return b5(t).filter(e=>t[e]===void 0&&n[e]!==void 0)}function REe(e,t){return e.format===`file`?null:e.buildEntry(t,{})}function zEe(e,t){return x5(e,t).length>0}function BEe(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:h5(t.args,t.command)}function VEe(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`&&h5(r,n)}function S5(e){return e===`win32`?Se:ve}function HEe(e={}){let t=e.platformName??process.platform,n=e.home??k();return S5(t).join(n,`.claude.json`)}function C5(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 w5(e={}){let t=e.platformName??process.platform,n=e.home??k();return S5(t).join(n,`.cursor`,`mcp.json`)}function UEe(e={}){let t=e.platformName??process.platform,n=e.home??k();return(e.env??process.env).CODEX_HOME??S5(t).join(n,`.codex`)}function T5(e={}){return S5(e.platformName??process.platform).join(UEe(e),`config.toml`)}function E5(e={}){let t=e.platformName??process.platform,n=e.home??k(),r=(e.env??process.env).COPILOT_HOME??S5(t).join(n,`.copilot`);return S5(t).join(r,`mcp-config.json`)}function WEe(e={}){let t=e.platformName??process.platform,n=e.home??k(),r=e.env??process.env,i=S5(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 D5(e={}){return S5(e.platformName??process.platform).join(WEe(e),`opencode.json`)}function GEe(e={}){let t=e.platformName??process.platform,n=e.home??k();return S5(t).join(n,`.openclaw`,`openclaw.json`)}function KEe(e={}){let t=e.platformName??process.platform,n=e.home??k();return S5(t).join(n,`.hermes`,`config.yaml`)}function O5(e={}){let t=e.platformName??process.platform,n=e.home??k();return(e.env??process.env).PI_CODING_AGENT_DIR??S5(t).join(n,`.pi`,`agent`)}function qEe(e={}){let t=e.platformName??process.platform,n=e.home??k();return S5(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function JEe(e,t){let n=S5(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 YEe(e){try{return w(e).length>0}catch{return!1}}function k5(e={}){let t=e.platformName??process.platform,[n,r]=JEe(e.home??k(),t),i=[n,r].find(e=>g(e.file));return i?i.file:YEe(r.dir)?r.file:n.file}function XEe(e){let t=e.serverName(``);return e.format===`toml`?`[${e.topLevelKey}.${t}]`:[e.topLevelKey,e.serverMapSubKey,t].filter(Boolean).join(`.`)}function ZEe(e,t){let n;try{n=e.configPath(``,t)}catch{return null}return n.startsWith(`${t}/`)?`~${n.slice(t.length)}`:n}const A5={claude:{id:`claude`,label:e5.claude,configPath:(e,t)=>HEe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(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:e5[`claude-desktop`],configPath:(e,t)=>C5({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>M(C5({home:t}))},cursor:{id:`cursor`,label:e5.cursor,configPath:(e,t)=>w5({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>M(w5({home:t})),projectConfigPath:e=>N(e,`.cursor`,`mcp.json`),projectSkillPath:e=>N(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:e5.codex,configPath:(e,t)=>T5({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>M(T5({home:t})),projectConfigPath:e=>N(e,`.codex`,`config.toml`),projectSkillPath:e=>N(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:e5.copilot,configPath:(e,t)=>E5({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>M(E5({home:t})),projectSkillPath:e=>N(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:e5.opencode,configPath:(e,t)=>D5({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>Oo,buildEntry:(e,t)=>jEe(t),scope:`global`,detectPath:(e,t)=>M(D5({home:t})),projectConfigPath:e=>N(e,`opencode.json`),projectSkillPath:e=>N(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:e5.openclaw,configPath:(e,t)=>GEe({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>N(t??k(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:e5.pi,configPath:()=>{throw Error("Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).")},format:`file`,topLevelKey:`mcpServers`,serverName:()=>Oo,scope:`project`,detectPath:(e,t)=>O5({home:t}),projectConfigPath:e=>N(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>N(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:e5.antigravity,configPath:(e,t)=>qEe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>N(t??k(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:e5[`lm-studio`],configPath:(e,t)=>k5({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>M(k5({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:e5.hermes,configPath:(e,t)=>KEe({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>N(t??k(),`.hermes`),offerOnlyWhenDetected:!0}};function QEe(e){let t=e.filter(e=>!Object.hasOwn(A5,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${$8.join(`, `)}`);return e.map(e=>A5[e])}var j5=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})),M5=i((e=>{let{InvalidArgumentError:t}=j5();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})),N5=i((e=>{let{humanReadableArgName:t}=M5();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(`
1123
+ exit 127`,c5=`// ok-pi-bridge`,l5=`${c5}-v1`;function u5(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command===`/bin/sh`){if(!Array.isArray(t.args)||t.args[0]!==`-l`||t.args[1]!==`-c`)return!1;let e=t.args[2];return _5(e,r5)}if(t.command===`powershell`){if(!Array.isArray(t.args)||t.args[0]!==`-NoProfile`||t.args[1]!==`-NonInteractive`||t.args[2]!==`-Command`)return!1;let e=t.args[3];return _5(e,a5)}if(t.type===`local`&&Array.isArray(t.command)){if(t.command[0]===`/bin/sh`){if(t.command[1]!==`-l`||t.command[2]!==`-c`)return!1;let e=t.command[3];return _5(e,r5)}if(t.command[0]===`powershell`){if(t.command[1]!==`-NoProfile`||t.command[2]!==`-NonInteractive`||t.command[3]!==`-Command`)return!1;let e=t.command[4];return _5(e,a5)}return!1}if(t.command===`ok-pi-managed-extension`){if(!Array.isArray(t.args))return!1;let e=t.args[0];return typeof e==`string`&&e.startsWith(l5)}return!1}function d5(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 f5(e={}){return e.mode===`dev`?{command:t5,args:[d5(),`mcp`],env:{...n5}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,s5]}:{command:`/bin/sh`,args:[`-l`,`-c`,i5]}}function MEe(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[t5,d5(),`mcp`],environment:{...n5}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,s5]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,i5]}}function p5(e){if(typeof e!=`object`||!e)return!1;let t=e;return m5(t,f5({mode:`published`,platformName:`darwin`}))||m5(t,f5({mode:`published`,platformName:`win32`}))}function m5(e,t){return Object.keys(e).length===Object.keys(t).length&&NEe(e,t)}function NEe(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 h5(e,t){let n=e=>v5(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 PEe(e){return e.format===`toml`?Q8().backend===`native`:e.format===`json`||e.format===`yaml`}function g5(e){return Array.isArray(e.command)?e.command:[e.command,...Array.isArray(e.args)?e.args:[]]}function _5(e,t){return typeof e==`string`&&e.trimStart().startsWith(t)}function v5(e){return _5(e,`# ok-mcp`)}function FEe(e){return typeof e==`string`&&(e===o5||e.startsWith(`${o5}@`))}function y5(e){if(typeof e!=`object`||!e)return!1;let t=g5(e),n=t.findIndex(e=>e===`-c`||e===`-Command`);return n>=0&&v5(t[n+1])?!0:t.some(FEe)}function IEe(e){if(typeof e!=`object`||!e)return!1;let t=g5(e);if(t[0]!==t5||t[2]!==`mcp`)return!1;try{return t[1]===d5()}catch{return!1}}const LEe=[`command`,`args`,`env`],REe=[`type`,`command`,`environment`];function b5(e){return e.type===`local`&&Array.isArray(e.command)?REe:LEe}function x5(e,t){if(typeof e!=`object`||!e)return[];let n=e;return b5(t).filter(e=>t[e]===void 0&&n[e]!==void 0)}function zEe(e,t){return e.format===`file`?null:e.buildEntry(t,{})}function BEe(e,t){return x5(e,t).length>0}function VEe(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:h5(t.args,t.command)}function HEe(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`&&h5(r,n)}function S5(e){return e===`win32`?Se:ve}function UEe(e={}){let t=e.platformName??process.platform,n=e.home??k();return S5(t).join(n,`.claude.json`)}function C5(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 w5(e={}){let t=e.platformName??process.platform,n=e.home??k();return S5(t).join(n,`.cursor`,`mcp.json`)}function WEe(e={}){let t=e.platformName??process.platform,n=e.home??k();return(e.env??process.env).CODEX_HOME??S5(t).join(n,`.codex`)}function T5(e={}){return S5(e.platformName??process.platform).join(WEe(e),`config.toml`)}function E5(e={}){let t=e.platformName??process.platform,n=e.home??k(),r=(e.env??process.env).COPILOT_HOME??S5(t).join(n,`.copilot`);return S5(t).join(r,`mcp-config.json`)}function GEe(e={}){let t=e.platformName??process.platform,n=e.home??k(),r=e.env??process.env,i=S5(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 D5(e={}){return S5(e.platformName??process.platform).join(GEe(e),`opencode.json`)}function KEe(e={}){let t=e.platformName??process.platform,n=e.home??k();return S5(t).join(n,`.openclaw`,`openclaw.json`)}function qEe(e={}){let t=e.platformName??process.platform,n=e.home??k();return S5(t).join(n,`.hermes`,`config.yaml`)}function O5(e={}){let t=e.platformName??process.platform,n=e.home??k();return(e.env??process.env).PI_CODING_AGENT_DIR??S5(t).join(n,`.pi`,`agent`)}function JEe(e={}){let t=e.platformName??process.platform,n=e.home??k();return S5(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function YEe(e,t){let n=S5(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 XEe(e){try{return w(e).length>0}catch{return!1}}function k5(e={}){let t=e.platformName??process.platform,[n,r]=YEe(e.home??k(),t),i=[n,r].find(e=>g(e.file));return i?i.file:XEe(r.dir)?r.file:n.file}function ZEe(e){let t=e.serverName(``);return e.format===`toml`?`[${e.topLevelKey}.${t}]`:[e.topLevelKey,e.serverMapSubKey,t].filter(Boolean).join(`.`)}function QEe(e,t){let n;try{n=e.configPath(``,t)}catch{return null}return n.startsWith(`${t}/`)?`~${n.slice(t.length)}`:n}const A5={claude:{id:`claude`,label:e5.claude,configPath:(e,t)=>UEe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(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:e5[`claude-desktop`],configPath:(e,t)=>C5({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>M(C5({home:t}))},cursor:{id:`cursor`,label:e5.cursor,configPath:(e,t)=>w5({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>M(w5({home:t})),projectConfigPath:e=>N(e,`.cursor`,`mcp.json`),projectSkillPath:e=>N(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:e5.codex,configPath:(e,t)=>T5({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>M(T5({home:t})),projectConfigPath:e=>N(e,`.codex`,`config.toml`),projectSkillPath:e=>N(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:e5.copilot,configPath:(e,t)=>E5({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>M(E5({home:t})),projectSkillPath:e=>N(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:e5.opencode,configPath:(e,t)=>D5({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>Oo,buildEntry:(e,t)=>MEe(t),scope:`global`,detectPath:(e,t)=>M(D5({home:t})),projectConfigPath:e=>N(e,`opencode.json`),projectSkillPath:e=>N(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:e5.openclaw,configPath:(e,t)=>KEe({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>N(t??k(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:e5.pi,configPath:()=>{throw Error("Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).")},format:`file`,topLevelKey:`mcpServers`,serverName:()=>Oo,scope:`project`,detectPath:(e,t)=>O5({home:t}),projectConfigPath:e=>N(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>N(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:e5.antigravity,configPath:(e,t)=>JEe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>N(t??k(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:e5[`lm-studio`],configPath:(e,t)=>k5({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>M(k5({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:e5.hermes,configPath:(e,t)=>qEe({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>Oo,buildEntry:(e,t)=>f5(t),scope:`global`,detectPath:(e,t)=>N(t??k(),`.hermes`),offerOnlyWhenDetected:!0}};function $Ee(e){let t=e.filter(e=>!Object.hasOwn(A5,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${$8.join(`, `)}`);return e.map(e=>A5[e])}var j5=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})),M5=i((e=>{let{InvalidArgumentError:t}=j5();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})),N5=i((e=>{let{humanReadableArgName:t}=M5();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(`
1124
1124
  `)}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,`
1125
1125
  `+` `.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(`
1126
1126
  `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),P5=i((e=>{let{InvalidArgumentError:t}=j5();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}
@@ -1129,7 +1129,7 @@ exit 127`,c5=`// ok-pi-bridge`,l5=`${c5}-v1`;function u5(e){if(typeof e!=`object
1129
1129
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(t)?Error(`${n}
1130
1130
  - too many short flags`):i.test(t)?Error(`${n}
1131
1131
  - too many long flags`):Error(`${n}
1132
- - 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})),$Ee=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})),eDe=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}=M5(),{CommanderError:l}=j5(),{Help:u,stripColor:d}=N5(),{Option:f,DualOptions:p}=P5(),{suggestSimilar:m}=$Ee();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
1132
+ - 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})),eDe=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})),tDe=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}=M5(),{CommanderError:l}=j5(),{Help:u,stripColor:d}=N5(),{Option:f,DualOptions:p}=P5(),{suggestSimilar:m}=eDe();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
1133
1133
  - 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}'.
1134
1134
  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}'
1135
1135
  - 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.
@@ -1138,7 +1138,7 @@ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._life
1138
1138
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
1139
1139
  - ${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(`
1140
1140
  `),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.
1141
- 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:tDe,createCommand:nDe,createArgument:rDe,createOption:iDe,CommanderError:aDe,InvalidArgumentError:oDe,InvalidOptionArgumentError:sDe,Command:cDe,Argument:lDe,Option:uDe,Help:dDe}=e(i((e=>{let{Argument:t}=M5(),{Command:n}=eDe(),{CommanderError:r,InvalidArgumentError:i}=j5(),{Help:a}=N5(),{Option:o}=P5();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 fDe(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=LTe({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}}const pDe=`${c5}-dev`;function mDe(e){return e.startsWith(c5)}function F5(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`&&mDe(n)}function hDe(e){return{command:`ok-pi-managed-extension`,args:[e]}}function I5(e={}){let t=e.mode===`dev`?pDe:l5,n={unix:f5({...e,platformName:`darwin`}),win32:f5({...e,platformName:`win32`})};return`${t}
1141
+ 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:nDe,createCommand:rDe,createArgument:iDe,createOption:aDe,CommanderError:oDe,InvalidArgumentError:sDe,InvalidOptionArgumentError:cDe,Command:lDe,Argument:uDe,Option:dDe,Help:fDe}=e(i((e=>{let{Argument:t}=M5(),{Command:n}=tDe(),{CommanderError:r,InvalidArgumentError:i}=j5(),{Help:a}=N5(),{Option:o}=P5();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 pDe(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=RTe({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}}const F5=`${c5}-dev`;function mDe(e){return e.startsWith(c5)}function I5(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`&&mDe(n)}function hDe(e){return{command:`ok-pi-managed-extension`,args:[e]}}function L5(e={}){let t=e.mode===`dev`?F5:l5,n={unix:f5({...e,platformName:`darwin`}),win32:f5({...e,platformName:`win32`})};return`${t}
1142
1142
  /**
1143
1143
  * Open Knowledge bridge for Pi — MANAGED FILE, written by \`ok init\`.
1144
1144
  * Hand edits are overwritten whenever OK re-syncs this project; remove it
@@ -1481,56 +1481,56 @@ export default function okBridge(pi: {
1481
1481
  }
1482
1482
  });
1483
1483
  }
1484
- `}function gDe(e,t){let n=ye(k8(t),k8(e));return n.length>0&&!n.startsWith(`..`)&&!ge(n)}const _De=e=>{try{let t=s(`git`,[`rev-parse`,`--show-toplevel`],W6({cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]})).trim();return t.length>0?t:null}catch{return null}};function vDe(e,t={}){let n=t.homeDir??k(),r=t.gitTopLevel??_De,i=be(e),a;try{a=E(i)}catch{a=i}let o=a,s=0;for(;s<30&&o!==n&&o!==`/`&&o!==``;){if(e8(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&&gDe(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}}function L5(e,t){let n;try{n=_(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);R5(e,t)}function yDe(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 Error(`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=OSe(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:y5(c)||FEe(c)}function bDe(e){let t=ls[e]?.satisfiers.find(e=>e.piece===`mcp`&&e.scope===`project`),n=t?.pathId===void 0?null:Ho(t.pathId);return n===null||n.kind!==`editor-project-config`||n.editor===e?null:A5[n.editor]??null}function xDe(e,t,n={}){if(!_n.includes(e.id))return!0;let r=bDe(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 SDe(e){let t=new Set(dn.filter(e=>e.scope===`project`).map(e=>e.editorId));return e.filter(e=>t.has(e))}function CDe(e,t){if(SDe(t).length===0)return null;let n=N(e,bs,pn,`SKILL.md`);try{let t=J6(`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(!xDe(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=J6(`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 wDe(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)?(yDe(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 TDe(){let e=Y8();return e&&typeof e.resolveSymlinkWritePath==`function`?e:null}function EDe(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 J8(`readlinkSync threw during symlink walk`,t),{readPath:null,writePath:e}}t=ge(i)?i:N(M(t),i)}}let W5;function DDe(){return W5===void 0&&(W5=TDe()),W5}function G5(e,t=DDe){let n=t();if(n)try{let t=n.resolveSymlinkWritePath(e);return{readPath:t.readPath??null,writePath:t.writePath}}catch(e){J8(`resolveSymlinkWritePath threw`,e)}return EDe(e)}const K5=`**/.ok/*`,q5=`!**/${ys}/`;function J5(e){let t=[`.ok/`,`.okignore`];for(let n of $8){let r=A5[n];r.projectConfigPath&&t.push(MDe(r.projectConfigPath(e),e))}return t.push(`.claude/launch.json`),Array.from(new Set(t))}function Y5(e){let t=N(e,..._B);if(!g(t))return[];try{let e=xB(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=ln[e];r&&n.push(`${r}/${t}/`)}return Array.from(new Set(n))}catch{return[]}}function ODe(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(`
1484
+ `}function gDe(e,t){let n=ye(k8(t),k8(e));return n.length>0&&!n.startsWith(`..`)&&!ge(n)}const _De=e=>{try{let t=s(`git`,[`rev-parse`,`--show-toplevel`],W6({cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]})).trim();return t.length>0?t:null}catch{return null}};function vDe(e,t={}){let n=t.homeDir??k(),r=t.gitTopLevel??_De,i=be(e),a;try{a=E(i)}catch{a=i}let o=a,s=0;for(;s<30&&o!==n&&o!==`/`&&o!==``;){if(n8(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&&gDe(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}}function R5(e,t){let n;try{n=_(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);z5(e,t)}function yDe(e,t){z5(e,t)}function z5(e,t){B5(e,t)}function B5(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 Error(`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 V5(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 H5(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function U5(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=MSe(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!H5(a))return!1;let o=a[e.topLevelKey];if(!H5(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;if(!H5(s))return!1;let c=s[e.serverName(t)];return H5(c)&&c.enabled===!1?!1:y5(c)||IEe(c)}function bDe(e){let t=ls[e]?.satisfiers.find(e=>e.piece===`mcp`&&e.scope===`project`),n=t?.pathId===void 0?null:Ho(t.pathId);return n===null||n.kind!==`editor-project-config`||n.editor===e?null:A5[n.editor]??null}function xDe(e,t,n={}){if(!_n.includes(e.id))return!0;let r=bDe(e.id),i=r?.projectConfigPath?.(t);if(r!==null&&i!==void 0&&U5(r,t,i))return!0;try{return U5(e,t,e.configPath(t,n.home))}catch{return!1}}function SDe(e){let t=new Set(dn.filter(e=>e.scope===`project`).map(e=>e.editorId));return e.filter(e=>t.has(e))}function CDe(e,t){if(SDe(t).length===0)return null;let n=N(e,bs,pn,`SKILL.md`);try{let t=J6(`project`,{checkDesktop:!0});return R5(M(n),e),{editorId:`agents`,label:`.agents hub`,action:V5(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 W5(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!xDe(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=J6(`project`,{checkDesktop:!0});R5(M(r),t);let i=V5(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 wDe(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)?(yDe(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 TDe(){let e=Y8();return e&&typeof e.resolveSymlinkWritePath==`function`?e:null}function EDe(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 J8(`readlinkSync threw during symlink walk`,t),{readPath:null,writePath:e}}t=ge(i)?i:N(M(t),i)}}let G5;function DDe(){return G5===void 0&&(G5=TDe()),G5}function K5(e,t=DDe){let n=t();if(n)try{let t=n.resolveSymlinkWritePath(e);return{readPath:t.readPath??null,writePath:t.writePath}}catch(e){J8(`resolveSymlinkWritePath threw`,e)}return EDe(e)}const q5=`**/.ok/*`,J5=`!**/${ys}/`;function Y5(e){let t=[`.ok/`,`.okignore`];for(let n of $8){let r=A5[n];r.projectConfigPath&&t.push(MDe(r.projectConfigPath(e),e))}return t.push(`.claude/launch.json`),Array.from(new Set(t))}function X5(e){let t=N(e,..._B);if(!g(t))return[];try{let e=xB(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=ln[e];r&&n.push(`${r}/${t}/`)}return Array.from(new Set(n))}catch{return[]}}function ODe(e,t){let n=Z5(e,t).tracked;if(n.length>0)return{kind:`refused-tracked`,tracked:n,remediation:Q5(n)};let r=$5(e);if(r.kind!==`ok`)return r.result;let i=g(r.path)?S(r.path,`utf-8`):``,a=new Set(X5(e)),o=[],s=a.size===0?i:i.split(`
1485
1485
  `).filter(e=>{let t=e.trim();return!a.has(t)||(o.push(t),!1)}).join(`
1486
- `),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(`
1486
+ `),c=n7(s),l=[],u=[];for(let e of t)t7(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(`
1487
1487
  `)?``:`
1488
1488
  `,f=l.length===0?``:`${l.join(`
1489
- `)}\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 kDe(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(`
1489
+ `)}\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 kDe(e,t){let n=$5(e);if(n.kind!==`ok`)return n.result;if(!g(n.path))return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let r=t.map(e=>e7(e)),i=new Set;for(let e of r)for(let t of e)i.add(t);i.add(q5),i.add(J5);for(let t of X5(e))i.add(t);let a;try{a=S(n.path,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}let o=a.split(`
1490
1490
  `),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(`
1491
- `);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 ADe(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 jDe(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(ln))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`,`--`,r],W6({cwd:e,stdio:[`ignore`,`ignore`,`ignore`]})),n.push(r)}catch{}}return{tracked:n}}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}${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(`
1492
- `)}function Q5(e){let t=Sge(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(`
1493
- `)){let e=n.trim();e.length!==0&&t.add(e)}return t}function MDe(e,t){return NDe(ye(t,e))}function NDe(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 PDe(e){for(let t of e.split(`
1494
- `)){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 FDe(e,t){let n=e.charCodeAt(0)===65279,r=n?e.slice(1):e,i=r.includes(`\r
1491
+ `);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 ADe(e){let t=$5(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=n7(n),i=Y5(e);for(let e of i)if(t7(r,e))return`local-only`;return r.has(q5)?`local-only`:`shared`}function jDe(e){let t=$5(e);if(t.kind!==`ok`||!g(t.path))return[];let n;try{n=S(t.path,`utf-8`)}catch{return[]}let r=n7(n),i=[...Y5(e),...X5(e)].filter(e=>t7(r,e)),a=new Set(i),o=[];for(let e of Object.values(ln))e!==null&&o.push(e);let s=[];for(let e of r){if(a.has(e))continue;if(e===q5||e===J5){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 Z5(e,t){let n=[];for(let r of t){let t=be(e,r);if(g(t))try{s(`git`,[`ls-files`,`--error-unmatch`,`--`,r],W6({cwd:e,stdio:[`ignore`,`ignore`,`ignore`]})),n.push(r)}catch{}}return{tracked:n}}function Q5(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}${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(`
1492
+ `)}function $5(e){let t=Sge(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 e7(e){let t=e.replace(/\/$/,``);return new Set([e,t,`/${e}`,`/${t}`])}function t7(e,t){for(let n of e7(t))if(e.has(n))return!0;return!1}function n7(e){let t=new Set;for(let n of e.split(`
1493
+ `)){let e=n.trim();e.length!==0&&t.add(e)}return t}function MDe(e,t){return NDe(ye(t,e))}function NDe(e){return xe===`/`?e:e.split(xe).join(`/`)}function r7(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 i7(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 PDe(e){for(let t of e.split(`
1494
+ `)){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 a7(e){let t=(e.match(/\r\n/g)??[]).length;return t!==0&&t>=(e.match(/\n/g)??[]).length-t}function o7(e){try{return te(e).mode&511}catch{return}}function FDe(e,t){let n=e.charCodeAt(0)===65279,r=n?e.slice(1):e,i=r.includes(`\r
1495
1495
  `)?`\r
1496
1496
  `:`
1497
- `,a=C4(r,t,void 0,{formattingOptions:{...PDe(r),eol:i}});if(a.length===0)return{text:e,changed:!1};let o=`${n?``:``}${w4(r,a)}`;return{text:o,changed:o!==e}}const IDe={allowTrailingComma:!0,disallowComments:!1};function LDe(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function o7(e){let t=[],n=kSe(e,t,IDe);return t.some(t=>!LDe(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&&S4(e)===t&&(n+=1)}return n}function c7(e,t){FQ(e,`${JSON.stringify(t,null,2)}\n`)}function RDe(e,t){let n=SEe(t);FQ(e,n.endsWith(`
1497
+ `,a=w4(r,t,void 0,{formattingOptions:{...PDe(r),eol:i}});if(a.length===0)return{text:e,changed:!1};let o=`${n?``:``}${T4(r,a)}`;return{text:o,changed:o!==e}}const IDe={allowTrailingComma:!0,disallowComments:!1};function LDe(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function s7(e){let t=[],n=NSe(e,t,IDe);return t.some(t=>!LDe(t,e))||n?.type!==`object`?null:n}function c7(e,t){let n=0;for(let r of e.children??[]){let e=r.children?.[0];e!==void 0&&C4(e)===t&&(n+=1)}return n}function l7(e,t){FQ(e,`${JSON.stringify(t,null,2)}\n`)}function RDe(e,t){let n=CEe(t);FQ(e,n.endsWith(`
1498
1498
  `)?n:`${n}\n`)}function zDe(e,t){let n=(0,nn.stringify)(t);FQ(e,n.endsWith(`
1499
- `)?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(K8(e)&&K8(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 BDe(e,t,n){return K8(e)&&n.every(n=>u7(e[n],t[n]))}function VDe(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 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:K8(r)?r[n]:void 0}function HDe(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 J8(`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(S4(c),t,i),u=K8(l)?l[n]:void 0,d=u!==void 0,f=b5(r);if(d&&a?p5(u):d&&BDe(u,r,f))return{kind:o?`unchanged`:`overwritten`};let p=s.charCodeAt(0)===65279,m=p?s.slice(1):s,h=m.includes(`\r
1499
+ `)?n:`${n}\n`)}const u7=10485760;function d7(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)=>d7(e,t[n]));if(K8(e)&&K8(t)){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&d7(e[n],t[n]))}return!1}function BDe(e,t,n){return K8(e)&&n.every(n=>d7(e[n],t[n]))}function VDe(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 f7(e,t,n){return t===void 0?[e,n]:[e,t,n]}function p7(e,t,n,r){let i={[n]:r};return{[e]:t===void 0?i:{[t]:i}}}function m7(e,t,n){let r=e[t];return n===void 0?r:K8(r)?r[n]:void 0}function HDe(e,t,n,r,i,a=!1,o=!1){if(!g(e))return o?{kind:`unchanged`}:(l7(e,p7(t,i,n,r)),{kind:`written`});let s;try{s=S(e,`utf-8`)}catch(e){return J8(`json config read failed`,e),{kind:`declined`,reason:r7(e)}}if(s.trim()===``)return o?{kind:`unchanged`}:(l7(e,p7(t,i,n,r)),{kind:`written`});if(Buffer.byteLength(s,`utf-8`)>u7)return{kind:`declined`,reason:`oversize`};let c=s7(s);if(!c)return{kind:`declined`,reason:`unparseable`};if(c7(c,t)>1)return{kind:`declined`,reason:`duplicate-container`};let l=m7(C4(c),t,i),u=K8(l)?l[n]:void 0,d=u!==void 0,f=b5(r);if(d&&a?p5(u):d&&BDe(u,r,f))return{kind:o?`unchanged`:`overwritten`};let p=s.charCodeAt(0)===65279,m=p?s.slice(1):s,h=m.includes(`\r
1501
1501
  `)?`\r
1502
1502
  `:`
1503
- `,_={...VDe(m),eol:h},v=d7(t,i,n),y=m;if(o)for(let e of d?x5(u,r):[]){let t=C4(y,[...v,e],void 0,{formattingOptions:_});y=w4(y,t)}else if(d&&!a&&y5(u))for(let e of f){let t=C4(y,[...v,e],r[e],{formattingOptions:_});y=w4(y,t)}else{let e=C4(y,v,r,{formattingOptions:_});y=w4(y,e)}let b=`${p?``:``}${y}`;return b!==s&&FQ(e,b,{mode:a7(e)}),o&&b===s?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}function UDe(e,t,n,r,i,a=!1,o=!1){let s=``;if(g(t))try{s=S(t,`utf-8`)}catch(e){return J8(`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?(RDe(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(`
1503
+ `,_={...VDe(m),eol:h},v=f7(t,i,n),y=m;if(o)for(let e of d?x5(u,r):[]){let t=w4(y,[...v,e],void 0,{formattingOptions:_});y=T4(y,t)}else if(d&&!a&&y5(u))for(let e of f){let t=w4(y,[...v,e],r[e],{formattingOptions:_});y=T4(y,t)}else{let e=w4(y,v,r,{formattingOptions:_});y=T4(y,e)}let b=`${p?``:``}${y}`;return b!==s&&FQ(e,b,{mode:o7(e)}),o&&b===s?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}function UDe(e,t,n,r,i,a=!1,o=!1){let s=``;if(g(t))try{s=S(t,`utf-8`)}catch(e){return J8(`toml config read failed`,e),{kind:`declined`,reason:r7(e)}}let c=s.trim()===``;if(c&&o)return{kind:`unchanged`};if(e.backend===`fallback`)return c?(RDe(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=a7(u),f=c||u.endsWith(`
1504
1504
  `),p,m=!1;try{let t=WDe(e,u,n,r);if(o){let n=u;for(let a of t===void 0?[]:x5(t,i))n=e.removeEntryKey(n,r,a).text;p={text:n,existed:t!==void 0}}else{let n=GDe(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 J8(`upsertEntry failed`,e),{kind:`declined`,reason:`unparseable`}}let h=p.text;f?h.endsWith(`
1505
1505
  `)||(h=`${h}\n`):h=h.replace(/\n+$/,``),d&&(h=h.replace(/\r\n/g,`
1506
1506
  `).replace(/\n/g,`\r
1507
- `));let _=`${l?``:``}${h}`;return _!==s&&FQ(t,_,{mode:a7(t)}),o&&_===s?{kind:`unchanged`}:{kind:p.existed||m?`overwritten`:`written`}}function WDe(e,t,n,r){if(t.trim()===``)return;let i=e.parseToObject(t)[n],a=K8(i)?i[r]:void 0;return K8(a)?a:void 0}function GDe(e,t,n){return e===void 0||p5(e)?{kind:`merge`,prune:[]}:n||!y5(e)?{kind:`replace`}:{kind:`merge`,prune:x5(e,t)}}function KDe(e,t,n,r,i=!1,a=!1){let o=``;if(g(e))try{o=S(e,`utf-8`)}catch(e){return J8(`yaml config read failed`,e),{kind:`declined`,reason:n7(e)}}if(o.trim()===``)return a?{kind:`unchanged`}:(zDe(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,nn.parseDocument)(c);if(l.errors.length>0)return{kind:`declined`,reason:`unparseable`};let u=[t,n],d=l.hasIn(u);l.hasIn([t])&&!(0,nn.isCollection)(l.getIn([t],!0))&&l.deleteIn([t]);let f=l.getIn(u,!0),p=d&&(0,nn.isCollection)(f)&&(i?p5(f.toJSON()):y5(f.toJSON()));if(a){if(d&&(0,nn.isCollection)(f))for(let e of x5(f.toJSON(),r))l.deleteIn([...u,e])}else if(p)for(let e of b5(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(`
1507
+ `));let _=`${l?``:``}${h}`;return _!==s&&FQ(t,_,{mode:o7(t)}),o&&_===s?{kind:`unchanged`}:{kind:p.existed||m?`overwritten`:`written`}}function WDe(e,t,n,r){if(t.trim()===``)return;let i=e.parseToObject(t)[n],a=K8(i)?i[r]:void 0;return K8(a)?a:void 0}function GDe(e,t,n){return e===void 0||p5(e)?{kind:`merge`,prune:[]}:n||!y5(e)?{kind:`replace`}:{kind:`merge`,prune:x5(e,t)}}function KDe(e,t,n,r,i=!1,a=!1){let o=``;if(g(e))try{o=S(e,`utf-8`)}catch(e){return J8(`yaml config read failed`,e),{kind:`declined`,reason:r7(e)}}if(o.trim()===``)return a?{kind:`unchanged`}:(zDe(e,{[t]:{[n]:r}}),{kind:`written`});if(Buffer.byteLength(o,`utf-8`)>u7)return{kind:`declined`,reason:`oversize`};let s=o.charCodeAt(0)===65279,c=s?o.slice(1):o,l=(0,nn.parseDocument)(c);if(l.errors.length>0)return{kind:`declined`,reason:`unparseable`};let u=[t,n],d=l.hasIn(u);l.hasIn([t])&&!(0,nn.isCollection)(l.getIn([t],!0))&&l.deleteIn([t]);let f=l.getIn(u,!0),p=d&&(0,nn.isCollection)(f)&&(i?p5(f.toJSON()):y5(f.toJSON()));if(a){if(d&&(0,nn.isCollection)(f))for(let e of x5(f.toJSON(),r))l.deleteIn([...u,e])}else if(p)for(let e of b5(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=a7(c);c.endsWith(`
1508
1508
  `)?m.endsWith(`
1509
1509
  `)||(m=`${m}\n`):m=m.replace(/\n+$/,``),h&&(m=m.replace(/\r\n/g,`
1510
1510
  `).replace(/\n/g,`\r
1511
- `));let _=`${s?``:``}${m}`;return _!==o&&FQ(e,_,{mode:a7(e)}),a&&_===o?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}const qDe=`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 YDe(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{LQ(`${o}.lock`,()=>{let t=G5(o).writePath;if(s||v(M(t),{recursive:!0}),e.format===`toml`){let r=UDe(Q8(),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=KDe(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=HDe(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 JDe={pi:I5};function YDe(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=JDe[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{LQ(`${t}.lock`,()=>{let e=null;try{e=S(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}FQ(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 XDe(e){let t=QEe(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(!K8(i))return{kind:`no-entry`};let a=i[n];return K8(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:hDe(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=Q8().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return v7(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,nn.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(S4(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}function ZDe(e,t){let n=[];for(let r of $8)r!==`claude-desktop`&&m7(A5[r],e,t)&&n.push(r);return n}function b7(e){return e===`opencode`?VEe:BEe}function QDe(e,t,n){let r=A5[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 $De(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const eOe=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function tOe(e){return e.replace(eOe,`$1"[REDACTED-DEVICE-ID]"`)}function C7(e){return tOe($De(e))}const nOe=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function rOe(e){if(typeof e!=`string`)return null;let t=nOe.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 iOe(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 aOe(e){try{let t=iOe(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:rOe(a)}}catch{return{kind:`unreadable`}}}function oOe(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function sOe(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=aOe(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!oOe(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`}}function w7(){return N(k(),`.ok`,`bug-reports`)}function cOe(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 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`))?Ne(`sha256`).update(be(e)).digest(`hex`).slice(0,12):null}function lOe(){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`,W6({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 uOe=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function E7(e){let t=me(e);return uOe.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function dOe(e,t){return k7(e,t).files}const fOe=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function D7(e,t=`com.inkeep.open-knowledge`){let n=N(e,`${t}.ShipIt`);if(!g(n))return[];let r;try{r=w(n)}catch{return[]}return fOe.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 O7(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 k7(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(E7),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=>!E7(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function pOe(e){let t=N(e,`.ok`,`local`);return g(t)?{files:[`server.lock`,`last-spawn-error.log`,Lu].map(e=>N(t,e)).filter(e=>g(e))}:{files:[]}}function mOe(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 hOe(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#${Ne(`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 A7(e){let t=e.revealDocNames?e.content:hOe(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=wB(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 j7(e){for(let t of e.files)try{let n=S(t,`utf8`);A7({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 gOe(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,o=t.userLogsDir??N(k(),`.ok`,`logs`),s=t.projectDir?T7(t.projectDir,i):null;v(M(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=lOe();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=k7(s,o),{files:d}=t.projectDir?pOe(t.projectDir):{files:[]},{files:f}=t.projectDir?mOe(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(a4(),1)),b=new y;j7({zipfile:b,files:[...l,...p],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),j7({zipfile:b,files:d,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),j7({zipfile:b,files:f,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),j7({zipfile:b,files:t.bugReportLedgerFiles??[],prefix:aR,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),j7({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)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&A7({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=>`${aR}/${me(e)}`)),ne=_.filter(e=>te.has(e)),re=s?_.filter(e=>e.startsWith(`logs/`)&&!E7(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: ${CB.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(`
1512
- `);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 M7(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 N7(e){return Ne(`sha256`).update(e).digest(`hex`)}function P7(e){return N(be(e),`.ok`,`pi-trust`)}function F7(e,t){return N(P7(e),N7(be(t)))}function I7(e,t,n){return N(F7(e,t),`${N7(n)}.json`)}var L7=class extends Error{constructor(e,t,n,r){super(`Pi trust receipt at ${M7(e)} ${M7(t)}; ${M7(n)}`,{cause:r}),this.name=`PiTrustReceiptError`}};function R7(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 L7(e,`could not ${t}: ${i}`,a,n)}function z7(e){let t;try{t=_(e)}catch(t){if(t.code===`ENOENT`)return!1;throw R7(e,`be inspected`,t)}if(!t.isDirectory())throw new L7(e,`is not a regular directory`,`restore the intended receipt directory without a symlink, then retry`);return!0}function B7(e,t){return Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t))}function V7(e,t){if(!K8(e)||!B7(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`||!K8(e.previous))throw new L7(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&&B7(e.previous,[`present`]))n={present:!1};else if(e.previous.present===!0&&B7(e.previous,[`present`,`value`]))n={present:!0,value:e.previous.value};else throw new L7(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 H7(e,t,n){let r;try{r=_(n)}catch(e){throw R7(n,`be inspected`,e)}if(!r.isFile())throw new L7(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 R7(n,`be read`,e)}let a;try{a=JSON.parse(i)}catch(e){throw new L7(n,`is not valid JSON`,`repair its JSON syntax without changing the recorded decision, then retry`,e)}let o=V7(a,n);if(o.cwd!==be(t)||n!==I7(e,t,o.canonicalTrustPath))throw new L7(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 U7(e,t){let{record:n,path:r}=t;for(let t of[P7(e),F7(e,n.cwd)])if(!z7(t))throw new L7(t,`no longer exists`,`restore access to the expected receipt directory, then retry`);let i=H7(e,n.cwd,r);if(!Le(i.record,n))throw new L7(r,`changed while its trust decision was being updated`,`retry to read its current ownership record`);return i}function _Oe(e,t,n,r,i){let a={version:1,cwd:be(t),configuredTrustPath:be(n),canonicalTrustPath:be(r),state:`pending`,previous:i},o=I7(e,a.cwd,a.canonicalTrustPath),s=`${JSON.stringify(a,null,2)}\n`;if(!Le(V7(JSON.parse(s),o),a))throw new L7(o,`cannot preserve the previous decision as JSON`,`provide the original decision as a JSON value before retrying`);z7(P7(e)),z7(M(o));try{v(M(o),{recursive:!0,mode:448})}catch(e){throw R7(M(o),`be created`,e)}let c;try{c=_(o,{throwIfNoEntry:!1})}catch(e){throw R7(o,`be inspected`,e)}if(c)throw new L7(o,`already exists`,`reconcile the existing ownership record before recording another grant`);try{FQ(o,s,{mode:384})}catch(e){throw R7(o,`be written`,e)}return{path:o,record:a}}function vOe(e,t){let n=U7(e,t);if(n.record.state!==`pending`)throw new L7(n.path,`is already committed`,`use the current ownership record without committing it again`);let r={...n.record,state:`committed`};try{FQ(n.path,`${JSON.stringify(r,null,2)}\n`,{mode:384})}catch(e){throw R7(n.path,`be committed`,e)}return{path:n.path,record:r}}function W7(e,t){if(!z7(P7(e)))return[];let n=F7(e,t);if(!z7(n))return[];let r;try{r=w(n).sort()}catch(e){throw R7(n,`be listed`,e)}return r.filter(e=>/^[a-f0-9]{64}\.json$/.test(e)).map(r=>H7(e,t,N(n,r)))}function G7(e,t){let n=U7(e,t);try{ne(n.path)}catch(e){throw R7(n.path,`be removed after reconciling its grant`,e)}for(let t of[M(n.path),P7(e)])try{ee(t)}catch(e){let n=e.code;if(n!==`ENOTEMPTY`&&n!==`EEXIST`&&n!==`ENOENT`)throw R7(t,`be removed after reconciling its grant`,e)}}var yOe=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`)}}})),bOe=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())}}})),xOe=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}})),K7=i(((e,n)=>{var r=t(`fs`),i=yOe(),a=bOe(),o=xOe(),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(`
1513
- 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))}}})),SOe=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}})),COe=i((e=>{var t=SOe();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}}})),wOe=i(((e,t)=>{t.exports=COe()})),TOe=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`)})),EOe=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=TOe(),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)}}})),DOe=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})),OOe=i(((e,n)=>{let r=t(`path`),i=K7(),a=wOe(),o=EOe(),s=DOe(),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})),kOe=i(((e,t)=>{let n=K7();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}})),q7=e(i(((e,t)=>{let n=OOe(),{toPromise:r,toSync:i,toSyncOptions:a}=kOe();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 J7=5e3;function Y7(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 ${J7}ms`,{cause:e}),{code:`ELOCKED`});return Math.min(25,r)}function X7(e,t){}function Z7(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 AOe(e,t,n){await sye(`${t}.ok.lock`,async()=>{let t=performance.now()+J7,r;for(;;)try{r=await q7.default.lock(M(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){await ze(Y7(n,t,e))}let i=[];try{n()}catch(e){i.push(e)}finally{try{await r()}catch(e){i.push(e)}}Z7(i,e)},{onWarn:X7})}function jOe(e,t,n){LQ(`${t}.ok.lock`,()=>{let t=performance.now()+J7,r=new Int32Array(new SharedArrayBuffer(4)),i;for(;;)try{i=q7.default.lockSync(M(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){Atomics.wait(r,0,0,Y7(n,t,e))}let a=[];try{n()}catch(e){a.push(e)}finally{try{i()}catch(e){a.push(e)}}Z7(a,e)},{onWarn:X7})}const MOe=[`settings.json`,`prompts`,`themes`,`SYSTEM.md`,`APPEND_SYSTEM.md`];var Q7=class extends Error{name=`PiResourceInspectionError`};function $7(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 Q7(r7(`missing-symlink-target`),{cause:e}):e}return d(e,p.R_OK|(n.isDirectory()?p.X_OK:0)),!0}function NOe(e){return e===`open-knowledge`||e.startsWith(`open-knowledge-`)}function POe(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 MOe)r=N(i,`.pi`,e),$7(r)&&s.push(r);if(r=N(i,`.pi`,`extensions`),$7(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,$7(e)))for(let t of w(e).sort())NOe(t)||s.push(N(e,t));let c=M(i);for(;c!==i;){r=N(c,`.agents`,`skills`),r!==o&&$7(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 ${M7(r)}: ${e instanceof Q7?e.message:r7(n7(e))}`}}}function e9(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 t9(e,t,n){let r=be(e),i=O5({home:t,env:n??(t===void 0?process.env:{})});return{cwd:r,bridgePath:A5.pi.projectConfigPath(r),trustPath:N(i,`trust.json`)}}function n9(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 ${M7(e)} is not a directory; restore the intended project directory, then retry`}}catch(t){return{kind:`refused`,error:`Pi project directory ${M7(e)} could not be resolved or accessed: ${M7(t instanceof Error?t.message:String(t))}; restore the directory or symlink and check its permissions, then retry`}}}function r9(e){let t=n9(e.path);if(t.kind===`refused`)return t.error;if(t.project.canonical!==e.canonical)return`Pi project path ${M7(e.path)} changed while waiting for its trust lock; restore the intended project location, then retry`}function i9(e,t,n){let r=y7(A5.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 u5(i)?{state:`own-current`,text:a}:F5(i)?{state:`own-stale`,text:a}:{state:`foreign`,text:a}}function a9(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 K8(r)?{state:r[t]===!0?`trusted`:`untrusted`,entries:r,trailingNewline:n.endsWith(`
1514
- `)}:{state:`unreadable`,reason:`invalid-json`}}function FOe(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 o9(e,t){return{kind:`refused`,error:`trust store ${M7(e)}: ${FOe(t)}`}}function s9(e){let t=e9(e);try{switch(t.kind){case`declined`:return o9(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 o9(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 o9(e,i.isSymbolicLink()&&t.code===`ENOENT`?`missing-symlink-target`:n7(t))}}catch(t){return o9(e,n7(t))}}function c9(e,t){let n=s9(e);return n.kind===`refused`?n:n.path!==t.path||t.kind===`ready`&&n.kind===`missing`?o9(e,`path-changed`):n}function IOe(e,t,n){let r=t9(e,t,n),i=n9(r.cwd);if(i.kind===`refused`)return{...r,project:`unavailable`,error:i.error};let a=i9(r.cwd,r.bridgePath,t).state,o=s9(r.trustPath),s=o.kind===`refused`?`unreadable`:o.kind===`missing`?`untrusted`:a9(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:LOe(r.bridgePath).displayNames}}function LOe(e){let t=M(e),n=me(e);try{return{displayNames:w(t).filter(e=>e!==n&&e.endsWith(`.ts`)).sort().map(e=>M7(JSON.stringify(e)))}}catch{return{displayNames:[]}}}async function ROe(e,t={mode:`published`},n,r,i){let a=t9(e,n,r),o=n9(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 ${M7(i)} no longer matches the current directory ${M7(o.project.canonical)}. Reopen the intended project and approve the Pi integration again; no bridge or trust settings were changed.`};let s=i9(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=I5(t)}catch{e=void 0}c=e!==void 0&&s.text===e?`unchanged`:`refreshed`}if(c!==`unchanged`){let e=g7(A5.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}`:M7(e.error)}}let l=await zOe(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 zOe(e,t,n){let r=t.canonical,i=s9(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:M7(e instanceof Error?e.message:String(e))}}let a={action:`added`};try{await AOe(e,i.path,()=>{let o=r9(t);if(o){a.action=`refused-unreadable`,a.error=o;return}let s=c9(e,i);if(s.kind===`refused`){a.action=`refused-unreadable`,a.error=s.error;return}let c=a9(s,r);if(c.state===`trusted`){a.action=`already-trusted`;return}if(c.state===`unreadable`){a.action=`refused-unreadable`,a.error=o9(e,c.reason).error;return}let l=u9(n,()=>{let t=W7(n,r).find(e=>e.record.canonicalTrustPath===s.path);return t&&G7(n,t),_Oe(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?`
1515
- `:``),f=a7(s.path);FQ(s.path,d,f===void 0?void 0:{mode:f}),u9(n,()=>vOe(n,l)),a.action=`added`})}catch(e){return{action:`failed`,error:M7(e instanceof Error?e.message:String(e))}}return a}function BOe(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 l9(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(`
1511
+ `));let _=`${s?``:``}${m}`;return _!==o&&FQ(e,_,{mode:o7(e)}),a&&_===o?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}const qDe=`open-knowledge-ui`;function h7(e,t,n){try{let r=e.detectPath?.(t,n)??M(e.configPath(t,n));return g(r)}catch{return!1}}function g7(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 _7(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||g7(e,t,r);if(!i&&c&&!h7(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{R5(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 YDe(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{LQ(`${o}.lock`,()=>{let t=K5(o).writePath;if(s||v(M(t),{recursive:!0}),e.format===`toml`){let r=UDe(Q8(),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=KDe(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=HDe(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 JDe={pi:L5};function YDe(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=JDe[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{LQ(`${t}.lock`,()=>{let e=null;try{e=S(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}FQ(t,c,e===null?void 0:{mode:o7(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 XDe(e){let t=$Ee(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=>_7(t,``,n,e.home))}function v7(e,t,n,r){let i=b7(e,t,n,r);return i.kind===`present`?i.entry:null}function y7(e,t,n,r){let i=m7(e,t,r);if(!K8(i))return{kind:`no-entry`};let a=i[n];return K8(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function b7(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>u7)return{kind:`decline`,reason:`oversize`}}catch(e){return{kind:`decline`,reason:r7(e)}}let a;try{a=S(i,`utf-8`)}catch(e){return{kind:`decline`,reason:r7(e)}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:hDe(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=Q8().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return y7(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,nn.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:y7(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=s7(a);return s?c7(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:y7(C4(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}function ZDe(e,t){let n=[];for(let r of $8)r!==`claude-desktop`&&h7(A5[r],e,t)&&n.push(r);return n}function x7(e){return e===`opencode`?HEe:VEe}function QDe(e,t,n){let r=A5[e],i=x7(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=v7(r,t,n,o.configPath);if(a!==null&&i(a))return{editorId:e,scope:o.scope,configPath:o.configPath}}return null}const S7=8192;function C7(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 $De(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const eOe=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function tOe(e){return e.replace(eOe,`$1"[REDACTED-DEVICE-ID]"`)}function w7(e){return tOe($De(e))}const nOe=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function rOe(e){if(typeof e!=`string`)return null;let t=nOe.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 iOe(e){let t=b(e,`r`);try{let e=Buffer.alloc(S7),n=0,r=!1;for(;n<S7;){let i=C(t,e,n,S7-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 aOe(e){try{let t=iOe(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:rOe(a)}}catch{return{kind:`unreadable`}}}function oOe(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function sOe(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=aOe(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!oOe(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`}}function T7(){return N(k(),`.ok`,`bug-reports`)}function cOe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=T7(),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 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`))?Ne(`sha256`).update(be(e)).digest(`hex`).slice(0,12):null}function lOe(){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`,W6({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 uOe=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function D7(e){let t=me(e);return uOe.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function dOe(e,t){return A7(e,t).files}const fOe=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function O7(e,t=`com.inkeep.open-knowledge`){let n=N(e,`${t}.ShipIt`);if(!g(n))return[];let r;try{r=w(n)}catch{return[]}return fOe.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 pOe(e){let t=N(e,`.ok`,`local`);return g(t)?{files:[`server.lock`,`last-spawn-error.log`,Lu].map(e=>N(t,e)).filter(e=>g(e))}:{files:[]}}function mOe(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 hOe(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#${Ne(`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:hOe(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=wB(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`)?w7(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 gOe(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=lOe();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=A7(s,o),{files:d}=t.projectDir?pOe(t.projectDir):{files:[]},{files:f}=t.projectDir?mOe(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(a4(),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:aR,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)}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)`:C7(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=>`${aR}/${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: ${CB.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(`
1512
+ `);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 Ne(`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(!K8(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`||!K8(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(!Le(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 _Oe(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(!Le(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{FQ(o,s,{mode:384})}catch(e){throw z7(o,`be written`,e)}return{path:o,record:a}}function vOe(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{FQ(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 yOe=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`)}}})),bOe=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())}}})),xOe=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=yOe(),a=bOe(),o=xOe(),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(`
1513
+ 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))}}})),SOe=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}})),COe=i((e=>{var t=SOe();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}}})),wOe=i(((e,t)=>{t.exports=COe()})),TOe=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`)})),EOe=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=TOe(),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)}}})),DOe=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})),OOe=i(((e,n)=>{let r=t(`path`),i=q7(),a=wOe(),o=EOe(),s=DOe(),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})),kOe=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=OOe(),{toPromise:r,toSync:i,toSyncOptions:a}=kOe();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 AOe(e,t,n){await sye(`${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 jOe(e,t,n){LQ(`${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 MOe=[`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(i7(`missing-symlink-target`),{cause:e}):e}return d(e,p.R_OK|(n.isDirectory()?p.X_OK:0)),!0}function NOe(e){return e===`open-knowledge`||e.startsWith(`open-knowledge-`)}function POe(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 MOe)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())NOe(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:i7(r7(e))}`}}}function t9(e){let t;try{t=_(e).isSymbolicLink()}catch(e){return e.code===`ENOENT`?{kind:`not-present`}:{kind:`declined`,reason:r7(e)}}let n=K5(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`:r7(e)}}return{kind:`ready`,path:n.writePath,symlink:t}}function n9(e,t,n){let r=be(e),i=O5({home:t,env:n??(t===void 0?process.env:{})});return{cwd:r,bridgePath:A5.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=b7(A5.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 u5(i)?{state:`own-current`,text:a}:I5(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:r7(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 K8(r)?{state:r[t]===!0?`trusted`:`untrusted`,entries:r,trailingNewline:n.endsWith(`
1514
+ `)}:{state:`unreadable`,reason:`invalid-json`}}function FOe(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 i7(e)}}function s9(e,t){return{kind:`refused`,error:`trust store ${N7(e)}: ${FOe(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`:r7(t))}}catch(t){return s9(e,r7(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 IOe(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:LOe(r.bridgePath).displayNames}}function LOe(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 ROe(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=L5(t)}catch{e=void 0}c=e!==void 0&&s.text===e?`unchanged`:`refreshed`}if(c!==`unchanged`){let e=_7(A5.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 zOe(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 zOe(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 AOe(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),_Oe(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?`
1515
+ `:``),f=o7(s.path);FQ(s.path,d,f===void 0?void 0:{mode:f}),d9(n,()=>vOe(n,l)),a.action=`added`})}catch(e){return{action:`failed`,error:N7(e instanceof Error?e.message:String(e))}}return a}function BOe(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(`
1516
1516
  `)}:n.detail===void 0?n:{...n,detail:i.join(`
1517
- `)}}function VOe(e,t,n,r={}){let i=t9(e,t,n),a=t??k(),o=n9(i.cwd),s=o.kind===`refused`&&r.recordedOnly?BOe(i.cwd):void 0,c=o.kind===`ready`?o.project.canonical:s,l;try{l=u9(a,()=>{let e=W7(a,i.cwd);return c===void 0||c===i.cwd?e:[...W7(a,c),...e]})}catch(e){return{action:`failed`,error:M7(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 ${M7(JSON.stringify(t.cwd))}; configured store ${M7(JSON.stringify(t.configuredTrustPath))}; recorded destination ${M7(JSON.stringify(t.canonicalTrustPath))}; ownership record ${M7(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(`
1518
- `)}}let u=POe(o.project.canonical,a,A5.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=s9(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 ${M7(e)} no longer points to its recorded destination ${M7(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(HOe(e,a,d,o.project))}return l9(f)}function u9(e,t){try{return t()}catch(t){throw t instanceof L7?t:Error(`Could not access OpenKnowledge's Pi trust ownership records at ${M7(N(e,`.ok`,`pi-trust`))}: ${M7(t instanceof Error?t.message:String(t))}. Check the records and their permissions, then retry.`,{cause:t})}}function HOe(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 ${M7(M(a.path))} is unavailable: ${M7(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{jOe(i,a.path,()=>{let e=r9(r);if(e){c.result={action:`kept-unverified`,error:e};return}let l=c9(i,a);if(l.kind===`refused`){c.result={action:`refused-unreadable`,error:l.error};return}let u=a9(l,r.canonical);if(u.state===`unreadable`){c.result={action:`refused-unreadable`,error:o9(i,u.reason).error};return}let d=o.map(e=>({cwd:e.cwd,mode:e.mode,expectedConfiguredPath:e.receipt?.record.configuredTrustPath,receipt:u9(t,()=>W7(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{UOe(e,t,i,l.path,u,n,r,c)}catch(t){let n=M7(t instanceof Error?t.message:String(t)),r=t instanceof L7?``:`; retry to check its current state.`;s.push({action:`failed`,error:`Pi trust entry ${M7(JSON.stringify(e.cwd))} in ${M7(i)} could not be reconciled: ${n}${r}`})}s.push(c.result),c.result={action:`not-present`}}})}catch(e){s.push({action:`failed`,error:M7(e instanceof Error?e.message:String(e))})}return l9([...s,c.result])}function UOe(e,t,n,r,i,a,o,s){let{cwd:c,receipt:l}=e;if(i.entries[c]!==!0){l&&e.mode===`recorded`&&u9(t,()=>G7(t,l)),s.result={action:`not-present`};return}let u=`To remove this grant manually, close Pi and remove only the ${M7(JSON.stringify(c))} entry from ${M7(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=>M7(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`&&u9(t,()=>G7(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 ${M7(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?`
1519
- `:``),p=a7(r);FQ(r,f,p===void 0?void 0:{mode:p}),i.entries=d,u9(t,()=>G7(t,l)),s.result={action:`removed`}}function WOe(e){return u5(e)||p5(e)||F5(e)}const d9=10485760;function f9(e,t,n,r=!1){let i=VOe(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 p9(e,t,n,r){if(e.id!==`pi`)return{kind:`not-present`};let i=f9(t,n,r,!0);return i.trust===`not-present`?{kind:`not-present`}:{kind:`removed`,...i}}function GOe(e,t,n,r,i){let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=e9(a);if(o.kind===`not-present`)return p9(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 p9(e,t,n,i);if(s.kind===`decline`)return{kind:`declined`,reason:s.reason};if(!WOe(s.entry))return{kind:`left-foreign`};let c=e.serverName(t);if(e.format===`file`){let e=f9(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`?JOe(o.path,c):e.format===`yaml`?qOe(o.path,e.topLevelKey,c):KOe(o.path,e.topLevelKey,e.serverMapSubKey,c)}function KOe(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`)>d9)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=FDe(i,d7(t,n,r));return o?(FQ(e,a,{mode:a7(e)}),{kind:`removed`}):{kind:`not-present`}}function qOe(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`)>d9)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,nn.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(`
1517
+ `)}}function VOe(e,t,n,r={}){let i=n9(e,t,n),a=t??k(),o=r9(i.cwd),s=o.kind===`refused`&&r.recordedOnly?BOe(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(`
1518
+ `)}}let u=POe(o.project.canonical,a,A5.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(HOe(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 HOe(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{jOe(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{UOe(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 UOe(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?`
1519
+ `:``),p=o7(r);FQ(r,f,p===void 0?void 0:{mode:p}),i.entries=d,d9(t,()=>K7(t,l)),s.result={action:`removed`}}function WOe(e){return u5(e)||p5(e)||I5(e)}const f9=10485760;function p9(e,t,n,r=!1){let i=VOe(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 GOe(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=b7(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(!WOe(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`?JOe(o.path,c):e.format===`yaml`?qOe(o.path,e.topLevelKey,c):KOe(o.path,e.topLevelKey,e.serverMapSubKey,c)}function KOe(e,t,n,r){let i;try{i=S(e,`utf-8`)}catch(e){return{kind:`declined`,reason:r7(e)}}if(Buffer.byteLength(i,`utf-8`)>f9)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=FDe(i,f7(t,n,r));return o?(FQ(e,a,{mode:o7(e)}),{kind:`removed`}):{kind:`not-present`}}function qOe(e,t,n){let r;try{r=S(e,`utf-8`)}catch(e){return{kind:`declined`,reason:r7(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,nn.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=a7(a);a.trim()===``||a.endsWith(`
1520
1520
  `)?c.endsWith(`
1521
1521
  `)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
1522
1522
  `).replace(/\n/g,`\r
1523
- `));let u=`${i?``:``}${c}`;return u!==r&&FQ(e,u,{mode:a7(e)}),{kind:`removed`}}function JOe(e,t){let n=Q8();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(`
1523
+ `));let u=`${i?``:``}${c}`;return u!==r&&FQ(e,u,{mode:o7(e)}),{kind:`removed`}}function JOe(e,t){let n=Q8();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:r7(e)}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=a7(a),s=a.trim()===``||a.endsWith(`
1524
1524
  `),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(`
1525
1525
  `)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
1526
1526
  `).replace(/\n/g,`\r
1527
- `));let u=`${i?``:``}${l}`;return u!==r&&FQ(e,u,{mode:a7(e)}),{kind:`removed`}}function YOe(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}function XOe(e){let{priorCommand:t,priorArgs:n}=m9(e.priorEntry);return{event:`mcp-config-migrate`,scope:e.scope,surface:e.surface,editorId:e.editorId,configPath:e.configPath,priorCommand:t,priorArgs:n}}function m9(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 h9(e,t,n={}){let r=UTe(e,t);if(!g(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(S(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!eTe(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??H6)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??HTe())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??ce();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}async function ZOe(e,t=void 0){let n=h9(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=GTe(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500)});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 QOe(e,t={}){return{targets:eke(e,t.isAlive??H6)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}async function $Oe(e){let t=e.inspect??(()=>h9(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??ZOe,o=e.logger??void 0,s=QOe(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 eke(e,t){return e.status===`alive`||e.status===`foreign-host`&&t(e.lock.pid)}function g9(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,nn.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 K8(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function tke(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=du({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function nke(e){let t=e??process.cwd(),n=[],r=[],i=[],a=[],o=zQ(`user`,t),s=PQ({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=g9(e);if(i.diagnostic!==void 0&&r.push(i.diagnostic),i.value===null)return{};let o=Nu({value:i.value,file:i.path,source:i.source,doc:i.doc});r.push(...o),n.push(e);let s=o.length>0?Fu(i.value):i.value;return t&&a.push(...vR({value:s,file:i.path,source:i.source,doc:i.doc})),s},l=be(t,`.ok`,`config.yml`),u=c(l,!0),d=c(zQ(`project-local`,t)),f=yR(s.value,u,d),p=rEe.safeParse(f);if(!p.success){let e=g9(l),t={code:`SCHEMA_INVALID`,issues:tke(p.error.issues,e)};throw Error(Ou(t))}return{config:p.data,sources:n,diagnostics:r,sidelined:i,ignoredCommittedKeys:a}}function _9(e){return e.replace(/:\d+$/,``)}function v9(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:_9(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:_9(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:_9(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 y9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=DR(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 b9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=DR(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 rke(e){let t=y9(e);if(t)return{kind:`doc`,...t};let n=b9(e);return n?{kind:`folder`,...n}:null}async function ike(e,t){let n,r;try{n=await De(be(e)),r=await De(be(M(e)))}catch{return{kind:`not-git`}}if(!x9(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 De(i)}catch{return{kind:`not-git`}}if(!x9(e,n))return{kind:`symlink-escape`}}else if(!a.isFile())return{kind:`not-git`};let o=xge(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=v9(c);if(l===null)return{kind:`non-github`};let u=DR(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 x9(e,t){if(e===t)return!0;let n=ye(t,e);return n.length>0&&!n.startsWith(`..`)&&!ge(n)}const ake=`# >>> open-knowledge cli >>>`,oke=`# <<< open-knowledge cli <<<`,ske=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function cke(e){return N(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}function S9(e,t,n=[]){let r=g(N(e,G6[t]))?`satisfied`:`absent`;return{...r===`satisfied`?{state:r,strictness:[`reclaim-permissive`]}:{state:r},...n.length===0?{}:{sharedWith:n}}}function lke(e,t){let n=$8.flatMap(t=>{let n=e[t];return n===null?[]:[{editor:t,root:n}]}),r=dn.filter(e=>e.scope===t).map(e=>({editor:e.editorId,root:bs}));return[...n,...r]}function C9(e,t,n,r){let i=QSe(e,lke(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 uke(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 dke(e,t){let n=A5[e];return h7(n,``,t)&&!m7(n,``,t)}function w9(e,t,n,r,i){let a=A5[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?uke(o,r):void 0,c=y7(a,n,r,i);switch(c.kind){case`absent`:case`no-entry`:return i===void 0&&dke(e,r)?{state:`structural-na`}:{state:`absent`,path:s};case`decline`:return{state:`unprobed`};case`present`:{let{entry:r}=c,i=[];u5(r)&&i.push(`reclaim-permissive`),p5(r)&&i.push(`pre-approval-exact`),b7(e)(r)&&i.push(`injection-functional`);let o=REe(a,n);return i.length>0&&(o!==null&&zEe(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}:NEe(a)?{state:`foreign-replaceable`,path:s}:{state:`foreign`,path:s}}}}function fke(e){let{cwd:t,home:n}=e;return e=>{if(e.pathId===null)return null;let r=Ho(e.pathId);if(r===null)return null;if(r.kind===`central-skill-store`)return n===void 0?null:S9(N(n,bs),`discovery`,C9(n,un,e.agent,`global`));let i=r.editor;switch(r.kind){case`editor-user-skill-root`:{let e=un[i];return e===null||n===void 0?null:S8(n).some(e=>e.editorId===i)?S9(N(n,e),`discovery`,C9(n,un,i,`global`)):{state:`structural-na`}}case`editor-project-skill-root`:{let e=ln[i];return e===null?null:S9(N(t,e),`project`,C9(t,ln,i,`project`))}case`editor-user-config`:return w9(i,e.strictness,t,n);case`editor-project-config`:{let r=gn[i];return r===null?null:w9(i,e.strictness,t,n,N(t,r))}}}}[...K6.map(e=>G6[e])];function pke(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 T9(e){let t=pke(e),n=[];for(let e of K6){let r=G6[e];n.push({path:N(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of mn)n.push({path:N(t,i.skillsRoot,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function mke(e,t){let n=[];for(let r of T9(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 hke=[{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 gke(e,t,n={},r=hke){let i=[];for(let a of t){let t=A5[a];for(let a of r)i.push(a.write(t,e,n))}let a=CDe(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 _ke(e,t,n={}){return{integrations:gke(e,t,n)}}function E9(e,t){let n=un[e];return n===null?null:N(t,...n.split(`/`),G6.discovery,`SKILL.md`)}function vke(e,t){let n=E9(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};if(!S8(t).some(t=>t.editorId===e))return{editorId:e,label:e,action:`skipped-unsupported`,path:n};try{let r=J6(`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 yke(e){return g(N(e,...`.agents/skills`.split(`/`),G6.discovery))?!0:cn.some(t=>{let n=E9(t,e);return n!==null&&g(M(n))})}function bke(e,t){let n=E9(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 xke(e){return PQ({absPath:zQ(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function D9({home:e=k(),env:t=process.env}={}){let n=xke(e),{override:r,preferenceList:i}=fye(t),{locale:a,source:o}=gB({override:r,storedPreference:n,supportedLocales:sl,preferenceList:i,autoDetectableLocales:ll});return{preference:n,locale:a,source:o,systemLanguages:i}}function O9(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function Ske(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function k9(e,t){if(typeof e==`string`)return O9(e,t.contentDir);if(Array.isArray(e))return e.map(e=>k9(e,t));if(!Ske(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=k9(i,t);return n}function A9(e,t){let n=S(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
1527
+ `));let u=`${i?``:``}${l}`;return u!==r&&FQ(e,u,{mode:o7(e)}),{kind:`removed`}}function YOe(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}function XOe(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=WTe(e,t);if(!g(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(S(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!tTe(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??H6)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??UTe())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??ce();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}async function ZOe(e,t=void 0){let n=g9(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=KTe(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500)});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 QOe(e,t={}){return{targets:eke(e,t.isAlive??H6)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}async function $Oe(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??ZOe,o=e.logger??void 0,s=QOe(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 eke(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,nn.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 K8(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function tke(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=du({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function nke(e){let t=e??process.cwd(),n=[],r=[],i=[],a=[],o=zQ(`user`,t),s=PQ({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=Nu({value:i.value,file:i.path,source:i.source,doc:i.doc});r.push(...o),n.push(e);let s=o.length>0?Fu(i.value):i.value;return t&&a.push(...vR({value:s,file:i.path,source:i.source,doc:i.doc})),s},l=be(t,`.ok`,`config.yml`),u=c(l,!0),d=c(zQ(`project-local`,t)),f=yR(s.value,u,d),p=iEe.safeParse(f);if(!p.success){let e=_9(l),t={code:`SCHEMA_INVALID`,issues:tke(p.error.issues,e)};throw Error(Ou(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=DR(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=DR(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 rke(e){let t=b9(e);if(t)return{kind:`doc`,...t};let n=x9(e);return n?{kind:`folder`,...n}:null}async function ike(e,t){let n,r;try{n=await De(be(e)),r=await De(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 De(i)}catch{return{kind:`not-git`}}if(!S9(e,n))return{kind:`symlink-escape`}}else if(!a.isFile())return{kind:`not-git`};let o=xge(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=DR(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 ake=`# >>> open-knowledge cli >>>`,oke=`# <<< open-knowledge cli <<<`,ske=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function cke(e){return N(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}function C9(e,t,n=[]){let r=g(N(e,G6[t]))?`satisfied`:`absent`;return{...r===`satisfied`?{state:r,strictness:[`reclaim-permissive`]}:{state:r},...n.length===0?{}:{sharedWith:n}}}function lke(e,t){let n=$8.flatMap(t=>{let n=e[t];return n===null?[]:[{editor:t,root:n}]}),r=dn.filter(e=>e.scope===t).map(e=>({editor:e.editorId,root:bs}));return[...n,...r]}function w9(e,t,n,r){let i=$Se(e,lke(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 uke(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 dke(e,t){let n=A5[e];return g7(n,``,t)&&!h7(n,``,t)}function T9(e,t,n,r,i){let a=A5[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?uke(o,r):void 0,c=b7(a,n,r,i);switch(c.kind){case`absent`:case`no-entry`:return i===void 0&&dke(e,r)?{state:`structural-na`}:{state:`absent`,path:s};case`decline`:return{state:`unprobed`};case`present`:{let{entry:r}=c,i=[];u5(r)&&i.push(`reclaim-permissive`),p5(r)&&i.push(`pre-approval-exact`),x7(e)(r)&&i.push(`injection-functional`);let o=zEe(a,n);return i.length>0&&(o!==null&&BEe(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}:PEe(a)?{state:`foreign-replaceable`,path:s}:{state:`foreign`,path:s}}}}function fke(e){let{cwd:t,home:n}=e;return e=>{if(e.pathId===null)return null;let r=Ho(e.pathId);if(r===null)return null;if(r.kind===`central-skill-store`)return n===void 0?null:C9(N(n,bs),`discovery`,w9(n,un,e.agent,`global`));let i=r.editor;switch(r.kind){case`editor-user-skill-root`:{let e=un[i];return e===null||n===void 0?null:X6(n).some(e=>e.editorId===i)?C9(N(n,e),`discovery`,w9(n,un,i,`global`)):{state:`structural-na`}}case`editor-project-skill-root`:{let e=ln[i];return e===null?null:C9(N(t,e),`project`,w9(t,ln,i,`project`))}case`editor-user-config`:return T9(i,e.strictness,t,n);case`editor-project-config`:{let r=gn[i];return r===null?null:T9(i,e.strictness,t,n,N(t,r))}}}}[...K6.map(e=>G6[e])];function pke(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=pke(e),n=[];for(let e of K6){let r=G6[e];n.push({path:N(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of mn)n.push({path:N(t,i.skillsRoot,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function mke(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 hke=[{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=_7(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=W5(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 gke(e,t,n={},r=hke){let i=[];for(let a of t){let t=A5[a];for(let a of r)i.push(a.write(t,e,n))}let a=CDe(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 _ke(e,t,n={}){return{integrations:gke(e,t,n)}}function D9(e,t){let n=un[e];return n===null?null:N(t,...n.split(`/`),G6.discovery,`SKILL.md`)}function vke(e,t){let n=D9(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};if(!X6(t).some(t=>t.editorId===e))return{editorId:e,label:e,action:`skipped-unsupported`,path:n};try{let r=J6(`discovery`,{checkDesktop:!0});return B5(M(n),t),{editorId:e,label:e,action:V5(r,n),path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function yke(e){return g(N(e,...`.agents/skills`.split(`/`),G6.discovery))?!0:cn.some(t=>{let n=D9(t,e);return n!==null&&g(M(n))})}function bke(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)?(B5(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 xke(e){return PQ({absPath:zQ(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function O9({home:e=k(),env:t=process.env}={}){let n=xke(e),{override:r,preferenceList:i}=fye(t),{locale:a,source:o}=gB({override:r,storedPreference:n,supportedLocales:sl,preferenceList:i,autoDetectableLocales:ll});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 Ske(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(!Ske(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(`
1528
1528
  `),i=n.split(`
1529
- `),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=k9(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}let o=r?`${a.join(`
1529
+ `),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(`
1530
1530
  `)}\n`:a.join(`
1531
- `);re(e,o)}function j9(e,t){let n=S(e,`utf-8`);if(n.trim().length!==0)try{let r=k9(JSON.parse(n),t),i=n.endsWith(`
1531
+ `);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(`
1532
1532
  `)?`
1533
- `:``;re(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=O9(n,t.contentDir);r!==n&&re(e,r)}}function M9(e,t){let n=S(e,`utf-8`),r=O9(n,t.contentDir);r!==n&&re(e,r)}function N9(e){try{return w(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>N(e,t.name))}catch{return[]}}const Cke=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function P9(e){return/\.log\.\d+$/.test(e)}function wke(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||P9(e)}const Tke=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function Eke(e){let t={contentDir:e.contentDir};for(let n of Tke)for(let r of N9(N(e.stagingDir,n)))wke(r)?A9(r,t):r.endsWith(`.json`)?j9(r,t):M9(r,t);for(let n of N9(N(e.stagingDir,`state`))){let e=me(n);n.endsWith(`.jsonl`)?A9(n,t):Cke.has(e)?j9(n,t):M9(n,t)}}const F9=[`.ok`,`local`,`telemetry`],I9=[`.ok`,`local`,`logs`],L9=[`.ok`,`local`,`loss-capture`],R9=`spans-current.jsonl`,z9=`spans-prev.jsonl`,B9=`server-current.jsonl`,V9=`server-prev.jsonl`,H9=`loss-current.jsonl`,U9=`loss-prev.jsonl`;function Dke(e){return N(e,...F9,R9)}function Oke(e){return N(e,...F9,z9)}function kke(e){return N(e,...I9,B9)}function Ake(e){return N(e,...I9,V9)}function jke(e){return N(e,...L9,H9)}function Mke(e){return N(e,...L9,U9)}const W9=1e3;async function Nke(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function Pke(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function Fke(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}function Ike(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(`
1534
- `)}\n`:null}catch{return null}}function Lke(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],W6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Rke(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/`],W6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function G9(){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 zke(){return{nodeVersion:process.version,platform:le(),arch:ae()}}function Bke(){return process.env.OTEL_SDK_DISABLED===`false`}function K9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q9(e){if(!g(e))return{};let t;try{t=(0,nn.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(!K9(t))return{};let n=t.telemetry;if(!K9(n))return{};let r=n.localSink;return K9(r)?r:{}}function J9(e){return typeof e==`boolean`?e:void 0}function Vke(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y9(e){if(K9(e))return Vke(e.maxBytes)}function Hke(e){let t=q9(zQ(`project`,e)),n=q9(zQ(`project-local`,e));return{enabled:J9(n.enabled)??J9(t.enabled)??!0,spansMaxBytes:Y9(n.spans)??Y9(t.spans)??52428800,logsMaxBytes:Y9(n.logs)??Y9(t.logs)??26214400}}function Uke(e){return Ne(`sha256`).update(e).digest(`hex`)}function Wke(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const Gke=[`"doc.name"`,`"docName"`];function Kke(e){let t=S(e,`utf-8`),n=0;for(let e of Gke){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function X9(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 Z9(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 qke=new Set([`.jsonl`]);function Jke(e){let t=e.lastIndexOf(`.`);return t!==-1&&qke.has(e.slice(t))}const Yke=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function Xke(e){if(P9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&Yke.has(e.slice(t))}function Q9(e){let t=[];for(let n of Z9(e)){let r=$9(e,n);if(!Xke(r))continue;let{redacted:i,patterns:a,lineCount:o}=wB(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 Zke(e){let t=be(e.contentDir),n=be(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??Nke,a=r.fetchAgentEffects??Pke,o=r.fetchWatcherRecent??Fke,s=r.readShadowHead??Lke,c=r.readCheckpointRefs??Rke,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.71.0-beta.4`),d=r.readDesktopEnv??G9,f=r.readLanguage??D9,p=r.readRuntime??zke,h=r.isOtlpPushEnabled??Bke,_=y(N(A(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),X9(Dke(n),N(_,`telemetry`,R9)),X9(Oke(n),N(_,`telemetry`,z9)),X9(kke(n),N(_,`logs`,B9)),X9(Ake(n),N(_,`logs`,V9));for(let t of e.userLogFiles??[])X9(t,N(_,`logs`,me(t)));for(let t of e.userStateFiles??[])X9(t,N(_,aR,me(t)));let y=0;for(let t of e.diagnosticReports?.files??[])X9(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)){X9(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=Ike(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),X9(jke(n),N(_,`state`,H9)),X9(Mke(n),N(_,`state`,U9)),X9(N(b,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),X9(N(b,Iu),N(_,`state`,Iu)),X9(N(b,Lu),N(_,`state`,Lu));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
1535
- `:`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&&Eke({stagingDir:_,contentDir:t}),e.note&&re(N(_,`note.txt`),e.note);let ce=null;e.scrubSecrets===!0&&(ce=Q9(_));for(let t of e.extraFiles??[])X9(t.sourcePath,N(_,`extra`,t.zipName??me(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let le=Hke(n),ue=Z9(_),A=[],j=0,de=0;for(let e of ue){let t=$9(_,e),n=te(e).size,r=Jke(t)?Wke(e):0;A.push({path:t,bytes:n,lines:r}),j+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(de+=Kke(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:Uke(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 Qke(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 _Se.ZipFile,a=Z9(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 $ke(e,t){let n=N(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,nn.parse)(S(n,`utf-8`)),r=K8(t)?t.content:void 0,i=K8(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 eAe(e,t,n,r,i){let a=T7(t,e.logger),o=await Zke({contentDir:$ke(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...dOe(a,e.userLogsDir??N(k(),`.ok`,`logs`)),...D7(e.cachesDir??N(k(),`Library`,`Caches`))],userStateFiles:O7(e.bugReportsDir??w7()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{v(M(e.outputPath),{recursive:!0}),await Qke({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 tAe(e){let{projectDir:t}=e,n=e.readDesktopEnv??G9,r=e.readLanguage??D9,i=()=>sOe(e.diagnosticReportsDir??N(k(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return eAe(e,t,n,r,i());let{zipPath:a,summary:o}=await gOe({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:D7(e.cachesDir??N(k(),`Library`,`Caches`)),bugReportLedgerFiles:O7(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{$8 as ALL_EDITOR_IDS,e5 as EDITOR_LABELS,A5 as EDITOR_TARGETS,AEe as HOSTS_WITH_USER_SKILL_DIR,qDe as LAUNCH_CONFIG_NAME,ake as PATH_SHIM_BEGIN,ske as PATH_SHIM_BLOCK_RE,oke as PATH_SHIM_END,ODe as addOkPathsToGitExclude,L5 as assertProjectPathSafe,f5 as buildManagedServerEntry,YOe as buildMcpConfigDeclineEvent,XOe as buildMcpConfigMigrateEvent,y7 as classifyExistingMcpEntry,tAe as collectReportBundle,fke as createCliProbeResolver,sn as createTokenStore,cOe as defaultBugReportZipPath,We as detectGh,qe as detectGhAccounts,ZDe as detectInstalledEditors,x5 as droppedManagedKeys,ZEe as editorConfigPathDisplay,XEe as editorEntryLocator,ROe as ensurePiBridge,Z5 as formatTrackedRemediation,jDe as getExcludedOkPaths,Y5 as getInstalledSkillProjectionPaths,kEe as getNativeTomlMcpEditor,J5 as getOkArtifactPaths,u5 as isEntryUpToDate,p5 as isOwnManagedEntry,nke as loadConfig,yee as makeLazyProbeTokenStore,w7 as okBugReportsDir,y9 as parseGitHubBlobUrl,rke as parseGitHubShareUrl,b9 as parseGitHubTreeUrl,v9 as parseGitUrl,cke as pathInstallMarkerPath,fDe as previewContent,QDe as probeOwnManagedEditorMcpEntry,IOe as probePiBridgeState,X5 as probeTrackedOkPaths,_7 as readExistingMcpEntry,ADe as readSharingMode,wB as redactContent,kDe as removeOkPathsFromGitExclude,GOe as removeOwnMcpEntry,wDe as removeProjectSkill,mke as removeUserGlobalSkillBundle,bke as removeUserSkill,vDe as resolveProjectRoot,$Oe as runStop,m9 as truncatePriorEntry,T9 as userGlobalSkillBundleTargets,yke as userSkillPresentAnywhere,ike as validateLocalFolderForShare,g7 as writeEditorMcpConfig,_ke as writeProjectAiIntegrations,U5 as writeProjectSkill,XDe as writeUserMcpConfigs,vke as writeUserSkill};
1533
+ `:``;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 Cke=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function F9(e){return/\.log\.\d+$/.test(e)}function wke(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||F9(e)}const Tke=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function Eke(e){let t={contentDir:e.contentDir};for(let n of Tke)for(let r of P9(N(e.stagingDir,n)))wke(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):Cke.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 Dke(e){return N(e,...I9,z9)}function Oke(e){return N(e,...I9,B9)}function kke(e){return N(e,...L9,V9)}function Ake(e){return N(e,...L9,H9)}function jke(e){return N(e,...R9,U9)}function Mke(e){return N(e,...R9,W9)}const G9=1e3;async function Nke(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 Pke(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 Fke(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 Ike(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(`
1534
+ `)}\n`:null}catch{return null}}function Lke(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],W6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Rke(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/`],W6({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 zke(){return{nodeVersion:process.version,platform:le(),arch:ae()}}function Bke(){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,nn.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 Vke(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function X9(e){if(q9(e))return Vke(e.maxBytes)}function Hke(e){let t=J9(zQ(`project`,e)),n=J9(zQ(`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 Uke(e){return Ne(`sha256`).update(e).digest(`hex`)}function Wke(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const Gke=[`"doc.name"`,`"docName"`];function Kke(e){let t=S(e,`utf-8`),n=0;for(let e of Gke){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,w7(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 qke=new Set([`.jsonl`]);function Jke(e){let t=e.lastIndexOf(`.`);return t!==-1&&qke.has(e.slice(t))}const Yke=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function Xke(e){if(F9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&Yke.has(e.slice(t))}function Zke(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!Xke(r))continue;let{redacted:i,patterns:a,lineCount:o}=wB(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 Qke(e){let t=be(e.contentDir),n=be(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??Nke,a=r.fetchAgentEffects??Pke,o=r.fetchWatcherRecent??Fke,s=r.readShadowHead??Lke,c=r.readCheckpointRefs??Rke,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.71.0-beta.6`),d=r.readDesktopEnv??K9,f=r.readLanguage??O9,p=r.readRuntime??zke,h=r.isOtlpPushEnabled??Bke,_=y(N(A(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),Z9(Dke(n),N(_,`telemetry`,z9)),Z9(Oke(n),N(_,`telemetry`,B9)),Z9(kke(n),N(_,`logs`,V9)),Z9(Ake(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(_,aR,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=Ike(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(jke(n),N(_,`state`,U9)),Z9(Mke(n),N(_,`state`,W9)),Z9(N(b,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),Z9(N(b,Iu),N(_,`state`,Iu)),Z9(N(b,Lu),N(_,`state`,Lu));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
1535
+ `:`not-running (${w})\n`;re(N(_,`state`,`server-status.txt`),oe);let se=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:C7(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&&Eke({stagingDir:_,contentDir:t}),e.note&&re(N(_,`note.txt`),e.note);let ce=null;e.scrubSecrets===!0&&(ce=Zke(_));for(let t of e.extraFiles??[])Z9(t.sourcePath,N(_,`extra`,t.zipName??me(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let le=Hke(n),ue=Q9(_),A=[],j=0,de=0;for(let e of ue){let t=$9(_,e),n=te(e).size,r=Jke(t)?Wke(e):0;A.push({path:t,bytes:n,lines:r}),j+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(de+=Kke(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:Uke(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 $ke(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 xSe.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 eAe(e,t){let n=N(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,nn.parse)(S(n,`utf-8`)),r=K8(t)?t.content:void 0,i=K8(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 tAe(e,t,n,r,i){let a=E7(t,e.logger),o=await Qke({contentDir:eAe(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...dOe(a,e.userLogsDir??N(k(),`.ok`,`logs`)),...O7(e.cachesDir??N(k(),`Library`,`Caches`))],userStateFiles:k7(e.bugReportsDir??T7()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{v(M(e.outputPath),{recursive:!0}),await $ke({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 nAe(e){let{projectDir:t}=e,n=e.readDesktopEnv??K9,r=e.readLanguage??O9,i=()=>sOe(e.diagnosticReportsDir??N(k(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return tAe(e,t,n,r,i());let{zipPath:a,summary:o}=await gOe({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??T7()),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{$8 as ALL_EDITOR_IDS,e5 as EDITOR_LABELS,A5 as EDITOR_TARGETS,jEe as HOSTS_WITH_USER_SKILL_DIR,qDe as LAUNCH_CONFIG_NAME,ake as PATH_SHIM_BEGIN,ske as PATH_SHIM_BLOCK_RE,oke as PATH_SHIM_END,ODe as addOkPathsToGitExclude,R5 as assertProjectPathSafe,f5 as buildManagedServerEntry,YOe as buildMcpConfigDeclineEvent,XOe as buildMcpConfigMigrateEvent,b7 as classifyExistingMcpEntry,nAe as collectReportBundle,fke as createCliProbeResolver,sn as createTokenStore,cOe as defaultBugReportZipPath,We as detectGh,qe as detectGhAccounts,ZDe as detectInstalledEditors,x5 as droppedManagedKeys,QEe as editorConfigPathDisplay,ZEe as editorEntryLocator,ROe as ensurePiBridge,Q5 as formatTrackedRemediation,jDe as getExcludedOkPaths,X5 as getInstalledSkillProjectionPaths,AEe as getNativeTomlMcpEditor,Y5 as getOkArtifactPaths,u5 as isEntryUpToDate,p5 as isOwnManagedEntry,nke as loadConfig,yee as makeLazyProbeTokenStore,T7 as okBugReportsDir,b9 as parseGitHubBlobUrl,rke as parseGitHubShareUrl,x9 as parseGitHubTreeUrl,y9 as parseGitUrl,cke as pathInstallMarkerPath,pDe as previewContent,QDe as probeOwnManagedEditorMcpEntry,IOe as probePiBridgeState,Z5 as probeTrackedOkPaths,v7 as readExistingMcpEntry,ADe as readSharingMode,wB as redactContent,kDe as removeOkPathsFromGitExclude,GOe as removeOwnMcpEntry,wDe as removeProjectSkill,mke as removeUserGlobalSkillBundle,bke as removeUserSkill,vDe as resolveProjectRoot,$Oe as runStop,h9 as truncatePriorEntry,E9 as userGlobalSkillBundleTargets,yke as userSkillPresentAnywhere,ike as validateLocalFolderForShare,_7 as writeEditorMcpConfig,_ke as writeProjectAiIntegrations,W5 as writeProjectSkill,XDe as writeUserMcpConfigs,vke as writeUserSkill};
1536
1536
  //# sourceMappingURL=index.mjs.map