@inkeep/open-knowledge 0.18.0-beta.0 → 0.18.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +6 -6
  4. package/dist/constants-__EeoXEM.mjs +2 -0
  5. package/dist/{dist-CkzRB2WE.mjs → dist-DOJts-fj.mjs} +1 -1
  6. package/dist/{dist-B5y4LMVx.mjs → dist-_pfPif1i.mjs} +12 -12
  7. package/dist/{gh-detect-CenJLuMO.mjs → gh-detect-DLds_L3H.mjs} +2 -2
  8. package/dist/index.mjs +1 -1
  9. package/dist/init-DOz-D8gU.mjs +1 -0
  10. package/dist/{init-CBprZg4D.mjs → init-S9gXm9Ry.mjs} +4 -4
  11. package/dist/{loader-Cu0hsF84.mjs → loader-D2tepURW.mjs} +2 -2
  12. package/dist/loader-ULU8sKpa.mjs +1 -0
  13. package/dist/{preview--AtfC4Xf.mjs → preview-BgVD-kDH.mjs} +2 -2
  14. package/dist/preview-EtwafvNv.mjs +1 -0
  15. package/dist/public/assets/{ActivityModeContent-BhLDEUEu.js → ActivityModeContent-BKhyzbSv.js} +1 -1
  16. package/dist/public/assets/DocumentContext-CZHTAtV9.js +34 -0
  17. package/dist/public/assets/{GraphPanel-BcI5qcvU.js → GraphPanel-PtrPJ2gc.js} +3 -3
  18. package/dist/public/assets/SettingsDialogBody-CBdMrld3.js +7 -0
  19. package/dist/public/assets/SourceEditor-CxpPOm6x.js +2 -0
  20. package/dist/public/assets/{TerminalPanel-CRRQI35z.js → TerminalPanel-BiMg7r6Y.js} +1 -1
  21. package/dist/public/assets/config-validation-events-DGSRdhjI.js +15 -0
  22. package/dist/public/assets/dist-D69VSUnH.js +524 -0
  23. package/dist/public/assets/index-DR-2i9Yo.js +2004 -0
  24. package/dist/public/assets/index-Dr6njkuY.css +1 -0
  25. package/dist/public/assets/keyboard-shortcuts-Buc7N-Gp.js +1 -0
  26. package/dist/public/assets/{prop-types-Bu6HzVRz.js → prop-types-OPwqKHmJ.js} +2 -2
  27. package/dist/public/assets/{target-navigation-intent-Dirj8zkE.js → target-navigation-intent-DwtOLgDJ.js} +1 -1
  28. package/dist/public/assets/{telemetry-impl-BBCqZg6V.js → telemetry-impl-DfPGjG5J.js} +1 -1
  29. package/dist/public/assets/typing-burst-detector-C1GC9Aui.js +10 -0
  30. package/dist/public/index.html +9 -9
  31. package/dist/{repair-launch-json-C-XmeL-M.mjs → repair-launch-json-CZLxf06c.mjs} +2 -2
  32. package/dist/{repair-mcp-configs-BSPWVWRa.mjs → repair-mcp-configs-CyI9lwR5.mjs} +2 -2
  33. package/dist/repair-skills-Cn0_bJn_.mjs +1 -0
  34. package/dist/{repair-skills-Cct2on9D.mjs → repair-skills-rowdalMz.mjs} +2 -2
  35. package/dist/{server-lock-BpjJj3OD-DWhr5fHw.mjs → server-lock-BpjJj3OD-dsDEfapU.mjs} +5 -5
  36. package/dist/server-lock-CyhBidkz-KXAjieIO.mjs +1 -0
  37. package/dist/{src-BZNJM3Un.mjs → src-CGRIl5Wf.mjs} +2 -2
  38. package/dist/start-DJfRNfZ-.mjs +1 -0
  39. package/dist/{start-DUSHVeTQ.mjs → start-rysaIHHX.mjs} +2 -2
  40. package/dist/{write-project-skill-DY8A4C2Y.mjs → write-project-skill-HhH8jTF_.mjs} +2 -2
  41. package/package.json +1 -1
  42. package/dist/constants-BTbKlCoY.mjs +0 -2
  43. package/dist/init-CXq5AVRc.mjs +0 -1
  44. package/dist/loader-BXukcTTl.mjs +0 -1
  45. package/dist/preview-ISGQ7wqS.mjs +0 -1
  46. package/dist/public/assets/DocumentContext-BX_sV_R5.js +0 -34
  47. package/dist/public/assets/OpenInAgentMenuRequestContext-RVOid4N9.js +0 -7
  48. package/dist/public/assets/SettingsDialogBody-HMe-8_5H.js +0 -7
  49. package/dist/public/assets/SourceEditor-CtjBvs7y.js +0 -2
  50. package/dist/public/assets/config-validation-events-D83pJzu8.js +0 -15
  51. package/dist/public/assets/dist-BOw5J5xw.js +0 -512
  52. package/dist/public/assets/index-B4rb10PI.js +0 -2002
  53. package/dist/public/assets/index-BqjKblAJ.css +0 -1
  54. package/dist/public/assets/keyboard-shortcuts-Cup8f5Fx.js +0 -1
  55. package/dist/repair-skills-CG6qbLWM.mjs +0 -1
  56. package/dist/server-lock-CyhBidkz-D48N1gMX.mjs +0 -1
  57. package/dist/start-DV3_Nh-W.mjs +0 -1
@@ -0,0 +1,10 @@
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,i as n,o as r,r as i,t as a}from"./compiler-runtime-Cs91PcD2.js";import{$ as o,An as s,G as c,K as l,it as u,n as d,q as f,ut as p}from"./DocumentContext-CZHTAtV9.js";import{a as ee,c as te,i as ne,n as re,o as ie,r as ae,s as oe,t as se,u as ce}from"./panel-BQ1weDcE.js";import{at as m,nt as h,ur as g}from"./dist-D69VSUnH.js";import{l as le}from"./button-CmLxDlCv.js";import{i as ue,z as _}from"./prop-types-OPwqKHmJ.js";import{$ as v,At as y,Bt as b,Dt as x,E as S,Et as C,Ft as w,Ht as T,J as E,Mt as D,N as O,Ot as k,Pt as A,Q as j,Rt as de,Ut as fe,X as M,_ as N,_t as P,ct as F,dt as I,et as L,f as pe,gt as me,ht as he,l as ge,lt as _e,mt as ve,nt as ye,ot as be,rt as xe,st as Se,tt as Ce,ut as we,wt as R,y as Te,yt as z,zt as Ee}from"./dist-C0jOOVYt.js";import{i as De,n as Oe,o as ke,r as Ae}from"./dist-j3LJSXW6.js";var je=e(t(),1),Me=a(),Ne=new Map;function Pe(e,t){Ne.set(e,t)}function Fe(e){let t=Ne.get(e)??null;return Ne.delete(e),t}function Ie(e){Ne.delete(e)}function Le(e,t){let n=(0,Me.c)(4),r=t===void 0?!1:t,[i,a]=(0,je.useState)(void 0),o=(0,je.useRef)(null),s,c;return n[0]!==r||n[1]!==e?(s=()=>{if(r||e.length===0){a(void 0);return}let t=function(){let t=window.innerHeight/2,n,r;for(let i of e){let e=document.getElementById(i);if(!e)continue;let a=e.getBoundingClientRect().top;a<0?n=i:r===void 0&&a<t&&(r=i)}a(r??n??e[0])},n=function(){o.current===null&&(o.current=requestAnimationFrame(()=>{o.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),o.current!==null&&(cancelAnimationFrame(o.current),o.current=null)}},c=[e,r],n[0]=r,n[1]=e,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,je.useEffect)(s,c),i}var B=r(),Re=300;async function ze(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new p(_._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=m.safeParse(n);throw e.success?Error(e.data.title):new p(_._({id:`zlErBl`}),{status:t.status})}let r=h.safeParse(n);if(!r.success)throw new p(_._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var Be=32,Ve=12,He=6,Ue=`open-knowledge:outline-nav`;function We(e){let t=(0,Me.c)(2),n;return t[0]===e?n=t[1]:(n=(0,B.jsx)(s,{name:`outline-panel`,children:(0,B.jsx)(Ge,{...e})}),t[0]=e,t[1]=n),n}function Ge(e){let t=(0,Me.c)(50),{docName:r,isSourceMode:a,className:o}=e,s=o===void 0?``:o,{_:c}=n(),{pages:l,loading:u}=ue(),f=ce(),{activeProvider:p,activeDocName:m}=d(),h,g;t[0]===r?(h=t[1],g=t[2]):(h=[`page-headings`,r],g=()=>ze(r),t[0]=r,t[1]=h,t[2]=g);let _;t[3]!==r||t[4]!==u||t[5]!==l?(_=!u&&l.has(r),t[3]=r,t[4]=u,t[5]=l,t[6]=_):_=t[6];let v;t[7]!==h||t[8]!==g||t[9]!==_?(v={queryKey:h,queryFn:g,enabled:_,staleTime:1/0},t[7]=h,t[8]=g,t[9]=_,t[10]=v):v=t[10];let{data:y,isLoading:b,error:x}=te(v),S;t[11]===y?S=t[12]:(S=y===void 0?[]:y,t[11]=y,t[12]=S);let C=S,w,T;t[13]!==m||t[14]!==p||t[15]!==r||t[16]!==f?(w=()=>{if(!p||m!==r)return;let e=p.document,t=null,n=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,f.invalidateQueries({queryKey:[`page-headings`,r]})},Re)};return e.on(`update`,n),()=>{e.off(`update`,n),t!==null&&clearTimeout(t)}},T=[p,m,r,f],t[13]=m,t[14]=p,t[15]=r,t[16]=f,t[17]=w,t[18]=T):(w=t[17],T=t[18]),(0,je.useEffect)(w,T);let E;t[19]===C?E=t[20]:(E=C.map(Ke),t[19]=C,t[20]=E);let D=Le(E,a),O;t[21]!==D||t[22]!==C?(O=D?C.findIndex(e=>e.slug===D):-1,t[21]=D,t[22]=C,t[23]=O):O=t[23];let k=O,A;t[24]!==r||t[25]!==a?(A=function(e,t){let n={index:e,slug:t,mode:a?`source`:`wysiwyg`};n.mode===`source`&&Pe(r,{kind:`outline`,detail:n}),window.dispatchEvent(new CustomEvent(Ue,{detail:n}))},t[24]=r,t[25]=a,t[26]=A):A=t[26];let j=A,de=((k>=0?C[k].level:1)-1)*Ve+(Ve-He)/2,fe=k*Be+(Be-He)/2,M;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,B.jsx)(oe,{children:(0,B.jsx)(i,{id:`dD7NPy`})}),t[27]=M):M=t[27];let N;t[28]!==C.length||t[29]!==b?(N=!b&&(0,B.jsx)(ae,{children:C.length}),t[28]=C.length,t[29]=b,t[30]=N):N=t[30];let P;t[31]===N?P=t[32]:(P=(0,B.jsxs)(ie,{children:[M,N]}),t[31]=N,t[32]=P);let F;t[33]!==c||t[34]!==k||t[35]!==D||t[36]!==x||t[37]!==j||t[38]!==C||t[39]!==b||t[40]!==de||t[41]!==fe?(F=x?(0,B.jsx)(ee,{className:`px-2`,children:x instanceof Error?x.message:c({id:`GuqOb1`})}):C.length===0&&!b?(0,B.jsx)(ne,{className:`px-2`,children:(0,B.jsx)(i,{id:`0BB9ID`})}):(0,B.jsxs)(`nav`,{"aria-label":c({id:`BymzO4`}),className:`relative`,children:[k>=0&&(0,B.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:He,height:He,transform:`translate(${de}px, ${fe}px)`}}),C.map((e,t)=>{let n=e.slug===D;return(0,B.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>j(t,e.slug),className:le(`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)*Ve+20}px`},title:e.text,children:e.text},t)})]}),t[33]=c,t[34]=k,t[35]=D,t[36]=x,t[37]=j,t[38]=C,t[39]=b,t[40]=de,t[41]=fe,t[42]=F):F=t[42];let I;t[43]!==b||t[44]!==F?(I=(0,B.jsx)(re,{className:`px-3 py-2`,"aria-busy":b,children:F}),t[43]=b,t[44]=F,t[45]=I):I=t[45];let L;return t[46]!==s||t[47]!==P||t[48]!==I?(L=(0,B.jsxs)(se,{className:s,children:[P,I]}),t[46]=s,t[47]=P,t[48]=I,t[49]=L):L=t[49],L}function Ke(e){return e.slug}var qe=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,V=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(qe(e)):qe,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return de(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=fe(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Ee(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(V.prototype[Symbol.iterator]=function(){return this});var Je={from:-1,to:-1,match:/.*/.exec(``)},Ye=`gm`+(/x/.unicode==null?``:`u`),Xe=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=Je,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new $e(e,t,n,r,i);this.re=new RegExp(t,Ye+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=tt(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=tt(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},Ze=new WeakMap,Qe=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=Ze.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return Ze.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),Ze.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},$e=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Je,this.matchPos=tt(e,r),this.re=new RegExp(t,Ye+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Qe.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=tt(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Qe.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Xe.prototype[Symbol.iterator]=$e.prototype[Symbol.iterator]=function(){return this});function et(e){try{return new RegExp(e,Ye),!0}catch{return!1}}function tt(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var nt=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=me(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),d=Math.round(t.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=t.doc.line(Math.max(1,Math.min(t.doc.lines,d))),p=C.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[r,M.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},rt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},it=k.define({combine(e){return b(e,rt,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function at(e){let t=[dt,ut];return e&&t.push(it.of(e)),t}var ot=E.mark({class:`cm-selectionMatch`}),st=E.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function ct(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=R.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=R.Word)}function lt(e,t,n,r){return e(t.sliceDoc(n,n+1))==R.Word&&e(t.sliceDoc(r-1,r))==R.Word}var ut=j.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(it),{state:n}=e,r=n.selection;if(r.ranges.length>1)return E.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return E.none;let e=n.wordAt(i.head);if(!e)return E.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return E.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(ct(o,n,i.from,i.to)&&lt(o,n,i.from,i.to)))return E.none}else if(a=n.sliceDoc(i.from,i.to),!a)return E.none}let s=[];for(let r of e.visibleRanges){let e=new V(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||ct(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(st.range(r,a)):(r>=i.to||a<=i.from)&&s.push(ot.range(r,a)),s.length>t.maxMatches))return E.none}}return E.set(s)}},{decorations:e=>e.decorations}),dt=M.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),ft=({state:e,dispatch:t})=>{let{selection:n}=e,r=C.create(n.ranges.map(t=>e.wordAt(t.head)||C.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function pt(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new V(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new V(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var mt=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return ft({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=pt(e,r);return i?(t(e.update({selection:e.selection.addRange(C.range(i.from,i.to),!1),effects:M.scrollIntoView(i.to)})),!0):!1},H=k.define({combine(e){return b(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Wt(e),scrollToMatch:e=>M.scrollIntoView(e)})}});function ht(e){return e?[H.of(e),Yt]:Yt}var gt=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||et(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
2
+ `:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Tt(this):new bt(this)}getCursor(e,t=0,n){let r=e.doc?e:x.create({doc:e});return n??=r.doc.length,this.regexp?W(this,r,t,n):U(this,r,t,n)}},_t=class{constructor(e){this.spec=e}};function vt(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function U(e,t,n,r){let i;return e.wholeWord&&(i=yt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=vt(e.test,t,i)),new V(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function yt(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(St(i,n-a))!=R.Word||t(Ct(i,n-a))!=R.Word)&&(t(Ct(i,r-a))!=R.Word||t(St(i,r-a))!=R.Word))}var bt=class extends _t{constructor(e){super(e)}nextMatch(e,t,n){let r=U(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=U(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=U(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=U(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=U(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function xt(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function W(e,t,n,r){let i;return e.wholeWord&&(i=wt(t.charCategorizer(t.selection.main.head))),e.test&&(i=xt(e.test,t,i)),new Xe(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function St(e,t){return e.slice(T(e,t,!1),t)}function Ct(e,t){return e.slice(t,T(e,t))}function wt(e){return(t,n,r)=>!r[0].length||(e(St(r.input,r.index))!=R.Word||e(Ct(r.input,r.index))!=R.Word)&&(e(Ct(r.input,r.index+r[0].length))!=R.Word||e(St(r.input,r.index+r[0].length))!=R.Word)}var Tt=class extends _t{nextMatch(e,t,n){let r=W(this.spec,e,n,e.doc.length).next();return r.done&&(r=W(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=W(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=W(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=W(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},G=A.define(),Et=A.define(),K=w.define({create(e){return new Dt(Rt(e).create(),null)},update(e,t){for(let n of t.effects)n.is(G)?e=new Dt(n.value.create(),e.panel):n.is(Et)&&(e=new Dt(e.query,n.value?Lt:null));return e},provide:e=>P.from(e,e=>e.panel)}),Dt=class{constructor(e,t){this.query=e,this.panel=t}},Ot=E.mark({class:`cm-searchMatch`}),kt=E.mark({class:`cm-searchMatch cm-searchMatch-selected`}),At=j.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(K))}update(e){let t=e.state.field(K);(t!=e.startState.field(K)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return E.none;let{view:n}=this,r=new D;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?kt:Ot)})}return r.finish()}},{decorations:e=>e.decorations});function q(e){return t=>{let n=t.state.field(K,!1);return n&&n.query.spec.valid?e(t,n):Vt(t)}}var jt=q((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=C.single(r.from,r.to),a=e.state.facet(H);return e.dispatch({selection:i,effects:[qt(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Bt(e),!0}),Mt=q((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=C.single(i.from,i.to),o=e.state.facet(H);return e.dispatch({selection:a,effects:[qt(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Bt(e),!0}),Nt=q((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:C.create(n.map(e=>C.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Pt=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new V(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(C.range(t.value.from,t.value.to))}return t(e.update({selection:C.create(a,o),userEvent:`select.search.matches`})),!0},Ft=q((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(M.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`)));let d=e.state.changes(s);return o&&(c=C.single(o.from,o.to).map(d),u.push(qt(e,o)),u.push(n.facet(H).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),It=q((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:M.announce.of(r),userEvent:`input.replace.all`}),!0});function Lt(e){return e.state.facet(H).createPanel(e)}function Rt(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(H);return new gt({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function zt(e){let t=xe(e,Lt);return t&&t.dom.querySelector(`[main-field]`)}function Bt(e){let t=zt(e);t&&t==e.root.activeElement&&t.select()}var Vt=e=>{let t=e.state.field(K,!1);if(t&&t.panel){let n=zt(e);if(n&&n!=e.root.activeElement){let r=Rt(e.state,t.query.spec);r.valid&&e.dispatch({effects:G.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Et.of(!0),t?G.of(Rt(e.state,t.query.spec)):A.appendConfig.of(Yt)]});return!0},Ht=e=>{let t=e.state.field(K,!1);if(!t||!t.panel)return!1;let n=xe(e,Lt);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Et.of(!1)}),!0},Ut=[{key:`Mod-f`,run:Vt,scope:`editor search-panel`},{key:`F3`,run:jt,shift:Mt,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:jt,shift:Mt,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Ht,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Pt},{key:`Mod-Alt-g`,run:nt},{key:`Mod-d`,run:mt,preventDefault:!0}],Wt=class{constructor(e){this.view=e;let t=this.query=e.state.field(K).query.spec;this.commit=this.commit.bind(this),this.searchField=z(`input`,{value:t.search,placeholder:J(e,`Find`),"aria-label":J(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=z(`input`,{value:t.replace,placeholder:J(e,`Replace`),"aria-label":J(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=z(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=z(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=z(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return z(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=z(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>jt(e),[J(e,`next`)]),n(`prev`,()=>Mt(e),[J(e,`previous`)]),n(`select`,()=>Nt(e),[J(e,`all`)]),z(`label`,null,[this.caseField,J(e,`match case`)]),z(`label`,null,[this.reField,J(e,`regexp`)]),z(`label`,null,[this.wordField,J(e,`by word`)]),...e.state.readOnly?[]:[z(`br`),this.replaceField,n(`replace`,()=>Ft(e),[J(e,`replace`)]),n(`replaceAll`,()=>It(e),[J(e,`replace all`)])],z(`button`,{name:`close`,onclick:()=>Ht(e),"aria-label":J(e,`close`),type:`button`},[`×`])])}commit(){let e=new gt({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:G.of(e)}))}keydown(e){he(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Mt:jt)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Ft(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(G)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(H).top}};function J(e,t){return e.state.phrase(t)}var Gt=30,Kt=/[\s\.,:;?!]/;function qt(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-Gt),o=Math.min(i,n+Gt),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<Gt;e++)if(!Kt.test(s[e+1])&&Kt.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-Gt;e--)if(!Kt.test(s[e-1])&&Kt.test(s[e])){s=s.slice(0,e);break}}return M.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Jt=M.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),Yt=[K,y.low(At),Jt],Xt=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},Y=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(Q).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new D,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=vn(s);if(i)o.add(n,n,E.widget({widget:new fn(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,E.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,X(f))}};function X(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new Xt(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new Xt(r.from,n,r.diagnostic)}),r}function Zt(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(Q).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is($t))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function Qt(e,t){return e.field(Z,!1)?t:t.concat(A.appendConfig.of(yn))}var $t=A.define(),en=A.define(),tn=A.define(),Z=w.define({create(){return new Y(E.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=X(n,e.selected.diagnostic,i)||X(n,null,i)}!n.size&&i&&t.state.facet(Q).autoPanel&&(i=null),e=new Y(n,i,r)}for(let n of t.effects)if(n.is($t)){let r=t.state.facet(Q).autoPanel?n.value.length?mn.open:null:e.panel;e=Y.init(n.value,r,t.state)}else n.is(en)?e=new Y(e.diagnostics,n.value?mn.open:null,e.selected):n.is(tn)&&(e=new Y(e.diagnostics,e.panel,n.value));return e},provide:e=>[P.from(e,e=>e.panel),M.decorations.from(e,e=>e.diagnostics)]}),nn=E.mark({class:`cm-lintRange cm-lintRange-active`});function rn(e,t,n){let{diagnostics:r}=e.state.field(Z),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(Q).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:an(e,i)}}}:null}function an(e,t){return z(`ul`,{class:`cm-tooltip-lint`},t.map(t=>dn(e,t,!1)))}var on=e=>{let t=e.state.field(Z,!1);(!t||!t.panel)&&e.dispatch({effects:Qt(e.state,[en.of(!0)])});let n=xe(e,mn.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},sn=e=>{let t=e.state.field(Z,!1);return!t||!t.panel?!1:(e.dispatch({effects:en.of(!1)}),!0)},cn=[{key:`Mod-Shift-m`,run:on,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(Z,!1);if(!t)return!1;let n=e.state.selection.main,r=X(t.diagnostics,null,n.to+1);return!r&&(r=X(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],Q=k.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...b(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:ln,tooltipFilter:ln,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function ln(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function un(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function dn(e,t,n){let r=n?un(t.actions):[];return z(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},z(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=X(e.state.field(Z).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),z(`u`,s.slice(c,c+1)),s.slice(c+1)];return z(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&z(`div`,{class:`cm-diagnosticSource`},t.source))}var fn=class extends v{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return z(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},pn=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=dn(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},mn=class e{constructor(e){this.view=e,this.items=[],this.list=z(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)sn(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=un(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=X(this.view.state.field(Z).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=z(`div`,{class:`cm-panel-lint`},this.list,z(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>sn(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(Z).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Z),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new pn(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new pn(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=X(this.view.state.field(Z).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:tn.of(t)})}static open(t){return new e(t)}};function hn(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function $(e){return hn(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var gn=M.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:$(`#d11`)},".cm-lintRange-warning":{backgroundImage:$(`orange`)},".cm-lintRange-info":{backgroundImage:$(`#999`)},".cm-lintRange-hint":{backgroundImage:$(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function _n(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function vn(e){let t=`hint`,n=1;for(let r of e){let e=_n(r.severity);e>n&&(n=e,t=r.severity)}return t}var yn=[Z,M.decorations.compute([Z],e=>{let{selected:t,panel:n}=e.field(Z);return!t||!n||t.from==t.to?E.none:E.set([nn.range(t.from,t.to)])}),_e(rn,{hideOn:Zt}),gn],bn=[I(),Se(),F(),l(),N(),Ce(),ye(),x.allowMultipleSelections.of(!0),S(),O(pe,{fallback:!0}),ge(),Ae(),Oe(),ve(),L(),be(),at(),we.of([...De,...c,...Ut,...f,...Te,...ke,...cn])];F(),l(),Ce(),O(pe,{fallback:!0}),we.of([...c,...f]);var xn={words:0,chars:0,tokens:0},Sn=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,Cn=/[\p{L}\p{N}]/u,wn=new Set([`text`,`inlineCode`,`code`,`tag`]),Tn=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),En=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function Dn(e,t){if(!e)return;let n=e.type;if(!Tn.has(n)){if(wn.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
3
+ `));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)Dn(n,t);if(En.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
4
+ `)&&t.push(`
5
+ `)}}}}function On(e){try{let t=u().parseToMdast(e),n=[];return Dn(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function kn(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))Cn.test(n)&&t++;return t}function An(e){let t=globalThis.Intl.Segmenter;if(!t)return kn(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function jn(e){let t=Sn.test(e)?1.5:4;return Math.ceil(e.length/t)}function Mn(e){return e?{words:Sn.test(e)?An(e):kn(e),chars:e.length,tokens:jn(e)}:{words:0,chars:0,tokens:0}}function Nn(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=g(e);return t.trim()?Mn(On(t)):{words:0,chars:0,tokens:0}}function Pn(e,{isMarkdown:t}){let n=e.trim();return n?Mn(t?On(e):n):xn}var Fn=new Map,In=new Set,Ln=(e,t)=>`${t}:${e}`;function Rn(){for(let e of In)e()}function zn(e,t,n){let r=Ln(e,t);if(n===null){Fn.delete(r)&&Rn();return}let i=Fn.get(r);i&&i.words===n.words&&i.chars===n.chars&&i.tokens===n.tokens||(Fn.set(r,n),Rn())}function Bn(e,t){return e===null?null:Fn.get(Ln(e,t))??null}function Vn(e){return In.add(e),()=>{In.delete(e)}}function Hn(e){let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
6
+ `,` `);return i.trim()?Pn(i,{isMarkdown:!1}):null}function Un(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(`
7
+ `);return n.trim()?Pn(n,{isMarkdown:!0}):null}function Wn(e){let t=o(e.state.selection.content(),e.state.schema);return u().serialize(t).trim()}function Gn(e){return e.lineCount===1&&e.charLen<100?{kind:`inline`,markdown:e.markdown}:e.surface===`source`&&e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?{kind:`lines`,startLine:e.sourceLineStart,endLine:e.sourceLineEnd}:{kind:`anchor`,markdown:e.markdown}}function Kn(e,t){return e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?`${t} (${e.sourceLineStart===e.sourceLineEnd?`${e.sourceLineStart}`:`${e.sourceLineStart}-${e.sourceLineEnd}`})`:e.lineCount>1?`${t} (${e.lineCount} lines)`:`${t} (selection)`}function qn(e){let t=e.replace(/\r\n/g,`
8
+ `).split(`
9
+ `),n=[],r=!1;for(let e of t){let t=e.trim();if(/^(```|~~~)/.test(t)){r||n.push(`code`),r=!r;continue}if(r||t===``)continue;if(/^\|.*\|?$/.test(t)&&t.includes(`|`)){n[n.length-1]!==`table`&&n.push(`table`);continue}if(/^<\/?[A-Za-z]/.test(t)){n[n.length-1]!==`component`&&n.push(`component`);continue}let i=t.match(/^#{1,6}\s+(.*)$/);if(i){n.push(i[1]??``);continue}let a=t.match(/^[-*+]\s+(.*)$/);if(a){n.push(`• ${a[1]??``}`);continue}let o=t.match(/^\d+\.\s+(.*)$/);if(o){n.push(`• ${o[1]??``}`);continue}let s=t.match(/^>\s?(.*)$/);if(s){n.push(s[1]??``);continue}n.push(t)}return n.join(` `).replace(/\s+/g,` `).trim()}var Jn=new Map,Yn=new Set,Xn=(e,t)=>`${t}:${e}`;function Zn(){for(let e of Yn)e()}function Qn(e,t){return e.markdown===t.markdown&&e.sourceLineStart===t.sourceLineStart&&e.sourceLineEnd===t.sourceLineEnd}function $n(e,t,n){let r=Xn(e,t);if(n===null){Jn.delete(r)&&Zn();return}let i=Jn.get(r);i&&Qn(i,n)||(Jn.set(r,n),Zn())}function er(e,t){return e===null?null:Jn.get(Xn(e,t))??null}function tr(e){return Yn.add(e),()=>{Yn.delete(e)}}function nr(e,t){if(e.state.selection.empty)return null;let n=Wn(e);return n.trim()?{surface:`wysiwyg`,docName:t,markdown:n,charLen:n.trim().length,lineCount:(n.match(/\n/g)?.length??0)+1}:null}function rr(e,t){return e.trim()?{surface:`frontmatter`,docName:t,markdown:e,charLen:e.trim().length,lineCount:(e.match(/\n/g)?.length??0)+1}:null}function ir(e,t){let n=[],r=1/0,i=-1;for(let t of e.state.selection.ranges)t.empty||(n.push(e.state.sliceDoc(t.from,t.to)),r=Math.min(r,t.from),i=Math.max(i,t.to));if(n.length===0)return null;let a=n.join(`
10
+ `);if(!a.trim())return null;let o=e.state.doc.lineAt(r).number,s=e.state.doc.lineAt(i).number;return{surface:`source`,docName:t,markdown:a,charLen:a.trim().length,lineCount:s-o+1,sourceLineStart:o,sourceLineEnd:s}}var ar=`open-knowledge:open-ask-ai-composer`;function or(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(ar))}function sr(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(ar,n),()=>t.removeEventListener(ar,n)}export{Ie as C,We as S,Pe as T,xn as _,$n as a,ht as b,ir as c,tr as d,Bn as f,Vn as g,Hn as h,qn as i,nr as l,Un as m,sr as n,Kn as o,zn as p,er as r,rr as s,or as t,Gn as u,Nn as v,Fe as w,Ue as x,bn as y};
@@ -48,7 +48,7 @@
48
48
  -->
49
49
  <script>(() => { let t = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (r === 'light' || r === 'dark' || r === 'system') t = r; } catch {} let dark = t === 'dark'; if (t === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } if (dark) document.documentElement.classList.add('dark'); if (window.okDesktop) document.documentElement.classList.add('electron-mode'); })();</script>
50
50
  <style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
51
- <script type="module" crossorigin src="./assets/index-B4rb10PI.js"></script>
51
+ <script type="module" crossorigin src="./assets/index-DR-2i9Yo.js"></script>
52
52
  <link rel="modulepreload" crossorigin href="./assets/chunk-CFjPhJqf.js">
53
53
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-2ej06EnG.js">
54
54
  <link rel="modulepreload" crossorigin href="./assets/w3c-keyname-nBRha8PK.js">
@@ -67,28 +67,28 @@
67
67
  <link rel="modulepreload" crossorigin href="./assets/dist-CSynDsuh.js">
68
68
  <link rel="modulepreload" crossorigin href="./assets/tooltip-DjrmDp0P.js">
69
69
  <link rel="modulepreload" crossorigin href="./assets/trace-api-DPMyR1_m.js">
70
- <link rel="modulepreload" crossorigin href="./assets/dist-BOw5J5xw.js">
71
- <link rel="modulepreload" crossorigin href="./assets/prop-types-Bu6HzVRz.js">
70
+ <link rel="modulepreload" crossorigin href="./assets/dist-D69VSUnH.js">
71
+ <link rel="modulepreload" crossorigin href="./assets/prop-types-OPwqKHmJ.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/propagation-api-qAYD7s-v.js">
73
73
  <link rel="modulepreload" crossorigin href="./assets/collapsible-BzkAcCLq.js">
74
74
  <link rel="modulepreload" crossorigin href="./assets/dist-DuNRfJxD.js">
75
75
  <link rel="modulepreload" crossorigin href="./assets/dialog-uOgi9SAD.js">
76
- <link rel="modulepreload" crossorigin href="./assets/DocumentContext-BX_sV_R5.js">
76
+ <link rel="modulepreload" crossorigin href="./assets/DocumentContext-CZHTAtV9.js">
77
77
  <link rel="modulepreload" crossorigin href="./assets/panel-BQ1weDcE.js">
78
- <link rel="modulepreload" crossorigin href="./assets/OpenInAgentMenuRequestContext-RVOid4N9.js">
78
+ <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-C1GC9Aui.js">
79
79
  <link rel="modulepreload" crossorigin href="./assets/checkbox-BlEgF5ZV.js">
80
80
  <link rel="modulepreload" crossorigin href="./assets/dist-C_giuVsx.js">
81
81
  <link rel="modulepreload" crossorigin href="./assets/textarea-DV1qaluU.js">
82
82
  <link rel="modulepreload" crossorigin href="./assets/toggle-group-oSLn0Q3B.js">
83
- <link rel="modulepreload" crossorigin href="./assets/config-validation-events-D83pJzu8.js">
83
+ <link rel="modulepreload" crossorigin href="./assets/config-validation-events-DGSRdhjI.js">
84
84
  <link rel="modulepreload" crossorigin href="./assets/agent-presence-DYKkeiBZ.js">
85
85
  <link rel="modulepreload" crossorigin href="./assets/project-paths-lA0ULe1F.js">
86
- <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-Dirj8zkE.js">
86
+ <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-DwtOLgDJ.js">
87
87
  <link rel="modulepreload" crossorigin href="./assets/terminal-theme-BhdZI3O9.js">
88
- <link rel="modulepreload" crossorigin href="./assets/keyboard-shortcuts-Cup8f5Fx.js">
88
+ <link rel="modulepreload" crossorigin href="./assets/keyboard-shortcuts-Buc7N-Gp.js">
89
89
  <link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-BmlKYN7O.js">
90
90
  <link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
91
- <link rel="stylesheet" crossorigin href="./assets/index-BqjKblAJ.css">
91
+ <link rel="stylesheet" crossorigin href="./assets/index-Dr6njkuY.css">
92
92
  </head>
93
93
 
94
94
  <body class="antialiased">
@@ -1,2 +1,2 @@
1
- import{h as e,n as t}from"./init-CBprZg4D.mjs";import{t as n}from"./is-object-Cg453afR.mjs";import{existsSync as r,readFileSync as i}from"node:fs";import{join as a}from"node:path";const o=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],t];function s(e){if(e.runtimeExecutable===`/bin/sh`&&Array.isArray(e.runtimeArgs)){let t=e.runtimeArgs[2];if(typeof t==`string`){if(t.includes(`# ok-ui-v1`))return`canonical`;if(/# ok-ui-v\d+/.test(t))return`legacy-bare`}return`preserved`}if(e.runtimeExecutable===`npx`&&Array.isArray(e.runtimeArgs)){for(let t of o)if(c(e.runtimeArgs,t))return`legacy-bare`}return`preserved`}function c(e,t){if(e.length!==t.length)return!1;for(let n=0;n<t.length;n++)if(e[n]!==t[n])return!1;return!0}function l(t){let o=t.logger??u,c=a(t.projectDir,`.claude`,`launch.json`);if(t.reclaimDisableEnv===`1`)return o({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:c,outcome:`skipped-reclaim-disabled`},repairedCount:0};if(!r(c))return{outcome:{configPath:c,outcome:`no-file`},repairedCount:0};let l;try{let e=i(c,`utf-8`).trim();l=e?JSON.parse(e):{}}catch(e){let t=e instanceof Error?e.message:String(e);return o({event:`launch-json-repair-read-failed`,configPath:c,error:t}),{outcome:{configPath:c,outcome:`read-failed`,error:t},repairedCount:0}}if(!n(l)){let e=`launch.json root is not an object`;return o({event:`launch-json-repair-read-failed`,configPath:c,error:e}),{outcome:{configPath:c,outcome:`read-failed`,error:e},repairedCount:0}}let d=l.configurations;if(!Array.isArray(d))return{outcome:{configPath:c,outcome:`no-entry`},repairedCount:0};let f=d.find(e=>n(e)&&e.name===`open-knowledge-ui`);if(!f)return{outcome:{configPath:c,outcome:`no-entry`},repairedCount:0};let p=s(f);if(p===`canonical`)return{outcome:{configPath:c,outcome:`canonical`},repairedCount:0};if(p===`preserved`)return{outcome:{configPath:c,outcome:`preserved`},repairedCount:0};let m=e(t.projectDir,{mode:`published`});if(m.action===`failed`){let e=m.error??`unknown write failure`;return o({event:`launch-json-repair-write-failed`,configPath:c,error:e}),{outcome:{configPath:c,outcome:`write-failed`,error:e},repairedCount:0}}return o({event:`launch-json-repair-applied`,configPath:c}),{outcome:{configPath:c,outcome:`repaired`},repairedCount:1}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{l as repairLaunchJson};
2
- //# sourceMappingURL=repair-launch-json-C-XmeL-M.mjs.map
1
+ import{h as e,n as t}from"./init-S9gXm9Ry.mjs";import{t as n}from"./is-object-Cg453afR.mjs";import{existsSync as r,readFileSync as i}from"node:fs";import{join as a}from"node:path";const o=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],t];function s(e){if(e.runtimeExecutable===`/bin/sh`&&Array.isArray(e.runtimeArgs)){let t=e.runtimeArgs[2];if(typeof t==`string`){if(t.includes(`# ok-ui-v1`))return`canonical`;if(/# ok-ui-v\d+/.test(t))return`legacy-bare`}return`preserved`}if(e.runtimeExecutable===`npx`&&Array.isArray(e.runtimeArgs)){for(let t of o)if(c(e.runtimeArgs,t))return`legacy-bare`}return`preserved`}function c(e,t){if(e.length!==t.length)return!1;for(let n=0;n<t.length;n++)if(e[n]!==t[n])return!1;return!0}function l(t){let o=t.logger??u,c=a(t.projectDir,`.claude`,`launch.json`);if(t.reclaimDisableEnv===`1`)return o({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:c,outcome:`skipped-reclaim-disabled`},repairedCount:0};if(!r(c))return{outcome:{configPath:c,outcome:`no-file`},repairedCount:0};let l;try{let e=i(c,`utf-8`).trim();l=e?JSON.parse(e):{}}catch(e){let t=e instanceof Error?e.message:String(e);return o({event:`launch-json-repair-read-failed`,configPath:c,error:t}),{outcome:{configPath:c,outcome:`read-failed`,error:t},repairedCount:0}}if(!n(l)){let e=`launch.json root is not an object`;return o({event:`launch-json-repair-read-failed`,configPath:c,error:e}),{outcome:{configPath:c,outcome:`read-failed`,error:e},repairedCount:0}}let d=l.configurations;if(!Array.isArray(d))return{outcome:{configPath:c,outcome:`no-entry`},repairedCount:0};let f=d.find(e=>n(e)&&e.name===`open-knowledge-ui`);if(!f)return{outcome:{configPath:c,outcome:`no-entry`},repairedCount:0};let p=s(f);if(p===`canonical`)return{outcome:{configPath:c,outcome:`canonical`},repairedCount:0};if(p===`preserved`)return{outcome:{configPath:c,outcome:`preserved`},repairedCount:0};let m=e(t.projectDir,{mode:`published`});if(m.action===`failed`){let e=m.error??`unknown write failure`;return o({event:`launch-json-repair-write-failed`,configPath:c,error:e}),{outcome:{configPath:c,outcome:`write-failed`,error:e},repairedCount:0}}return o({event:`launch-json-repair-applied`,configPath:c}),{outcome:{configPath:c,outcome:`repaired`},repairedCount:1}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{l as repairLaunchJson};
2
+ //# sourceMappingURL=repair-launch-json-CZLxf06c.mjs.map
@@ -1,2 +1,2 @@
1
- import{d as e,g as t}from"./init-CBprZg4D.mjs";import{c as n,o as r,r as i}from"./write-project-skill-DY8A4C2Y.mjs";import{t as a}from"./mcp-migrate-event-D0NrGjvc.mjs";import{homedir as o}from"node:os";function s(e){let t=e.logger??u,n=e.home??o(),a=[];if(e.reclaimDisableEnv===`1`)return t({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of i){let i=r[o],s=c(()=>i.configPath(``,n));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:i,home:n,cwd:``,configPath:s,configPathOverride:void 0,logger:t})),i.projectConfigPath){let n=i.projectConfigPath,r=c(()=>n(e.projectDir));r!==null&&a.push(l({scope:`project`,editorId:o,target:i,home:void 0,cwd:e.projectDir,configPath:r,configPathOverride:r,logger:t}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(r){let i={scope:r.scope,editorId:r.editorId,configPath:r.configPath},o=e(r.target,r.cwd,r.home,r.configPathOverride);if(o===null)return{...i,outcome:`no-entry`};if(n(o))return{...i,outcome:`canonical`};r.logger(a({scope:r.scope,surface:`cli-repair`,editorId:r.editorId,configPath:r.configPath,priorEntry:o}));let s=t(r.target,r.cwd,{mode:`published`,skipAvailabilityCheck:!0},r.home,r.configPathOverride);if(s.action===`failed`){let e=s.error??`unknown write failure`;return r.logger({event:`mcp-config-repair-write-failed`,scope:r.scope,editorId:r.editorId,configPath:r.configPath,error:e}),{...i,outcome:`write-failed`,error:e}}return{...i,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
2
- //# sourceMappingURL=repair-mcp-configs-BSPWVWRa.mjs.map
1
+ import{d as e,g as t}from"./init-S9gXm9Ry.mjs";import{c as n,o as r,r as i}from"./write-project-skill-HhH8jTF_.mjs";import{t as a}from"./mcp-migrate-event-D0NrGjvc.mjs";import{homedir as o}from"node:os";function s(e){let t=e.logger??u,n=e.home??o(),a=[];if(e.reclaimDisableEnv===`1`)return t({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of i){let i=r[o],s=c(()=>i.configPath(``,n));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:i,home:n,cwd:``,configPath:s,configPathOverride:void 0,logger:t})),i.projectConfigPath){let n=i.projectConfigPath,r=c(()=>n(e.projectDir));r!==null&&a.push(l({scope:`project`,editorId:o,target:i,home:void 0,cwd:e.projectDir,configPath:r,configPathOverride:r,logger:t}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(r){let i={scope:r.scope,editorId:r.editorId,configPath:r.configPath},o=e(r.target,r.cwd,r.home,r.configPathOverride);if(o===null)return{...i,outcome:`no-entry`};if(n(o))return{...i,outcome:`canonical`};r.logger(a({scope:r.scope,surface:`cli-repair`,editorId:r.editorId,configPath:r.configPath,priorEntry:o}));let s=t(r.target,r.cwd,{mode:`published`,skipAvailabilityCheck:!0},r.home,r.configPathOverride);if(s.action===`failed`){let e=s.error??`unknown write failure`;return r.logger({event:`mcp-config-repair-write-failed`,scope:r.scope,editorId:r.editorId,configPath:r.configPath,error:e}),{...i,outcome:`write-failed`,error:e}}return{...i,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
2
+ //# sourceMappingURL=repair-mcp-configs-CyI9lwR5.mjs.map
@@ -0,0 +1 @@
1
+ import{t as e}from"./repair-skills-rowdalMz.mjs";export{e as repairSkills};
@@ -1,3 +1,3 @@
1
- import{t as e}from"./esm-BLMtE3s6.mjs";import{Hi as t,Nr as n,Tr as r,kr as i,zr as a}from"./dist-B5y4LMVx.mjs";import{i as o,o as s,t as c}from"./write-project-skill-DY8A4C2Y.mjs";import{existsSync as l,mkdirSync as u,readFileSync as d,readdirSync as f,rmSync as p,statSync as m,writeFileSync as h}from"node:fs";import{dirname as g,join as _,resolve as v}from"node:path";import{homedir as y}from"node:os";const b=[{hostDir:`.claude`,editorId:`claude`},{hostDir:`.cursor`,editorId:`cursor`},{hostDir:`.agents`,editorId:`codex`}],x=`open-knowledge-discovery`,S=[`.agents`,`skills`,x],C={existsSync:e=>l(e),isDirectory:e=>{try{return m(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>f(e),readFileSync:e=>d(e),writeFileSync:(e,t)=>{h(e,t)},mkdirSync:(e,t)=>{u(e,t)},rmSync:(e,t)=>{p(e,t)}},w={resolveProjectBundledSkillDir:()=>a(`project`,{checkDesktop:!1}),resolveDiscoveryBundledSkillDir:()=>a(`discovery`,{checkDesktop:!1}),readBundledVersion:()=>r(),readRecordedVersion:e=>i(e,`cli-hosts`),writeRecordedVersion:(e,n)=>t(e,`cli-hosts`,n,`cli-start`),recordEvent:e=>n(e)};function T(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function E(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(g(t),{recursive:!0}),D(e,t,n)}function D(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=_(e,r),a=_(t,r);n.isDirectory(i)?D(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function O(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(o):!1}catch{return!1}}function k(e,t,n,r){let i;try{i=t.resolveProjectBundledSkillDir()}catch(e){return r({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let a=[];for(let t of b){let o=_(e,t.hostDir,`skills`,`open-knowledge`),l=_(o,`SKILL.md`),u=n.existsSync(l),d=s[t.editorId]?.projectConfigPath?.(e),f=!u&&O(d,n);if(!u&&!f){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:o});continue}try{c(o,e),E(i,o,n);let s=u?`reclaimed`:`created`;a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:s}),r({event:u?`project-skill-reclaim-reclaimed`:`project-skill-reclaim-created`,scope:`project`,editorId:t.editorId,path:o})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:o,error:n})}}return{outcome:`done`,entries:a}}async function A(e,t,n,r){let i=e=>{t.recordEvent(e).catch(()=>{})},a=()=>new Date().toISOString(),o;try{o=await t.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return r({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let s;try{s=await t.readRecordedVersion(e)}catch(e){r({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),s=null}if(s!==null&&s===o)return r({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:o}),{outcome:`skipped`,reason:`version-current`};let c;try{c=t.resolveDiscoveryBundledSkillDir()}catch(e){let t=e instanceof Error?e.message:String(e);return r({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:t}),i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`bundle-missing:${t}`}),{outcome:`skipped`,reason:`bundle-missing`}}let l=[],u=_(e,...S),d=n.existsSync(u);try{E(c,u,n),l.push({kind:`central`,path:u,outcome:d?`overwritten`:`written`}),r({event:`user-skill-reclaim-central-written`,scope:`user`,path:u,preexisting:d,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);l.push({kind:`central`,path:u,outcome:`failed`,error:t}),r({event:`user-skill-reclaim-central-failed`,scope:`user`,path:u,error:t})}for(let t of b){let i=_(e,t.hostDir),a=_(i,`skills`,x);if(a===u){l.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:`skipped-collapsed-with-central`});continue}if(!n.existsSync(i)){l.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:`skipped-host-absent`});continue}let s=n.existsSync(a);try{E(c,a,n),l.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:s?`overwritten`:`written`}),r({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:t.editorId,hostDir:t.hostDir,path:a,preexisting:s,version:o})}catch(e){let n=e instanceof Error?e.message:String(e);l.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:`failed`,error:n}),r({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:t.editorId,hostDir:t.hostDir,path:a,error:n})}}let f=l.find(e=>e.kind===`central`);if(f?.outcome===`written`||f?.outcome===`overwritten`){let n=null;try{await t.writeRecordedVersion(e,o),r({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:o})}catch(e){n=e instanceof Error?e.message:String(e),r({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:o,error:n})}i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:n===null?`installed`:`failed`,version:o,...n===null?{}:{reason:`state-write-failed:${n}`}})}else{let e=l.some(e=>e.kind===`host`&&e.outcome===`failed`);i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,version:o,reason:e?`all-writes-failed`:`no-hosts-installed`})}return{outcome:`done`,version:o,entries:l}}async function j(e){let t=e.logger??T,n=e.fs??C,r=e.home??y(),i={...w,...e.deps};return e.reclaimDisableEnv===`1`?(t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`}):{status:`done`,project:k(e.projectDir,i,n,t),user:await A(r,i,n,t)}}function M(e){return e.status===`skipped`?e.reason===`reclaim-disabled`?0:1:e.project.outcome===`skipped`||e.user.outcome===`skipped`&&e.user.reason!==`version-current`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function N(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`reclaimed`).length,r=e.project.entries.filter(e=>e.outcome===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length;t.push(` Project: ${n} reclaimed, ${r} created, ${i} no-token, ${a} failed.`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`||e.outcome===`overwritten`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,i=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} skipped, ${i} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return t.join(`
1
+ import{t as e}from"./esm-BLMtE3s6.mjs";import{Hi as t,Nr as n,Tr as r,kr as i,zr as a}from"./dist-_pfPif1i.mjs";import{i as o,o as s,t as c}from"./write-project-skill-HhH8jTF_.mjs";import{existsSync as l,mkdirSync as u,readFileSync as d,readdirSync as f,rmSync as p,statSync as m,writeFileSync as h}from"node:fs";import{dirname as g,join as _,resolve as v}from"node:path";import{homedir as y}from"node:os";const b=[{hostDir:`.claude`,editorId:`claude`},{hostDir:`.cursor`,editorId:`cursor`},{hostDir:`.agents`,editorId:`codex`}],x=`open-knowledge-discovery`,S=[`.agents`,`skills`,x],C={existsSync:e=>l(e),isDirectory:e=>{try{return m(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>f(e),readFileSync:e=>d(e),writeFileSync:(e,t)=>{h(e,t)},mkdirSync:(e,t)=>{u(e,t)},rmSync:(e,t)=>{p(e,t)}},w={resolveProjectBundledSkillDir:()=>a(`project`,{checkDesktop:!1}),resolveDiscoveryBundledSkillDir:()=>a(`discovery`,{checkDesktop:!1}),readBundledVersion:()=>r(),readRecordedVersion:e=>i(e,`cli-hosts`),writeRecordedVersion:(e,n)=>t(e,`cli-hosts`,n,`cli-start`),recordEvent:e=>n(e)};function T(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function E(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(g(t),{recursive:!0}),D(e,t,n)}function D(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=_(e,r),a=_(t,r);n.isDirectory(i)?D(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function O(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(o):!1}catch{return!1}}function k(e,t,n,r){let i;try{i=t.resolveProjectBundledSkillDir()}catch(e){return r({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let a=[];for(let t of b){let o=_(e,t.hostDir,`skills`,`open-knowledge`),l=_(o,`SKILL.md`),u=n.existsSync(l),d=s[t.editorId]?.projectConfigPath?.(e),f=!u&&O(d,n);if(!u&&!f){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:o});continue}try{c(o,e),E(i,o,n);let s=u?`reclaimed`:`created`;a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:s}),r({event:u?`project-skill-reclaim-reclaimed`:`project-skill-reclaim-created`,scope:`project`,editorId:t.editorId,path:o})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:o,error:n})}}return{outcome:`done`,entries:a}}async function A(e,t,n,r){let i=e=>{t.recordEvent(e).catch(()=>{})},a=()=>new Date().toISOString(),o;try{o=await t.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return r({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let s;try{s=await t.readRecordedVersion(e)}catch(e){r({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),s=null}if(s!==null&&s===o)return r({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:o}),{outcome:`skipped`,reason:`version-current`};let c;try{c=t.resolveDiscoveryBundledSkillDir()}catch(e){let t=e instanceof Error?e.message:String(e);return r({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:t}),i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`bundle-missing:${t}`}),{outcome:`skipped`,reason:`bundle-missing`}}let l=[],u=_(e,...S),d=n.existsSync(u);try{E(c,u,n),l.push({kind:`central`,path:u,outcome:d?`overwritten`:`written`}),r({event:`user-skill-reclaim-central-written`,scope:`user`,path:u,preexisting:d,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);l.push({kind:`central`,path:u,outcome:`failed`,error:t}),r({event:`user-skill-reclaim-central-failed`,scope:`user`,path:u,error:t})}for(let t of b){let i=_(e,t.hostDir),a=_(i,`skills`,x);if(a===u){l.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:`skipped-collapsed-with-central`});continue}if(!n.existsSync(i)){l.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:`skipped-host-absent`});continue}let s=n.existsSync(a);try{E(c,a,n),l.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:s?`overwritten`:`written`}),r({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:t.editorId,hostDir:t.hostDir,path:a,preexisting:s,version:o})}catch(e){let n=e instanceof Error?e.message:String(e);l.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:`failed`,error:n}),r({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:t.editorId,hostDir:t.hostDir,path:a,error:n})}}let f=l.find(e=>e.kind===`central`);if(f?.outcome===`written`||f?.outcome===`overwritten`){let n=null;try{await t.writeRecordedVersion(e,o),r({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:o})}catch(e){n=e instanceof Error?e.message:String(e),r({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:o,error:n})}i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:n===null?`installed`:`failed`,version:o,...n===null?{}:{reason:`state-write-failed:${n}`}})}else{let e=l.some(e=>e.kind===`host`&&e.outcome===`failed`);i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,version:o,reason:e?`all-writes-failed`:`no-hosts-installed`})}return{outcome:`done`,version:o,entries:l}}async function j(e){let t=e.logger??T,n=e.fs??C,r=e.home??y(),i={...w,...e.deps};return e.reclaimDisableEnv===`1`?(t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`}):{status:`done`,project:k(e.projectDir,i,n,t),user:await A(r,i,n,t)}}function M(e){return e.status===`skipped`?e.reason===`reclaim-disabled`?0:1:e.project.outcome===`skipped`||e.user.outcome===`skipped`&&e.user.reason!==`version-current`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function N(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`reclaimed`).length,r=e.project.entries.filter(e=>e.outcome===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length;t.push(` Project: ${n} reclaimed, ${r} created, ${i} no-token, ${a} failed.`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`||e.outcome===`overwritten`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,i=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} skipped, ${i} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return t.join(`
2
2
  `)}function P(){return new e(`repair-skills`).description("Refresh bundled SKILL.md files for installed AI editors (project-local + user-global). Runs automatically during `ok start`; this command forces an explicit sweep.").action(async()=>{let e=await j({projectDir:v(process.cwd()),reclaimDisableEnv:process.env.OK_RECLAIM_DISABLE??null});process.stdout.write(`${N(e)}\n`),process.exitCode=M(e)})}export{P as n,j as t};
3
- //# sourceMappingURL=repair-skills-Cct2on9D.mjs.map
3
+ //# sourceMappingURL=repair-skills-rowdalMz.mjs.map
@@ -444,8 +444,8 @@ $2`).split(`
444
444
  `)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=a$(i.attributes??[]);return!i.children||i.children.length===0?s?c?`<${s} ${c} />`:`<${s} />`:``:r$({...i,attributes:(i.attributes??[]).map(s$)},t,n,r)},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),o+=i.move(`==`),a(),o},comment(e,t,n,r){let i=e.data?.sourceForm,a=i===`html`?`<!-- `:`%%`,o=i===`html`?` -->`:`%%`,s=n.createTracker(r),c=n.enter(`comment`),l=s.move(a);return l+=n.containerPhrasing(e,{before:l,after:o,...s.current()}),l+=s.move(o),c(),l},commentBlock(e,t,n,r){let i=n.createTracker(r),a=n.enter(`commentBlock`),o=e.children??[],s=e.data?.sourceForm,c=e.data?.sourceLayout,l=o.length===1&&o[0]?.type===`paragraph`;if(s===`html`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`<!-- `,after:` -->`,...i.current()});return a(),`<!-- ${t} -->`}if(c===`inline`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`%% `,after:` %%`,...i.current()});return a(),`%% ${t} %%`}let u=n.containerFlow(e,i.current());return a(),`%%\n\n${u}\n\n%%`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;if(typeof t==`string`)return t;let n=e.name??``,r=a$(e.attributes??[]);return r?`<${n} ${r} />`:`<${n}/>`},rawMdxFallback(e){return e.value??``},blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.containerFlow(e,a.current());i();let s=e.data?.sourceMarkerSpacings,c=0;return n.indentLines(o,(e,t,n)=>{if(n)return`>`;let r=s?.[c++];return r===`none`||r===0?`>${e}`:typeof r==`number`&&r>=2&&!e.startsWith(` `)?`>${` `.repeat(r)}${e}`:`> ${e}`})}};function a$(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){n.value.includes(`"`)?t.push(`${e}={${o$(n.value)}}`):t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function o$(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function s$(e){return e.type===`mdxJsxAttribute`&&typeof e.value==`string`&&e.value.includes(`"`)?{type:`mdxJsxAttribute`,name:e.name,value:{type:`mdxJsxAttributeValueExpression`,value:o$(e.value)}}:e}function c$(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function l$(e){if(!e)return``;let t=0,n=!0;for(let r of e)r===`(`?t++:r===`)`&&(t--,t<0&&(n=!1));return t!==0&&(n=!1),n?e:e.replace(/[\\()]/g,`\\$&`)}function u$(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>d$(t)?e:`\\${e}`)}function d$(e){if(e.charCodeAt(0)!==35)return!1;let t=e[1]===`x`||e[1]===`X`?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return t===9||t===10||t===11||t===12||t===13||t===32}function f$(e,t,n){let r=e.unsafe;e.unsafe=r.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`||e.character==="`"||(e.character===`*`||e.character===`_`||e.character===`~`)&&e.inConstruct===`phrasing`||e.character===`=`&&e.atBreak===!0));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return u$(g$(i,n))}function p$(e){if(Number.isNaN(e))return`ws`;let t=cN(e);return t===1?`ws`:t===2?`punct`:`other`}function m$(e,t,n){let r=p$(t),i=p$(n),a=i!==`ws`&&(i===`other`||r!==`other`),o=r!==`ws`&&(r===`other`||i!==`other`);return e===`_`?a&&(!o||r===`punct`)||o&&(!a||i===`punct`):a||o}function h$(e,t,n){let r=t;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r<e.length)return e[r]===`
445
445
  `||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function g$(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&h$(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=m$(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function _$(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=e,a=i.charCodeAt(0);v$(t.before.charCodeAt(t.before.length-1),a,r)&&(i=y$(a)+i.slice(1));let o=i.charCodeAt(i.length-1);return v$(t.after.charCodeAt(0),o,r)&&(i=i.slice(0,-1)+y$(o)),i}function v$(e,t,n){return!(cN(t)!==1||n===`_`&&cN(e)===void 0)}function y$(e){return`&#x${e.toString(16).toUpperCase()};`}function b$(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!S$(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function x$(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),s+=a.move(i),o(),s}function S$(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}function C$(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var w$=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};constructor(e){this.schema=Ly(e.extensions),this.handlers=P$(this.schema,this.parseCtx);let{nodeHandlers:t,markHandlers:n}=F$(this.schema);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=VQ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=HQ({toMarkdownHandlers:i$})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return JQ(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?YQ(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?$Y(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e){let t;try{t=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}return XQ(t,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}};const T$=VY();function E$(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function D$(e){let t=!1;return e.descendants(e=>t||e.type.name===`jsxInline`?!1:e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function O$(e){return e.attrs.sourceDirty||D$(e)}function k$(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function A$(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function j$(e,t){if(e.length===0)return A$({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return A$({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[j$(n.children,t)]}}return A$({type:`inlineCode`,value:M$(e)},t)}function M$(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=M$(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const N$=CK;function P$(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=ZL(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=ZL(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=e$(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i){let t=n.replaceAll(`\xA0`,` `);return r.sourceLiteral?e.text(t,[r.sourceLiteral.create({sourceRaw:i})]):e.text(t)}let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n.replaceAll(`\xA0`,` `));let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&Iq(t.raw)!==null&&Nq(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset).replaceAll(`\xA0`,` `);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length).replaceAll(`\xA0`,` `);if(i)if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=Iq(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i));u=t.offset+t.length}}if(u<n.length){let t=n.slice(u).replaceAll(`\xA0`,` `);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=QL(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=QL(r.highlight)),r.comment&&(i.comment=QL(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=ZL(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=QL(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=QL(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=ZL(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`})),n.list&&(i.list=ZL(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=ZL(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:``,title:null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=T$.getOrWildcard(o),c=E$(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=e$(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=Zq(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&N$.has(l)&&n.jsxComponent&&T$.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&wK.has(l)&&n.jsxComponent&&T$.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&EK.has(l)&&n.jsxComponent&&T$.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&DK.has(l)&&n.jsxComponent&&T$.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:C$(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=ZL(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function F$(e){let t={},n={},r=e.nodes,i=e.marks;r.paragraph&&(t.paragraph=rR(`paragraph`)),r.blockquote&&(t.blockquote=rR(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),r.heading&&(t.heading=rR(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),r.codeBlock&&(t.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),r.thematicBreak&&(t.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),r.hardBreak&&(t.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle}})),r.list&&(t.list=rR(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),r.listItem&&(t.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&k$(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),r.table&&(t.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),r.tableRow&&(t.tableRow=rR(`tableRow`));let a=e=>{let t=e.attrs.sourcePadding,n={};return typeof t==`object`&&t&&typeof t.left==`number`&&typeof t.right==`number`&&(n.sourcePadding=t),Object.keys(n).length>0?{data:n}:{}};if(r.tableCell&&(t.tableCell=rR(`tableCell`,a)),r.tableHeader&&(t.tableHeader=rR(`tableCell`,a)),r.image&&(t.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),r.imageReference&&(t.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),r.htmlBlock&&(t.htmlBlock=e=>({type:`html`,value:e.attrs.content})),r.linkDefinition??r.linkRefDef){let e=r.linkDefinition?`linkDefinition`:`linkRefDef`;t[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(r.jsxComponent&&(t.jsxComponent=(e,t,n)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let r=e.attrs.componentName||null,i=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!O$(e)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:r,attributes:i,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:T$.getOrWildcard(r??`*`).serialize(e,{all:e=>n.all(e),registry:T$,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),r.rawMdxFallback&&(t.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),r.jsxInline&&(t.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),r.mathInline&&(t.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),r.wikiLink&&(t.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),r.tag&&(t.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),r.wikiLinkEmbed&&(t.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),i.emphasis&&(n.emphasis=iR(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.strong&&(n.strong=iR(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.code&&(n.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return j$(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0?!0:void 0})}),i.strike??i.delete){let e=i.strike?`strike`:`delete`;n[e]=iR(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return i.highlight&&(n.highlight=iR(`mark`)),i.comment&&(n.comment=iR(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),r.commentBlock&&(t.commentBlock=rR(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),r.footnoteReference&&(t.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),r.footnoteDefinition&&(t.footnoteDefinition=rR(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),i.link&&(n.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=i||(r?`${t}#${r}`:t),o=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return o!==a&&o.trim().length>0&&!o.includes(`]]`)&&(i=o,a=o),{type:`wikiLinkEmbed`,value:a,data:{target:t,anchor:r,alias:i},children:[{type:`text`,value:a}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),i.escapeMark&&(n.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),i.sourceLiteral&&(n.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return Rq(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:t,markHandlers:n}}const I$=/\p{M}+/gu,L$=/[^\p{L}\p{N}]+/gu,R$=/^-+|-+$/g;function z$(e){return e.trim().normalize(`NFKD`).replace(I$,``).toLowerCase().replace(L$,`-`).replace(R$,``)}function B$(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function V$(e,t){let n=z$(e);return n?B$(n,t):``}const H$=new Set([`img`,`video`,`audio`,`mark`]);new Map(zY.flatMap(e=>e.surface===`compat`&&H$.has(e.rendersAs)?[[e.name,e]]:[])),uF(`<>`);const U$=qB(),W$=dB(),G$=fB();function K$(){return zY.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function q$(){return K$().filter(e=>J$(e)!==`fence`)}function J$(e){return e.name===`MermaidFence`?`fence`:e.hasChildren?`jsx-block`:`jsx-void`}function Y$(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:J$(e)}}function X$(e){if(e.hidden!==!0&&e.type!==`reactnode`){if(`defaultValue`in e&&e.defaultValue!==void 0)return e.defaultValue;if(e.type===`enum`)return e.enumValues[0];if(e.type===`string`)return``;if(e.type===`number`)return 0;if(e.type===`boolean`)return!1}}function Z$(e,t){return!(e.omitOnDefault===!0&&`defaultValue`in e&&Object.is(e.defaultValue,t)||e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&t===``)}function Q$(e){let t=[];for(let n of e.props){let e=X$(n);e!==void 0&&Z$(n,e)&&t.push(QJ(n.name,e))}return t}function $$(e){return yz(e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`Body content here.`,{extensions:[U$],mdastExtensions:[W$]}).children}function e1(e){let t=J$(e),n;if(t===`fence`)n={type:`code`,lang:`mermaid`,meta:null,value:e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`graph LR
446
446
  A --> B`};else{let r=Q$(e),i=t===`jsx-block`?$$(e):[];n={type:`mdxJsxFlowElement`,name:e.name,attributes:r,children:i}}return dP({type:`root`,children:[n]},{extensions:[G$]}).trimEnd()}function t1(e){let t=[];for(let n of e.props){if(n.hidden===!0)continue;let e={name:n.name,type:n.type,required:n.required};n.description!==void 0&&(e.description=n.description),n.advanced===!0&&(e.advanced=!0),n.omitOnDefault===!0&&(e.omitOnDefault=!0),n.type===`enum`&&(e.values=n.enumValues,n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue)),n.type===`string`&&(n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.language!==void 0&&(e.language=n.language),n.accept!==void 0&&(e.accept=n.accept)),n.type===`boolean`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.type===`number`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),t.push(e)}return t}function n1(e){return{...Y$(e),example:e1(e),params:t1(e)}}function r1(){return[``,"**Custom canonical components.** OK `.md` / `.mdx` supports the JSX components below — use whichever is semantically useful in any part of the doc. For full source syntax + parameter schemas, call `palette({ components: [ids] })` with the ids you want to use. Fenced code blocks render naturally and don't need a fetch — including ` ```mermaid ` for diagrams (mermaid label text has sharp edges — `palette({ components: [\"Mermaid\"] })` lists them; parse failures come back as `warnings` entries on write/edit) and ` ```html preview ` for interactive HTML/JS/CSS pages (the fence info-string `preview` token renders the block as a live iframe; works for `html` / `htm` / `xml`; optional `h=` / `w=` tokens set size, e.g. ` ```html preview h=400px `). Use ` ```html preview ` whenever you want anything interactive or JS-powered (charts, demos, calculators, animations) — just author the standalone HTML page in the fence. Call `palette` for the markdown-native component forms (write `> [!NOTE]`, not `<Callout>`), copy-ready themed `html preview` starters, and the theme tokens (`var(--chart-1)`, `var(--foreground)`, …) an embed should reference so it tracks the reader's light/dark theme. Arbitrary `<TagName>` JSX falls through as raw MDX when no canonical fits.",``,...q$().map(Y$).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
447
- `)}const i1=N({docName:lJ,summary:dJ,content:k().optional(),...uJ}).loose(),a1=N({docName:lJ,summary:dJ,markdown:k(),position:P([`append`,`prepend`,`replace`]).optional(),extension:P(iK).optional(),...uJ}).loose(),o1=N({docName:lJ,summary:dJ,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...uJ}).loose(),s1=N({docName:lJ,connectionId:k().min(1),scope:P([`last`,`session`,`file`]).optional(),...uJ}).loose(),c1=N({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),l1=$s(`kind`,[N({kind:F(`inline`),content:k()}),N({kind:F(`truncated`),byteLength:A().int().nonnegative(),hint:k()})]),u1=N({kind:F(`content-divergence`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),divergenceType:k().optional(),currentState:l1.optional(),hint:k().optional()}).loose(),d1=N({type:F(`orphan`),parentCandidates:M(k()),message:k()}).loose(),f1=N({kind:F(`disk-edit-reconciled`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),mergeOutcome:k().optional(),hint:k().optional()}).loose(),p1=$s(`kind`,[u1,f1]),m1=$s(`kind`,[u1,f1,N({kind:F(`mermaid-parse-error`),fenceIndex:A().int().positive(),fenceFirstLine:k(),message:k(),line:A().int().positive().optional()}).loose()]),h1=M(m1).min(1),g1=N({timestamp:k().min(1),summary:c1.optional(),warning:p1.optional(),warnings:h1.optional()}).loose(),_1=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:M(d1).optional(),summary:c1.optional(),warning:p1.optional(),warnings:h1.optional()}).loose(),v1=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:c1.optional(),warning:p1.optional(),warnings:h1.optional()}).loose(),y1=N({docName:k().min(1),scope:P([`last`,`session`]),undone:j()}).loose(),b1=N({docName:lJ,patch:rc(k(),Zs([zW,Bs()])),types:rc(k(),P(IW)).optional(),summary:dJ,...uJ}).loose(),x1=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:M(k()),summary:c1.optional(),warning:p1.optional(),warnings:h1.optional()}).loose(),S1=N({entries:M(N({level:P([`info`,`warn`,`error`]),message:k().max(8192),event:k().optional(),fields:rc(k(),Ws()).optional(),ts:A().optional(),sourceId:k().optional(),lineNumber:A().optional()}).loose()).max(100)}).loose(),C1=N({accepted:A().int().min(0)}).loose(),w1=N({status:k().min(1),reason:k()}).loose(),T1=N({docName:k().min(1),content:k(),lifecycle:w1.nullable()}).loose(),E1=N({documents:M(N({kind:P([`document`,`asset`,`folder`,`file`]).default(`document`),docName:k().min(1).optional(),docExt:k().min(1).default(`.md`),size:A().int().nonnegative(),modified:k().min(1),isSymlink:j().default(!1),canonicalDocName:k().nullable().default(null),targetPath:k().nullable().default(null),path:k().min(1).optional(),assetExt:k().min(1).optional(),mediaKind:P([`image`,`video`,`audio`,`pdf`,`text`]).nullable().optional(),referencedBy:M(k().min(1)).optional(),hasChildren:j().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:j().optional()}).loose(),D1=N({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),O1=N({docName:k().min(1),backlinks:M(D1)}).loose(),k1=N({counts:rc(k().min(1),A().int().nonnegative())}).loose(),A1=$s(`kind`,[N({kind:F(`doc`),docName:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),N({kind:F(`external`),url:k().min(1),title:k(),snippet:k().nullable()}).loose()]),j1=N({docName:k().min(1),forwardLinks:M(A1)}).loose(),M1=$s(`kind`,[N({id:k().min(1),kind:F(`doc`),docName:k().min(1),anchor:k().nullable(),label:k(),cluster:k().nullable(),category:k().nullable(),tags:M(k()).nullable()}).loose(),N({id:k().min(1),kind:F(`external`),url:k().min(1),label:k()}).loose()]),N1=N({source:k().min(1),target:k().min(1)}).loose(),P1=N({nodes:M(M1),links:M(N1)}).loose(),F1=N({ts:A().int().min(0),url:k(),method:k(),ua:k().optional(),origin:k().optional(),referer:k().optional(),host:k().optional(),remote:k().optional(),secChUa:k().optional(),secChUaMobile:k().optional(),secChUaPlatform:k().optional(),secFetchSite:k().optional(),secFetchDest:k().optional(),secFetchMode:k().optional(),secFetchUser:k().optional()}).loose(),I1=N({app:Zs([F(`cursor`),F(`codex`),F(`claude`),Bs()]),signals_fired:M(k())}).loose(),L1=N({entries:M(F1),count:A().int().min(0),detection:I1}).loose(),R1=N({writers:M(N({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),summary:dJ,...uJ}).loose(),z1=N({checkpointRef:k().min(1)}).loose(),B1=N({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:M(k()),summaries:M(k()).optional()}).loose(),V1=N({entries:M(N({sha:k().min(1),timestamp:k().min(1),author:k(),authorEmail:k(),type:P([`checkpoint`,`wip`,`upstream`,`park`]),message:k(),contributors:M(B1),checkpoint:Ws().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:j().optional(),hasMore:j().optional()}).loose(),H1=N({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose(),U1=N({contentDir:k().min(1),pathSeparator:P([`/`,`\\`]),symlinkResolved:j()}).loose(),W1=M($s(`source`,[N({docName:k().min(1),timestamp:k().min(1),size:A().int().nonnegative(),source:F(`flat`)}).loose(),N({docName:k().min(1),timestamp:k().min(1),source:F(`timeline`),sha:k().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),G1=N({orphans:M(N({docName:k().min(1),title:k()}).loose())}).loose(),K1=N({hubs:M(N({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),q1=N({source:k().min(1),title:k(),snippet:k().nullable()}).loose(),J1=N({deadLinks:M(N({target:k().min(1),sources:M(q1)}).loose())}).loose(),Y1=N({target:N({docName:k().min(1),title:k(),aliases:M(k())}).loose(),mentions:M(N({source:k().min(1),excerpt:k(),offset:A().int().nonnegative()}).loose()),truncated:j()}).loose(),X1=N({projectPath:k().min(1)}).loose(),Z1=P([`not-a-git-worktree`,`init-failed`]),Q1=$s(`ok`,[N({ok:F(!0),projectPath:k().min(1)}).loose(),N({ok:F(!1),reason:Z1,message:k().min(1)}).loose()]),$1=N({host:k().min(1).optional()}).loose(),e0=N({key:k().min(1)}).loose(),t0=N({keyPresent:j()}).loose(),n0=N({name:k().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:k().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),r0=N({authenticated:j()}).loose(),i0=N({}).loose(),a0=N({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),o0=N({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:M(a0)}).loose(),s0=N({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),c0=N({sessionAlive:j(),agent:s0.nullable(),files:M(o0)}).loose(),l0=N({diff:k(),generatedAt:A().int().min(0)}).loose(),u0=N({}).loose(),d0=N({}).loose(),f0=N({}).loose(),p0=N({}).loose(),m0=N({}).loose(),h0=N({}).loose(),g0=N({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:P([`idle`,`writing`]),ts:A().int().min(0)}).loose(),_0=N({presence:rc(k().min(1),g0)}).loose(),v0=rc(k().min(1),j()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});N({path:k().min(1,`path must be non-empty`)}).loose();const y0=N({}).loose(),b0=N({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),x0=N({fromPath:k().min(1),toPath:k().min(1)}).loose(),S0=N({}).loose(),C0=N({path:k().min(1),...uJ,summary:dJ}).loose(),w0=N({docName:k().min(1)}).loose(),T0=N({path:k().min(1),...uJ,summary:dJ}).loose(),E0=N({path:k().min(1)}).loose(),D0=N({kind:P([`file`,`folder`]),path:k().min(1),...uJ,summary:dJ}).loose(),O0=N({kind:P([`file`,`folder`]),path:k().min(1),duplicatedDocNames:M(k().min(1))}).loose(),k0=N({pages:M(N({docName:k().min(1),title:k(),docExt:k().min(1),size:A().int().nonnegative(),modified:k().min(1),icon:k().min(1).max(2048).optional()}).loose())}).loose(),A0=N({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),j0=N({docName:k().min(1),headings:M(A0)}).loose(),M0=N({docName:k().min(1),rewrites:A().int().nonnegative()}).loose(),N0=N({kind:P([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...uJ,summary:dJ}).loose(),P0=N({renamed:M(b0),renamedAssets:M(x0),rewrittenDocs:M(M0).optional(),summary:c1.optional()}).loose(),F0=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...uJ}).loose(),I0=N({deletedDocNames:M(k().min(1))}).loose(),L0=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...uJ,summary:dJ}).loose(),R0=N({deletedDocNames:M(k().min(1))}).loose(),z0=N({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:dJ,...uJ}).loose(),B0=N({restoredFrom:k().min(1),timestamp:k().min(1),summary:c1.optional(),warning:u1.optional(),warnings:h1.optional()}).loose(),V0=P([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),H0=N({label:k().min(1),webUrl:ys().nullable()}).loose(),U0=$s(`checkStatus`,[N({checkStatus:F(`allowed`)}).loose(),N({checkStatus:F(`denied`),deniedReason:P([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),N({checkStatus:F(`unknown`),unknownError:P([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),W0=P([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),G0=N({state:V0,lastSyncUtc:k().nullable(),lastFetchUtc:k().nullable(),lastPushedSha:k().nullable(),ahead:A().int().min(0),behind:A().int().min(0),consecutiveFailures:A().int().min(0),conflictCount:A().int().min(0),hasRemote:j(),syncEnabled:j(),identityUnresolved:j(),remote:H0.nullable().optional(),pushError:k().optional(),pushErrorCode:W0.optional(),pullError:k().optional(),pullErrorCode:W0.optional(),pausedReason:k().optional(),pushPermission:U0.optional()}).loose(),K0=N({op:P([`sync`,`push`,`pull`]).optional()}).loose(),q0=N({op:P([`sync`,`push`,`pull`])}).loose(),J0=N({conflicts:M(N({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose())}).loose(),Y0=N({file:k().min(1),strategy:P([`mine`,`theirs`,`content`,`delete`]),content:k().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),X0=N({}).loose(),Z0=N({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:P([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),Q0=N({plan:kc(e=>e!==void 0,{message:`plan is required`})}).loose(),$0=N({plan:kc(e=>e!==void 0,{message:`plan is required`})}).loose(),e2=N({result:kc(e=>e!==void 0,{message:`result is required`})}).loose(),t2=N({path:k().min(1),summary:k().min(1)}).loose(),n2=N({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose(),r2=N({packs:M(N({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:M(t2),entryCounts:n2}).loose())}).loose(),i2=N({noOpen:j().optional(),out:k().min(1).optional()}).loose(),a2=N({reason:P([`unsupported-platform`,`spawn-error`]),message:k()}).loose(),o2=$s(`status`,[N({status:F(`installed`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k()}).loose(),N({status:F(`built`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k(),handoffError:a2.optional()}).loose(),N({status:F(`failed`),buildError:k()}).loose(),N({status:F(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]),s2=N({tags:M(N({name:k().min(1),count:A().int().nonnegative(),isLeaf:j()}).loose())}).loose(),c2=N({docName:k().min(1),title:k(),matchingTags:M(k().min(1)),snippet:k().nullable()}).loose(),l2=N({name:k().min(1),docs:M(c2)}).loose(),u2=N({folder:Ws(),frontmatter_local:rc(k(),Ws()).nullable()}).loose(),d2=N({path:k(),frontmatter:rc(k(),Ws()).optional()}).loose(),f2=N({applied:Ws()}).loose(),p2=rc(k(),Ws()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),m2=N({template:N({name:k().min(1),folder:k(),scope:P([`local`,`inherited`]),path:k().min(1),frontmatter:p2,body:k()}).strict()}).strict(),h2=N({templates:M(N({name:k().min(1),title:k().optional(),description:k().optional(),path:k().min(1),source_folder:k()}).strict()),truncated:j()}).strict(),g2=N({folder:k(),name:k(),body:k().optional(),frontmatter:p2.optional(),...uJ,summary:dJ}).strict(),_2=N({path:k().min(1),created:j(),warnings:M(k())}).strict(),v2=N({existed:j(),path:k().min(1)}).strict(),y2=N({fromFolder:k(),fromName:k(),toFolder:k(),toName:k(),body:k().optional(),frontmatter:p2.optional(),...uJ,summary:dJ}).strict(),b2=N({from:k().min(1),to:k().min(1),committed:j()}).strict(),x2=N({query:k().optional(),intent:P([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:P([`navigation`,`relevance`]).optional(),scopes:M(P([`page`,`folder`,`content`,`file`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional(),semantic:j().optional(),source:P([`omnibar`,`mcp`,`http`]).optional()}).loose(),S2=N({kind:P([`page`,`folder`,`content`,`file`]),path:k().min(1),title:k(),score:A(),signals:rc(k(),Ws()),snippet:k().optional()}).loose(),C2=N({capable:j(),applied:j(),coverage:N({embedded:A().int().nonnegative(),total:A().int().nonnegative()})}).loose(),w2=N({enabled:j(),keyPresent:j(),keySource:P([`file`,`env`]).nullable(),keyHint:k().nullable(),ready:j(),capable:j(),embedded:A().int().nonnegative(),total:A().int().nonnegative()}).loose(),T2=N({query:k(),intent:P([`autocomplete`,`full_text`,`omnibar`]),results:M(S2),elapsedMs:A().nonnegative(),semantic:C2.optional(),truncated:j().optional(),ready:j().optional()}).loose(),E2=N({version:k().min(1),recordedAt:k().min(1)}).loose(),D2=N({currentVersion:k().min(1),targets:rc(k(),E2.nullable())}).loose(),O2=`server-info`,k2=`branch-switched`,A2=`disk-ack`,j2=`config-validation-rejected`,M2=`config-ignore-nested-error`,N2=P([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),P2=N({v:F(1),ch:F(O2),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),F2=N({v:F(1),ch:F(k2),seq:A(),branch:k().min(1)}).loose(),I2=N({v:F(1),ch:N2,seq:A()}).loose(),L2=N({v:F(1),ch:F(A2),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),R2=N({v:F(1),ch:F(j2),seq:A(),docName:k().min(1),error:ll}).loose(),z2=N({v:F(1),ch:F(M2),seq:A(),path:k().min(1),error:k().min(1)}).loose(),B2={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},V2=new WeakMap;function H2(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function U2(e){return e.trim().toLowerCase()}const W2=/\.(?:md|mdx)$/;function G2(e,t){if(t!==`page`)return e;let n=e.replace(W2,``);return n.length>0?n:e}function K2(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function q2(e){let t=K2(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function J2(e){let t=LU({schema:B2});return e.length>0&&JU(t,e),t}function Y2(e){let t={documents:e};return V2.set(t,J2(e)),t}function X2(e){let t=V2.get(e);if(t)return t;let n=J2(e.documents);return V2.set(e,n),n}function Z2(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function Q2(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function $2(e,t){let n=U2(t);if(!n)return 0;let r=G2(n,e.kind),i=U2(e.title),a=U2(e.name),o=U2(e.path),s=o.split(`/`);return i===r||a===r?700:o===r?650:i.startsWith(r)||a.startsWith(r)?600:s.some(e=>e.startsWith(r))?550:i.includes(r)||a.includes(r)?500:o.includes(r)?450:-1}function e4(e,t){let n=$2(e,t);return n<=0?n:sJ(e.path)?n*.5:n}function t4(e){return e===`file`?-60:0}function n4(e,t,n,r,i){let a=i>0?t/i:0,o=n/50,s=r===`file`?-.001:0,c=1*a+1*o+s;return e*1e3+c}function r4(e,t,n,r){return e+t*20+n+t4(r)}function i4(e,t,n,r,i,a){return e===`relevance`?r4(t,n,r,i):n4(t,n,r,i,a)}function a4(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function o4(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function s4(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function c4(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function l4(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}function u4(e,t){return U2(t).length<4?0:e===`full_text`?1:0}function d4(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=[],i=0,a=0;for(let t of e){if(t.document.kind===`folder`){if(i>=3)continue;i+=1}else if(t.document.kind===`file`){if(a>=3)continue;a+=1}if(r.push(t),r.length>=n)break}return r}function f4(e,t,n={}){let r=n.intent??`omnibar`,i=a4(r,n.ranking),a=H2(n.limit),o=new Set(n.scopes??Z2(r)),s=e.documents.filter(e=>Q2(e,o)),c=U2(t);if(!c)return s.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,a).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let l=wW(X2(e),{term:c,properties:c4(r),boost:l4(r),tolerance:u4(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>Q2(e.document,o)).map(e=>[e.document.id,e.score])),d=s4(s),f=new Map;for(let e of s)e4(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)Q2(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=o4(f.values(),u);return d4([...f.values()].map(t=>{let n=Math.max(0,e4(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:i4(i,n,r,a,t.kind,e),signals:{lexical:n,fullText:r,recency:a}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score),i,a)}return d4(m4({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function p4(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function m4(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,ranking:o,semantic:s}=e,c=s.rrfK??60,l=s.candidateLimit??64,u=s.similarityFloor??0,d=s.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=o4(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,e4(e,a)),n=r.get(e.id)??0,s=i.get(e.id)??0,c=d.get(e.id),l=c!==void 0&&c>=u;return{document:e,score:t>0?i4(o,t,n,s,e.kind,m):r4(t,n,s,e.kind),signals:l?{lexical:t,fullText:n,recency:s,vector:c}:{lexical:t,fullText:n,recency:s},lexical:t,fullText:n,recency:s,cosine:c}}),g=p4(h.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=p4(h.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),v=e=>{let t=0,n=g.get(e);n!==void 0&&(t+=1/(c+n));let r=_.get(e);return r!==void 0&&(t+=1/(c+r)),t};return h.sort((e,t)=>{let n=e.lexical>0?1:0,r=t.lexical>0?1:0;if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=v(e.document.id),a=v(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n}))}function h4(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),g4(n)}function g4(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const _4=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),v4=globalThis;v4[_4]===void 0&&(v4[_4]=Ii());const y4=v4[_4],b4=[`.ok`,`skill-state.yml`],x4=[`claude-cowork`,`cli-hosts`],S4=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],C4=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,w4=Ys({version:k().regex(C4,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(y4,{description:`Recorded skill version for this target.`}),recordedAt:Uo().register(y4,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:P(S4).register(y4,{description:`Install-source surface that recorded this entry.`}).optional()}),T4=Ys({schema:F(1).register(y4,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Ys({"claude-cowork":w4.optional(),"cli-hosts":w4.optional()}).register(y4,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function E4(){return{schema:1,targets:{}}}const D4=`template`;function O4(e){if(e.trim()===``)return{};let t;try{t=(0,Nc.parse)(e)}catch{return{}}return typeof t!=`object`||!t||Array.isArray(t)?{}:t}function k4(e,t){return e.trim()===``?t:`---\n${e}\n---\n${t}`}function A4(e){let{frontmatter:t,body:n}=UW(e);return t===``?{docFrontmatterText:``,markdown:e}:{docFrontmatterText:GW(t),markdown:n}}function j4(e){let t=e.split(`
448
- `);if(!(t[0]??``).startsWith(`template:`))return null;let n=[t[0]??``],r=1;for(;r<t.length;){let e=t[r]??``;if(/^[ \t]/.test(e)){n.push(e),r++;continue}if(e.trim()===``){let i=r+1;for(;i<t.length&&(t[i]??``).trim()===``;)i++;if(i<t.length&&/^[ \t]/.test(t[i]??``)){n.push(e),r++;continue}}break}let i=O4(n.join(`
449
- `))[D4];return{identity:typeof i==`object`&&i&&!Array.isArray(i)?i:{},docFrontmatterText:t.slice(r).join(`
450
- `).replace(/\n+$/,``)}}function M4(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,{frontmatter:n,body:r}=UW(t);if(n===``)return{identity:{},starterContent:t};let i=GW(n),a=j4(i);if(a)return{identity:a.identity,starterContent:k4(a.docFrontmatterText,r)};let{frontmatter:o}=UW(r);if(o!==``)return{identity:O4(i),starterContent:r};let s=O4(i);return typeof s.title==`string`?{identity:s,starterContent:r}:{identity:{},starterContent:k4(i,r)}}function N4(e,t){let{docFrontmatterText:n,markdown:r}=A4(t),i={};for(let[t,n]of Object.entries(e))n!==void 0&&(i[t]=n);let a=(0,Nc.stringify)({[D4]:i});return`---\n${n.trim()===``?a:`${a}${n}\n`}---\n${r}`}function P4(e){return M4(e).starterContent}function F4(){let e=!1,t=``,n=0;return r=>{let i=I4(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function I4(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}const L4=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],R4={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function z4(e,t=L4){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const B4={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function V4(e){return e?B4[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const H4={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function U4(e){let t=e?.trim();return t?H4[V4(t)]??t:`Agent`}function W4(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}const G4=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function K4(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function q4(e){let t=e.trim();return G4.test(t)||t.startsWith(`//`)}function J4(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(q4(n))return{kind:`external`,url:n};let r=W4(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=K4(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function Y4(e,t){let n=e.trim();if(!n)return null;if(q4(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=K4(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function X4(e,t){let n=e.trim();if(!n||G4.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function Z4(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function Q4(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function $4(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function e3(e){return e.split(`/`).filter(e=>e!==``)}function t3(e,t){let n=$4(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function n3(e,t){let n=$4(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:e3(r).length}function r3(e,t){let n=e3(e),r=e3(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function i3(){let e=new Map;function t(t){let n=Z4(t);if(n===``)return;let r=Q4(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=Z4(t),r=Q4(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=$4(Z4(n)),o=[],s=[];for(let e of i)t3(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=n3(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=n3(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=r3(a,$4(t));for(let r=1;r<e.length;r++){let i=e[r],o=r3(a,$4(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function a3(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function o3(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function s3(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function c3(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function l3(){try{let e=_(g(b(import.meta.url)),`..`,`package.json`),t=JSON.parse(d(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}const u3=l3(),d3=1;var f3=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`Open Knowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function p3(e,t){return _(e,`${t}.lock`)}const m3=new Map;function h3(e){m3.set(e,(m3.get(e)??0)+1)}function g3(e){let t=m3.get(e);return t===void 0||t<=1?(m3.delete(e),!0):(m3.set(e,t-1),!1)}function _3(e,t){try{let n=JSON.parse(d(e,`utf-8`));return n&&typeof n==`object`&&c3(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function v3(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;l(n,{recursive:!0});let a=p3(n,t),o={pid:process.pid,hostname:y(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??u3},d=JSON.stringify(o,null,2);for(let e=0;e<3;e++){if(!c(a))try{let e=u(a,`wx`,384);try{m(e,d)}finally{s(e)}return h3(a),y3({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=_3(a,i);if(e){let r=e.hostname===y();if(r&&e.pid===process.pid)return p(a,d,{encoding:`utf-8`,mode:384}),h3(a),y3({lockName:t,lockDir:n,lockPath:a});if(r&&s3(e.pid))throw new f3(e,a,t);console.warn(`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{f(a)}catch{}}throw Error(`${i} Failed to acquire ${a} after 3 attempts (concurrent acquire contention).`)}function y3(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>C3({lockName:t,lockDir:n}),updatePort:e=>b3({lockName:t,lockDir:n,port:e})}}function b3(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=p3(n,t);if(!c(a)){console.warn(`${i} Lock file missing at ${a} during port update — skipping`);return}let o;try{let e=JSON.parse(d(a,`utf-8`));if(!e||typeof e!=`object`||!c3(e.pid)){console.warn(`${i} Corrupt lock at ${a} during port update — skipping`);return}o=e}catch{console.warn(`${i} Unreadable lock at ${a} during port update — skipping`);return}if(o.pid===process.pid&&!(typeof o.hostname==`string`&&o.hostname!==y())){o.port=r;try{p(a,JSON.stringify(o,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function x3(e){let{lockName:t,lockDir:n}=e,r=p3(n,t);if(!c(r))return null;let i;try{let e=JSON.parse(d(r,`utf-8`));if(!e||typeof e!=`object`||!c3(e.pid))return null;i=e}catch{return null}if(i.hostname!==y())return null;if(!s3(i.pid)){try{f(r)}catch{}return null}return i}function S3(e){let{lockName:t,lockDir:n}=e,r=p3(n,t);if(!c(r))return{status:`absent`};let i;try{i=JSON.parse(d(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!c3(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(o.hostname!==y())return{status:`stale`,lock:o};if(!s3(o.pid)){try{f(r)}catch{}return{status:`stale`,lock:o}}return o.protocolVersion===void 0||o.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:o}}function C3(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=p3(n,t);if(g3(i)&&c(i))try{let e=JSON.parse(d(i,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||typeof e.hostname==`string`&&e.hostname!==y())return;f(i)}catch(e){console.warn(`${r} Failed to release ${i}: ${e instanceof Error?e.message:String(e)}`)}}var w3=class extends f3{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function T3(e,t){try{return v3({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof f3&&e.lockName===`server`?new w3(e.existing,e.lockPath):e}}function E3(e,t){b3({lockName:`server`,lockDir:e,port:t})}function D3(e){return x3({lockName:`server`,lockDir:e})}function O3(e){C3({lockName:`server`,lockDir:e})}export{eK as $,P as $i,s2 as $n,fK as $r,h0 as $t,g1 as A,Lt as Aa,I as Ai,Q0 as An,Y2 as Ar,x1 as At,I2 as B,yl as Bi,T4 as Bn,rJ as Br,qK as Bt,o1 as C,ai as Ca,cG as Ci,R1 as Cn,Y4 as Cr,L1 as Ct,a1 as D,fn as Da,ZW as Di,$0 as Dn,i3 as Dr,f2 as Dt,y1 as E,un as Ea,oJ as Ei,T2 as En,N4 as Er,d2 as Et,lG as F,ft as Fa,Vc as Fi,bJ as Fn,U4 as Fr,MK as Ft,j2 as G,ul as Gi,J0 as Gn,qY as Gr,r0 as Gt,P2 as H,tl as Hi,YJ as Hn,C$ as Hr,i0 as Ht,vG as I,Bc as Ii,yJ as In,KG as Ir,i2 as It,ZG as J,$c as Ji,G0 as Jn,P4 as Jr,e0 as Jt,A2 as K,_l as Ki,Y0 as Kn,Yq as Kr,JJ as Kt,F2 as L,zc as Li,SJ as Ln,E4 as Lr,o2 as Lt,k1 as M,O as Ma,Wc as Mi,BJ as Mn,BG as Mr,V1 as Mt,O1 as N,D as Na,Hc as Ni,pJ as Nn,zG as Nr,H1 as Nt,_1 as O,mn as Oa,Ly as Oi,e2 as On,F4 as Or,j1 as Ot,IJ as P,pt as Pa,Uc as Pi,hJ as Pn,QW as Pr,K1 as Pt,QG as Q,cc as Qi,l2 as Qn,PJ as Qr,_0 as Qt,z2 as R,Tl as Ri,wJ as Rn,h4 as Rr,v0 as Rt,l0 as S,Ga as Sa,o3 as Si,XG as Sn,J4 as Sr,OK as St,s1 as T,cn as Ta,GW as Ti,x2 as Tn,z4 as Tr,u2 as Tt,k2 as U,Sl as Ui,Y1 as Un,q$ as Ur,$1 as Ut,L2 as V,Jc as Vi,y0 as Vn,sG as Vr,P1 as Vt,M2 as W,pl as Wi,Z0 as Wn,V$ as Wr,n0 as Wt,nK as X,qc as Xi,q0 as Xn,VW as Xr,Q1 as Xt,JG as Y,Kc as Yi,K0 as Yn,DJ as Yr,X1 as Yt,tK as Z,Fs as Zi,D4 as Zn,sJ as Zr,w$ as Zt,R4 as _,ys as _a,GG as _i,b4 as _n,NW as _r,E1 as _t,v3 as a,$s as aa,M4 as ai,qG as an,_2 as ar,T0 as at,m1 as b,fa as ba,dG as bi,mK as bn,WJ as br,O0 as bt,c3 as c,Ys as ca,n1 as ci,VJ as cn,d0 as cr,w0 as ct,S3 as d,lc as da,fG as di,P0 as dn,L0 as dr,vK as dt,Bs as ea,TJ as ei,m0 as en,v2 as er,$G as et,D3 as f,Mc as fa,r1 as fi,W1 as fn,R0 as fr,pK as ft,E3 as g,Ws as ga,JW as gi,AK as gn,U1 as gr,I0 as gt,b3 as h,Zs as ha,f4 as hi,jK as hn,KJ as hr,F0 as ht,w3 as i,kc as ia,qW as ii,_K as in,g2 as ir,C1 as it,HJ as j,Tt as ja,Cl as ji,w2 as jn,q2 as jr,zW as jt,i1 as k,on as ka,Df as ki,r2 as kn,tQ as kr,b1 as kt,p3 as l,A as la,pG as li,GJ as ln,f0 as lr,NK as lt,O3 as m,k as ma,W4 as mi,B0 as mn,qJ as mr,J1 as mt,u3 as n,M as na,hG as ni,G1 as nn,y2 as nr,zJ as nt,T3 as o,tc as oa,WW as oi,j0 as on,h2 as or,E0 as ot,C3 as p,rc as pa,X4 as pi,z0 as pn,lK as pr,oK as pt,O2 as q,nl as qi,X0 as qn,V4 as qr,t0 as qt,d3 as r,j as ra,RG as ri,hK as rn,b2 as rr,S1 as rt,s3 as s,F as sa,gK as si,k0 as sn,p0 as sr,C0 as st,f3 as t,Hs as ta,JK as ti,dK as tn,m2 as tr,LJ as tt,x3 as u,N as ua,tG as ui,N0 as un,u0 as ur,uK as ut,sK as v,Uo as va,$q as vi,x4 as vn,MW as vr,T1 as vt,v1 as w,vr as wa,z$ as wi,z1 as wn,YG as wr,S0 as wt,c0 as x,Wa as xa,UW as xi,iK as xn,NJ as xr,cK as xt,kK as y,Vo as ya,aJ as yi,C4 as yn,oG as yr,D0 as yt,R2 as z,wl as zi,D2 as zn,a3 as zr,aK as zt};
451
- //# sourceMappingURL=server-lock-BpjJj3OD-DWhr5fHw.mjs.map
447
+ `)}const i1=N({docName:lJ,summary:dJ,content:k().optional(),...uJ}).loose(),a1=N({docName:lJ,summary:dJ,markdown:k(),position:P([`append`,`prepend`,`replace`]).optional(),extension:P(iK).optional(),...uJ}).loose(),o1=N({docName:lJ,summary:dJ,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...uJ}).loose(),s1=N({docName:lJ,connectionId:k().min(1),scope:P([`last`,`session`,`file`]).optional(),...uJ}).loose(),c1=N({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),l1=$s(`kind`,[N({kind:F(`inline`),content:k()}),N({kind:F(`truncated`),byteLength:A().int().nonnegative(),hint:k()})]),u1=N({kind:F(`content-divergence`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),divergenceType:k().optional(),currentState:l1.optional(),hint:k().optional()}).loose(),d1=N({type:F(`orphan`),parentCandidates:M(k()),message:k()}).loose(),f1=N({kind:F(`disk-edit-reconciled`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),mergeOutcome:k().optional(),hint:k().optional()}).loose(),p1=$s(`kind`,[u1,f1]),m1=$s(`kind`,[u1,f1,N({kind:F(`mermaid-parse-error`),fenceIndex:A().int().positive(),fenceFirstLine:k(),message:k(),line:A().int().positive().optional()}).loose()]),h1=M(m1).min(1),g1=N({timestamp:k().min(1),summary:c1.optional(),warning:p1.optional(),warnings:h1.optional()}).loose(),_1=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:M(d1).optional(),summary:c1.optional(),warning:p1.optional(),warnings:h1.optional()}).loose(),v1=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:c1.optional(),warning:p1.optional(),warnings:h1.optional()}).loose(),y1=N({docName:k().min(1),scope:P([`last`,`session`]),undone:j()}).loose(),b1=N({docName:lJ,patch:rc(k(),Zs([zW,Bs()])),types:rc(k(),P(IW)).optional(),summary:dJ,...uJ}).loose(),x1=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:M(k()),summary:c1.optional(),warning:p1.optional(),warnings:h1.optional()}).loose(),S1=N({entries:M(N({level:P([`info`,`warn`,`error`]),message:k().max(8192),event:k().optional(),fields:rc(k(),Ws()).optional(),ts:A().optional(),sourceId:k().optional(),lineNumber:A().optional()}).loose()).max(100)}).loose(),C1=N({accepted:A().int().min(0)}).loose(),w1=N({status:k().min(1),reason:k()}).loose(),T1=N({docName:k().min(1),content:k(),lifecycle:w1.nullable()}).loose(),E1=N({documents:M(N({kind:P([`document`,`asset`,`folder`,`file`]).default(`document`),docName:k().min(1).optional(),docExt:k().min(1).default(`.md`),size:A().int().nonnegative(),modified:k().min(1),isSymlink:j().default(!1),canonicalDocName:k().nullable().default(null),targetPath:k().nullable().default(null),path:k().min(1).optional(),assetExt:k().min(1).optional(),mediaKind:P([`image`,`video`,`audio`,`pdf`,`text`]).nullable().optional(),referencedBy:M(k().min(1)).optional(),hasChildren:j().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:j().optional()}).loose(),D1=N({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),O1=N({docName:k().min(1),backlinks:M(D1)}).loose(),k1=N({counts:rc(k().min(1),A().int().nonnegative())}).loose(),A1=$s(`kind`,[N({kind:F(`doc`),docName:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),N({kind:F(`external`),url:k().min(1),title:k(),snippet:k().nullable()}).loose()]),j1=N({docName:k().min(1),forwardLinks:M(A1)}).loose(),M1=$s(`kind`,[N({id:k().min(1),kind:F(`doc`),docName:k().min(1),anchor:k().nullable(),label:k(),cluster:k().nullable(),category:k().nullable(),tags:M(k()).nullable()}).loose(),N({id:k().min(1),kind:F(`external`),url:k().min(1),label:k()}).loose()]),N1=N({source:k().min(1),target:k().min(1)}).loose(),P1=N({nodes:M(M1),links:M(N1)}).loose(),F1=N({ts:A().int().min(0),url:k(),method:k(),ua:k().optional(),origin:k().optional(),referer:k().optional(),host:k().optional(),remote:k().optional(),secChUa:k().optional(),secChUaMobile:k().optional(),secChUaPlatform:k().optional(),secFetchSite:k().optional(),secFetchDest:k().optional(),secFetchMode:k().optional(),secFetchUser:k().optional()}).loose(),I1=N({app:Zs([F(`cursor`),F(`codex`),F(`claude`),Bs()]),signals_fired:M(k())}).loose(),L1=N({entries:M(F1),count:A().int().min(0),detection:I1}).loose(),R1=N({writers:M(N({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),summary:dJ,...uJ}).loose(),z1=N({checkpointRef:k().min(1)}).loose(),B1=N({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:M(k()),summaries:M(k()).optional()}).loose(),V1=N({entries:M(N({sha:k().min(1),timestamp:k().min(1),author:k(),authorEmail:k(),type:P([`checkpoint`,`wip`,`upstream`,`park`]),message:k(),contributors:M(B1),checkpoint:Ws().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:j().optional(),hasMore:j().optional()}).loose(),H1=N({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose(),U1=N({contentDir:k().min(1),pathSeparator:P([`/`,`\\`]),symlinkResolved:j()}).loose(),W1=M($s(`source`,[N({docName:k().min(1),timestamp:k().min(1),size:A().int().nonnegative(),source:F(`flat`)}).loose(),N({docName:k().min(1),timestamp:k().min(1),source:F(`timeline`),sha:k().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),G1=N({orphans:M(N({docName:k().min(1),title:k()}).loose())}).loose(),K1=N({hubs:M(N({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),q1=N({source:k().min(1),title:k(),snippet:k().nullable()}).loose(),J1=N({deadLinks:M(N({target:k().min(1),sources:M(q1)}).loose())}).loose(),Y1=N({target:N({docName:k().min(1),title:k(),aliases:M(k())}).loose(),mentions:M(N({source:k().min(1),excerpt:k(),offset:A().int().nonnegative()}).loose()),truncated:j()}).loose(),X1=N({projectPath:k().min(1)}).loose(),Z1=P([`not-a-git-worktree`,`init-failed`]),Q1=$s(`ok`,[N({ok:F(!0),projectPath:k().min(1)}).loose(),N({ok:F(!1),reason:Z1,message:k().min(1)}).loose()]),$1=N({host:k().min(1).optional()}).loose(),e0=N({key:k().min(1)}).loose(),t0=N({keyPresent:j()}).loose(),n0=N({name:k().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:k().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),r0=N({authenticated:j()}).loose(),i0=N({}).loose(),a0=N({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),o0=N({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:M(a0)}).loose(),s0=N({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),c0=N({sessionAlive:j(),agent:s0.nullable(),files:M(o0)}).loose(),l0=N({diff:k(),generatedAt:A().int().min(0)}).loose(),u0=N({}).loose(),d0=N({}).loose(),f0=N({}).loose(),p0=N({}).loose(),m0=N({}).loose(),h0=N({}).loose(),g0=N({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:P([`idle`,`writing`]),ts:A().int().min(0)}).loose(),_0=N({presence:rc(k().min(1),g0)}).loose(),v0=rc(k().min(1),j()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});N({path:k().min(1,`path must be non-empty`)}).loose();const y0=N({}).loose(),b0=N({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),x0=N({fromPath:k().min(1),toPath:k().min(1)}).loose(),S0=N({}).loose(),C0=N({path:k().min(1),...uJ,summary:dJ}).loose(),w0=N({docName:k().min(1)}).loose(),T0=N({path:k().min(1),...uJ,summary:dJ}).loose(),E0=N({path:k().min(1)}).loose(),D0=N({kind:P([`file`,`folder`]),path:k().min(1),...uJ,summary:dJ}).loose(),O0=N({kind:P([`file`,`folder`]),path:k().min(1),duplicatedDocNames:M(k().min(1))}).loose(),k0=N({pages:M(N({docName:k().min(1),title:k(),docExt:k().min(1),size:A().int().nonnegative(),modified:k().min(1),icon:k().min(1).max(2048).optional()}).loose())}).loose(),A0=N({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),j0=N({docName:k().min(1),headings:M(A0)}).loose(),M0=N({docName:k().min(1),rewrites:A().int().nonnegative()}).loose(),N0=N({kind:P([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...uJ,summary:dJ}).loose(),P0=N({renamed:M(b0),renamedAssets:M(x0),rewrittenDocs:M(M0).optional(),summary:c1.optional()}).loose(),F0=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...uJ}).loose(),I0=N({deletedDocNames:M(k().min(1))}).loose(),L0=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...uJ,summary:dJ}).loose(),R0=N({deletedDocNames:M(k().min(1))}).loose(),z0=N({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:dJ,...uJ}).loose(),B0=N({restoredFrom:k().min(1),timestamp:k().min(1),summary:c1.optional(),warning:u1.optional(),warnings:h1.optional()}).loose(),V0=P([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),H0=N({label:k().min(1),webUrl:ys().nullable()}).loose(),U0=$s(`checkStatus`,[N({checkStatus:F(`allowed`)}).loose(),N({checkStatus:F(`denied`),deniedReason:P([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),N({checkStatus:F(`unknown`),unknownError:P([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),W0=P([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),G0=N({state:V0,lastSyncUtc:k().nullable(),lastFetchUtc:k().nullable(),lastPushedSha:k().nullable(),ahead:A().int().min(0),behind:A().int().min(0),consecutiveFailures:A().int().min(0),conflictCount:A().int().min(0),hasRemote:j(),syncEnabled:j(),identityUnresolved:j(),remote:H0.nullable().optional(),pushError:k().optional(),pushErrorCode:W0.optional(),pullError:k().optional(),pullErrorCode:W0.optional(),pausedReason:k().optional(),pushPermission:U0.optional()}).loose(),K0=N({op:P([`sync`,`push`,`pull`]).optional()}).loose(),q0=N({op:P([`sync`,`push`,`pull`])}).loose(),J0=N({conflicts:M(N({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose())}).loose(),Y0=N({file:k().min(1),strategy:P([`mine`,`theirs`,`content`,`delete`]),content:k().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),X0=N({}).loose(),Z0=N({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:P([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),Q0=N({plan:kc(e=>e!==void 0,{message:`plan is required`})}).loose(),$0=N({plan:kc(e=>e!==void 0,{message:`plan is required`})}).loose(),e2=N({result:kc(e=>e!==void 0,{message:`result is required`})}).loose(),t2=N({path:k().min(1),summary:k().min(1)}).loose(),n2=N({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose(),r2=N({packs:M(N({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:M(t2),entryCounts:n2}).loose())}).loose(),i2=N({noOpen:j().optional(),out:k().min(1).optional()}).loose(),a2=N({reason:P([`unsupported-platform`,`spawn-error`]),message:k()}).loose(),o2=$s(`status`,[N({status:F(`installed`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k()}).loose(),N({status:F(`built`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k(),handoffError:a2.optional()}).loose(),N({status:F(`failed`),buildError:k()}).loose(),N({status:F(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]),s2=N({tags:M(N({name:k().min(1),count:A().int().nonnegative(),isLeaf:j()}).loose())}).loose(),c2=N({docName:k().min(1),title:k(),matchingTags:M(k().min(1)),snippet:k().nullable()}).loose(),l2=N({name:k().min(1),docs:M(c2)}).loose(),u2=N({folder:Ws(),frontmatter_local:rc(k(),Ws()).nullable()}).loose(),d2=N({path:k(),frontmatter:rc(k(),Ws()).optional()}).loose(),f2=N({applied:Ws()}).loose(),p2=rc(k(),Ws()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),m2=N({template:N({name:k().min(1),folder:k(),scope:P([`local`,`inherited`]),path:k().min(1),frontmatter:p2,body:k()}).strict()}).strict(),h2=N({templates:M(N({name:k().min(1),title:k().optional(),description:k().optional(),path:k().min(1),source_folder:k()}).strict()),truncated:j()}).strict(),g2=N({folder:k(),name:k(),body:k().optional(),frontmatter:p2.optional(),...uJ,summary:dJ}).strict(),_2=N({path:k().min(1),created:j(),warnings:M(k())}).strict(),v2=N({existed:j(),path:k().min(1)}).strict(),y2=N({fromFolder:k(),fromName:k(),toFolder:k(),toName:k(),body:k().optional(),frontmatter:p2.optional(),...uJ,summary:dJ}).strict(),b2=N({from:k().min(1),to:k().min(1),committed:j()}).strict(),x2=N({query:k().optional(),intent:P([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:P([`navigation`,`relevance`]).optional(),scopes:M(P([`page`,`folder`,`content`,`file`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional(),semantic:j().optional(),source:P([`omnibar`,`mcp`,`http`]).optional()}).loose(),S2=N({kind:P([`page`,`folder`,`content`,`file`]),path:k().min(1),title:k(),score:A(),signals:rc(k(),Ws()),snippet:k().optional()}).loose(),C2=N({capable:j(),applied:j(),coverage:N({embedded:A().int().nonnegative(),total:A().int().nonnegative()})}).loose(),w2=N({enabled:j(),keyPresent:j(),keySource:P([`file`,`env`]).nullable(),keyHint:k().nullable(),ready:j(),capable:j(),embedded:A().int().nonnegative(),total:A().int().nonnegative()}).loose(),T2=N({query:k(),intent:P([`autocomplete`,`full_text`,`omnibar`]),results:M(S2),elapsedMs:A().nonnegative(),semantic:C2.optional(),truncated:j().optional(),ready:j().optional()}).loose(),E2=N({version:k().min(1),recordedAt:k().min(1)}).loose(),D2=N({currentVersion:k().min(1),targets:rc(k(),E2.nullable())}).loose(),O2=`server-info`,k2=`branch-switched`,A2=`disk-ack`,j2=`config-validation-rejected`,M2=`config-ignore-nested-error`,N2=P([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),P2=N({v:F(1),ch:F(O2),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),F2=N({v:F(1),ch:F(k2),seq:A(),branch:k().min(1)}).loose(),I2=N({v:F(1),ch:N2,seq:A()}).loose(),L2=N({v:F(1),ch:F(A2),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),R2=N({v:F(1),ch:F(j2),seq:A(),docName:k().min(1),error:ll}).loose(),z2=N({v:F(1),ch:F(M2),seq:A(),path:k().min(1),error:k().min(1)}).loose(),B2={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},V2=new WeakMap;function H2(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function U2(e){return e.trim().toLowerCase()}const W2=/\.(?:md|mdx)$/;function G2(e,t){if(t!==`page`)return e;let n=e.replace(W2,``);return n.length>0?n:e}function K2(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function q2(e){let t=K2(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function J2(e){let t=LU({schema:B2});return e.length>0&&JU(t,e),t}function Y2(e){let t={documents:e};return V2.set(t,J2(e)),t}function X2(e){let t=V2.get(e);if(t)return t;let n=J2(e.documents);return V2.set(e,n),n}function Z2(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function Q2(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function $2(e,t){let n=U2(t);if(!n)return 0;let r=G2(n,e.kind),i=U2(e.title),a=U2(e.name),o=U2(e.path),s=o.split(`/`);return i===r||a===r?700:o===r?650:i.startsWith(r)||a.startsWith(r)?600:s.some(e=>e.startsWith(r))?550:i.includes(r)||a.includes(r)?500:o.includes(r)?450:-1}function e4(e,t){let n=$2(e,t);return n<=0?n:sJ(e.path)?n*.5:n}function t4(e){return e===`file`?-60:0}function n4(e,t,n,r,i){let a=i>0?t/i:0,o=n/50,s=r===`file`?-.001:0,c=1*a+1*o+s;return e*1e3+c}function r4(e,t,n,r){return e+t*20+n+t4(r)}function i4(e,t,n,r,i,a){return e===`relevance`?r4(t,n,r,i):n4(t,n,r,i,a)}function a4(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function o4(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function s4(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function c4(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function l4(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}function u4(e,t){return U2(t).length<4?0:e===`full_text`?1:0}function d4(e){let{lexical:t,fullText:n}=e.signals;return t>=500?`lexical`:t===450&&n<=0?`pathOnly`:`body`}function f4(e){let t=[],n=[],r=[];for(let i of e){let e=d4(i);e===`lexical`?t.length<100&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function p4(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=f4(e),i=[],a=0,o=0;for(let e of r){if(e.document.kind===`folder`){if(a>=3)continue;a+=1}else if(e.document.kind===`file`){if(o>=3)continue;o+=1}if(i.push(e),i.length>=n)break}return i}function m4(e,t,n={}){let r=n.intent??`omnibar`,i=a4(r,n.ranking),a=H2(n.limit),o=new Set(n.scopes??Z2(r)),s=e.documents.filter(e=>Q2(e,o)),c=U2(t);if(!c)return s.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,a).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let l=wW(X2(e),{term:c,properties:c4(r),boost:l4(r),tolerance:u4(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>Q2(e.document,o)).map(e=>[e.document.id,e.score])),d=s4(s),f=new Map;for(let e of s)e4(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)Q2(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=o4(f.values(),u);return p4([...f.values()].map(t=>{let n=Math.max(0,e4(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:i4(i,n,r,a,t.kind,e),signals:{lexical:n,fullText:r,recency:a}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score),i,a)}return p4(g4({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function h4(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function g4(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,ranking:o,semantic:s}=e,c=s.rrfK??60,l=s.candidateLimit??64,u=s.similarityFloor??0,d=s.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=o4(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,e4(e,a)),n=r.get(e.id)??0,s=i.get(e.id)??0,c=d.get(e.id),l=c!==void 0&&c>=u;return{document:e,score:t>0?i4(o,t,n,s,e.kind,m):r4(t,n,s,e.kind),signals:l?{lexical:t,fullText:n,recency:s,vector:c}:{lexical:t,fullText:n,recency:s},lexical:t,fullText:n,recency:s,cosine:c}}),g=h4(h.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=h4(h.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),v=e=>{let t=0,n=g.get(e);n!==void 0&&(t+=1/(c+n));let r=_.get(e);return r!==void 0&&(t+=1/(c+r)),t};return h.sort((e,t)=>{let n=e.lexical>0?1:0,r=t.lexical>0?1:0;if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=v(e.document.id),a=v(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n}))}function _4(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),v4(n)}function v4(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const y4=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),b4=globalThis;b4[y4]===void 0&&(b4[y4]=Ii());const x4=b4[y4],S4=[`.ok`,`skill-state.yml`],C4=[`claude-cowork`,`cli-hosts`],w4=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],T4=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,E4=Ys({version:k().regex(T4,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(x4,{description:`Recorded skill version for this target.`}),recordedAt:Uo().register(x4,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:P(w4).register(x4,{description:`Install-source surface that recorded this entry.`}).optional()}),D4=Ys({schema:F(1).register(x4,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Ys({"claude-cowork":E4.optional(),"cli-hosts":E4.optional()}).register(x4,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function O4(){return{schema:1,targets:{}}}const k4=`template`;function A4(e){if(e.trim()===``)return{};let t;try{t=(0,Nc.parse)(e)}catch{return{}}return typeof t!=`object`||!t||Array.isArray(t)?{}:t}function j4(e,t){return e.trim()===``?t:`---\n${e}\n---\n${t}`}function M4(e){let{frontmatter:t,body:n}=UW(e);return t===``?{docFrontmatterText:``,markdown:e}:{docFrontmatterText:GW(t),markdown:n}}function N4(e){let t=e.split(`
448
+ `);if(!(t[0]??``).startsWith(`template:`))return null;let n=[t[0]??``],r=1;for(;r<t.length;){let e=t[r]??``;if(/^[ \t]/.test(e)){n.push(e),r++;continue}if(e.trim()===``){let i=r+1;for(;i<t.length&&(t[i]??``).trim()===``;)i++;if(i<t.length&&/^[ \t]/.test(t[i]??``)){n.push(e),r++;continue}}break}let i=A4(n.join(`
449
+ `))[k4];return{identity:typeof i==`object`&&i&&!Array.isArray(i)?i:{},docFrontmatterText:t.slice(r).join(`
450
+ `).replace(/\n+$/,``)}}function P4(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,{frontmatter:n,body:r}=UW(t);if(n===``)return{identity:{},starterContent:t};let i=GW(n),a=N4(i);if(a)return{identity:a.identity,starterContent:j4(a.docFrontmatterText,r)};let{frontmatter:o}=UW(r);if(o!==``)return{identity:A4(i),starterContent:r};let s=A4(i);return typeof s.title==`string`?{identity:s,starterContent:r}:{identity:{},starterContent:j4(i,r)}}function F4(e,t){let{docFrontmatterText:n,markdown:r}=M4(t),i={};for(let[t,n]of Object.entries(e))n!==void 0&&(i[t]=n);let a=(0,Nc.stringify)({[k4]:i});return`---\n${n.trim()===``?a:`${a}${n}\n`}---\n${r}`}function I4(e){return P4(e).starterContent}function L4(){let e=!1,t=``,n=0;return r=>{let i=R4(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function R4(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}const z4=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],B4={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function V4(e,t=z4){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const H4={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function U4(e){return e?H4[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const W4={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function G4(e){let t=e?.trim();return t?W4[U4(t)]??t:`Agent`}function K4(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}const q4=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function J4(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function Y4(e){let t=e.trim();return q4.test(t)||t.startsWith(`//`)}function X4(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(Y4(n))return{kind:`external`,url:n};let r=K4(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=J4(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function Z4(e,t){let n=e.trim();if(!n)return null;if(Y4(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=J4(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function Q4(e,t){let n=e.trim();if(!n||q4.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function $4(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function e3(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function t3(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function n3(e){return e.split(`/`).filter(e=>e!==``)}function r3(e,t){let n=t3(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function i3(e,t){let n=t3(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:n3(r).length}function a3(e,t){let n=n3(e),r=n3(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function o3(){let e=new Map;function t(t){let n=$4(t);if(n===``)return;let r=e3(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=$4(t),r=e3(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=t3($4(n)),o=[],s=[];for(let e of i)r3(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=i3(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=i3(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=a3(a,t3(t));for(let r=1;r<e.length;r++){let i=e[r],o=a3(a,t3(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function s3(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function c3(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function l3(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function u3(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function d3(){try{let e=_(g(b(import.meta.url)),`..`,`package.json`),t=JSON.parse(d(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}const f3=d3(),p3=1;var m3=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`Open Knowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function h3(e,t){return _(e,`${t}.lock`)}const g3=new Map;function _3(e){g3.set(e,(g3.get(e)??0)+1)}function v3(e){let t=g3.get(e);return t===void 0||t<=1?(g3.delete(e),!0):(g3.set(e,t-1),!1)}function y3(e,t){try{let n=JSON.parse(d(e,`utf-8`));return n&&typeof n==`object`&&u3(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function b3(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;l(n,{recursive:!0});let a=h3(n,t),o={pid:process.pid,hostname:y(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??f3},d=JSON.stringify(o,null,2);for(let e=0;e<3;e++){if(!c(a))try{let e=u(a,`wx`,384);try{m(e,d)}finally{s(e)}return _3(a),x3({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=y3(a,i);if(e){let r=e.hostname===y();if(r&&e.pid===process.pid)return p(a,d,{encoding:`utf-8`,mode:384}),_3(a),x3({lockName:t,lockDir:n,lockPath:a});if(r&&l3(e.pid))throw new m3(e,a,t);console.warn(`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{f(a)}catch{}}throw Error(`${i} Failed to acquire ${a} after 3 attempts (concurrent acquire contention).`)}function x3(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>T3({lockName:t,lockDir:n}),updatePort:e=>S3({lockName:t,lockDir:n,port:e})}}function S3(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=h3(n,t);if(!c(a)){console.warn(`${i} Lock file missing at ${a} during port update — skipping`);return}let o;try{let e=JSON.parse(d(a,`utf-8`));if(!e||typeof e!=`object`||!u3(e.pid)){console.warn(`${i} Corrupt lock at ${a} during port update — skipping`);return}o=e}catch{console.warn(`${i} Unreadable lock at ${a} during port update — skipping`);return}if(o.pid===process.pid&&!(typeof o.hostname==`string`&&o.hostname!==y())){o.port=r;try{p(a,JSON.stringify(o,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function C3(e){let{lockName:t,lockDir:n}=e,r=h3(n,t);if(!c(r))return null;let i;try{let e=JSON.parse(d(r,`utf-8`));if(!e||typeof e!=`object`||!u3(e.pid))return null;i=e}catch{return null}if(i.hostname!==y())return null;if(!l3(i.pid)){try{f(r)}catch{}return null}return i}function w3(e){let{lockName:t,lockDir:n}=e,r=h3(n,t);if(!c(r))return{status:`absent`};let i;try{i=JSON.parse(d(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!u3(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(o.hostname!==y())return{status:`stale`,lock:o};if(!l3(o.pid)){try{f(r)}catch{}return{status:`stale`,lock:o}}return o.protocolVersion===void 0||o.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:o}}function T3(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=h3(n,t);if(v3(i)&&c(i))try{let e=JSON.parse(d(i,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||typeof e.hostname==`string`&&e.hostname!==y())return;f(i)}catch(e){console.warn(`${r} Failed to release ${i}: ${e instanceof Error?e.message:String(e)}`)}}var E3=class extends m3{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function D3(e,t){try{return b3({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof m3&&e.lockName===`server`?new E3(e.existing,e.lockPath):e}}function O3(e,t){S3({lockName:`server`,lockDir:e,port:t})}function k3(e){return C3({lockName:`server`,lockDir:e})}function A3(e){T3({lockName:`server`,lockDir:e})}export{eK as $,P as $i,s2 as $n,fK as $r,h0 as $t,g1 as A,Lt as Aa,I as Ai,Q0 as An,Y2 as Ar,x1 as At,I2 as B,yl as Bi,D4 as Bn,rJ as Br,qK as Bt,o1 as C,ai as Ca,cG as Ci,R1 as Cn,Z4 as Cr,L1 as Ct,a1 as D,fn as Da,ZW as Di,$0 as Dn,o3 as Dr,f2 as Dt,y1 as E,un as Ea,oJ as Ei,T2 as En,F4 as Er,d2 as Et,lG as F,ft as Fa,Vc as Fi,bJ as Fn,G4 as Fr,MK as Ft,j2 as G,ul as Gi,J0 as Gn,qY as Gr,r0 as Gt,P2 as H,tl as Hi,YJ as Hn,C$ as Hr,i0 as Ht,vG as I,Bc as Ii,yJ as In,KG as Ir,i2 as It,ZG as J,$c as Ji,G0 as Jn,I4 as Jr,e0 as Jt,A2 as K,_l as Ki,Y0 as Kn,Yq as Kr,JJ as Kt,F2 as L,zc as Li,SJ as Ln,O4 as Lr,o2 as Lt,k1 as M,O as Ma,Wc as Mi,BJ as Mn,BG as Mr,V1 as Mt,O1 as N,D as Na,Hc as Ni,pJ as Nn,zG as Nr,H1 as Nt,_1 as O,mn as Oa,Ly as Oi,e2 as On,L4 as Or,j1 as Ot,IJ as P,pt as Pa,Uc as Pi,hJ as Pn,QW as Pr,K1 as Pt,QG as Q,cc as Qi,l2 as Qn,PJ as Qr,_0 as Qt,z2 as R,Tl as Ri,wJ as Rn,_4 as Rr,v0 as Rt,l0 as S,Ga as Sa,c3 as Si,XG as Sn,X4 as Sr,OK as St,s1 as T,cn as Ta,GW as Ti,x2 as Tn,V4 as Tr,u2 as Tt,k2 as U,Sl as Ui,Y1 as Un,q$ as Ur,$1 as Ut,L2 as V,Jc as Vi,y0 as Vn,sG as Vr,P1 as Vt,M2 as W,pl as Wi,Z0 as Wn,V$ as Wr,n0 as Wt,nK as X,qc as Xi,q0 as Xn,VW as Xr,Q1 as Xt,JG as Y,Kc as Yi,K0 as Yn,DJ as Yr,X1 as Yt,tK as Z,Fs as Zi,k4 as Zn,sJ as Zr,w$ as Zt,B4 as _,ys as _a,GG as _i,S4 as _n,NW as _r,E1 as _t,b3 as a,$s as aa,P4 as ai,qG as an,_2 as ar,T0 as at,m1 as b,fa as ba,dG as bi,mK as bn,WJ as br,O0 as bt,u3 as c,Ys as ca,n1 as ci,VJ as cn,d0 as cr,w0 as ct,w3 as d,lc as da,fG as di,P0 as dn,L0 as dr,vK as dt,Bs as ea,TJ as ei,m0 as en,v2 as er,$G as et,k3 as f,Mc as fa,r1 as fi,W1 as fn,R0 as fr,pK as ft,O3 as g,Ws as ga,JW as gi,AK as gn,U1 as gr,I0 as gt,S3 as h,Zs as ha,m4 as hi,jK as hn,KJ as hr,F0 as ht,E3 as i,kc as ia,qW as ii,_K as in,g2 as ir,C1 as it,HJ as j,Tt as ja,Cl as ji,w2 as jn,q2 as jr,zW as jt,i1 as k,on as ka,Df as ki,r2 as kn,tQ as kr,b1 as kt,h3 as l,A as la,pG as li,GJ as ln,f0 as lr,NK as lt,A3 as m,k as ma,K4 as mi,B0 as mn,qJ as mr,J1 as mt,f3 as n,M as na,hG as ni,G1 as nn,y2 as nr,zJ as nt,D3 as o,tc as oa,WW as oi,j0 as on,h2 as or,E0 as ot,T3 as p,rc as pa,Q4 as pi,z0 as pn,lK as pr,oK as pt,O2 as q,nl as qi,X0 as qn,U4 as qr,t0 as qt,p3 as r,j as ra,RG as ri,hK as rn,b2 as rr,S1 as rt,l3 as s,F as sa,gK as si,k0 as sn,p0 as sr,C0 as st,m3 as t,Hs as ta,JK as ti,dK as tn,m2 as tr,LJ as tt,C3 as u,N as ua,tG as ui,N0 as un,u0 as ur,uK as ut,sK as v,Uo as va,$q as vi,C4 as vn,MW as vr,T1 as vt,v1 as w,vr as wa,z$ as wi,z1 as wn,YG as wr,S0 as wt,c0 as x,Wa as xa,UW as xi,iK as xn,NJ as xr,cK as xt,kK as y,Vo as ya,aJ as yi,T4 as yn,oG as yr,D0 as yt,R2 as z,wl as zi,D2 as zn,s3 as zr,aK as zt};
451
+ //# sourceMappingURL=server-lock-BpjJj3OD-dsDEfapU.mjs.map
@@ -0,0 +1 @@
1
+ import{g as e}from"./server-lock-BpjJj3OD-dsDEfapU.mjs";export{e as updateServerLockPort};
@@ -1,7 +1,7 @@
1
- import{s as e}from"./chunk-C94x7I9S.mjs";import{t}from"./esm-BLMtE3s6.mjs";import{c as n,l as r,s as i}from"./server-lock-BpjJj3OD-DWhr5fHw.mjs";import"./gh-detect-CenJLuMO.mjs";import{Ur as a,vn as o}from"./dist-B5y4LMVx.mjs";import{g as s,h as c}from"./init-CBprZg4D.mjs";import{n as l,o as u}from"./write-project-skill-DY8A4C2Y.mjs";import"./loader-Cu0hsF84.mjs";import{c as d}from"./colors-CBY1ibtz.mjs";import"./preview--AtfC4Xf.mjs";import{spawnSync as f}from"node:child_process";import{existsSync as p,lstatSync as m,readFileSync as h,readdirSync as g,statSync as ee}from"node:fs";import{basename as te,dirname as _,isAbsolute as v,join as y,relative as b,resolve as x}from"node:path";import{hostname as ne}from"node:os";import{readFile as S,realpath as C}from"node:fs/promises";function w(e,t,a={}){let o=r(e,t);if(!p(o))return{status:`missing`,lockPath:o};let s;try{s=JSON.parse(h(o,`utf-8`))}catch{return{status:`corrupt`,lockPath:o}}if(!s||typeof s!=`object`||!n(s.pid))return{status:`corrupt`,lockPath:o};let c=s;if(!(a.isAlive??i)(c.pid))return{status:`dead-pid`,lockPath:o,lock:c};let l=a.host??ne();return c.hostname===l?{status:`alive`,lockPath:o,lock:c}:{status:`foreign-host`,lockPath:o,lock:c}}function T(e){return e.replace(/:\d+$/,``)}function E(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:T(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:T(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:T(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.-]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function D(e){let t;try{t=new URL(e)}catch{return null}if(t.hostname!==`github.com`&&t.hostname!==`www.github.com`)return null;let n=t.pathname.split(`/`).filter(e=>e.length>0);if(n.length<5||n[2]!==`blob`)return null;let r,i,a,o;try{r=decodeURIComponent(n[0]),i=decodeURIComponent(n[1]),a=decodeURIComponent(n[3]),o=n.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!r||!i||!a||o.length===0||o.some(e=>e.length===0)?null:{owner:r,repo:i,branch:a,path:o.join(`/`)}}function O(e){let t;try{t=new URL(e)}catch{return null}if(t.hostname!==`github.com`&&t.hostname!==`www.github.com`)return null;let n=t.pathname.split(`/`);if(n.length<5||n[0]!==``||n[3]!==`tree`)return null;let r=n.slice(5);r.length===1&&r[0]===``&&r.pop();let i,a,o,s;try{i=decodeURIComponent(n[1]),a=decodeURIComponent(n[2]),o=decodeURIComponent(n[4]),s=r.map(e=>decodeURIComponent(e))}catch{return null}return!i||!a||!o||s.some(e=>e.length===0)?null:{owner:i,repo:a,branch:o,path:s.join(`/`)}}function k(e){let t=D(e);if(t)return{kind:`doc`,...t};let n=O(e);return n?{kind:`folder`,...n}:null}const A=2e3,j=2e3,re=[/cli\.mjs/,/(^|[\s/])(open-knowledge|ok)\s+(start|mcp|ui)(\s|$)/,/Open Knowledge(?:\.app| Helper)/,/(^|[\s/])bun([\s/]).*?(run dev|packages\/app|vite|hocuspocus)/,/(^|[\s/])node([\s/]).*?(packages\/(cli|app)|vite|hocuspocus)/,/(^|\s)--ok-lock-dir-b64=/,/(^|\s)--ok-project-path=/];function M(e){return re.some(t=>t.test(e))}function ie(e){let t=e.trim().split(/\s+/).find(e=>e.startsWith(`--ok-lock-dir-b64=`));if(t==null)return null;let n=t.slice(18);if(!n)return null;try{let e=Buffer.from(n,`base64url`).toString(`utf8`);return v(e)?e:null}catch{return null}}function ae(e){let t=e.indexOf(`--ok-project-path=`);if(t===-1)return null;let n=t+18,r=e.slice(n),i=r.search(/\s--/),a=(i===-1?r:r.slice(0,i)).trim();return a&&v(a)?a:null}function oe(e){let t=[];for(let n of e.split(`
1
+ import{s as e}from"./chunk-C94x7I9S.mjs";import{t}from"./esm-BLMtE3s6.mjs";import{c as n,l as r,s as i}from"./server-lock-BpjJj3OD-dsDEfapU.mjs";import"./gh-detect-DLds_L3H.mjs";import{Ur as a,vn as o}from"./dist-_pfPif1i.mjs";import{g as s,h as c}from"./init-S9gXm9Ry.mjs";import{n as l,o as u}from"./write-project-skill-HhH8jTF_.mjs";import"./loader-D2tepURW.mjs";import{c as d}from"./colors-CBY1ibtz.mjs";import"./preview-BgVD-kDH.mjs";import{spawnSync as f}from"node:child_process";import{existsSync as p,lstatSync as m,readFileSync as h,readdirSync as g,statSync as ee}from"node:fs";import{basename as te,dirname as _,isAbsolute as v,join as y,relative as b,resolve as x}from"node:path";import{hostname as ne}from"node:os";import{readFile as S,realpath as C}from"node:fs/promises";function w(e,t,a={}){let o=r(e,t);if(!p(o))return{status:`missing`,lockPath:o};let s;try{s=JSON.parse(h(o,`utf-8`))}catch{return{status:`corrupt`,lockPath:o}}if(!s||typeof s!=`object`||!n(s.pid))return{status:`corrupt`,lockPath:o};let c=s;if(!(a.isAlive??i)(c.pid))return{status:`dead-pid`,lockPath:o,lock:c};let l=a.host??ne();return c.hostname===l?{status:`alive`,lockPath:o,lock:c}:{status:`foreign-host`,lockPath:o,lock:c}}function T(e){return e.replace(/:\d+$/,``)}function E(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:T(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:T(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:T(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.-]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function D(e){let t;try{t=new URL(e)}catch{return null}if(t.hostname!==`github.com`&&t.hostname!==`www.github.com`)return null;let n=t.pathname.split(`/`).filter(e=>e.length>0);if(n.length<5||n[2]!==`blob`)return null;let r,i,a,o;try{r=decodeURIComponent(n[0]),i=decodeURIComponent(n[1]),a=decodeURIComponent(n[3]),o=n.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!r||!i||!a||o.length===0||o.some(e=>e.length===0)?null:{owner:r,repo:i,branch:a,path:o.join(`/`)}}function O(e){let t;try{t=new URL(e)}catch{return null}if(t.hostname!==`github.com`&&t.hostname!==`www.github.com`)return null;let n=t.pathname.split(`/`);if(n.length<5||n[0]!==``||n[3]!==`tree`)return null;let r=n.slice(5);r.length===1&&r[0]===``&&r.pop();let i,a,o,s;try{i=decodeURIComponent(n[1]),a=decodeURIComponent(n[2]),o=decodeURIComponent(n[4]),s=r.map(e=>decodeURIComponent(e))}catch{return null}return!i||!a||!o||s.some(e=>e.length===0)?null:{owner:i,repo:a,branch:o,path:s.join(`/`)}}function k(e){let t=D(e);if(t)return{kind:`doc`,...t};let n=O(e);return n?{kind:`folder`,...n}:null}const A=2e3,j=2e3,re=[/cli\.mjs/,/(^|[\s/])(open-knowledge|ok)\s+(start|mcp|ui)(\s|$)/,/Open Knowledge(?:\.app| Helper)/,/(^|[\s/])bun([\s/]).*?(run dev|packages\/app|vite|hocuspocus)/,/(^|[\s/])node([\s/]).*?(packages\/(cli|app)|vite|hocuspocus)/,/(^|\s)--ok-lock-dir-b64=/,/(^|\s)--ok-project-path=/];function M(e){return re.some(t=>t.test(e))}function ie(e){let t=e.trim().split(/\s+/).find(e=>e.startsWith(`--ok-lock-dir-b64=`));if(t==null)return null;let n=t.slice(18);if(!n)return null;try{let e=Buffer.from(n,`base64url`).toString(`utf8`);return v(e)?e:null}catch{return null}}function ae(e){let t=e.indexOf(`--ok-project-path=`);if(t===-1)return null;let n=t+18,r=e.slice(n),i=r.search(/\s--/),a=(i===-1?r:r.slice(0,i)).trim();return a&&v(a)?a:null}function oe(e){let t=[];for(let n of e.split(`
2
2
  `)){let e=n.trim();if(!e)continue;let r=e.indexOf(` `);if(r===-1)continue;let i=e.slice(0,r),a=e.slice(r+1),o=Number.parseInt(i,10);!Number.isNaN(o)&&M(a)&&t.push({pid:o,command:a})}return t}function se(e){let t=[],n=e.split(`
3
3
  `);for(let e=1;e<n.length;e++){let r=n[e]?.trim();if(!r)continue;let i=r.indexOf(` `);if(i===-1)continue;let a=r.slice(0,i),o=r.slice(i+1).trim(),s=Number.parseInt(a,10);!Number.isNaN(s)&&M(o)&&t.push({pid:s,command:o})}return t}async function ce(){let e=f(`pgrep`,[`-a`,`-f`,`cli\\.mjs|open-knowledge|Open Knowledge(\\.app| Helper)|--ok-lock-dir-b64=|--ok-project-path=|(^|[ /])ok[ ]+(start|mcp|ui)([ ]|$)|packages/(cli|app)|hocuspocus|vite`],{encoding:`utf-8`,timeout:A});if(!(e.error!=null&&e.error.code===`ENOENT`)){let t=e.stdout??``,n=oe(t);if(n.length>0||t.trim()===``)return n}let t=f(`ps`,[`-axo`,`pid,command`],{encoding:`utf-8`,timeout:A});return t.error!=null||!t.stdout?[]:se(t.stdout)}function le(e){let t=e.trim().split(/\s+/).filter(Boolean);for(let e of t){if(e.startsWith(`@`))continue;let t=te(e);if(t===`open-knowledge`||t===`ok`||e.endsWith(`/packages/cli/src/cli.ts`)||e.endsWith(`/packages/cli/dist/cli.mjs`)||t===`cli.mjs`||t===`cli.ts`)return e}return null}function N(e){let t=f(`ps`,[`-p`,String(e),`-o`,`command=`],{encoding:`utf-8`,timeout:A});return t.error!=null||!t.stdout?null:t.stdout.trim()||null}function P(e){let t=f(`ps`,[`-p`,String(e),`-o`,`%cpu=,%mem=`],{encoding:`utf-8`,timeout:A});if(t.error!=null||!t.stdout)return null;let[n,r]=t.stdout.trim().split(/\s+/),i=Number.parseFloat(n??``),a=Number.parseFloat(r??``);return Number.isNaN(i)||Number.isNaN(a)?null:{cpuPercent:i,memPercent:a}}async function F(e){let t=f(`lsof`,[`-p`,String(e),`-a`,`-d`,`cwd`,`-Fn`],{encoding:`utf-8`,timeout:A});if(t.error!=null)return null;let n=t.stdout??``;for(let e of n.split(`
4
4
  `))if(e.startsWith(`n`)&&e.length>1)return e.slice(1);return null}function I(e){let t=[],n=e.split(`
5
5
  `);for(let e=1;e<n.length;e++){let r=n[e]?.trim();if(!r)continue;let i=r.split(/\s+/);if(i.length<2)continue;let a=Number.parseInt(i[1]??``,10);Number.isNaN(a)||t.push(a)}return[...new Set(t)]}function L(e){return p(y(e,`server.lock`))||p(y(e,`ui.lock`))}function R(e,t){for(let n of[y(t,`.ok`,`local`),y(t,`.ok`)])p(n)&&L(n)&&e.add(n)}function z(e,t){let n=0,r=(t,i)=>{if(n>=j||(n++,R(e,t),i>=3))return;let a;try{a=g(t)}catch{return}for(let e of a){if(n>=j)return;if(e===`node_modules`||e===`.git`||e===`Library`||e.startsWith(`.`)&&e!==`.ok`)continue;let a=y(t,e),o=!1;try{o=m(a).isDirectory()}catch{continue}o&&r(a,i+1)}};r(t,0)}async function B(){let e=new Set,t=await ce(),n=t.map(e=>F(e.pid)),r=await Promise.all(n);for(let n of t){let t=ie(n.command);t!=null&&p(t)&&e.add(t);let r=ae(n.command);r!=null&&R(e,r)}for(let t of r)t!=null&&R(e,t);let i=f(`lsof`,[`-iTCP`,`-sTCP:LISTEN`,`-nP`],{encoding:`utf-8`,timeout:A});if(i.error==null&&i.stdout){let n=I(i.stdout),r=new Set(t.map(e=>e.pid)),a=n.filter(e=>!r.has(e)).map(e=>F(e)),o=await Promise.all(a);for(let t of o)t!=null&&R(e,t)}(e.size===0||r.some(e=>e===`/`))&&z(e,process.cwd());let a=new Map;for(let t of e)try{let e=await C(t);a.set(e,e)}catch{a.set(t,t)}return[...a.values()]}var V=e(d(),1);function H(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function U(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function W(e,t,n,r,i,a){if(t.status===`missing`||t.status===`corrupt`)return null;let o=t.lock,s=null;if(n.status!==`missing`&&n.status!==`corrupt`){let e=n.lock;s={port:e.port,status:n.status,pid:e.pid,startedAt:e.startedAt,usage:a}}return{directory:o.worktreeRoot,server:{port:o.port,status:t.status,pid:o.pid,startedAt:o.startedAt,usage:i},ui:s,hostname:o.hostname,lockPath:t.lockPath,binary:r==null?null:le(r),command:r,isDesktop:H(r)}}function ue(e){return e.ui==null?!1:e.ui.status===`alive`||e.ui.status===`foreign-host`}function G(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:t===`dead-pid`&&ue(e)?`ui-orphan`:`stale`}const de=new Set([`running`,`desktop`,`foreign`,`ui-orphan`]);function fe(e){switch(e){case`running`:return V.default.green(e);case`desktop`:return V.default.blue(e);case`foreign`:return V.default.cyan(e);case`ui-orphan`:return V.default.magenta(e);case`stale`:return V.default.yellow(e)}}function K(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function pe(e){return`${K(e.server.usage)} | ${K(e.ui?.usage??null)}`}function me(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null||e.ui.status===`dead-pid`?`—`:String(e.ui.port)}`}function he(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>{let t=G(e),n=t===`ui-orphan`&&e.ui!=null?e.ui.pid:e.server.pid;return[e.directory,me(e),pe(e),t,String(n),U(e.server.startedAt),e.binary??`—`]}),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=fe(G(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=V.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
6
6
  `)}async function q(e={}){let t=e.discover??B,n=e.inspect??w,r=e.log??(e=>console.log(e)),i=e.resolveCommand??N,a=e.resolveUsage??P,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=n(e,`ui`),o=W(e,t,r,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid),r.status===`missing`||r.status===`corrupt`?null:a(r.lock.pid));o!=null&&s.push(o)}if(e.json){let e=s.map(e=>({...e,displayStatus:G(e)}));r(JSON.stringify(e,null,2));return}r(he(e.all?s:s.filter(e=>de.has(G(e)))))}function ge(){return new t(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await q({all:t.all===!0||e===`all`,json:t.json===!0})})}const _e=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`]);function ve(e,t,n=o){if(e!==void 0&&!_e.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let J=null;function ye(e){J=e}function be(){return J??process.cwd()}function xe(e,t,n={}){let r=n.isAlive??i,a=[];for(let[n,i]of[[`server`,e],[`ui`,t]])(i.status===`alive`||i.status===`foreign-host`&&r(i.lock.pid))&&a.push({name:n,pid:i.lock.pid,port:i.lock.port});return{targets:a}}function Y(e){let t=e.inspect??(t=>w(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=xe(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function X(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function Se(e,t=i){let n=await B(),r=null;for(let i of n){let n=w(i,`server`),a=w(i,`ui`);if(X(n,t)&&n.lock.port===e||X(a,t)&&a.lock.port===e)return i;r===null&&(X(n,t)&&n.lock.pid===e||X(a,t)&&a.lock.pid===e)&&(r=i)}return r}function Z(e){let t=Y({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function Ce(e){return new t(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=Y({lockDir:a(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await q({});return}if(n===`all`){let e=await B();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=w(n,`server`),r=w(n,`ui`);!X(e,i)&&!X(r,i)||(Z(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await Se(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}Z(t);return}Z(a(x(be(),n)))})}async function we(e,t){let n,r;try{n=await C(x(e)),r=await C(x(_(e)))}catch{return{kind:`not-git`}}if(!$(n,r))return{kind:`symlink-escape`};let i=y(n,`.git`),a;try{a=ee(i)}catch{return{kind:`not-git`}}let o;if(a.isDirectory()){let e;try{e=await C(i)}catch{return{kind:`not-git`}}if(!$(e,n))return{kind:`symlink-escape`};o=e}else if(a.isFile()){let e;try{e=await S(i,`utf-8`)}catch{return{kind:`not-git`}}let t=/^gitdir:\s*(.+)$/m.exec(e.trim());if(!t)return{kind:`not-git`};let r=t[1].trim(),a=v(r)?r:x(n,r);try{o=await C(a)}catch{return{kind:`not-git`}}}else return{kind:`not-git`};let s=y(await Q(o),`config`),c;try{c=await S(s,`utf-8`)}catch{return{kind:`not-git`}}let l=Ee(c);if(l===null)return{kind:`no-origin`};let u=E(l);if(u===null||u.hostname!==`github.com`)return{kind:`non-github`};let d=u.owner.toLowerCase()===t.owner.toLowerCase(),f=u.name.toLowerCase()===t.repo.toLowerCase();return!d||!f?{kind:`wrong-repo`,actualOwner:u.owner,actualRepo:u.name}:{kind:`ok`,gitRemoteUrl:`https://github.com/${u.owner}/${u.name}.git`}}async function Q(e){let t;try{t=(await S(y(e,`commondir`),`utf-8`)).trim()}catch{return e}if(t.length===0)return e;let n=v(t)?t:x(e,t);try{return await C(n)}catch{return n}}function $(e,t){if(e===t)return!0;let n=b(t,e);return n.length>0&&!n.startsWith(`..`)&&!v(n)}function Te(e){let t=e.indexOf(`#`),n=e.indexOf(`;`),r=-1;return t>=0&&n>=0?r=Math.min(t,n):t>=0?r=t:n>=0&&(r=n),(r===-1?e:e.slice(0,r)).trim()}function Ee(e){let t=!1;for(let n of e.split(/\r?\n/)){let e=Te(n);if(e.length===0)continue;if(e.startsWith(`[`)){t=/^\[\s*remote\s+["']origin["']\s*\]$/.test(e);continue}if(!t)continue;let r=/^url\s*=\s*(.+)$/.exec(e);if(r)return De(r[1])}return null}function De(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}const Oe=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=s(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let n=l(e,t);return{integration:`project-skill`,editorId:e.id,action:n.action,...n.path?{path:n.path}:{},...n.error?{error:n.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function ke(e,t,n={},r=Oe){let i=[];for(let a of t){let t=u[a];for(let a of r)i.push(a.write(t,e,n))}return i}function Ae(e,t,n={}){return{integrations:ke(e,t,n),claudeLaunchJson:t.includes(`claude`)?c(e,n):void 0}}export{ye as a,B as c,D as d,k as f,w as h,Ce as i,N as l,E as m,we as n,ve as o,O as p,Y as r,ge as s,Ae as t,P as u};
7
- //# sourceMappingURL=src-BZNJM3Un.mjs.map
7
+ //# sourceMappingURL=src-CGRIl5Wf.mjs.map
@@ -0,0 +1 @@
1
+ import{_ as e,f as t,r as n}from"./start-rysaIHHX.mjs";export{n as bootStartServer,t as resolveHost,e as startCommand};