@inkeep/open-knowledge 0.83.0-beta.7 → 0.83.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +52 -52
- package/dist/constants-DWohuTZz.mjs +1 -0
- package/dist/dist-B9DtIzpt.mjs +1 -0
- package/dist/{dist-DMhyZWXW.mjs → dist-JTJCXKWa.mjs} +508 -494
- package/dist/index.mjs +236 -236
- package/dist/{init-B4K69pZS.mjs → init-Dc8_JDpj.mjs} +54 -54
- package/dist/init-Q1pK7iF1.mjs +1 -0
- package/dist/{launch-json-removal-CT0i-3-W.mjs → launch-json-removal-DbQwC4O1.mjs} +1 -1
- package/dist/loader-C5RE9SEB.mjs +1 -0
- package/dist/{loader-DZHqBHXr.mjs → loader-KO7Y4yHr.mjs} +1 -1
- package/dist/{md-manager-BGnqyqi1-B1QSgyMJ.mjs → md-manager-BGnqyqi1-BfETHApY.mjs} +120 -120
- package/dist/{open-browser-B-7x1MTL.mjs → open-browser-BIyeIBW0.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/preview-D5hoFXnA.mjs +1 -0
- package/dist/{preview-BdmlMCtY.mjs → preview-n4D4OfhY.mjs} +1 -1
- package/dist/public/assets/{AccountSection-DJh9iLbq.js → AccountSection-Chcqq4Rn.js} +1 -1
- package/dist/public/assets/{ActivityModeContent-BAm_Sv3o.js → ActivityModeContent-VRaEekKQ.js} +1 -1
- package/dist/public/assets/AddPropertiesButton-D3i8DDw1.js +2 -0
- package/dist/public/assets/{AgentDiffPane-rX7T_Ooo.js → AgentDiffPane-iLFWvxJg.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-FLGDe3pX.js → AttachmentsSection-C8b3L8oR.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-BuFeADVI.js → CodeMirrorPropInput-Cza70VJH.js} +69 -69
- package/dist/public/assets/{ContentRulesSection-DZmyRVa0.js → ContentRulesSection-g9Do-G-T.js} +1 -1
- package/dist/public/assets/DocumentContext-DcLfGXeI.js +108 -0
- package/dist/public/assets/{EditorModeToggle-DS_xfOtT.js → EditorModeToggle-aZMvzwYT.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-DWd6a8Sl.js → ExcalidrawDocEditor-CO9SJ8TB.js} +1 -1
- package/dist/public/assets/FeedbackForm-B2NFrqe2.js +1 -0
- package/dist/public/assets/{ImportSkillDialog-C2_Su5XJ.js → ImportSkillDialog-CpeiJvUY.js} +1 -1
- package/dist/public/assets/{LinkPreviewsSection-ChJ4iMSL.js → LinkPreviewsSection-CDm6lROI.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-BbSzjMFm.js → LintConfigEditor-CgmITWmp.js} +1 -1
- package/dist/public/assets/{LintingSection-4HBYSeJr.js → LintingSection-DX5R516q.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-4vZd220h.js +1 -0
- package/dist/public/assets/ManagedArtifactProperties-DsJx8iXo.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-CA7gNCDw.js → MermaidDocEditor-DAYu64J5.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-OcPnmrqG.js → NetworkAccessSection-CPkK5yoz.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-BvC-5Aoc.js → PropertyDisplayRow-Dh-7Ytaq.js} +1 -1
- package/dist/public/assets/{PublishToGitHubDialog-BAs3Rgt6.js → PublishToGitHubDialog-BD0FxuNe.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-_iycEDNg.js → SchemaConfigEditor-kGZrMizb.js} +1 -1
- package/dist/public/assets/{SearchSection-BXFLBgQF.js → SearchSection-D-XoY_-a.js} +1 -1
- package/dist/public/assets/{SessionsHost-YR8a-CBs.js → SessionsHost-BANbRx8e.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-FXTDyHIp.js → SettingsDialogBody-f15Sg4NZ.js} +2 -2
- package/dist/public/assets/{ShareReceiveMissDialog-D0feG-ij.js → ShareReceiveMissDialog-DgPtHVze.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-BOtPYfa8.js → SkillToolbarControls-BacmWVVb.js} +1 -1
- package/dist/public/assets/SourceEditor-DmmIGcpn.js +1 -0
- package/dist/public/assets/{SpellingSettings-DaGy2fT9.js → SpellingSettings-C3y5UjRC.js} +1 -1
- package/dist/public/assets/{SyncSection-B17cmijr.js → SyncSection-B3qvlZnG.js} +1 -1
- package/dist/public/assets/{SyncStatusBadge-DckHbstF.js → SyncStatusBadge-CrhgKvf8.js} +1 -1
- package/dist/public/assets/{TerminalSection-CWS2W27g.js → TerminalSection-Dtw-wKoT.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-0S4powU1.js → TerminalWindowApp-BvD0XdC6.js} +1 -1
- package/dist/public/assets/{TextDocEditor-DIsBDCjZ.js → TextDocEditor-CUNmExI5.js} +1 -1
- package/dist/public/assets/{ThemePluginSection-0b67foiM.js → ThemePluginSection-rW_Rhi3t.js} +1 -1
- package/dist/public/assets/{ThreadView-KbVr8sEz.js → ThreadView-CPPW0Dfp.js} +6 -6
- package/dist/public/assets/{TimelineDiffPane-PhDxCy33.js → TimelineDiffPane-Dw4QtUm-.js} +1 -1
- package/dist/public/assets/{comment-chips-DOajrkhR.js → comment-chips-BMqI1RUZ.js} +3 -3
- package/dist/public/assets/{config-provider-Dp4Rfq0I.js → config-provider-Cs3B2_OX.js} +1 -1
- package/dist/public/assets/config-schema-xOnB5jc5.js +1 -0
- package/dist/public/assets/{doc-undo-manager-ahQPlK9S.js → doc-undo-manager-szCxH80V.js} +1 -1
- package/dist/public/assets/{field-controls-c03mLOtp.js → field-controls-BqsFU6aY.js} +1 -1
- package/dist/public/assets/field-controls-CnF_w0df.js +1 -0
- package/dist/public/assets/index-CqWkPm5z.js +2205 -0
- package/dist/public/assets/{lint-config-client-DBaQUIFB.js → lint-config-client-C0cPUFg9.js} +1 -1
- package/dist/public/assets/{lint-plugins-B7BcnvBQ.js → lint-plugins-CwlqYhnN.js} +1 -1
- package/dist/public/assets/{markdown-lint-CciVlHiz.js → markdown-lint-DxrbxECW.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-CV8JXarL.js → markdownlint-rule-browser-C-vo_WXw.js} +1 -1
- package/dist/public/assets/{messages-CVkIPXvF.js → messages-9pu0eKMD.js} +1 -1
- package/dist/public/assets/{messages-yosQwPO3.js → messages-BCv3uDH5.js} +1 -1
- package/dist/public/assets/{messages-DUncwHK7.js → messages-BGib4TMp.js} +1 -1
- package/dist/public/assets/{messages-CI6bk3ZZ.js → messages-BOWt1g5R.js} +1 -1
- package/dist/public/assets/{messages-CpkkpjCc.js → messages-BtwWpZz0.js} +1 -1
- package/dist/public/assets/{messages-WS5AYLW5.js → messages-BtzlQnhk.js} +1 -1
- package/dist/public/assets/{messages-BoIpsnrB.js → messages-BxPgHAGT.js} +1 -1
- package/dist/public/assets/{messages-BtoWyWp4.js → messages-C_IQGWPh.js} +1 -1
- package/dist/public/assets/{messages-CKSKVChp.js → messages-CgvGzWvU.js} +1 -1
- package/dist/public/assets/{messages-DP2kzUjm.js → messages-CmBBJ_lX.js} +1 -1
- package/dist/public/assets/{messages-CGY-qBkm.js → messages-D07eucGp.js} +1 -1
- package/dist/public/assets/{messages-CAWZbzxC.js → messages-DHQmHLsP.js} +1 -1
- package/dist/public/assets/{messages-7VNu1LEh.js → messages-R6IvK1vE.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-Ji-MjcTi.js → pending-receive-nav-store-Dmll1xaV.js} +1 -1
- package/dist/public/assets/{progress-RYUnJ5Yy.js → progress-BOxsa6I6.js} +5 -5
- package/dist/public/assets/{saved-themes-client-C0V8gWns.js → saved-themes-client-CmQnQ6kY.js} +1 -1
- package/dist/public/assets/{schema-section-BEhtY3tq.js → schema-section-eljmMDBb.js} +1 -1
- package/dist/public/assets/{selection-context-DFzIaDVr.js → selection-context-D4kyfjCo.js} +1 -1
- package/dist/public/assets/{src-Cc4wFWWl.js → src-CaHEUw28.js} +1 -1
- package/dist/public/assets/typing-burst-detector-C-nEZIsQ.js +8 -0
- package/dist/public/assets/{uninstall-SlWuPbLL.js → uninstall-DiNfurw6.js} +1 -1
- package/dist/public/assets/{use-activity-panel-BynfAds7.js → use-activity-panel-CbdICT9Y.js} +1 -1
- package/dist/public/assets/{use-apply-config-language-CNWS2YSn.js → use-apply-config-language-BvXQKexF.js} +2 -2
- package/dist/public/assets/{use-open-skill-oBbTNCkY.js → use-open-skill-BunYAIpE.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-DZ-JhCyV.js → use-terminal-enabled-Vqy8aWBy.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-3gupsEXJ.js → use-timeline-entry-diff-DCMJfj6k.js} +1 -1
- package/dist/public/index.html +21 -21
- package/dist/public/uninstall.html +3 -3
- package/dist/registry-probes-CrbLg6FH.mjs +17 -0
- package/dist/{removal-file-path-DpI99hTo.mjs → removal-file-path-CBDcB9aY.mjs} +1 -1
- package/dist/{repair-launch-json--_R-76cC.mjs → repair-launch-json-CcRM-s1c.mjs} +1 -1
- package/dist/{repair-mcp-configs-CZSnWHtM.mjs → repair-mcp-configs-BRMXs0MC.mjs} +1 -1
- package/dist/{src-BrQpMSWu.mjs → src-3rZ7k4S6.mjs} +5 -5
- package/dist/src-BmkVYGLa.mjs +1 -0
- package/dist/start-BZCeDp8V.mjs +1 -0
- package/dist/{start-CDnYOrHP.mjs → start-CMT-BjjJ.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-CCYsBRvI.mjs +0 -1
- package/dist/dist-ObUBLmuL.mjs +0 -1
- package/dist/init-DORmPVEO.mjs +0 -1
- package/dist/loader-BQnA36qb.mjs +0 -1
- package/dist/preview-BWmm6t1q.mjs +0 -1
- package/dist/public/assets/AddPropertiesButton-B1mRaQFw.js +0 -2
- package/dist/public/assets/DocumentContext-C8ape_2m.js +0 -108
- package/dist/public/assets/FeedbackForm-MbJXUGuy.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-2ky67bIe.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CatYQWAb.js +0 -1
- package/dist/public/assets/SourceEditor-ZhZtt3fQ.js +0 -1
- package/dist/public/assets/config-schema-8zesQqFR.js +0 -1
- package/dist/public/assets/field-controls-D4Q9aSAc.js +0 -1
- package/dist/public/assets/index-CWM5nCtw.js +0 -2205
- package/dist/public/assets/typing-burst-detector-D_B94C2V.js +0 -8
- package/dist/registry-probes-D6HyJ_8R.mjs +0 -17
- package/dist/src-CY1smm1s.mjs +0 -1
- package/dist/start-Pg-N_eC0.mjs +0 -1
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{L as n,Nn as r,Rn as i,Rt as a,Xn as o,fr as s,i as c,kn as l,pn as u,si as d,ui as f,vr as p,zt as m}from"./DocumentContext-C8ape_2m.js";import{t as h}from"./react-f2sANaYj.js";import{n as g,r as _}from"./dist-Nvb76hAm.js";import{r as v,t as y}from"./useQuery-ZeEDLtxh.js";import{t as b}from"./compiler-runtime-BfE3aGVn.js";import{t as x}from"./utils-CPqDy6Hr.js";import{i as S,n as C,t as w}from"./tooltip-DBqLYfio.js";import{n as T,r as E,t as D}from"./collapsible-BKbszYZV.js";import{n as O,t as k}from"./toggle-group-B7p69Qfd.js";import{t as A}from"./button-DzgjsZzC.js";import{y as j}from"./constants-upload-CVKO8P4d.js";import{n as M}from"./dist-BGzUo_18.js";import{t as N}from"./dist-C_FzPxEX2.js";import{d as P}from"./constants-cc1-Bt4QPTUe.js";import{f as F,v as I}from"./documents-events-C04vpPEp.js";import{C as L,ht as ee,vt as R}from"./schemas-api-BM3O7zA1.js";import{n as z}from"./_envelope-Dwl6i2K9-DPqJ_Q4W.js";import{t as B}from"./note-window-mode-CI3Yju9B.js";import{t as V}from"./createLucideIcon-DdBzwsHe.js";import{t as H}from"./chevron-right-Bofu4lib.js";import{n as U,t as te}from"./lint-plugin-meta-CtDE2R0v.js";import{t as W}from"./circle-alert-eBm4JPxY.js";import{Hn as G,S as K,Wn as q,cr as ne,dr as re,ft as J,lt as Y,or as X,rn as ie,tt as ae}from"./CodeMirrorPropInput-BuFeADVI.js";import{t as oe}from"./info-CyR0W2SK.js";import{t as se}from"./refresh-cw-CC7UZEnZ.js";import{t as ce}from"./sparkles-BS2TX_Um.js";import{t as le}from"./triangle-alert-BXrUEeRU.js";import{t as ue}from"./wrench-DqFwoSdV.js";import{t as de}from"./badge-DmdA1C7r.js";import{c as fe}from"./use-settings-route-DT86DJkF.js";import{l as pe,s as me}from"./doc-hash-BJkweiX9.js";import{t as he}from"./diagnostic-breadcrumb-Cr0C15nJ.js";import{n as ge,t as _e}from"./perf-DZJpLc5j.js";import{A as ve}from"./navigation-targets-DTSxcGor.js";import{C as ye,y as be}from"./config-provider-Dp4Rfq0I.js";import{J as xe,K as Se,Mt as Ce,Nt as we,X as Te,wt as Ee}from"./dist-D2SphF3p.js";import{n as De,r as Oe}from"./PageListContext-CYKNvec7.js";import{a as ke,c as Ae,i as je,n as Me,r as Ne,s as Pe,t as Fe}from"./panel-My61A8fk.js";import{d as Ie,h as Le,u as Re,y as ze}from"./markdown-lint-CciVlHiz.js";import{t as Be}from"./skeleton-BPb29aFG.js";import{a as Ve,c as He,d as Ue}from"./lint-config-client-DBaQUIFB.js";var We=V(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Ge=56,Ke=2,qe=150,Je=2e3;function Ye(e,t,n){return e.top+e.height/2-(n+t)/2}function Xe(e,t){let n=Math.max(0,t.scrollHeight-t.clientHeight);return Math.max(0,Math.min(e,n))}function Ze(e){let{docName:t,container:n,measureTarget:a,placement:o,intent:s,grade:c,landedMode:u,transition:d,onOutcome:f,onDiscardQueuedTarget:p,toolbarOffset:m=Ge,driftThresholdPx:h=Ke,quietMs:g=qe,abandonAfterMs:_=Je}=e,v=e.contentColumn??n.firstElementChild,y=l(t,`landing`),b=r(t,{yieldsToNavigation:s===`toggle`,supersede:()=>P(`superseded`)}),x=n.style.overflowAnchor;n.style.overflowAnchor=`none`,d&&ge(`ok/mode-switch/transition`,{from:d.from,to:d.to,grade:c});let S=!1,C=null,w,T,E=0,D,O=()=>{let e=a();return e===null?null:Xe(o===`center`?Ye(e,n.clientHeight,m):e.top-m,n)},k=()=>{let e=O();if(e===null)return{measurable:!1,moved:!1};C=e;let t=Math.abs(n.scrollTop-e)>h;return t&&(n.scrollTop=e),{measurable:!0,moved:t}},A=()=>n.scrollTop-(O()??C??n.scrollTop),j=()=>{w&&clearTimeout(w),T&&clearTimeout(T),E&&cancelAnimationFrame(E),D?.disconnect(),n.removeEventListener(`wheel`,I),n.removeEventListener(`touchstart`,I),n.removeEventListener(`contentvisibilityautostatechange`,L,!0),n.style.overflowAnchor=x,y.release(),b.release()},M=()=>{if(S)return;S=!0;let e;try{k(),e=A(),C!==null&&i({docName:t,container:n,targetScrollTop:n.scrollTop,mode:u})}finally{j()}ge(`ok/landing/land`,{grade:c,delta:e}),f?.({status:`landed`,delta:e})},N=()=>{if(S)return;S=!0;let e=C??n.scrollTop,t;try{t=A()}finally{j()}ge(`ok/landing/abandoned`,{grade:c,target:e,delta:t}),f?.({status:`abandoned`,delta:t})},P=e=>{S||(S=!0,j(),e===`mode-flip`&&p?.(),f?.({status:`cancelled`,reason:e}))},F=()=>{w&&clearTimeout(w),w=setTimeout(M,g)};function I(){P(`user-scroll`)}function L(){if(S)return;let{measurable:e,moved:t}=k();e&&(t||w===void 0)&&F()}try{k().measurable&&F(),n.addEventListener(`contentvisibilityautostatechange`,L,!0),n.addEventListener(`wheel`,I,{passive:!0}),n.addEventListener(`touchstart`,I,{passive:!0}),typeof ResizeObserver<`u`&&v&&(D=new ResizeObserver(L),D.observe(v)),E=requestAnimationFrame(L),T=setTimeout(N,_)}catch(e){throw S=!0,j(),e}return{cancel:P}}function Qe(e){switch(e){case`bulletList`:case`orderedList`:case`taskList`:case`list`:return`list`;case`codeBlock`:case`code`:return`code`;case`horizontalRule`:case`thematicBreak`:return`thematicBreak`;case`jsxComponent`:case`mdxJsxFlowElement`:case`mdxJsxTextElement`:return`jsx`;case`htmlBlock`:case`html`:return`html`;default:return e}}function $e(e){return typeof e!=`object`||!e?``:`value`in e&&typeof e.value==`string`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map($e).join(``):``}function et(e,t){let{frontmatter:n,body:r}=R(e),i=n===``?0:n.split(`
|
|
2
|
-
`).length-1;try{return{blocks:t.parseToEditorMdast(r).children.map(e=>({start:(e.position?.start.line??1/0)+i,end:(e.position?.end.line??-1/0)+i,kind:Qe(e.type),text:$e(e)})),fmLineCount:i}}catch{return performance.mark(`ok/block-spans/parse-failed`),{blocks:[],fmLineCount:i}}}function tt(e,t){let{blocks:n,fmLineCount:r}=et(e,t);return{spans:n.map(e=>({start:e.start,end:e.end})),fmLineCount:r}}function nt(e,t){if(e.length===0)return null;let n=0,r=e.length-1,i=e.length-1;for(;n<=r;){let a=n+r>>1,o=e[a];o!==void 0&&o.end>=t?(i=a,r=a-1):n=a+1}return i}function rt(e){let t=0;for(let n=e.childCount-1;n>=0;n--){let r=e.child(n);if(r.type.name!==`paragraph`||r.content.size!==0)break;t++}return t===e.childCount?0:e.childCount}function it(e,t,n){let r=e.childCount,i=Math.max(0,Math.min(t,r)),a=Math.max(i,Math.min(n,r));if(a<=i)return null;let o=0;for(let t=0;t<i;t++)o+=e.child(t).nodeSize;let s=o;for(let t=i;t<a;t++)o+=e.child(t).nodeSize;let c=o,l=e.content.size,u=Math.max(0,Math.min(s,l)),d=Math.max(u,Math.min(c,l));return d<=u?null:{from:u,to:d}}function at(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
3
|
-
`&&t.push(n+1);return t}function ot(e,t,n){return t<=1?0:t-1>=e.length?n:e[t-1]??n}function st(e,t){let n=0,r=e.length-1,i=1;for(;n<=r;){let a=n+r>>1;(e[a]??0)<=t?(i=a+1,n=a+1):r=a-1}return i}function ct(e,t,n){return Math.max(t,Math.min(e,n))}function lt(e,t){let n=e=>e.replace(/\s+/g,` `).trim();return n(e)===n(t)}function ut(e,t){return t.inRange?t.tripwireOk?lt(e.content,t.text)?`exact`:e.kind===t.kind?`same-type-ordinal`:`ordinal`:`ordinal`:`clamped`}function dt(e){let t=null,n=null;function r(r){return n!==null&&t===r?n:(n={blocks:et(r,e).blocks,lineStarts:at(r)},t=r,n)}return{captureFromWysiwyg(e,t,n){if(e.childCount===0)return null;let r=ct(t,0,e.content.size),i=0,a=e.childCount-1,o=0;for(let t=0;t<e.childCount;t++){let n=e.child(t).nodeSize;if(r<i+n){a=t,o=i+1;break}i+=n,o=i+1}let s=e.child(a),c={blockIndex:a,kind:Qe(s.type.name),content:s.textContent};return n?.refine&&(c.selectionInBlock=Math.max(0,r-o)),c},captureFromSource(e,t,n){let{blocks:i,lineStarts:a}=r(e);if(i.length===0)return null;let o=ct(t,0,e.length),s=nt(i,st(a,o));if(s===null)return null;let c=i[s];if(!c)return null;let l={blockIndex:s,kind:c.kind,content:c.text};if(n?.refine){let t=ot(a,c.start,e.length);l.selectionInBlock=Math.max(0,o-t)}return l},resolveInSource(e,{source:t,doc:n}){let{blocks:i,lineStarts:a}=r(t);if(i.length===0)return null;let o=e.blockIndex>=0&&e.blockIndex<i.length,s=rt(n)===i.length,c=i[ct(e.blockIndex,0,i.length-1)],l=ot(a,c.start,t.length),u=Math.min(ot(a,c.end+1,t.length),t.length),d=ut(e,{inRange:o,tripwireOk:s,kind:c.kind,text:c.text}),f=l;return d===`exact`&&e.selectionInBlock!==void 0&&(f=ct(l+e.selectionInBlock,l,u)),{blockStart:l,blockEnd:u,point:f,confidence:d}},resolveInWysiwyg(e,{source:t,doc:n}){let i=rt(n);if(i===0)return null;let{blocks:a}=r(t),o=e.blockIndex>=0&&e.blockIndex<i,s=i===a.length,c=ct(e.blockIndex,0,i-1),l=it(n,c,c+1);if(l===null)return null;let u=n.child(c),d=ut(e,{inRange:o,tripwireOk:s,kind:Qe(u.type.name),text:u.textContent});return{blockStart:l.from,blockEnd:l.to,point:l.from,confidence:d}}}}var ft=Ce.define(),pt=Ce.define(),mt=Se.mark({class:a}),ht=we.define({create(){return Se.none},update(e,t){let n=e.map(t.changes);for(let e of t.effects)e.is(ft)?n=Se.set([mt.range(e.value.from,e.value.to)]):e.is(pt)&&(n=Se.none);return n},provide:e=>xe.decorations.from(e)}),gt=new WeakMap,_t=Te.define(e=>({destroy(){let t=gt.get(e);t!==void 0&&(clearTimeout(t),gt.delete(e))}}));function vt(e,t,n,r){let i=m(e.state.doc.length,t,n,r);if(!i)return;e.dispatch({effects:ft.of(i)});let a=gt.get(e);a!==void 0&&clearTimeout(a);let o=setTimeout(()=>{gt.delete(e),e.dispatch({effects:pt.of(null)})},Y);gt.set(e,o)}function yt(){return[ht,_t]}var bt=3e4;function xt(){let e=new Map,t=e=>e?Date.now()-e.rememberedAt>bt?null:e.navigation:null;return{remember(t,n){e.set(t,{navigation:n,rememberedAt:Date.now()})},peek(n){return t(e.get(n))},consume(n){let r=e.get(n);return e.delete(n),t(r)},clear(t){e.delete(t)},clearForTest(){e.clear()}}}var St=xt(),Ct=xt(),wt=St.remember,Tt=St.peek,Et=St.consume,Dt=St.clear;St.clearForTest;var Ot=Ct.remember,kt=Ct.peek,At=Ct.consume,jt=Ct.clear;Ct.clearForTest;function Mt(e,t,n){return{start:ye(e,t),end:ye(e,n)}}function Nt(e,t){let n=be(e.start,t),r=be(e.end,t);return n===null||r===null||r.index<=n.index?null:n.index}var Pt=`open-knowledge:view-in-source`,Ft=null;function It(){return Ft??=dt(ae()),Ft}function Lt(e,t,n,r,i=`toggle`){let a=r.captureFromWysiwyg(e,t,{refine:i===`jump`});if(!a)return null;let o=r.resolveInSource(a,{source:n.toString(),doc:e});return{kind:`selection-offset`,intent:i,anchor:a,pin:o?Mt(n,o.blockStart,o.blockEnd):void 0}}function Rt(e){let{editor:t,docName:n,ytext:r}=e,i=X(t);if(!i)return;let a=i.state.selection.from,o=Lt(i.state.doc,a,r,It(),`jump`);o&&wt(n,o),window.dispatchEvent(new CustomEvent(Pt,{detail:{docName:n}}))}function zt(e,t,n,r,i){let a=r.captureFromSource(e,t);if(!a)return null;let o=i?r.resolveInSource(a,{source:e,doc:i}):null;return{kind:`selection-offset`,anchor:a,pin:o?Mt(n,o.blockStart,o.blockEnd):void 0}}function Bt(e,t){let{source:n,pmDoc:r,ydoc:i,resolver:a}=t;if(e.pin){let t=Nt(e.pin,i);if(t===null){let t=a.resolveInWysiwyg(e.anchor,{source:n,doc:r});return t?{...t,point:t.blockStart,confidence:`clamped`}:null}let o=a.captureFromSource(n,t);if(o)return a.resolveInWysiwyg(o,{source:n,doc:r})}return a.resolveInWysiwyg(e.anchor,{source:n,doc:r})}function Vt(e,t){let{source:n,pmDoc:r,ydoc:i,resolver:a}=t;if(e.pin){let t=Nt(e.pin,i);if(t===null){let t=a.resolveInSource(e.anchor,{source:n,doc:r});return t?{...t,point:t.blockStart,confidence:`clamped`}:null}let o=a.captureFromSource(n,t);if(o)return a.resolveInSource(o,{source:n,doc:r})}return a.resolveInSource(e.anchor,{source:n,doc:r})}function Ht(e,t){try{return e.coordsAtPos(t)}catch{return null}}function Ut(e,t,n){let r=Math.max(0,Math.min(n,e.state.doc.length)),i=t.getBoundingClientRect().top,a=Ht(e,r);if(a)return{top:a.top-i+t.scrollTop,height:a.bottom-a.top};try{let n=e.lineBlockAt(r);return{top:e.documentTop-i+t.scrollTop+n.top,height:n.height}}catch{return null}}function Wt(e,t){if(e.isDestroyed)return null;try{let n=e.nodeDOM(t);if(n instanceof HTMLElement)return n;let{node:r}=e.domAtPos(t);return r instanceof HTMLElement?r:r.parentElement}catch{return null}}function Gt(e,t,n){if(e.isDestroyed)return null;let r=Wt(e,Math.max(0,Math.min(n,e.state.doc.content.size)));if(!r)return null;let i=r.getBoundingClientRect(),a=t.getBoundingClientRect().top;return{top:i.top-a+t.scrollTop,height:i.height}}function Kt(){return typeof document>`u`?null:u()}function qt(e,t){let n=t.getBoundingClientRect(),r=n.left+n.width/2,i=K();for(let t of[i+1,i+12,i+40]){let i=e.posAtCoords({left:r,top:n.top+t});if(i)return i.pos}return null}function Jt(e,t){let n=t.getBoundingClientRect(),r=n.left+n.width/2,i=K();for(let t of[i+1,i+12,i+40]){let i=e.posAtCoords({x:r,y:n.top+t});if(i!==null)return i}return null}function Yt(e){let{from:t,to:n,docName:r,ytext:i}=e;t===`wysiwyg`&&n===`source`?Xt(r,i):t===`source`&&n===`wysiwyg`&&Zt(r,i)}function Xt(e,t){let n=Tt(e);if(n&&n.kind!==`selection-offset`)return;let r=o(e);if(!r)return;let i=X(r);if(!i)return;let a=Kt();if(!a)return;let s=qt(i,a);if(s===null)return;let c=Lt(i.state.doc,s,t,It());c&&wt(e,c)}function Zt(e,t){let n=G(e);if(!n)return;let r=Kt();if(!r)return;let i=Jt(n,r);if(i===null)return;let a=o(e),s=a?X(a)?.state.doc:void 0,c=zt(t.toString(),i,t,It(),s);c&&Ot(e,c)}function Qt(e){let{view:t,docName:n,navigation:i,ydoc:a,transition:s}=e,c=o(n),l=c?X(c)?.state.doc:void 0;if(!l)return null;let u=Vt(i,{source:t.state.doc.toString(),pmDoc:l,ydoc:a,resolver:It()});if(!u)return null;let d=Kt();if(!d)return null;let f=u,p=i.intent===`jump`,m=p?f.point:f.blockStart;t.dispatch({effects:xe.scrollIntoView(m,{y:`start`})});let h=!1,g=null,_=r(n,{yieldsToNavigation:!p,supersede:()=>{h=!0,_.release()}}),v=e=>{if(!h){if(Ht(t,m)===null&&e<8){requestAnimationFrame(()=>v(e+1));return}try{p&&(t.dispatch({selection:Ee.cursor(m)}),t.focus())}finally{_.release()}g=Ze({docName:n,container:d,contentColumn:t.contentDOM,measureTarget:()=>Ut(t,d,m),placement:p?`center`:`top`,intent:p?`jump`:`toggle`,grade:f.confidence,landedMode:`source`,transition:s,toolbarOffset:K(),onOutcome:p?e=>{e.status===`landed`&&vt(t,f.blockStart,f.blockEnd,f.confidence)}:void 0,onDiscardQueuedTarget:()=>Dt(n)})}};return v(0),{cancel:e=>{h=!0,_.release(),g?.cancel(e)}}}function $t(e){let{editor:t,docName:n,navigation:r,ydoc:i,transition:a}=e,o=X(t);if(!o)return null;let s=Bt(r,{source:i.getText(`source`).toString(),pmDoc:o.state.doc,ydoc:i,resolver:It()});if(!s)return null;let c=Kt();if(!c)return null;let l=s;return Ze({docName:n,container:c,contentColumn:o.dom,measureTarget:()=>Gt(o,c,l.point),placement:`top`,intent:`toggle`,grade:l.confidence,landedMode:`wysiwyg`,transition:a,toolbarOffset:K(),onDiscardQueuedTarget:()=>jt(n)})}var en={words:0,chars:0,tokens:0},tn=/[ -〿-ゟ゠-ヿ㐀-䶿一-鿿豈---ក-]/,nn=/[\p{L}\p{N}]/u,rn=new Set([`text`,`inlineCode`,`code`,`tag`]),an=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),on=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function sn(e,t){if(!e)return;let n=e.type;if(!an.has(n)){if(rn.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
|
|
4
|
-
`));return}if(n===`wikiLink`||n===`wikiLinkEmbed`){let n=e.data?.alias??e.value??``;n&&t.push(n);return}if(Array.isArray(e.children)){for(let n of e.children)sn(n,t);if(on.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
|
|
5
|
-
`)&&t.push(`
|
|
6
|
-
`)}}}}function cn(e){try{let t=ae().parseToMdast(e),n=[];return sn(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function ln(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))nn.test(n)&&t++;return t}function un(e){let t=globalThis.Intl.Segmenter;if(!t)return ln(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function dn(e){let t=tn.test(e)?1.5:4;return Math.ceil(e.length/t)}function fn(e){return e?{words:tn.test(e)?un(e):ln(e),chars:e.length,tokens:dn(e)}:{words:0,chars:0,tokens:0}}function pn(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=R(e);return t.trim()?fn(cn(t)):{words:0,chars:0,tokens:0}}function mn(e){return fn(e)}function hn(e,{isMarkdown:t}){let n=e.trim();return n?fn(t?cn(e):n):en}function gn(e,t){return e!==null&&j(e)?`source`:t}var _n=new Map,vn=new Set,yn=(e,t)=>`${t}:${e}`;function bn(){for(let e of vn)e()}function xn(e,t,n){let r=yn(e,t);if(n===null){_n.delete(r)&&bn();return}let i=_n.get(r);i&&i.words===n.words&&i.chars===n.chars&&i.tokens===n.tokens||(_n.set(r,n),bn())}function Sn(e,t){return e===null?null:_n.get(yn(e,t))??null}function Cn(e){return vn.add(e),()=>{vn.delete(e)}}function wn(e){let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
|
|
7
|
-
`,` `);return i.trim()?hn(i,{isMarkdown:!1}):null}function Tn(e){let t=[];for(let n of e.state.selection.ranges)n.empty||t.push(e.state.sliceDoc(n.from,n.to));if(t.length===0)return null;let n=t.join(`
|
|
8
|
-
`);return n.trim()?hn(n,{isMarkdown:!0}):null}var Z=e(h(),1),Q=b(),$=t();function En(e){let t=(0,Q.c)(14),{scope:n,onScopeChange:r,projectLabel:i}=e,{_:a}=_(),o;t[0]===r?o=t[1]:(o=e=>{e&&r(e)},t[0]=r,t[1]=o);let s;t[2]===a?s=t[3]:(s=a({id:`aBgwis`}),t[2]=a,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(O,{value:`doc`,className:`flex-1`,"data-testid":`panel-scope-doc`,children:(0,$.jsx)(g,{id:`UpCz01`})}),t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=i??(0,$.jsx)(g,{id:`ZWyHmq`}),t[5]=i,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,$.jsx)(O,{value:`project`,className:`flex-1`,"data-testid":`panel-scope-project`,children:l}),t[7]=l,t[8]=u);let d;return t[9]!==n||t[10]!==o||t[11]!==s||t[12]!==u?(d=(0,$.jsx)(`div`,{className:`shrink-0 px-4 pb-2`,children:(0,$.jsxs)(k,{type:`single`,variant:`segmented`,size:`sm`,spacing:1,value:n,onValueChange:o,"aria-label":s,className:`w-full rounded-md bg-muted p-0.5 dark:bg-background`,children:[c,u]})}),t[9]=n,t[10]=o,t[11]=s,t[12]=u,t[13]=d):d=t[13],d}function Dn(e){let t=e.localTarget;if(e.source!==`links`||t===void 0)return e.message;let n=t.resolvedTarget??t.href;return t.reason===`unresolvable`?t.role===`image`?N._({id:`W5qdI_`,values:{shown:n}}):N._({id:`bpMVIA`,values:{shown:n}}):t.reason===`excluded`?t.role===`image`?N._({id:`qAC6UE`,values:{shown:n}}):N._({id:`gssxm9`,values:{shown:n}}):t.targetKind===`file`?t.role===`image`?N._({id:`iSWh95`,values:{shown:n}}):N._({id:`fOzzSV`,values:{shown:n}}):N._({id:`XBBZnv`,values:{shown:n}})}var On=`audit-superseded`;async function kn(e={kind:`project`},t){return jn(e,Ie,!1,t)}async function An(e={kind:`project`},t){return jn(e,Re,!0,t)}async function jn(e,t,n,r){try{let i=new URLSearchParams;e.kind===`path`?i.set(`path`,e.path):e.kind===`doc`&&i.set(`doc`,e.docName),n&&i.set(`counts`,`1`);let a=i.size===0?``:`?${i}`,o=await fetch(`/api/audit${a}`,r===void 0?void 0:{signal:r});if(!o.ok)return o.status===409?On:(console.warn(`[audit] request failed`,o.status,o.statusText),null);let s;try{s=await o.json()}catch{return r?.aborted===!0||console.warn(`[audit] response body is not valid JSON`),null}let c=t.safeParse(s);return c.success?c.data:(console.warn(`[audit] response failed schema validation`,c.error.issues),null)}catch(e){return r?.aborted===!0||console.warn(`[audit] fetch threw`,e),null}}function Mn(e,t){let n=!1,r=!1,i=!1,a=[],o,s=null,c=()=>({findings:a,...o===void 0?{}:{brokenLinkSuppression:o}}),l=()=>{if(r){i=!0;return}r=!0,s=new AbortController,t({status:`loading`,...c()}),kn({kind:`doc`,docName:e},s.signal).then(e=>{if(!(n||s?.signal.aborted===!0)){if(e===null){t({status:`failed`,...c()});return}if(e===`audit-superseded`){i=!0;return}i||(a=e.files.flatMap(e=>e.diagnostics).filter(e=>e.source===`links`),o=e.brokenLinkSuppression,t({status:`loaded`,...c()}))}}).finally(()=>{n||(r=!1,s=null,i&&(i=!1,l()))})};l();let u=I(e=>{(e.includes(`backlinks`)||F(e))&&l()}),d=He(l);return()=>{n=!0,s?.abort(),u(),d()}}function Nn(e){let t=(0,Q.c)(6),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={docName:null,state:{status:`idle`,findings:[]}},t[0]=n):n=t[0];let[r,i]=(0,Z.useState)(n),a,o;if(t[1]===e?(a=t[2],o=t[3]):(a=()=>{if(e===null){i({docName:null,state:{status:`idle`,findings:[]}});return}return i({docName:e,state:{status:`loading`,findings:[]}}),Mn(e,t=>i({docName:e,state:t}))},o=[e],t[1]=e,t[2]=a,t[3]=o),(0,Z.useEffect)(a,o),r.docName!==e){let n;return t[4]===e?n=t[5]:(n=e===null?{status:`idle`,findings:[]}:{status:`loading`,findings:[]},t[4]=e,t[5]=n),n}return r.state}function Pn(e){return Math.min(50,Math.max(1,Math.ceil(e/10)))}function Fn(e,t){return e===t||e%Pn(t)===0}var In=[250,500,1e3,2e3,4e3];function Ln(e){return e.status===503&&e.problemType===`urn:ok:error:too-many-agent-sessions`}async function Rn(e,t){let n=await t.fixItem(e);for(let r of In){if(n.ok||!Ln(n)||!t.shouldContinue()||(console.debug(`[sweep] capacity refusal, backing off %dms`,r),await t.sleep(r),!t.shouldContinue()))break;n=await t.fixItem(e)}return n}async function zn(e){let t=e.items.length,n=[];for(let[r,i]of e.items.entries()){if(r>0&&(await e.sleep(15),!e.shouldContinue()))return{failures:n,cancelled:!0};let a=await Rn(i,e);if(a.ok||n.push({item:i,detail:a.errorDetail}),!e.shouldContinue())return{failures:n,cancelled:!0};let o=r+1;Fn(o,t)&&e.onProgress(o,t)}return{failures:n,cancelled:!1}}function Bn(e){return new Promise(t=>setTimeout(t,e))}var Vn=null,Hn=!1,Un=new Set,Wn=new Set;function Gn(e){Vn=e;for(let e of Un)e()}function Kn(e){return Un.add(e),()=>{Un.delete(e)}}function qn(){return Vn}function Jn(){return(0,Z.useSyncExternalStore)(Kn,qn,qn)}function Yn(e){return Wn.add(e),()=>{Wn.delete(e)}}function Xn(){Hn=!0}function Zn(e,t,n){if(e.length>0&&(console.warn(`[lint] fix-all: ${e.length} of ${n} files failed`,e.map(e=>({file:e.item.file,detail:e.detail}))),!t)){let t=e[0];M.error(N._({id:`se-tU0`,values:{0:e.length,total:n}}),{description:t===void 0?void 0:`${t.item.file}${t.detail===null?``:` — ${t.detail}`}`})}if(t){M.info(N._({id:`H1TmTu`}));return}e.length===0&&M.success(N._({id:`SWX1O7`,values:{total:n}}))}async function Qn({items:e,fixItem:t,sleep:n=Bn}){if(Vn!==null||e.length===0)return;let r=e.length;Hn=!1,Gn({done:0,total:r});let i=[],a=!1,o=!1;try{let o=await zn({items:e,fixItem:t,sleep:n,onProgress:e=>Gn({done:e,total:r}),shouldContinue:()=>!Hn});i=o.failures,a=o.cancelled}catch(e){console.warn(`[lint] fix-all: sweep threw`,e),o=!0}finally{Gn(null)}try{o?M.error(N._({id:`vwV-kH`})):Zn(i,a,r)}finally{for(let e of Wn)e()}}var $n={errorCount:0,warningCount:0},er=new Map,tr=new Set,nr=new Map;function rr(){let e=new Map;for(let[t,n]of er){let r=n.lint.errorCount+n.links.errorCount,i=n.lint.warningCount+n.links.warningCount;r===0&&i===0||e.set(t,{errorCount:r,warningCount:i})}nr=e;for(let e of tr)e()}var ir=Le;function ar(e){return tr.add(e),()=>{tr.delete(e)}}function or(){return nr}function sr(e){er.clear();for(let t of e)er.set(me(t.file),ir(t.diagnostics));rr()}function cr(e){er.clear();for(let t of e)er.set(me(t.file),{lint:t.lint,links:t.links});rr()}function lr(e,t){er.set(e,ir(t)),rr()}function ur(e,t,n){let r=er.get(e)??{lint:$n,links:$n},i=r[t];i.errorCount===n.errorCount&&i.warningCount===n.warningCount||(er.set(e,{...r,[t]:n}),rr())}var dr=`open-knowledge:lint-nav`;function fr(e,t){return e.range.start.line-t.range.start.line||e.range.start.character-t.range.start.character}function pr(e,t){return{docName:e,line:t.range.start.line+1,column:t.range.start.character+1,source:t.source,...t.frontmatterScope===void 0?{}:{frontmatterScope:t.frontmatterScope}}}function mr(e){if(e.source!==`links`)return null;let t=e.localTarget;return t===void 0?`document`:t.role===`image`?`image`:t.targetKind===`file`?`file`:t.targetKind===`document`?`document`:`unresolvable`}var hr={document:s,file:p,image:ne,unresolvable:s};function gr(e){return e.linkTarget!==void 0&&mr(e)===`document`}function _r(e){let t=(0,Q.c)(40),{diagnostic:n,instanceCount:r}=e,{_:i}=_(),a=n.severity===`error`?W:le,o=n.range.start.line+1,s;t[0]===n?s=t[1]:(s=mr(n),t[0]=n,t[1]=s);let c=s,l=c===null?null:hr[c],u=r!==void 0&&r>1,d=n.severity===`error`?`text-destructive`:`text-amber-500`,f;t[2]===d?f=t[3]:(f=x(`mt-0.5 size-3.5 shrink-0`,d),t[2]=d,t[3]=f);let p;t[4]!==a||t[5]!==f?(p=(0,$.jsx)(a,{"aria-hidden":`true`,className:f}),t[4]=a,t[5]=f,t[6]=p):p=t[6];let m;t[7]===n?m=t[8]:(m=Dn(n),t[7]=n,t[8]=m);let h;t[9]===m?h=t[10]:(h=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 text-foreground`,children:m}),t[9]=m,t[10]=h);let v;t[11]!==u||t[12]!==r?(v=u?(0,$.jsxs)(`span`,{className:`mt-0.5 flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(de,{variant:`gray`,"data-testid":`problems-instance-count`,className:`h-4 px-1 font-sans text-[10px] leading-none`,children:(0,$.jsx)(g,{id:`iZCZmF`,values:{instanceCount:r}})}),(0,$.jsx)(H,{"aria-hidden":`true`,className:`size-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`})]}):null,t[11]=u,t[12]=r,t[13]=v):v=t[13];let y;t[14]!==p||t[15]!==h||t[16]!==v?(y=(0,$.jsxs)(`span`,{className:`flex items-start gap-1.5 text-sm`,children:[p,h,v]}),t[14]=p,t[15]=h,t[16]=v,t[17]=y):y=t[17];let b=c??void 0,S=l!==null&&`gap-0.5`,C;t[18]===S?C=t[19]:(C=x(`h-4 shrink-0 px-1 font-sans text-[10px] uppercase leading-none`,S),t[18]=S,t[19]=C);let w;t[20]===l?w=t[21]:(w=l===null?null:(0,$.jsx)(l,{"aria-hidden":`true`,className:`size-2.5`}),t[20]=l,t[21]=w);let T;t[22]!==n.source||t[23]!==C||t[24]!==w||t[25]!==b?(T=(0,$.jsxs)(de,{variant:`gray`,"data-testid":`problems-source-tag`,"data-target-kind":b,className:C,children:[w,n.source]}),t[22]=n.source,t[23]=C,t[24]=w,t[25]=b,t[26]=T):T=t[26];let E;t[27]!==i||t[28]!==n.code||t[29]!==o||t[30]!==u?(E=u?n.code:`${n.code} · ${i({id:`enPTnx`,values:{displayLine:o}})}`,t[27]=i,t[28]=n.code,t[29]=o,t[30]=u,t[31]=E):E=t[31];let D;t[32]===E?D=t[33]:(D=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:E}),t[32]=E,t[33]=D);let O;t[34]!==T||t[35]!==D?(O=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 ps-5 font-mono text-xs text-muted-foreground`,children:[T,D]}),t[34]=T,t[35]=D,t[36]=O):O=t[36];let k;return t[37]!==O||t[38]!==y?(k=(0,$.jsxs)($.Fragment,{children:[y,O]}),t[37]=O,t[38]=y,t[39]=k):k=t[39],k}function vr(e){let t=new Map;for(let n of e){let e=`${n.source}/${n.code}\u0000${n.linkTarget??``}\u0000${n.message}`,r=t.get(e);r===void 0?t.set(e,{key:e,instances:[n]}):r.instances.push(n)}return[...t.values()]}function yr(e){let t=(0,Q.c)(63),{group:n,onNavigate:r,navTitle:i,renderActions:a}=e,{_:o}=_(),s=n.instances[0],c,l,u,d,f,p,m,h;if(t[0]!==o||t[1]!==s||t[2]!==n.instances.length||t[3]!==i||t[4]!==r||t[5]!==a){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Dn(s);if(n.instances.length===1){let e;t[14]!==s||t[15]!==a?(e=a(s),t[14]=s,t[15]=a,t[16]=e):e=t[16];let n=e,o;t[17]!==s||t[18]!==r?(o=()=>r(s),t[17]=s,t[18]=r,t[19]=o):o=t[19];let c;t[20]!==s||t[21]!==i?(c=i(s),t[20]=s,t[21]=i,t[22]=c):c=t[22];let l;t[23]===s?l=t[24]:(l=(0,$.jsx)(_r,{diagnostic:s}),t[23]=s,t[24]=l);let u;t[25]!==l||t[26]!==o||t[27]!==c?(u=(0,$.jsx)(`button`,{type:`button`,onClick:o,className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left`,title:c,children:l}),t[25]=l,t[26]=o,t[27]=c,t[28]=u):u=t[28];let d;t[29]===n?d=t[30]:(d=n===null?null:(0,$.jsx)(`div`,{className:`absolute bottom-1 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:n}),t[29]=n,t[30]=d);let f;t[31]!==u||t[32]!==d?(f=(0,$.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[u,d]}),t[31]=u,t[32]=d,t[33]=f):f=t[33],h=f;break bb0}p=`rounded`,m=`problems-duplicate-group`,l=D,t[34]!==s||t[35]!==n.instances.length?(f=(0,$.jsx)(E,{className:`group flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:(0,$.jsx)(_r,{diagnostic:s,instanceCount:n.instances.length})}),t[34]=s,t[35]=n.instances.length,t[36]=f):f=t[36],c=T,d=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,u=o({id:`_Bix3-`,values:{localizedFirstMessage:e}})}t[0]=o,t[1]=s,t[2]=n.instances.length,t[3]=i,t[4]=r,t[5]=a,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g;if(t[37]!==o||t[38]!==n.instances||t[39]!==i||t[40]!==r||t[41]!==a){let e;t[43]!==o||t[44]!==i||t[45]!==r||t[46]!==a?(e=e=>{let t=a(e),n=e.range.start.line+1,s=Dn(e);return(0,$.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`flex w-full cursor-pointer rounded px-2 py-1 text-left font-mono text-xs text-muted-foreground`,title:i(e),"aria-label":o({id:`txUHO8`,values:{localizedMessage:s,displayLine:n}}),children:o({id:`enPTnx`,values:{displayLine:n}})}),t===null?null:(0,$.jsx)(`div`,{className:`absolute bottom-0.5 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:t})]},br(e))},t[43]=o,t[44]=i,t[45]=r,t[46]=a,t[47]=e):e=t[47],g=n.instances.map(e),t[37]=o,t[38]=n.instances,t[39]=i,t[40]=r,t[41]=a,t[42]=g}else g=t[42];let v;t[48]!==u||t[49]!==g?(v=(0,$.jsx)(`ul`,{"aria-label":u,className:`flex flex-col gap-0.5 pb-1 ps-5`,"data-testid":`problems-duplicate-instances`,children:g}),t[48]=u,t[49]=g,t[50]=v):v=t[50];let y;t[51]!==c||t[52]!==d||t[53]!==v?(y=(0,$.jsx)(c,{className:d,children:v}),t[51]=c,t[52]=d,t[53]=v,t[54]=y):y=t[54];let b;t[55]!==l||t[56]!==f||t[57]!==y?(b=(0,$.jsxs)(l,{children:[f,y]}),t[55]=l,t[56]=f,t[57]=y,t[58]=b):b=t[58];let x;return t[59]!==b||t[60]!==p||t[61]!==m?(x=(0,$.jsx)(`li`,{className:p,"data-testid":m,children:b}),t[59]=b,t[60]=p,t[61]=m,t[62]=x):x=t[62],x}function br(e){return`${e.source}/${e.code}-${e.range.start.line}-${e.range.start.character}-${e.message}`}function xr(e){return e.reduce((e,t)=>e+ +((t.fixes?.length??0)>0),0)}function Sr(e){let t=(0,Q.c)(11),{target:n,creating:r,disabled:i,onCreate:a}=e,{_:o}=_(),s;t[0]!==o||t[1]!==n?(s=o({id:`oWsZk8`,values:{target:n}}),t[0]=o,t[1]=n,t[2]=s):s=t[2];let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(re,{"aria-hidden":`true`,className:`size-3`}),t[3]=c):c=t[3];let l;t[4]===r?l=t[5]:(l=r?(0,$.jsx)(g,{id:`E9bKSA`}):(0,$.jsx)(g,{id:`XRuL0i`}),t[4]=r,t[5]=l);let u;return t[6]!==i||t[7]!==a||t[8]!==s||t[9]!==l?(u=(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:i,onClick:a,"aria-label":s,"data-testid":`problems-create-page`,children:[c,l]}),t[6]=i,t[7]=a,t[8]=s,t[9]=l,t[10]=u):u=t[10],u}function Cr(e){let t=(0,Q.c)(8),{tip:n,testId:r,children:i}=e,a;t[0]===i?a=t[1]:(a=(0,$.jsx)(S,{asChild:!0,children:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:i})}),t[0]=i,t[1]=a);let o;t[2]!==r||t[3]!==n?(o=(0,$.jsx)(C,{"data-testid":r,children:n}),t[2]=r,t[3]=n,t[4]=o):o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(w,{children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function wr(e){let t=(0,Q.c)(21),{count:n,problemCount:r,aiAvailable:i,disabled:a,onClick:o,children:s}=e,{_:c}=_(),l;t[0]!==i||t[1]!==n||t[2]!==r?(l=n>0?(0,$.jsx)(g,{id:`vjwsDi`,values:{count:n}}):r===0?(0,$.jsx)(g,{id:`gAhHu7`}):i?(0,$.jsx)(g,{id:`zA9zRL`}):(0,$.jsx)(g,{id:`X3MMeA`}),t[0]=i,t[1]=n,t[2]=r,t[3]=l):l=t[3];let u;t[4]!==c||t[5]!==s||t[6]!==n||t[7]!==r?(u=s===void 0?r===0?c({id:`4m-xuX`}):n===0?c({id:`SqIoy_`}):void 0:void 0,t[4]=c,t[5]=s,t[6]=n,t[7]=r,t[8]=u):u=t[8];let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),t[9]=d):d=t[9];let f;t[10]!==s||t[11]!==n?(f=s??(0,$.jsx)(g,{id:`RZXTlY`,values:{count:n}}),t[10]=s,t[11]=n,t[12]=f):f=t[12];let p;t[13]!==a||t[14]!==o||t[15]!==u||t[16]!==f?(p=(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:a,onClick:o,"aria-label":u,"data-testid":`problems-auto-fix`,children:[d,f]}),t[13]=a,t[14]=o,t[15]=u,t[16]=f,t[17]=p):p=t[17];let m;return t[18]!==l||t[19]!==p?(m=(0,$.jsx)(Cr,{testId:`problems-auto-fix-tip`,tip:l,children:p}),t[18]=l,t[19]=p,t[20]=m):m=t[20],m}function Tr(e){let t=(0,Q.c)(12),{count:n,disabled:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(g,{id:`mgDKWS`,values:{count:n}}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(ce,{"aria-hidden":`true`,className:`size-3`}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,$.jsx)(g,{id:`gyHDWC`,values:{count:n}}),t[3]=n,t[4]=s);let c;t[5]!==r||t[6]!==i||t[7]!==s?(c=(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:r,onClick:i,"data-testid":`problems-fix-with-ai`,children:[o,s]}),t[5]=r,t[6]=i,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,$.jsx)(Cr,{testId:`problems-fix-with-ai-tip`,tip:a,children:c}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Er(e){let t=(0,Q.c)(59),{docName:r,diagnostics:i,linkFindingsStatus:a,brokenLinkSuppression:o,onFix:s,onAutoFix:c,onAskAi:l,onFixWithAi:u}=e,p=a===void 0?`loaded`:a,{_:m}=_(),h=(0,Z.useRef)(null),v=(0,Z.useId)(),[y,b]=(0,Z.useState)(`doc`),x;t[0]===r?x=t[1]:(x=j(r),t[0]=r,t[1]=x);let T=!x,{data:E}=Ue(),D=E===null?null:E.effective.enabled?te.filter(e=>E.effective.plugins[e.id].enabled):[],O=D!==null&&D.length===0,k=o!==void 0,N=(y===`project`||T)&&D!==null&&D.length>0,P;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(P={status:`idle`},t[2]=P):P=t[2];let[L,ee]=(0,Z.useState)(P),R=Jn(),z=De(),[B,V]=(0,Z.useState)(null),H=(0,Z.useRef)(!0),U,W;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>(H.current=!0,()=>{H.current=!1}),W=[],t[3]=U,t[4]=W):(U=t[3],W=t[4]),(0,Z.useEffect)(U,W);let G=(0,Z.useRef)(Pr),K=(0,Z.useRef)(Nr),q;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(q={status:`idle`},t[5]=q):q=t[5];let ne=(0,Z.useRef)(q),re;t[6]===L?re=t[7]:(re=()=>{L.status!==`loading`&&(ne.current=L)},t[6]=L,t[7]=re),(0,Z.useEffect)(re);let J=(0,Z.useRef)(0),Y=[...i].sort(fr),X=xr(Y),ie;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(ie=async function(){J.current+=1;let e=J.current,t=ne.current;ee({status:`loading`});let n=await kn();if(n===`audit-superseded`){J.current===e&&H.current&&ee(t.status===`idle`?{status:`failed`}:t);return}n!==null&&sr(n.files),H.current&&ee(n===null?{status:`failed`}:{status:`loaded`,result:n})},t[8]=ie):ie=t[8];let ae=ie,oe;t[9]!==m||t[10]!==L.status||t[11]!==B||t[12]!==z?(oe=async function(e){let t=e.linkTarget;if(!(t===void 0||B!==null||z===null)){V(t);try{await n({initialDir:``,suggestedName:t},{addPage:z.addPage})}catch(e){let t=e;M.error(t instanceof Error?t.message:m({id:`tfi40B`})),H.current&&V(null);return}M.success(m({id:`EWCJFu`,values:{target:t}})),H.current&&V(null),H.current&&L.status===`loaded`&&await ae()}},t[9]=m,t[10]=L.status,t[11]=B,t[12]=z,t[13]=oe):oe=t[13];let se=oe,le=L.status===`loaded`?L.result.files.filter(jr):[],de=function(){Qn({items:le,fixItem:Ar})},he;t[14]===L.status?he=t[15]:(he=function(e){b(e),e===`project`&&L.status===`idle`&&ae()},t[14]=L.status,t[15]=he);let ge=he,_e;t[16]===L.status?_e=t[17]:(_e=()=>{G.current=()=>{L.status===`idle`||L.status===`failed`||ae()}},t[16]=L.status,t[17]=_e),(0,Z.useEffect)(_e);let ve,ye;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ve=()=>He(()=>G.current()),ye=[],t[18]=ve,t[19]=ye):(ve=t[18],ye=t[19]),(0,Z.useEffect)(ve,ye);let be,xe;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>I(e=>{F(e)&&G.current()}),xe=[],t[20]=be,t[21]=xe):(be=t[20],xe=t[21]),(0,Z.useEffect)(be,xe);let Se;t[22]===ge?Se=t[23]:(Se=(e,t)=>{e===`problems`&&(d(`problems`),t.scope!==void 0&&ge(t.scope),t.focus===`panel`&&h.current?.focus({preventScroll:!0}))},t[22]=ge,t[23]=Se);let Ce=(0,Z.useEffectEvent)(Se),we;t[24]===Ce?we=t[25]:(we=()=>{let e=d(`problems`);return e!==null&&Ce(`problems`,e),f(Ce)},t[24]=Ce,t[25]=we);let Te;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Te=[],t[26]=Te):Te=t[26],(0,Z.useEffect)(we,Te);let Ee;t[27]===L.status?Ee=t[28]:(Ee=()=>{K.current=()=>{L.status===`idle`||L.status===`failed`||ae().catch(e=>{console.warn(`[lint] post-sweep re-audit failed`,e),H.current&&ee({status:`failed`})})}},t[27]=L.status,t[28]=Ee),(0,Z.useEffect)(Ee);let Oe,Ie;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=()=>Yn(()=>K.current()),Ie=[],t[29]=Oe,t[30]=Ie):(Oe=t[29],Ie=t[30]),(0,Z.useEffect)(Oe,Ie);let Le;t[31]===r?Le=t[32]:(Le=function(e){let t=pr(r,e);wt(r,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(dr,{detail:t}))},t[31]=r,t[32]=Le);let Re=Le,ze;t[33]!==r||t[34]!==Re?(ze=function(e,t){let n=me(e);if(n===r){Re(t);return}wt(n,{kind:`lint`,detail:pr(n,t)}),window.location.hash=pe(n)},t[33]=r,t[34]=Re,t[35]=ze):ze=t[35];let Be=ze,Ve;t[36]!==m||t[37]!==se||t[38]!==B||t[39]!==l||t[40]!==s||t[41]!==z?(Ve=function(e){let t=s!==void 0&&(e.fixes?.length??0)>0,n=gr(e)&&z!==null;if(!t&&!n&&l===void 0)return null;let r=`${e.source}/${e.code}`;return(0,$.jsxs)($.Fragment,{children:[n?(0,$.jsx)(Sr,{target:e.linkTarget??``,creating:B===e.linkTarget,disabled:B!==null,onCreate:()=>void se(e)}):null,t?(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>s?.(e),"aria-label":m({id:`fZj9em`,values:{flatId:r}}),"data-testid":`problems-fix`,children:[(0,$.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),(0,$.jsx)(g,{id:`c4fVUV`})]}):null,l===void 0?null:(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>l(e),"aria-label":m({id:`hh4mVC`,values:{flatId:r}}),"data-testid":`problems-ask-ai`,children:[(0,$.jsx)(ce,{"aria-hidden":`true`,className:`size-3`}),(0,$.jsx)(g,{id:`xWEvuo`})]})]})},t[36]=m,t[37]=se,t[38]=B,t[39]=l,t[40]=s,t[41]=z,t[42]=Ve):Ve=t[42];let We=Ve,Ge=Fe,Ke;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,$.jsx)(g,{id:`OXdGnd`}),t[43]=Ke):Ke=t[43];let qe;t[44]===v?qe=t[45]:(qe=(0,$.jsx)(Ae,{id:v,children:Ke}),t[44]=v,t[45]=qe);let Je=y===`doc`&&Y.length>0&&(0,$.jsx)(Ne,{children:Y.length}),Ye=N&&(0,$.jsxs)(w,{children:[(0,$.jsx)(S,{className:`shrink-0 cursor-default rounded-md bg-muted-foreground/5 px-2 py-1 font-mono text-xs text-muted-foreground`,"data-testid":`problems-active-plugins`,children:(0,$.jsx)(g,{id:`yxF19Y`,values:{0:D.length}})}),(0,$.jsx)(C,{"data-testid":`problems-active-plugins-tooltip`,children:(0,$.jsx)(g,{id:`ws5o1F`,values:{0:D.map(kr).join(`, `)}})})]}),Xe;t[46]!==qe||t[47]!==Je||t[48]!==Ye?(Xe=(0,$.jsx)(Pe,{children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[qe,Je,Ye]})}),t[46]=qe,t[47]=Je,t[48]=Ye,t[49]=Xe):Xe=t[49];let Ze;t[50]!==ge||t[51]!==y?(Ze=(0,$.jsx)(En,{scope:y,onScopeChange:ge}),t[50]=ge,t[51]=y,t[52]=Ze):Ze=t[52];let Qe=y===`doc`?(0,$.jsxs)(Me,{className:`px-2 py-2`,children:[p===`idle`||p===`loading`?(0,$.jsx)(je,{className:`px-2 pb-2`,role:`status`,"aria-live":`polite`,"data-testid":`problems-links-loading`,children:(0,$.jsx)(g,{id:`W9NSe0`})}):p===`failed`?(0,$.jsx)(ke,{className:`px-2 pb-2`,role:`status`,"data-testid":`problems-links-failed`,children:Y.length>0||k?(0,$.jsx)(g,{id:`IoHQYP`}):(0,$.jsx)(g,{id:`gpbKxw`})}):null,k&&(0,$.jsx)(zr,{suppression:o}),Y.length===0?p===`loaded`?T?O?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{className:`px-2`,"data-testid":`problems-no-plugins`,children:k?(0,$.jsx)(g,{id:`mI1KPS`}):(0,$.jsx)(g,{id:`Hngy37`})}),(0,$.jsx)(`div`,{className:`px-2 pt-2`,children:(0,$.jsx)(A,{variant:`outline`,size:`sm`,onClick:fe,"data-testid":`problems-enable-plugins`,children:(0,$.jsx)(g,{id:`rnX-1S`})})})]}):k?null:(0,$.jsx)(je,{className:`px-2`,children:(0,$.jsx)(g,{id:`ZI8uvA`})}):(0,$.jsx)(je,{className:`px-2`,"data-testid":`problems-markdown-not-applicable`,children:(0,$.jsx)(g,{id:`Kdvukk`})}):null:(0,$.jsxs)($.Fragment,{children:[c!==void 0||u!==void 0?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1 px-2 pb-1`,children:[c!==void 0&&(0,$.jsx)(wr,{count:X,problemCount:Y.length,aiAvailable:u!==void 0,disabled:X===0,onClick:c}),u!==void 0&&(0,$.jsx)(Tr,{count:Y.length,disabled:!1,onClick:()=>u(`doc`)})]}):null,(0,$.jsx)(`ul`,{"aria-label":m({id:`OXdGnd`}),className:`flex flex-col gap-0.5`,children:vr(Y).map(e=>(0,$.jsx)(yr,{group:e,onNavigate:Re,navTitle:e=>m({id:`vbMHjo`,values:{0:e.range.start.line+1}}),renderActions:We},e.key))})]})]}):(0,$.jsx)(Fr,{audit:L,onRefresh:()=>void ae(),onNavigate:Be,fixableCount:le.reduce(Or,0),problemCount:L.status===`loaded`?L.result.files.reduce(Dr,0):0,fixing:R,onAutoFix:de,onCancelFix:Xn,onFixWithAi:u===void 0||L.status!==`loaded`?void 0:()=>u(`project`),onCreateTarget:z===null?void 0:e=>void se(e),creatingTarget:B}),$e;return t[53]!==Ge||t[54]!==v||t[55]!==Xe||t[56]!==Ze||t[57]!==Qe?($e=(0,$.jsxs)(Ge,{ref:h,tabIndex:-1,"aria-labelledby":v,"data-testid":`problems-panel`,children:[Xe,Ze,Qe]}),t[53]=Ge,t[54]=v,t[55]=Xe,t[56]=Ze,t[57]=Qe,t[58]=$e):$e=t[58],$e}function Dr(e,t){return e+t.diagnostics.length}function Or(e,t){return e+xr(t.diagnostics)}function kr(e){return e.label}function Ar(e){return Ve(me(e.file))}function jr(e){return e.diagnostics.some(Mr)}function Mr(e){return(e.fixes?.length??0)>0}function Nr(){}function Pr(){}function Fr(e){let t=(0,Q.c)(81),{audit:n,onRefresh:r,onNavigate:i,fixableCount:a,problemCount:o,fixing:s,onAutoFix:c,onCancelFix:l,onFixWithAi:u,onCreateTarget:d,creatingTarget:f}=e,{_:p}=_(),m=n.status===`loading`||n.status===`idle`,h;t[0]!==n.result||t[1]!==n.status?(h=n.status===`loaded`?n.result.files:[],t[0]=n.result,t[1]=n.status,t[2]=h):h=t[2];let v=h,[y,b]=(0,Z.useState)(Rr),x;t[3]!==y||t[4]!==v?(x=v.length>0&&v.every(e=>y.has(e.file)),t[3]=y,t[4]=v,t[5]=x):x=t[5];let T=x,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e,t){b(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},t[6]=E):E=t[6];let D=E,O;t[7]!==T||t[8]!==v?(O=function(){b(T?new Set:new Set(v.map(Lr)))},t[7]=T,t[8]=v,t[9]=O):O=t[9];let k=O,j;t[10]!==n.result||t[11]!==n.status?(j=n.status===`loaded`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{id:`DsDwR-`,values:{0:n.result.errorCount}}),` · `,(0,$.jsx)(g,{id:`W1SI2K`,values:{0:n.result.warningCount}})]}),t[10]=n.result,t[11]=n.status,t[12]=j):j=t[12];let M;t[13]===j?M=t[14]:(M=(0,$.jsx)(`p`,{className:`min-w-0 truncate text-xs text-muted-foreground`,"data-testid":`problems-audit-summary`,children:j}),t[13]=j,t[14]=M);let N;t[15]!==p||t[16]!==T||t[17]!==v.length||t[18]!==k?(N=v.length>0?(0,$.jsxs)(w,{children:[(0,$.jsx)(S,{asChild:!0,children:(0,$.jsx)(A,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":p(T?{id:`I4LGsH`}:{id:`Ugvy4O`}),"data-testid":`problems-audit-expand-toggle`,onClick:k,children:T?(0,$.jsx)(We,{"aria-hidden":`true`,className:`size-3.5`}):(0,$.jsx)(U,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,$.jsx)(C,{"data-testid":`problems-audit-expand-toggle-tooltip`,children:T?(0,$.jsx)(g,{id:`I4LGsH`}):(0,$.jsx)(g,{id:`Ugvy4O`})})]}):null,t[15]=p,t[16]=T,t[17]=v.length,t[18]=k,t[19]=N):N=t[19];let P;t[20]===p?P=t[21]:(P=p({id:`I7y_vn`}),t[20]=p,t[21]=P);let F=m||s!==null,I;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),t[22]=I):I=t[22];let L;t[23]!==r||t[24]!==P||t[25]!==F?(L=(0,$.jsx)(S,{asChild:!0,children:(0,$.jsx)(A,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":P,"data-testid":`problems-audit-refresh`,disabled:F,onClick:r,children:I})}),t[23]=r,t[24]=P,t[25]=F,t[26]=L):L=t[26];let ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(C,{"data-testid":`problems-audit-refresh-tooltip`,children:(0,$.jsx)(g,{id:`I7y_vn`})}),t[27]=ee):ee=t[27];let R;t[28]===L?R=t[29]:(R=(0,$.jsxs)(w,{children:[L,ee]}),t[28]=L,t[29]=R);let z;t[30]!==R||t[31]!==N?(z=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[N,R]}),t[30]=R,t[31]=N,t[32]=z):z=t[32];let B;t[33]!==z||t[34]!==M?(B=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[M,z]}),t[33]=z,t[34]=M,t[35]=B):B=t[35];let V;t[36]!==p||t[37]!==s?(V=s===null?null:(0,$.jsx)(`span`,{className:`sr-only`,role:`status`,children:p({id:`gZElfU`,values:{0:s.done,1:s.total}})}),t[36]=p,t[37]=s,t[38]=V):V=t[38];let H;t[39]!==p||t[40]!==s||t[41]!==l?(H=s===null?null:(0,$.jsxs)(w,{children:[(0,$.jsx)(S,{asChild:!0,children:(0,$.jsx)(A,{variant:`ghost`,size:`sm`,className:`h-6 shrink-0 px-2 text-muted-foreground`,"aria-label":p({id:`q2cLM6`}),"data-testid":`problems-cancel-fix`,onClick:l,children:(0,$.jsx)(g,{id:`ygCKqB`})})}),(0,$.jsx)(C,{"data-testid":`problems-cancel-fix-tooltip`,children:(0,$.jsx)(g,{id:`yvSAuM`})})]}),t[39]=p,t[40]=s,t[41]=l,t[42]=H):H=t[42];let te=u!==void 0,W=m||s!==null||a===0,G;t[43]===s?G=t[44]:(G=s===null?void 0:(0,$.jsx)(g,{id:`S9t1PI`,values:{0:s.done,1:s.total}}),t[43]=s,t[44]=G);let K;t[45]!==a||t[46]!==c||t[47]!==o||t[48]!==te||t[49]!==W||t[50]!==G?(K=(0,$.jsx)(wr,{count:a,problemCount:o,aiAvailable:te,disabled:W,onClick:c,children:G}),t[45]=a,t[46]=c,t[47]=o,t[48]=te,t[49]=W,t[50]=G,t[51]=K):K=t[51];let q;t[52]!==s||t[53]!==u||t[54]!==o?(q=u!==void 0&&o>0?(0,$.jsx)(Tr,{count:o,disabled:s!==null,onClick:u}):null,t[52]=s,t[53]=u,t[54]=o,t[55]=q):q=t[55];let ne;t[56]!==V||t[57]!==H||t[58]!==K||t[59]!==q?(ne=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1`,children:[V,H,K,q]}),t[56]=V,t[57]=H,t[58]=K,t[59]=q,t[60]=ne):ne=t[60];let re;t[61]!==B||t[62]!==ne?(re=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 px-2 pb-1`,children:[B,ne]}),t[61]=B,t[62]=ne,t[63]=re):re=t[63];let J;t[64]!==p||t[65]!==m?(J=m&&(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,role:`status`,"aria-busy":`true`,"aria-label":p({id:`dx-TwN`}),children:[1,2,3].map(Ir)}),t[64]=p,t[65]=m,t[66]=J):J=t[66];let Y;t[67]===n.status?Y=t[68]:(Y=n.status===`failed`&&(0,$.jsx)(ke,{className:`px-2 text-xs`,children:(0,$.jsx)(g,{id:`IFezUv`})}),t[67]=n.status,t[68]=Y);let X;t[69]!==n.result||t[70]!==n.status||t[71]!==f||t[72]!==y||t[73]!==d||t[74]!==i?(X=n.status===`loaded`&&(0,$.jsx)(Br,{result:n.result,onNavigate:i,onCreateTarget:d,creatingTarget:f,expandedFiles:y,onToggleFile:D}),t[69]=n.result,t[70]=n.status,t[71]=f,t[72]=y,t[73]=d,t[74]=i,t[75]=X):X=t[75];let ie;return t[76]!==re||t[77]!==J||t[78]!==Y||t[79]!==X?(ie=(0,$.jsxs)(Me,{className:`px-2 py-2`,"data-testid":`problems-project-scope`,children:[re,J,Y,X]}),t[76]=re,t[77]=J,t[78]=Y,t[79]=X,t[80]=ie):ie=t[80],ie}function Ir(e){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded px-2 py-1.5`,children:[(0,$.jsx)(Be,{className:`mt-0.5 size-3.5 shrink-0 rounded`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,$.jsx)(Be,{className:`h-3 w-28`}),(0,$.jsx)(Be,{className:`h-3 w-40`})]})]},e)}function Lr(e){return e.file}function Rr(){return new Set}function zr(e){let t=(0,Q.c)(6),{suppression:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(oe,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),t[0]=r):r=t[0];let i;t[1]===n.count?i=t[2]:(i=(0,$.jsx)(g,{id:`gi9c0-`,values:{0:n.count}}),t[1]=n.count,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(g,{id:`l91IVc`}),t[3]=a):a=t[3];let o;return t[4]===i?o=t[5]:(o=(0,$.jsxs)(`div`,{role:`note`,"aria-live":`polite`,"data-testid":`problems-broken-link-suppression`,className:`mx-2 mb-1 flex items-start gap-1.5 rounded-md border border-border/70 bg-muted/40 px-2 py-1.5 text-xs text-muted-foreground`,children:[r,(0,$.jsxs)(`span`,{className:`min-w-0`,children:[i,` `,a]})]}),t[4]=i,t[5]=o),o}function Br(e){let t=(0,Q.c)(24),{result:n,onNavigate:r,onCreateTarget:i,creatingTarget:a,expandedFiles:o,onToggleFile:s}=e,{_:c}=_(),l,u,d,f;if(t[0]!==c||t[1]!==n.warnings){let e=n.warnings.filter(Ur);l=n.warnings.filter(ze),u=`flex flex-col gap-1`,d=e.length>0&&(0,$.jsx)(`ul`,{"aria-label":c({id:`Rsdhj9`}),className:`flex flex-col gap-0.5 pb-1`,children:e.map(Hr)}),f=l.map(Vr),t[0]=c,t[1]=n.warnings,t[2]=l,t[3]=u,t[4]=d,t[5]=f}else l=t[2],u=t[3],d=t[4],f=t[5];let p;t[6]===n.brokenLinkSuppression?p=t[7]:(p=n.brokenLinkSuppression!==void 0&&(0,$.jsx)(zr,{suppression:n.brokenLinkSuppression}),t[6]=n.brokenLinkSuppression,t[7]=p);let m;t[8]!==a||t[9]!==l||t[10]!==o||t[11]!==i||t[12]!==r||t[13]!==s||t[14]!==n.brokenLinkSuppression||t[15]!==n.fileCount||t[16]!==n.files?(m=n.files.length===0?n.brokenLinkSuppression===void 0&&l.length===0?(0,$.jsx)(je,{className:`px-2`,children:(0,$.jsx)(g,{id:`k_Dqw1`,values:{0:n.fileCount}})}):null:n.files.map(e=>(0,$.jsx)(Wr,{file:e,onNavigate:r,onCreateTarget:i,creatingTarget:a,open:o.has(e.file),onOpenChange:t=>s(e.file,t)},e.file)),t[8]=a,t[9]=l,t[10]=o,t[11]=i,t[12]=r,t[13]=s,t[14]=n.brokenLinkSuppression,t[15]=n.fileCount,t[16]=n.files,t[17]=m):m=t[17];let h;return t[18]!==u||t[19]!==d||t[20]!==f||t[21]!==p||t[22]!==m?(h=(0,$.jsxs)(`div`,{className:u,children:[d,f,p,m]}),t[18]=u,t[19]=d,t[20]=f,t[21]=p,t[22]=m,t[23]=h):h=t[23],h}function Vr(e){return(0,$.jsxs)(`div`,{role:`status`,className:`flex items-start gap-1.5 px-2 text-xs`,children:[(0,$.jsx)(oe,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`min-w-0 text-foreground`,children:e})]},e)}function Hr(e,t){return(0,$.jsxs)(`li`,{className:`flex items-start gap-1.5 px-2 text-xs`,children:[(0,$.jsx)(le,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-500`}),(0,$.jsx)(`span`,{className:`min-w-0 text-foreground`,children:e})]},`${t}-${e}`)}function Ur(e){return!ze(e)}function Wr(e){let t=(0,Q.c)(45),{file:n,onNavigate:r,onCreateTarget:i,creatingTarget:a,open:o,onOpenChange:s}=e,{_:c}=_(),l,u,d,f,p,m,h,g,v,y;if(t[0]!==c||t[1]!==a||t[2]!==n.diagnostics||t[3]!==n.file||t[4]!==i||t[5]!==r||t[6]!==s||t[7]!==o){let e=[...n.diagnostics].sort(fr);u=D,h=o,g=s,v=`problems-audit-group`;let _;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(H,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),t[18]=_):_=t[18];let b;t[19]===n.file?b=t[20]:(b=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,title:n.file,children:n.file}),t[19]=n.file,t[20]=b),y=(0,$.jsxs)(E,{className:`group flex w-full cursor-pointer items-center gap-1.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:[_,b,(0,$.jsx)(de,{variant:`gray`,"data-testid":`problems-audit-file-count`,className:`shrink-0`,children:e.length})]}),l=T,m=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,t[21]!==c||t[22]!==n.file?(d=c({id:`zAJzIg`,values:{0:n.file}}),t[21]=c,t[22]=n.file,t[23]=d):d=t[23],f=`flex flex-col gap-0.5 pb-1 ps-3`;let x;t[24]!==c||t[25]!==a||t[26]!==n.file||t[27]!==i||t[28]!==r?(x=e=>(0,$.jsx)(yr,{group:e,onNavigate:e=>r(n.file,e),navTitle:e=>c({id:`xKDsGS`,values:{0:e.range.start.line+1,1:n.file}}),renderActions:e=>!gr(e)||i===void 0?null:(0,$.jsx)(Sr,{target:e.linkTarget??``,creating:a===e.linkTarget,disabled:a!==null,onCreate:()=>i(e)})},e.key),t[24]=c,t[25]=a,t[26]=n.file,t[27]=i,t[28]=r,t[29]=x):x=t[29],p=vr(e).map(x),t[0]=c,t[1]=a,t[2]=n.diagnostics,t[3]=n.file,t[4]=i,t[5]=r,t[6]=s,t[7]=o,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=v,t[17]=y}else l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13],h=t[14],g=t[15],v=t[16],y=t[17];let b;t[30]!==d||t[31]!==f||t[32]!==p?(b=(0,$.jsx)(`ul`,{"aria-label":d,className:f,children:p}),t[30]=d,t[31]=f,t[32]=p,t[33]=b):b=t[33];let x;t[34]!==l||t[35]!==m||t[36]!==b?(x=(0,$.jsx)(l,{className:m,children:b}),t[34]=l,t[35]=m,t[36]=b,t[37]=x):x=t[37];let S;return t[38]!==u||t[39]!==x||t[40]!==h||t[41]!==g||t[42]!==v||t[43]!==y?(S=(0,$.jsxs)(u,{open:h,onOpenChange:g,"data-testid":v,children:[y,x]}),t[38]=u,t[39]=x,t[40]=h,t[41]=g,t[42]=v,t[43]=y,t[44]=S):S=t[44],S}function Gr(e,t){return e.has(t)||P(t)}var Kr=/^(#{1,6})\s+(.+)$/;function qr(e,t){let n=(e.endsWith(`\r`)?e.slice(0,-1):e).match(Kr);if(!n)return null;let r=n[2].trim(),i=ve(r,t);return i?{level:n[1].length,text:r,slug:i}:null}var Jr=null,Yr=[];function Xr(e){if(e===Jr)return Yr;let t=Zr(e);return Jr=e,Yr=t,t}function Zr(e){let t=[],n=new Map,r=ie();for(let i=Qr(e);i<=e.lines;i++){let a=e.line(i);if(r(a.text))continue;let o=qr(a.text,n);o&&t.push({slug:o.slug,from:a.from})}return t}function Qr(e){if(!$r(e.line(1).text))return 1;for(let t=2;t<=e.lines;t++)if($r(e.line(t).text))return t+1;return 1}function $r(e){return ee.test(e.endsWith(`\r`)?e.slice(0,-1):e)}function ei(e){let t=document.getElementById(e);return t?t.getBoundingClientRect().top:null}function ti(e){let t=new Map;for(let n of Xr(e.state.doc))t.set(n.slug,n.from);let n=e.documentTop;return r=>{let i=t.get(r);return i===void 0?null:n+e.lineBlockAt(i).top}}function ni(e,t){let n=(0,Q.c)(9),r;n[0]===t?r=n[1]:(r=t===void 0?{}:t,n[0]=t,n[1]=r);let{isSourceMode:i,docName:a}=r,o=i===void 0?!1:i,[s,c]=(0,Z.useState)(void 0),l=(0,Z.useRef)(null),u;n[2]===a?u=n[3]:(u=()=>a?G(a):null,n[2]=a,n[3]=u);let d=(0,Z.useSyncExternalStore)(q,u,ri),f,p;return n[4]!==o||n[5]!==e||n[6]!==d?(f=()=>{if(e.length===0||o&&!d){c(void 0);return}let t=function(){let t=o&&d?ti(d):ei,n=window.innerHeight/2,r,i;for(let a of e){let e=t(a);e!==null&&(e<0?r=a:i===void 0&&e<n&&(i=a))}c(i??r??e[0])},n=function(){l.current===null&&(l.current=requestAnimationFrame(()=>{l.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),l.current!==null&&(cancelAnimationFrame(l.current),l.current=null)}},p=[e,o,d],n[4]=o,n[5]=e,n[6]=d,n[7]=f,n[8]=p):(f=n[7],p=n[8]),(0,Z.useEffect)(f,p),s}function ri(){return null}var ii=300;async function ai(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new J(N._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=z.safeParse(n);throw e.success?Error(e.data.title):new J(N._({id:`zlErBl`}),{status:t.status})}let r=L.safeParse(n);if(!r.success)throw new J(N._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var oi=32,si=12,ci=6,li=`open-knowledge:outline-nav`,ui=`ok-outline-nav`,di=`ok-outline-nav-dispatch`,fi=`ok-outline-nav-settled`;function pi(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(_e,{name:`outline-panel`,children:(0,$.jsx)(mi,{...e})}),t[0]=e,t[1]=n),n}function mi(e){let t=(0,Q.c)(65),{docName:n,isSourceMode:r,className:i}=e,a=i===void 0?``:i,{_:o}=_(),{pages:s,loading:l,error:u}=Oe(),d=v(),{activeProvider:f,activeDocName:p}=c(),m;t[0]!==n||t[1]!==s?(m=Gr(s,n),t[0]=n,t[1]=s,t[2]=m):m=t[2];let h=m,b;t[3]!==n||t[4]!==d?(b=d.getQueryState([`page-headings`,n]),t[3]=n,t[4]=d,t[5]=b):b=t[5];let S=!l&&u===null&&!h&&b!==void 0,C,w;t[6]===n?(C=t[7],w=t[8]):(C=[`page-headings`,n],w=()=>ai(n),t[6]=n,t[7]=C,t[8]=w);let T=!l&&h,E;t[9]!==C||t[10]!==w||t[11]!==T?(E={queryKey:C,queryFn:w,enabled:T,staleTime:1/0},t[9]=C,t[10]=w,t[11]=T,t[12]=E):E=t[12];let{data:D,isLoading:O,error:k}=y(E),A;t[13]===D?A=t[14]:(A=D===void 0?[]:D,t[13]=D,t[14]=A);let j=A,M,N;t[15]!==n||t[16]!==S||t[17]!==d?(M=()=>{S&&d.resetQueries({queryKey:[`page-headings`,n]})},N=[S,n,d],t[15]=n,t[16]=S,t[17]=d,t[18]=M,t[19]=N):(M=t[18],N=t[19]),(0,Z.useEffect)(M,N);let P,F;t[20]!==p||t[21]!==f||t[22]!==n||t[23]!==d?(P=()=>{if(!f||p!==n)return;let e=f.document,t=null,r=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,d.invalidateQueries({queryKey:[`page-headings`,n]})},ii)};return e.on(`update`,r),()=>{e.off(`update`,r),t!==null&&clearTimeout(t)}},F=[f,p,n,d],t[20]=p,t[21]=f,t[22]=n,t[23]=d,t[24]=P,t[25]=F):(P=t[24],F=t[25]),(0,Z.useEffect)(P,F);let I=l||O,L;t[26]===j?L=t[27]:(L=j.map(hi),t[26]=j,t[27]=L);let ee=L,R;t[28]!==n||t[29]!==r?(R={isSourceMode:r,docName:n},t[28]=n,t[29]=r,t[30]=R):R=t[30];let z=ni(ee,R),B,V,H,U,te,W,G;if(t[31]!==o||t[32]!==z||t[33]!==a||t[34]!==n||t[35]!==k||t[36]!==j||t[37]!==I||t[38]!==r||t[39]!==S){let e=z?j.findIndex(e=>e.slug===z):-1,i=function(t,i){let a={docName:n,index:t,slug:i,mode:r?`source`:`wysiwyg`};a.mode===`source`&&wt(n,{kind:`outline`,detail:a}),he(di,{docName:n,index:t,mode:a.mode,outlineCount:j.length,headingLevel:j[t]?.level,activeIndex:e}),window.dispatchEvent(new CustomEvent(li,{detail:a}))},s=((e>=0?j[e].level:1)-1)*si+(si-ci)/2,c=e*oi+(oi-ci)/2;V=Fe,W=a;let l;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(Ae,{children:(0,$.jsx)(g,{id:`dD7NPy`})}),t[47]=l):l=t[47];let u;t[48]!==k||t[49]!==j.length||t[50]!==I||t[51]!==S?(u=!I&&!k&&!S&&(0,$.jsx)(Ne,{children:j.length}),t[48]=k,t[49]=j.length,t[50]=I,t[51]=S,t[52]=u):u=t[52],t[53]===u?G=t[54]:(G=(0,$.jsx)(Pe,{children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[l,u]})}),t[53]=u,t[54]=G),B=Me,H=`px-3 py-2`,U=I,te=S?(0,$.jsx)(je,{className:`px-2`,role:`status`,children:(0,$.jsx)(g,{id:`0x9smA`})}):k?(0,$.jsx)(ke,{className:`px-2`,children:k instanceof Error?k.message:o({id:`GuqOb1`})}):j.length===0&&!I?(0,$.jsx)(je,{className:`px-2`,children:(0,$.jsx)(g,{id:`0BB9ID`})}):(0,$.jsxs)(`nav`,{"aria-label":o({id:`BymzO4`}),className:`relative`,children:[e>=0&&(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-0 top-0 rounded-full bg-primary motion-safe:[transition:transform_0.25s_var(--ease-out-strong)]`,style:{width:ci,height:ci,transform:`translate(${s}px, ${c}px)`}}),j.map((e,t)=>{let n=e.slug===z;return(0,$.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>i(t,e.slug),className:x(`w-full cursor-pointer truncate py-1.5 pe-2 text-left text-sm transition-colors`,n?`font-medium text-primary`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${(e.level-1)*si+20}px`},title:e.text,children:e.text},t)})]}),t[31]=o,t[32]=z,t[33]=a,t[34]=n,t[35]=k,t[36]=j,t[37]=I,t[38]=r,t[39]=S,t[40]=B,t[41]=V,t[42]=H,t[43]=U,t[44]=te,t[45]=W,t[46]=G}else B=t[40],V=t[41],H=t[42],U=t[43],te=t[44],W=t[45],G=t[46];let K;t[55]!==B||t[56]!==H||t[57]!==U||t[58]!==te?(K=(0,$.jsx)(B,{className:H,"aria-busy":U,children:te}),t[55]=B,t[56]=H,t[57]=U,t[58]=te,t[59]=K):K=t[59];let q;return t[60]!==V||t[61]!==W||t[62]!==G||t[63]!==K?(q=(0,$.jsxs)(V,{className:W,children:[G,K]}),t[60]=V,t[61]=W,t[62]=G,t[63]=K,t[64]=q):q=t[64],q}function hi(e){return e.slug}var gi=!1;function _i(){return gi||!B()?!1:(gi=!0,!0)}export{mn as A,kt as B,Sn as C,Cn as D,wn as E,Pt as F,rt as G,yt as H,Dt as I,tt as K,Et as L,Rt as M,Qt as N,en as O,$t as P,At as R,gn as S,Tn as T,nt as U,wt as V,it as W,An as _,pi as a,Dn as b,dr as c,lr as d,ur as f,kn as g,On as h,fi as i,Yt as j,pn as k,Er as l,ar as m,ui as n,Xr as o,cr as p,li as r,Gr as s,_i as t,or as u,Mn as v,xn as w,En as x,Nn as y,Tt as z};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{Fa as r,Nc as i,Qd as a,Rc as o,Ru as s,Xd as c,Yd as l,ff as u,gf as d,hf as f,id as p,lf as m,qd as h}from"./md-manager-BGnqyqi1-B1QSgyMJ.mjs";import{Jn as g,Pn as _,Xo as v,Yo as y,fa as ee,lr as b,m as x,ns as S,ts as te,wo as ne,zo as re}from"./dist-DMhyZWXW.mjs";import{$ as ie,A as C,J as ae,M as w,O as T,P as oe,R as se,T as ce,X as E,at as le,ct as ue,d as de,dt as fe,f as pe,it as me,j as he,k as ge,lt as _e,nt as ve,o as ye,rt as be,tt as xe,v as Se,w as Ce,x as we,y as Te}from"./init-B4K69pZS.mjs";import{t as Ee}from"./is-object-BGze3w87.mjs";import{t as De}from"./removal-file-path-DpI99hTo.mjs";import{spawn as Oe}from"node:child_process";import{basename as D,dirname as O,join as k,resolve as A,win32 as ke}from"node:path";import{accessSync as Ae,constants as j,existsSync as M,lstatSync as N,mkdirSync as je,readFileSync as P,readdirSync as F,realpathSync as I,rmSync as Me,rmdirSync as Ne,statSync as L,unlinkSync as Pe}from"node:fs";import{homedir as Fe}from"node:os";import{createHash as Ie}from"node:crypto";import{isDeepStrictEqual as Le}from"node:util";import{setTimeout as Re}from"node:timers/promises";var ze=s();let Be;function Ve(){return Be}function He(e,t){if(t!==void 0&&t.length>0)return t;try{return b(e)?.rootPath}catch{return}}function Ue(e){let t=He(e.cwd,e.configuredProjectName),n=_({name:`cli`,project:t});return Be=n,n.info({command:e.command,cwd:e.cwd,project:t},`cli command started`),n}function R(){return o(i)}function z(){return u().keyringService}function B(e){try{e()}catch{}}var We=class{backend=`keyring`;onKeychainRead;constructor(e){this.onKeychainRead=e}async get(e){let{Entry:t}=await import(`@napi-rs/keyring`),n;try{n=new t(z(),e).getPassword()}catch(t){return B(()=>this.onKeychainRead?.({kind:`read-error`,host:e,error:t instanceof Error?t.name:`unknown`})),null}if(n==null)return B(()=>this.onKeychainRead?.({kind:`absent`,host:e})),null;try{return JSON.parse(n)}catch{return B(()=>this.onKeychainRead?.({kind:`corrupt-entry`,host:e,error:`corrupt-entry`})),null}}async set(e,t,n,r){let{Entry:i}=await import(`@napi-rs/keyring`),a=new i(z(),e),o={login:t,token:n,...r};a.setPassword(JSON.stringify(o))}async clear(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{new t(z(),e).deletePassword()}catch{}}},V=class{backend=`file`;authFile;constructor(e){this.authFile=e??k(v(),`auth.yml`)}read(){if(!M(this.authFile))return{};try{let e=P(this.authFile,`utf-8`);return(0,ze.parse)(e)??{}}catch(e){let t=e instanceof Error?e.message:`unknown error`;return process.stderr.write(`[auth] Failed to parse ${this.authFile}: ${t}. Starting with empty credentials.\n`),{}}}write(e){let t=O(this.authFile);M(t)||je(t,{recursive:!0,mode:448}),y(this.authFile,(0,ze.stringify)(e),{mode:384})}async get(e){return this.read()[e]??null}async set(e,t,n,r){let i=this.read();i[e]={login:t,token:n,...r},this.write(i)}async clear(e){let t=this.read();delete t[e],this.write(t)}},Ge=class{backend=`keyring`;keychain;file;constructor(e,t){this.keychain=e,this.file=t}async get(e){let t=await this.keychain.get(e);if(t!=null)return t;let n=await this.file.get(e);if(n==null)return null;try{await this.keychain.set(e,n.login,n.token,{gitProtocol:n.gitProtocol,name:n.name,email:n.email}),await this.file.clear(e),process.stderr.write(`[auth] migrated ${e} credential from ${R()} to the OS keychain\n`)}catch{}return n}set(e,t,n,r){return this.keychain.set(e,t,n,r)}async clear(e){await this.keychain.clear(e),await this.file.get(e)!=null&&await this.file.clear(e)}};async function Ke(e,t){try{let{Entry:n}=await import(`@napi-rs/keyring`);return new n(z(),`__probe__`),process.stderr.write(`[auth] token storage: OS keychain
|
|
2
|
-
`),B(()=>t?.onBackendSelected?.({backend:`keyring`})),new Ge(new We(t?.onKeychainRead),new V(e))}catch(n){let r=n instanceof Error?`${n.name}: ${n.message}`:String(n);return process.stderr.write(`[auth] token storage: file (${R()}) — OS keychain unavailable: ${r}\n`),B(()=>t?.onBackendSelected?.({backend:`file`,reason:r})),new V(e)}}function qe(e){let t=null;return function(){if(t)return t;let n=2e3;return t=(async()=>{let t=null,r=new Promise(r=>{t=setTimeout(()=>{process.stderr.write(`[auth] token storage: keyring init exceeded ${n}ms; falling back to file (${R()})\n`),r(new V(e))},n)});try{return await Promise.race([Ke(e),r])}catch{return new V(e)}finally{t!==null&&clearTimeout(t)}})(),t}}function Je(e){let t=qe(e);return{async get(e){let n=await(await t()).get(e);return n===null?null:{token:n.token,login:n.login}}}}function Ye(e){let t=qe(e);return{backend:`file`,async get(e){return(await t()).get(e)},async set(e,n,r,i){return(await t()).set(e,n,r,i)},async clear(e){return(await t()).clear(e)}}}async function Xe(e,t){let n=[],r=new V(t);await r.get(e)!=null&&(await r.clear(e),n.push(`file`));let i;try{let{Entry:t}=await import(`@napi-rs/keyring`);new t(z(),`__probe__`);let r,a=await new We(e=>{e.kind===`read-error`&&(r=e.error??`read-error`)}).get(e);if(r!==void 0)i=r;else if(a!=null)try{new t(z(),e).deletePassword(),n.push(`keychain`)}catch(e){i=e instanceof Error?e.name:`delete-error`}}catch{}return{touched:n,keychainError:i}}function Ze(e){let t={...e};return delete t.ELECTRON_RUN_AS_NODE,t}function Qe(e){let t=e?.code;return t===`ENOENT`||t===`EACCES`||t===`EPERM`?{ok:!1,reason:`not-installed`}:{ok:!1,reason:`spawn-error`}}function $e(e){return ne({detached:!0,stdio:`ignore`,shell:!1,env:Ze(e)})}function et(e,t,n={}){let r=(n.spawn??Oe)(e,[...t],$e(n.env??process.env));return r.unref(),r}function tt(e,t,n={}){let r=n.spawn??Oe,i=n.timeoutMs??2e3;return new Promise(a=>{let o=!1,s=e=>{o||(o=!0,a(e))},c=setTimeout(()=>s({ok:!1,reason:`timeout`}),i);try{let i=r(e,[...t],$e(n.env??process.env));i.once(`error`,e=>{clearTimeout(c),s(Qe(e))}),i.once(`spawn`,()=>{clearTimeout(c),s({ok:!0})});try{i.unref()}catch{}}catch(e){clearTimeout(c),s(Qe(e))}})}const nt=m.stable.appId,H=[m.stable,m.beta];function rt(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return L(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function it(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}let t=e.homeDir??Fe();for(let n of H)for(let r of[k(t,`Applications`),`/Applications`]){let t=k(r,`${n.productName}.app`);if(at(e,k(t,`Contents`,`MacOS`,n.productName)))return t}return null}function at(e,t){try{let n=e.statSync(t);return n?typeof n.isFile==`function`&&n.isFile():!1}catch{return!1}}function ot(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`&&H.find(t=>e.execPath.toLowerCase().endsWith(`\\${f(t).toLowerCase()}`)))return e.execPath;let t=e.env.LOCALAPPDATA;if(t)for(let n of H)for(let r of d(n)){let i=ke.join(t,`Programs`,r,f(n));if(at(e,i))return i}return null}function st(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`&&H.find(t=>e.execPath.endsWith(`/${t.linuxExecutableName}`)))return e.execPath;for(let t of H){let n=`/opt/${t.productName}/${t.linuxExecutableName}`;if(at(e,n))return n}return null}function ct(e){if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`};if(e.platform!==`darwin`&&e.platform!==`win32`&&e.platform!==`linux`)return{available:!1,reason:`unsupported-platform`};let t;try{t=e.platform===`darwin`?it(e):e.platform===`win32`?ot(e):st(e)}catch{return{available:!1,reason:`stat-error`}}return t?e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,bundlePath:t}:!(e.isTTY===!0||e.platform===`win32`&&e.isTTY===void 0&&!e.env.CI)||e.env.SSH_CONNECTION||e.env.SSH_TTY||e.platform===`linux`&&!e.env.DISPLAY&&!e.env.WAYLAND_DISPLAY?{available:!1,reason:`headless`,bundlePath:t}:{available:!0,reason:`available`,bundlePath:t}:{available:!1,reason:`no-bundle`}}function lt(e,t){let n=e.log??(e=>console.error(e)),r=e.platform??process.platform;n("Launching OpenKnowledge desktop (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)");let i=t?.bundlePath;if(!i){n(`Desktop launch skipped: no resolved desktop executable (caller bug).`);return}if(r===`darwin`){et(`open`,[`-a`,i],{spawn:e.spawn});return}et(i,[],{spawn:e.spawn})}function ut(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found (checked the standard install locations for this OS). Install it from https://openknowledge.ai/download, or omit --mode for browser mode.`;case`darwin-only`:case`unsupported-platform`:return`Desktop app is not available on this platform. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect the desktop install (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available but launch dispatch did not fire (caller bug).`}}function U(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 dt(e){return Ie(`sha256`).update(e).digest(`hex`)}function W(e){return k(v(A(e)),`pi-trust`)}function ft(e,t){return k(W(e),dt(A(t)))}function pt(e,t,n){return k(ft(e,t),`${dt(n)}.json`)}var G=class extends Error{constructor(e,t,n,r){super(`Pi trust receipt at ${U(e)} ${U(t)}; ${U(n)}`,{cause:r}),this.name=`PiTrustReceiptError`}};function K(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 G(e,`could not ${t}: ${i}`,a,n)}function q(e){let t;try{t=N(e)}catch(t){if(t.code===`ENOENT`)return!1;throw K(e,`be inspected`,t)}if(!t.isDirectory())throw new G(e,`is not a regular directory`,`restore the intended receipt directory without a symlink, then retry`);return!0}function mt(e,t){return Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t))}function ht(e,t){if(!Ee(e)||!mt(e,[`version`,`cwd`,`configuredTrustPath`,`canonicalTrustPath`,`state`,`previous`])||e.version!==1||typeof e.cwd!=`string`||e.cwd!==A(e.cwd)||typeof e.configuredTrustPath!=`string`||e.configuredTrustPath!==A(e.configuredTrustPath)||typeof e.canonicalTrustPath!=`string`||e.canonicalTrustPath!==A(e.canonicalTrustPath)||e.state!==`pending`&&e.state!==`committed`||!Ee(e.previous))throw new G(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&&mt(e.previous,[`present`]))n={present:!1};else if(e.previous.present===!0&&mt(e.previous,[`present`,`value`]))n={present:!0,value:e.previous.value};else throw new G(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 gt(e,t,n){let r;try{r=N(n)}catch(e){throw K(n,`be inspected`,e)}if(!r.isFile())throw new G(n,`is not a regular file`,`restore the intended receipt as a regular file without a symlink, then retry`);let i;try{i=P(n,`utf8`)}catch(e){throw K(n,`be read`,e)}let a;try{a=JSON.parse(i)}catch(e){throw new G(n,`is not valid JSON`,`repair its JSON syntax without changing the recorded decision, then retry`,e)}let o=ht(a,n);if(o.cwd!==A(t)||n!==pt(e,t,o.canonicalTrustPath))throw new G(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 _t(e,t){let{record:n,path:r}=t;for(let t of[W(e),ft(e,n.cwd)])if(!q(t))throw new G(t,`no longer exists`,`restore access to the expected receipt directory, then retry`);let i=gt(e,n.cwd,r);if(!Le(i.record,n))throw new G(r,`changed while its trust decision was being updated`,`retry to read its current ownership record`);return i}function vt(e,t,n,r,i){let a={version:1,cwd:A(t),configuredTrustPath:A(n),canonicalTrustPath:A(r),state:`pending`,previous:i},o=pt(e,a.cwd,a.canonicalTrustPath),s=`${JSON.stringify(a,null,2)}\n`;if(!Le(ht(JSON.parse(s),o),a))throw new G(o,`cannot preserve the previous decision as JSON`,`provide the original decision as a JSON value before retrying`);q(W(e)),q(O(o));try{je(O(o),{recursive:!0,mode:448})}catch(e){throw K(O(o),`be created`,e)}let c;try{c=N(o,{throwIfNoEntry:!1})}catch(e){throw K(o,`be inspected`,e)}if(c)throw new G(o,`already exists`,`reconcile the existing ownership record before recording another grant`);try{y(o,s,{mode:384})}catch(e){throw K(o,`be written`,e)}return{path:o,record:a}}function yt(e,t){let n=_t(e,t);if(n.record.state!==`pending`)throw new G(n.path,`is already committed`,`use the current ownership record without committing it again`);let r={...n.record,state:`committed`};try{y(n.path,`${JSON.stringify(r,null,2)}\n`,{mode:384})}catch(e){throw K(n.path,`be committed`,e)}return{path:n.path,record:r}}function J(e,t){if(!q(W(e)))return[];let n=ft(e,t);if(!q(n))return[];let r;try{r=F(n).sort()}catch(e){throw K(n,`be listed`,e)}return r.filter(e=>/^[a-f0-9]{64}\.json$/.test(e)).map(r=>gt(e,t,k(n,r)))}function Y(e,t){let n=_t(e,t);try{Pe(n.path)}catch(e){throw K(n.path,`be removed after reconciling its grant`,e)}for(let t of[O(n.path),W(e)])try{Ne(t)}catch(e){let n=e.code;if(n!==`ENOTEMPTY`&&n!==`EEXIST`&&n!==`ENOENT`)throw K(t,`be removed after reconciling its grant`,e)}}var bt=n(((t,n)=>{var r=e(`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`)}}})),xt=n(((t,n)=>{var r=e(`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())}}})),St=n(((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}})),Ct=n(((t,n)=>{var r=e(`fs`),i=bt(),a=xt(),o=St(),s=e(`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(`
|
|
3
|
-
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]),e(`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=ne,e.createWriteStream=re;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);b=g.ReadStream,S=g.WriteStream}var _=e.ReadStream;_&&(b.prototype=Object.create(_.prototype),b.prototype.open=x);var v=e.WriteStream;v&&(S.prototype=Object.create(v.prototype),S.prototype.open=te),Object.defineProperty(e,"ReadStream",{get:function(){return b},set:function(e){b=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return S},set:function(e){S=e},enumerable:!0,configurable:!0});var y=b;Object.defineProperty(e,"FileReadStream",{get:function(){return y},set:function(e){y=e},enumerable:!0,configurable:!0});var ee=S;Object.defineProperty(e,"FileWriteStream",{get:function(){return ee},set:function(e){ee=e},enumerable:!0,configurable:!0});function b(e,t){return this instanceof b?(_.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}function x(){var e=this;C(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 S(e,t){return this instanceof S?(v.apply(this,arguments),this):S.apply(Object.create(S.prototype),arguments)}function te(){var e=this;C(e.path,e.flags,e.mode,function(t,n){t?(e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n))})}function ne(t,n){return new e.ReadStream(t,n)}function re(t,n){return new e.WriteStream(t,n)}var ie=e.open;e.open=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 ie(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))}}})),wt=n(((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}})),Tt=n((e=>{var t=wt();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}}})),Et=n(((e,t)=>{t.exports=Tt()})),Dt=n(((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`)})),Ot=n(((t,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=e(`assert`),o=Dt(),s=/^win/i.test(r.platform),c=e(`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)}}})),kt=n(((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})),At=n(((t,n)=>{let r=e(`path`),i=Ct(),a=Et(),o=Ot(),s=kt(),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})),jt=n(((e,t)=>{let n=Ct();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}})),Mt=t(n(((e,t)=>{let n=At(),{toPromise:r,toSync:i,toSyncOptions:a}=jt();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 Nt=5e3;function Pt(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 ${Nt}ms`,{cause:e}),{code:`ELOCKED`});return Math.min(25,r)}function Ft(e,t){Ve()?.warn(t,e)}function It(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 Lt(e,t,n){await te(`${t}.ok.lock`,async()=>{let t=performance.now()+Nt,r;for(;;)try{r=await Mt.default.lock(O(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){await Re(Pt(n,t,e))}let i=[];try{n()}catch(e){i.push(e)}finally{try{await r()}catch(e){i.push(e)}}It(i,e)},{onWarn:Ft})}function Rt(e,t,n){S(`${t}.ok.lock`,()=>{let t=performance.now()+Nt,r=new Int32Array(new SharedArrayBuffer(4)),i;for(;;)try{i=Mt.default.lockSync(O(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){Atomics.wait(r,0,0,Pt(n,t,e))}let a=[];try{n()}catch(e){a.push(e)}finally{try{i()}catch(e){a.push(e)}}It(a,e)},{onWarn:Ft})}const zt=[`settings.json`,`prompts`,`themes`,`SYSTEM.md`,`APPEND_SYSTEM.md`];var Bt=class extends Error{name=`PiResourceInspectionError`};function X(e){let t;try{t=N(e)}catch(e){if(e.code===`ENOENT`)return!1;throw e}let n;try{n=L(e)}catch(e){throw t.isSymbolicLink()&&e.code===`ENOENT`?new Bt(he(`missing-symlink-target`),{cause:e}):e}return Ae(e,j.R_OK|(n.isDirectory()?j.X_OK:0)),!0}function Vt(e){return e===`open-knowledge`||e.startsWith(`open-knowledge-`)}function Ht(e,t,n){let r=e;try{let i=I(e),a;r=t;try{a=I(t)}catch(e){if(e.code!==`ENOENT`)throw e;a=A(t)}let o=k(a,`.agents`,`skills`),s=[];for(let e of zt)r=k(i,`.pi`,e),X(r)&&s.push(r);if(r=k(i,`.pi`,`extensions`),X(r))for(let t of F(r).sort()){let i=k(r,t);A(n)!==k(A(e),`.pi`,`extensions`,t)&&s.push(i)}for(let e of[k(i,`.pi`,`skills`),k(i,`.agents`,`skills`)])if(e!==o&&(r=e,X(e)))for(let t of F(e).sort())Vt(t)||s.push(k(e,t));let c=O(i);for(;c!==i;){r=k(c,`.agents`,`skills`),r!==o&&X(r)&&s.push(r);let e=O(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 ${U(r)}: ${e instanceof Bt?e.message:he(w(e))}`}}}function Ut(e,t,n){let r=A(e),i=ue({home:t,env:n??(t===void 0?process.env:{})});return{cwd:r,bridgePath:E.pi.projectConfigPath(r),trustPath:k(i,`trust.json`)}}function Z(e){try{let t=I(e);return L(t).isDirectory()?(Ae(t,j.X_OK),{kind:`ready`,project:{path:e,canonical:t}}):{kind:`refused`,error:`Pi project path ${U(e)} is not a directory; restore the intended project directory, then retry`}}catch(t){return{kind:`refused`,error:`Pi project directory ${U(e)} could not be resolved or accessed: ${U(t instanceof Error?t.message:String(t))}; restore the directory or symlink and check its permissions, then retry`}}}function Wt(e){let t=Z(e.path);if(t.kind===`refused`)return t.error;if(t.project.canonical!==e.canonical)return`Pi project path ${U(e.path)} changed while waiting for its trust lock; restore the intended project location, then retry`}function Gt(e,t,n){let r=ye(E.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 be(i)?{state:`own-current`,text:a}:ce(i)?{state:`own-stale`,text:a}:{state:`foreign`,text:a}}function Kt(e,t){let n;try{n=P(e.path,`utf-8`)}catch(t){let n=t.code;return e.kind===`missing`&&n===`ENOENT`?{state:`untrusted`,entries:{},trailingNewline:!1}:{state:`unreadable`,reason:w(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 Ee(r)?{state:r[t]===!0?`trusted`:`untrusted`,entries:r,trailingNewline:n.endsWith(`
|
|
4
|
-
`)}:{state:`unreadable`,reason:`invalid-json`}}function qt(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 he(e)}}function Q(e,t){return{kind:`refused`,error:`trust store ${U(e)}: ${qt(t)}`}}function Jt(e){let t=De(e);try{switch(t.kind){case`declined`:return Q(e,t.reason);case`ready`:return{kind:`ready`,path:I(t.path)};case`not-present`:break;default:throw Error(`unhandled trust file resolution: ${t}`)}let n=O(e),r=[D(e)],i=N(n,{throwIfNoEntry:!1});for(;!i;){let t=O(n);if(t===n)return Q(e,`unavailable-root`);r.unshift(D(n)),n=t,i=N(n,{throwIfNoEntry:!1})}try{return{kind:`missing`,path:k(I(n),...r)}}catch(t){return Q(e,i.isSymbolicLink()&&t.code===`ENOENT`?`missing-symlink-target`:w(t))}}catch(t){return Q(e,w(t))}}function Yt(e,t){let n=Jt(e);return n.kind===`refused`?n:n.path!==t.path||t.kind===`ready`&&n.kind===`missing`?Q(e,`path-changed`):n}function Xt(e,t,n){let r=Ut(e,t,n),i=Z(r.cwd);if(i.kind===`refused`)return{...r,project:`unavailable`,error:i.error};let a=Gt(r.cwd,r.bridgePath,t).state,o=Jt(r.trustPath),s=o.kind===`refused`?`unreadable`:o.kind===`missing`?`untrusted`:Kt(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:Zt(r.bridgePath).displayNames}}function Zt(e){let t=O(e),n=D(e);try{return{displayNames:F(t).filter(e=>e!==n&&e.endsWith(`.ts`)).sort().map(e=>U(JSON.stringify(e)))}}catch{return{displayNames:[]}}}async function Qt(e,t={mode:`published`},n,r,i){let a=Ut(e,n,r),o=Z(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 ${U(i)} no longer matches the current directory ${U(o.project.canonical)}. Reopen the intended project and approve the Pi integration again; no bridge or trust settings were changed.`};let s=Gt(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=Ce(t)}catch{e=void 0}c=e!==void 0&&s.text===e?`unchanged`:`refreshed`}if(c!==`unchanged`){let e=Te(E.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}`:U(e.error)}}let l=await $t(a.trustPath,o.project,n??Fe());return{...a,ok:l.action===`already-trusted`||l.action===`added`,bridge:c,trust:l.action,...l.error===void 0?{}:{error:l.error}}}async function $t(e,t,n){let r=t.canonical,i=Jt(e);if(i.kind===`refused`)return{action:`refused-unreadable`,error:i.error};try{je(O(i.path),{recursive:!0})}catch(e){return{action:`failed`,error:U(e instanceof Error?e.message:String(e))}}let a={action:`added`};try{await Lt(e,i.path,()=>{let o=Wt(t);if(o){a.action=`refused-unreadable`,a.error=o;return}let s=Yt(e,i);if(s.kind===`refused`){a.action=`refused-unreadable`,a.error=s.error;return}let c=Kt(s,r);if(c.state===`trusted`){a.action=`already-trusted`;return}if(c.state===`unreadable`){a.action=`refused-unreadable`,a.error=Q(e,c.reason).error;return}let l=$(n,()=>{let t=J(n,r).find(e=>e.record.canonicalTrustPath===s.path);return t&&Y(n,t),vt(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?`
|
|
5
|
-
`:``),f=T(s.path);y(s.path,d,f===void 0?void 0:{mode:f}),$(n,()=>yt(n,l)),a.action=`added`})}catch(e){return{action:`failed`,error:U(e instanceof Error?e.message:String(e))}}return a}function en(e){let t=[],n=e;try{for(;;){if(N(n,{throwIfNoEntry:!1})){if(t.length===0)return;let e=I(n);return L(e).isDirectory()?(Ae(e,j.X_OK),k(e,...t)):void 0}let e=O(n);if(e===n)return;t.unshift(D(n)),n=e}}catch{return}}function tn(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(`
|
|
6
|
-
`)}:n.detail===void 0?n:{...n,detail:i.join(`
|
|
7
|
-
`)}}function nn(e,t,n,r={}){let i=Ut(e,t,n),a=t??Fe(),o=Z(i.cwd),s=o.kind===`refused`&&r.recordedOnly?en(i.cwd):void 0,c=o.kind===`ready`?o.project.canonical:s,l;try{l=$(a,()=>{let e=J(a,i.cwd);return c===void 0||c===i.cwd?e:[...J(a,c),...e]})}catch(e){return{action:`failed`,error:U(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 ${U(JSON.stringify(t.cwd))}; configured store ${U(JSON.stringify(t.configuredTrustPath))}; recorded destination ${U(JSON.stringify(t.canonicalTrustPath))}; ownership record ${U(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(`
|
|
8
|
-
`)}}let u=Ht(o.project.canonical,a,E.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=Jt(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 ${U(e)} no longer points to its recorded destination ${U(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(rn(e,a,d,o.project))}return tn(f)}function $(e,t){try{return t()}catch(t){throw t instanceof G?t:Error(`Could not access OpenKnowledge's Pi trust ownership records at ${U(k(v(e),`pi-trust`))}: ${U(t instanceof Error?t.message:String(t))}. Check the records and their permissions, then retry.`,{cause:t})}}function rn(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{N(O(a.path))}catch(e){return{action:`failed`,error:`The recorded Pi trust directory ${U(O(a.path))} is unavailable: ${U(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{Rt(i,a.path,()=>{let e=Wt(r);if(e){c.result={action:`kept-unverified`,error:e};return}let l=Yt(i,a);if(l.kind===`refused`){c.result={action:`refused-unreadable`,error:l.error};return}let u=Kt(l,r.canonical);if(u.state===`unreadable`){c.result={action:`refused-unreadable`,error:Q(i,u.reason).error};return}let d=o.map(e=>({cwd:e.cwd,mode:e.mode,expectedConfiguredPath:e.receipt?.record.configuredTrustPath,receipt:$(t,()=>J(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{an(e,t,i,l.path,u,n,r,c)}catch(t){let n=U(t instanceof Error?t.message:String(t)),r=t instanceof G?``:`; retry to check its current state.`;s.push({action:`failed`,error:`Pi trust entry ${U(JSON.stringify(e.cwd))} in ${U(i)} could not be reconciled: ${n}${r}`})}s.push(c.result),c.result={action:`not-present`}}})}catch(e){s.push({action:`failed`,error:U(e instanceof Error?e.message:String(e))})}return tn([...s,c.result])}function an(e,t,n,r,i,a,o,s){let{cwd:c,receipt:l}=e;if(i.entries[c]!==!0){l&&e.mode===`recorded`&&$(t,()=>Y(t,l)),s.result={action:`not-present`};return}let u=`To remove this grant manually, close Pi and remove only the ${U(JSON.stringify(c))} entry from ${U(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=>U(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`&&$(t,()=>Y(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 ${U(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?`
|
|
9
|
-
`:``),p=T(r);y(r,f,p===void 0?void 0:{mode:p}),i.entries=d,$(t,()=>Y(t,l)),s.result={action:`removed`}}function on(e){return be(e)||me(e)||ce(e)}const sn=10485760;function cn(e,t,n,r=!1){let i=nn(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 ln(e,t,n,r){if(e.id!==`pi`)return{kind:`not-present`};let i=cn(t,n,r,!0);return i.trust===`not-present`?{kind:`not-present`}:{kind:`removed`,...i}}function un(e,t,n,r,i){let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=De(a);if(o.kind===`not-present`)return ln(e,t,n,i);if(o.kind===`declined`)return o;let s=ye(e,t,n,o.path);if(s.kind===`absent`||s.kind===`no-entry`)return ln(e,t,n,i);if(s.kind===`decline`)return{kind:`declined`,reason:s.reason};if(!on(s.entry))return{kind:`left-foreign`};let c=e.serverName(t);if(e.format===`file`){let e=cn(t,n,i);try{Me(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`?pn(o.path,c):e.format===`yaml`?fn(o.path,e.topLevelKey,c):dn(o.path,e.topLevelKey,e.serverMapSubKey,c)}function dn(e,t,n,r){let i;try{i=P(e,`utf-8`)}catch(e){return{kind:`declined`,reason:w(e)}}if(Buffer.byteLength(i,`utf-8`)>sn)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=C(i,Se(t,n,r));return o?(y(e,a,{mode:T(e)}),{kind:`removed`}):{kind:`not-present`}}function fn(e,t,n){let r;try{r=P(e,`utf-8`)}catch(e){return{kind:`declined`,reason:w(e)}}if(Buffer.byteLength(r,`utf-8`)>sn)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,ze.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=ge(a);a.trim()===``||a.endsWith(`
|
|
10
|
-
`)?c.endsWith(`
|
|
11
|
-
`)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
|
|
12
|
-
`).replace(/\n/g,`\r
|
|
13
|
-
`));let u=`${i?``:``}${c}`;return u!==r&&y(e,u,{mode:T(e)}),{kind:`removed`}}function pn(e,t){let n=fe();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=P(e,`utf-8`)}catch(e){return{kind:`declined`,reason:w(e)}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=ge(a),s=a.trim()===``||a.endsWith(`
|
|
14
|
-
`),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(`
|
|
15
|
-
`)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
|
|
16
|
-
`).replace(/\n/g,`\r
|
|
17
|
-
`));let u=`${i?``:``}${l}`;return u!==r&&y(e,u,{mode:T(e)}),{kind:`removed`}}function mn(e,t){let n=c[e];return n===null?null:k(t,...n.split(`/`),x.discovery,`SKILL.md`)}function hn(e,t){let n=mn(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};if(!g(t).some(t=>t.editorId===e))return{editorId:e,label:e,action:`skipped-unsupported`,path:n};try{let r=ee(`discovery`,{checkDesktop:!0});return oe(O(n),t),{editorId:e,label:e,action:se(r,n),path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function gn(e){return M(k(e,...`.agents/skills`.split(`/`),x.discovery))?!0:h.some(t=>{let n=mn(t,e);return n!==null&&M(O(n))})}function _n(e,t){let n=mn(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};let r=O(n);try{return M(n)?(oe(r,t),Me(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 vn(e){return e===`opencode`?le:ve}function yn(e,t,n){let r=E[e],i=vn(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=pe(r,t,n,o.configPath);if(a!==null&&i(a))return{editorId:e,scope:o.scope,configPath:o.configPath}}return null}function bn(e,t,n=[]){let r=M(k(e,x[t]))?`satisfied`:`absent`;return{...r===`satisfied`?{state:r,strictness:[`reclaim-permissive`]}:{state:r},...n.length===0?{}:{sharedWith:n}}}function xn(e,t){let n=ae.flatMap(t=>{let n=e[t];return n===null?[]:[{editor:t,root:n}]}),i=a.filter(e=>e.scope===t).map(e=>({editor:e.editorId,root:r}));return[...n,...i]}function Sn(e,t,n,r){let i=re(e,xn(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 Cn(e,t){let n=(t??Fe()).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 wn(e,t){let n=E[e];return we(n,``,t)&&!de(n,``,t)}function Tn(e,t,n,r,i){let a=E[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?Cn(o,r):void 0,c=ye(a,n,r,i);switch(c.kind){case`absent`:case`no-entry`:return i===void 0&&wn(e,r)?{state:`structural-na`}:{state:`absent`,path:s};case`decline`:return{state:`unprobed`};case`present`:{let{entry:r}=c,i=[];be(r)&&i.push(`reclaim-permissive`),me(r)&&i.push(`pre-approval-exact`),vn(e)(r)&&i.push(`injection-functional`);let o=ie(a,n);return i.length>0&&(o!==null&&xe(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}:_e(a)?{state:`foreign-replaceable`,path:s}:{state:`foreign`,path:s}}}}function En(e){let{cwd:t,home:n}=e;return e=>{if(e.pathId===null)return null;let i=p(e.pathId);if(i===null)return null;if(i.kind===`central-skill-store`)return n===void 0?null:bn(k(n,r),`discovery`,Sn(n,c,e.agent,`global`));let a=i.editor;switch(i.kind){case`editor-user-skill-root`:{let e=c[a];return e===null||n===void 0?null:g(n).some(e=>e.editorId===a)?bn(k(n,e),`discovery`,Sn(n,c,a,`global`)):{state:`structural-na`}}case`editor-project-skill-root`:{let e=l[a];return e===null?null:bn(k(t,e),`project`,Sn(t,l,a,`project`))}case`editor-user-config`:return Tn(a,e.strictness,t,n);case`editor-project-config`:{let r=E[a].projectConfigPath?.(t);return r===void 0?null:Tn(a,e.strictness,t,n,r)}}}}export{Ue as S,Xe as _,hn as a,Ye as b,Xt as c,ct as d,lt as f,R as g,tt as h,gn as i,nt as l,et as m,yn as n,un as o,ut as p,_n as r,Qt as s,En as t,rt as u,Ke as v,Ve as x,Je as y};
|
package/dist/src-CY1smm1s.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./md-manager-BGnqyqi1-B1QSgyMJ.mjs";import"./src-BrQpMSWu.mjs";import"./init-B4K69pZS.mjs";import"./registry-probes-D6HyJ_8R.mjs";import"./start-CDnYOrHP.mjs";import{n as e}from"./loader-DZHqBHXr.mjs";import"./preview-BdmlMCtY.mjs";import"./repair-mcp-configs-CZSnWHtM.mjs";export{e as loadConfig};
|
package/dist/start-Pg-N_eC0.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,m as t,p as n,r}from"./start-CDnYOrHP.mjs";export{r as bootStartServer,n as resolveBundledReactShellDir,t as resolveHost,e as startCommand};
|