@inkeep/open-knowledge 0.11.0-beta.2 → 0.11.0-beta.3

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 (47) 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 +13 -13
  4. package/dist/constants-DyydeB4j.mjs +2 -0
  5. package/dist/dist-BQ2eKPri.mjs +1 -0
  6. package/dist/{dist-C0xnaEtj.mjs → dist-CCyYJGQt.mjs} +8 -9
  7. package/dist/{gh-detect-CA44spgV.mjs → gh-detect-BVhbpmu_.mjs} +2 -2
  8. package/dist/index.mjs +1 -1
  9. package/dist/init-BZjQ37CC.mjs +1 -0
  10. package/dist/{init-Ciq04XPD.mjs → init-T36y4VG4.mjs} +4 -4
  11. package/dist/loader-CFHyMNhM.mjs +1 -0
  12. package/dist/{loader-Bz9ASXI0.mjs → loader-DhtMuXAX.mjs} +3 -3
  13. package/dist/preview-BZshejrR.mjs +1 -0
  14. package/dist/{preview-Cqve46h4.mjs → preview-CquRg_CE.mjs} +2 -2
  15. package/dist/public/assets/{ActivityModeContent-CqOdmRDQ.js → ActivityModeContent-ZoZKf6Gm.js} +1 -1
  16. package/dist/public/assets/{DocumentContext-9X09oG0N.js → DocumentContext-DBiTzPPp.js} +2 -2
  17. package/dist/public/assets/{GraphPanel-_BCbvLM6.js → GraphPanel-CFpfVJ4w.js} +1 -1
  18. package/dist/public/assets/{SettingsDialogBody-CJBYdFNy.js → SettingsDialogBody-Cm5As9uw.js} +2 -2
  19. package/dist/public/assets/SourceEditor-CxKHLkny.js +2 -0
  20. package/dist/public/assets/{config-validation-events-CTKSLfrC.js → config-validation-events-Co2Fzxvd.js} +5 -5
  21. package/dist/public/assets/index-A7P-olmm.js +1915 -0
  22. package/dist/public/assets/{keyboard-shortcuts-D1ntCgJI.js → keyboard-shortcuts-B7RaCLwK.js} +1 -1
  23. package/dist/public/assets/{prop-types-3UnRySkO.js → prop-types-DfshR72P.js} +1 -1
  24. package/dist/public/assets/{target-navigation-intent-SROx-nlb.js → target-navigation-intent-o4RtIHjG.js} +1 -1
  25. package/dist/public/assets/{typing-burst-detector-D4PNvLF3.js → typing-burst-detector-Hj7RQFt0.js} +2 -2
  26. package/dist/public/index.html +7 -7
  27. package/dist/{repair-launch-json-XAE_JN-m.mjs → repair-launch-json-D2ZvteMx.mjs} +2 -2
  28. package/dist/{repair-mcp-configs-DF6fmbaO.mjs → repair-mcp-configs-B0Zod3GV.mjs} +2 -2
  29. package/dist/repair-skills-D4XmoSSA.mjs +1 -0
  30. package/dist/{repair-skills-BRxi0rRb.mjs → repair-skills-PR-WFCoP.mjs} +2 -2
  31. package/dist/{server-lock-BpjJj3OD-BYyEdzAD.mjs → server-lock-BpjJj3OD-BIHTaNk6.mjs} +2 -2
  32. package/dist/server-lock-CyhBidkz-D8p-oBU3.mjs +1 -0
  33. package/dist/{src-DQCQ-Lah.mjs → src-BsLpq-yj.mjs} +2 -2
  34. package/dist/{start-CJV2plXo.mjs → start-CuUWVawW.mjs} +2 -2
  35. package/dist/start-DLaD9UkH.mjs +1 -0
  36. package/dist/{write-project-skill-AEaG6bcq.mjs → write-project-skill-IhCllMlm.mjs} +2 -2
  37. package/package.json +1 -1
  38. package/dist/constants-tinfqGlt.mjs +0 -2
  39. package/dist/dist-DglAcTUx.mjs +0 -1
  40. package/dist/init-DPzXuaty.mjs +0 -1
  41. package/dist/loader-Cqxopf9k.mjs +0 -1
  42. package/dist/preview-BhwNW-yC.mjs +0 -1
  43. package/dist/public/assets/SourceEditor-C1jfu96D.js +0 -2
  44. package/dist/public/assets/index-DJYXzJag.js +0 -1915
  45. package/dist/repair-skills-LlCrfK-2.mjs +0 -1
  46. package/dist/server-lock-CyhBidkz-BKGV8zdF.mjs +0 -1
  47. package/dist/start-DKjEKF15.mjs +0 -1
@@ -1,5 +1,5 @@
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{Dn as o,J as s,Y as c,ft as l,n as u,ot as d,q as f}from"./DocumentContext-9X09oG0N.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-BNBODYwB.js";import{$t as p,Xr as m,Zi as h,i as le,nn as g}from"./prop-types-3UnRySkO.js";import{S as ue}from"./button-DenIdY-r.js";import{$ as _,At as v,Bt as y,Dt as b,E as x,Et as S,Ft as C,Ht as w,J as T,Mt as E,N as D,Ot as O,Pt as k,Q as A,Rt as de,Ut as fe,X as j,_ as M,_t as N,ct as P,dt as F,et as I,f as L,gt as pe,ht as me,l as he,lt as ge,mt as _e,nt as ve,ot as ye,rt as be,st as xe,tt as Se,ut as Ce,wt as R,y as we,yt as z,zt as Te}from"./dist-Du-s1q8P.js";import{i as Ee,n as De,o as Oe,r as ke}from"./dist-BrsSsfiw.js";var B=e(t(),1),Ae=a(),je=new Map;function Me(e,t){je.set(e,t)}function Ne(e){let t=je.get(e)??null;return je.delete(e),t}function Pe(e){je.delete(e)}function Fe(e,t){let n=(0,Ae.c)(4),r=t===void 0?!1:t,[i,a]=(0,B.useState)(void 0),o=(0,B.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,B.useEffect)(s,c),i}var V=r(),Ie=300;async function Le(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new l(h._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=g.safeParse(n);throw e.success?Error(e.data.title):new l(h._({id:`zlErBl`}),{status:t.status})}let r=p.safeParse(n);if(!r.success)throw new l(h._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var Re=32,ze=12,Be=6,Ve=`open-knowledge:outline-nav`;function He(e){let t=(0,Ae.c)(2),n;return t[0]===e?n=t[1]:(n=(0,V.jsx)(o,{name:`outline-panel`,children:(0,V.jsx)(Ue,{...e})}),t[0]=e,t[1]=n),n}function Ue(e){let t=(0,Ae.c)(50),{docName:r,isSourceMode:a,className:o}=e,s=o===void 0?``:o,{_:c}=n(),{pages:l,loading:d}=le(),f=ce(),{activeProvider:p,activeDocName:m}=u(),h,g;t[0]===r?(h=t[1],g=t[2]):(h=[`page-headings`,r],g=()=>Le(r),t[0]=r,t[1]=h,t[2]=g);let _;t[3]!==r||t[4]!==d||t[5]!==l?(_=!d&&l.has(r),t[3]=r,t[4]=d,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]})},Ie)};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,B.useEffect)(w,T);let E;t[19]===C?E=t[20]:(E=C.map(We),t[19]=C,t[20]=E);let D=Fe(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`&&Me(r,{kind:`outline`,detail:n}),window.dispatchEvent(new CustomEvent(Ve,{detail:n}))},t[24]=r,t[25]=a,t[26]=A):A=t[26];let de=A,fe=((k>=0?C[k].level:1)-1)*ze+(ze-Be)/2,j=k*Re+(Re-Be)/2,M;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,V.jsx)(oe,{children:(0,V.jsx)(i,{id:`dD7NPy`})}),t[27]=M):M=t[27];let N;t[28]!==C.length||t[29]!==b?(N=!b&&(0,V.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,V.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]!==de||t[38]!==C||t[39]!==b||t[40]!==fe||t[41]!==j?(F=x?(0,V.jsx)(ee,{className:`px-2`,children:x instanceof Error?x.message:c({id:`GuqOb1`})}):C.length===0&&!b?(0,V.jsx)(ne,{className:`px-2`,children:(0,V.jsx)(i,{id:`0BB9ID`})}):(0,V.jsxs)(`nav`,{"aria-label":c({id:`BymzO4`}),className:`relative`,children:[k>=0&&(0,V.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:Be,height:Be,transform:`translate(${fe}px, ${j}px)`}}),C.map((e,t)=>{let n=e.slug===D;return(0,V.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>de(t,e.slug),className:ue(`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)*ze+20}px`},title:e.text,children:e.text},t)})]}),t[33]=c,t[34]=k,t[35]=D,t[36]=x,t[37]=de,t[38]=C,t[39]=b,t[40]=fe,t[41]=j,t[42]=F):F=t[42];let I;t[43]!==b||t[44]!==F?(I=(0,V.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,V.jsxs)(se,{className:s,children:[P,I]}),t[46]=s,t[47]=P,t[48]=I,t[49]=L):L=t[49],L}function We(e){return e.slug}var Ge=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,H=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(Ge(e)):Ge,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+=Te(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`&&(H.prototype[Symbol.iterator]=function(){return this});var Ke={from:-1,to:-1,match:/.*/.exec(``)},qe=`gm`+(/x/.unicode==null?``:`u`),Je=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=Ke,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Ze(e,t,n,r,i);this.re=new RegExp(t,qe+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=$e(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=$e(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}}},Ye=new WeakMap,Xe=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=Ye.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return Ye.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)),Ye.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Ze=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Ke,this.matchPos=$e(e,r),this.re=new RegExp(t,qe+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Xe.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=$e(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Xe.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Je.prototype[Symbol.iterator]=Ze.prototype[Symbol.iterator]=function(){return this});function Qe(e){try{return new RegExp(e,qe),!0}catch{return!1}}function $e(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 et=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=pe(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))),ee=S.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[r,j.scrollIntoView(ee.from,{y:`center`})],selection:ee})}),!0},tt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},nt=O.define({combine(e){return y(e,tt,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function rt(e){let t=[lt,ct];return e&&t.push(nt.of(e)),t}var it=T.mark({class:`cm-selectionMatch`}),at=T.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function ot(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 st(e,t,n,r){return e(t.sliceDoc(n,n+1))==R.Word&&e(t.sliceDoc(r-1,r))==R.Word}var ct=A.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(nt),{state:n}=e,r=n.selection;if(r.ranges.length>1)return T.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return T.none;let e=n.wordAt(i.head);if(!e)return T.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 T.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(ot(o,n,i.from,i.to)&&st(o,n,i.from,i.to)))return T.none}else if(a=n.sliceDoc(i.from,i.to),!a)return T.none}let s=[];for(let r of e.visibleRanges){let e=new H(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||ot(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(at.range(r,a)):(r>=i.to||a<=i.from)&&s.push(it.range(r,a)),s.length>t.maxMatches))return T.none}}return T.set(s)}},{decorations:e=>e.decorations}),lt=j.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),ut=({state:e,dispatch:t})=>{let{selection:n}=e,r=S.create(n.ranges.map(t=>e.wordAt(t.head)||S.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function dt(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 H(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new H(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 ft=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return ut({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=dt(e,r);return i?(t(e.update({selection:e.selection.addRange(S.range(i.from,i.to),!1),effects:j.scrollIntoView(i.to)})),!0):!1},U=O.define({combine(e){return y(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Vt(e),scrollToMatch:e=>j.scrollIntoView(e)})}}),pt=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||Qe(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 St(this):new _t(this)}getCursor(e,t=0,n){let r=e.doc?e:b.create({doc:e});return n??=r.doc.length,this.regexp?G(this,r,t,n):W(this,r,t,n)}},mt=class{constructor(e){this.spec=e}};function ht(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 W(e,t,n,r){let i;return e.wholeWord&&(i=gt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=ht(e.test,t,i)),new H(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function gt(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(yt(i,n-a))!=R.Word||t(bt(i,n-a))!=R.Word)&&(t(bt(i,r-a))!=R.Word||t(yt(i,r-a))!=R.Word))}var _t=class extends mt{constructor(e){super(e)}nextMatch(e,t,n){let r=W(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=W(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=W(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=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-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 vt(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function G(e,t,n,r){let i;return e.wholeWord&&(i=xt(t.charCategorizer(t.selection.main.head))),e.test&&(i=vt(e.test,t,i)),new Je(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function yt(e,t){return e.slice(w(e,t,!1),t)}function bt(e,t){return e.slice(t,w(e,t))}function xt(e){return(t,n,r)=>!r[0].length||(e(yt(r.input,r.index))!=R.Word||e(bt(r.input,r.index))!=R.Word)&&(e(bt(r.input,r.index+r[0].length))!=R.Word||e(yt(r.input,r.index+r[0].length))!=R.Word)}var St=class extends mt{nextMatch(e,t,n){let r=G(this.spec,e,n,e.doc.length).next();return r.done&&(r=G(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=G(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=G(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=G(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)}},K=k.define(),Ct=k.define(),q=C.define({create(e){return new wt(Ft(e).create(),null)},update(e,t){for(let n of t.effects)n.is(K)?e=new wt(n.value.create(),e.panel):n.is(Ct)&&(e=new wt(e.query,n.value?Pt:null));return e},provide:e=>N.from(e,e=>e.panel)}),wt=class{constructor(e,t){this.query=e,this.panel=t}},Tt=T.mark({class:`cm-searchMatch`}),Et=T.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Dt=A.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(q))}update(e){let t=e.state.field(q);(t!=e.startState.field(q)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return T.none;let{view:n}=this,r=new E;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?Et:Tt)})}return r.finish()}},{decorations:e=>e.decorations});function J(e){return t=>{let n=t.state.field(q,!1);return n&&n.query.spec.valid?e(t,n):Rt(t)}}var Ot=J((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=S.single(r.from,r.to),a=e.state.facet(U);return e.dispatch({selection:i,effects:[Wt(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Lt(e),!0}),kt=J((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=S.single(i.from,i.to),o=e.state.facet(U);return e.dispatch({selection:a,effects:[Wt(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Lt(e),!0}),At=J((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:S.create(n.map(e=>S.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),jt=({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 H(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(S.range(t.value.from,t.value.to))}return t(e.update({selection:S.create(a,o),userEvent:`select.search.matches`})),!0},Mt=J((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(j.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`)));let d=e.state.changes(s);return o&&(c=S.single(o.from,o.to).map(d),u.push(Wt(e,o)),u.push(n.facet(U).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),Nt=J((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:j.announce.of(r),userEvent:`input.replace.all`}),!0});function Pt(e){return e.state.facet(U).createPanel(e)}function Ft(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(U);return new pt({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 It(e){let t=be(e,Pt);return t&&t.dom.querySelector(`[main-field]`)}function Lt(e){let t=It(e);t&&t==e.root.activeElement&&t.select()}var Rt=e=>{let t=e.state.field(q,!1);if(t&&t.panel){let n=It(e);if(n&&n!=e.root.activeElement){let r=Ft(e.state,t.query.spec);r.valid&&e.dispatch({effects:K.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Ct.of(!0),t?K.of(Ft(e.state,t.query.spec)):k.appendConfig.of(Kt)]});return!0},zt=e=>{let t=e.state.field(q,!1);if(!t||!t.panel)return!1;let n=be(e,Pt);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Ct.of(!1)}),!0},Bt=[{key:`Mod-f`,run:Rt,scope:`editor search-panel`},{key:`F3`,run:Ot,shift:kt,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:Ot,shift:kt,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:zt,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:jt},{key:`Mod-Alt-g`,run:et},{key:`Mod-d`,run:ft,preventDefault:!0}],Vt=class{constructor(e){this.view=e;let t=this.query=e.state.field(q).query.spec;this.commit=this.commit.bind(this),this.searchField=z(`input`,{value:t.search,placeholder:Y(e,`Find`),"aria-label":Y(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:Y(e,`Replace`),"aria-label":Y(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`,()=>Ot(e),[Y(e,`next`)]),n(`prev`,()=>kt(e),[Y(e,`previous`)]),n(`select`,()=>At(e),[Y(e,`all`)]),z(`label`,null,[this.caseField,Y(e,`match case`)]),z(`label`,null,[this.reField,Y(e,`regexp`)]),z(`label`,null,[this.wordField,Y(e,`by word`)]),...e.state.readOnly?[]:[z(`br`),this.replaceField,n(`replace`,()=>Mt(e),[Y(e,`replace`)]),n(`replaceAll`,()=>Nt(e),[Y(e,`replace all`)])],z(`button`,{name:`close`,onclick:()=>zt(e),"aria-label":Y(e,`close`),type:`button`},[`×`])])}commit(){let e=new pt({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:K.of(e)}))}keydown(e){me(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?kt:Ot)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Mt(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(K)&&!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(U).top}};function Y(e,t){return e.state.phrase(t)}var Ht=30,Ut=/[\s\.,:;?!]/;function Wt(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-Ht),o=Math.min(i,n+Ht),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<Ht;e++)if(!Ut.test(s[e+1])&&Ut.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-Ht;e--)if(!Ut.test(s[e-1])&&Ut.test(s[e])){s=s.slice(0,e);break}}return j.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Gt=j.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`}}),Kt=[q,v.low(Dt),Gt],qt=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},X=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet($).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new E,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=gn(s);if(i)o.add(n,n,T.widget({widget:new ln(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,T.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,Z(f))}};function Z(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 qt(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new qt(r.from,n,r.diagnostic)}),r}function Jt(e,t){let n=t.pos,r=t.end||n,i=e.state.facet($).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(Xt))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function Yt(e,t){return e.field(Q,!1)?t:t.concat(k.appendConfig.of(_n))}var Xt=k.define(),Zt=k.define(),Qt=k.define(),Q=C.define({create(){return new X(T.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=Z(n,e.selected.diagnostic,i)||Z(n,null,i)}!n.size&&i&&t.state.facet($).autoPanel&&(i=null),e=new X(n,i,r)}for(let n of t.effects)if(n.is(Xt)){let r=t.state.facet($).autoPanel?n.value.length?dn.open:null:e.panel;e=X.init(n.value,r,t.state)}else n.is(Zt)?e=new X(e.diagnostics,n.value?dn.open:null,e.selected):n.is(Qt)&&(e=new X(e.diagnostics,e.panel,n.value));return e},provide:e=>[N.from(e,e=>e.panel),j.decorations.from(e,e=>e.diagnostics)]}),$t=T.mark({class:`cm-lintRange cm-lintRange-active`});function en(e,t,n){let{diagnostics:r}=e.state.field(Q),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($).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:tn(e,i)}}}:null}function tn(e,t){return z(`ul`,{class:`cm-tooltip-lint`},t.map(t=>cn(e,t,!1)))}var nn=e=>{let t=e.state.field(Q,!1);(!t||!t.panel)&&e.dispatch({effects:Yt(e.state,[Zt.of(!0)])});let n=be(e,dn.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},rn=e=>{let t=e.state.field(Q,!1);return!t||!t.panel?!1:(e.dispatch({effects:Zt.of(!1)}),!0)},an=[{key:`Mod-Shift-m`,run:nn,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(Q,!1);if(!t)return!1;let n=e.state.selection.main,r=Z(t.diagnostics,null,n.to+1);return!r&&(r=Z(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)}}],$=O.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...y(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:on,tooltipFilter:on,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 on(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function sn(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 cn(e,t,n){let r=n?sn(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=Z(e.state.field(Q).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 ln=class extends _{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return z(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},un=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=cn(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},dn=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)rn(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=sn(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=Z(this.view.state.field(Q).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:()=>rn(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(Q).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(Q),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 un(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 un(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=Z(this.view.state.field(Q).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Qt.of(t)})}static open(t){return new e(t)}};function fn(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 pn(e){return fn(`<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 mn=j.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:pn(`#d11`)},".cm-lintRange-warning":{backgroundImage:pn(`orange`)},".cm-lintRange-info":{backgroundImage:pn(`#999`)},".cm-lintRange-hint":{backgroundImage:pn(`#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 hn(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function gn(e){let t=`hint`,n=1;for(let r of e){let e=hn(r.severity);e>n&&(n=e,t=r.severity)}return t}var _n=[Q,j.decorations.compute([Q],e=>{let{selected:t,panel:n}=e.field(Q);return!t||!n||t.from==t.to?T.none:T.set([$t.range(t.from,t.to)])}),ge(en,{hideOn:Jt}),mn],vn=[F(),xe(),P(),s(),M(),Se(),ve(),b.allowMultipleSelections.of(!0),x(),D(L,{fallback:!0}),he(),ke(),De(),_e(),I(),ye(),rt(),Ce.of([...Ee,...f,...Bt,...c,...we,...Oe,...an])];P(),s(),Se(),D(L,{fallback:!0}),Ce.of([...f,...c]);var yn={words:0,chars:0,tokens:0},bn=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,xn=/[\p{L}\p{N}]/u,Sn=new Set([`text`,`inlineCode`,`code`,`tag`]),Cn=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),wn=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function Tn(e,t){if(!e)return;let n=e.type;if(!Cn.has(n)){if(Sn.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
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{J as o,On as s,Y as c,ft as l,n as u,ot as d,q as f}from"./DocumentContext-DBiTzPPp.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-BNBODYwB.js";import{$t as p,Xr as m,Zi as h,i as le,nn as g}from"./prop-types-DfshR72P.js";import{S as ue}from"./button-DenIdY-r.js";import{$ as _,At as v,Bt as y,Dt as b,E as x,Et as S,Ft as C,Ht as w,J as T,Mt as E,N as D,Ot as O,Pt as k,Q as A,Rt as de,Ut as fe,X as j,_ as M,_t as N,ct as P,dt as F,et as I,f as L,gt as pe,ht as me,l as he,lt as ge,mt as _e,nt as ve,ot as ye,rt as be,st as xe,tt as Se,ut as Ce,wt as R,y as we,yt as z,zt as Te}from"./dist-Du-s1q8P.js";import{i as Ee,n as De,o as Oe,r as ke}from"./dist-BrsSsfiw.js";var B=e(t(),1),Ae=a(),je=new Map;function Me(e,t){je.set(e,t)}function Ne(e){let t=je.get(e)??null;return je.delete(e),t}function Pe(e){je.delete(e)}function Fe(e,t){let n=(0,Ae.c)(4),r=t===void 0?!1:t,[i,a]=(0,B.useState)(void 0),o=(0,B.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,B.useEffect)(s,c),i}var V=r(),Ie=300;async function Le(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new l(h._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=g.safeParse(n);throw e.success?Error(e.data.title):new l(h._({id:`zlErBl`}),{status:t.status})}let r=p.safeParse(n);if(!r.success)throw new l(h._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var Re=32,ze=12,Be=6,Ve=`open-knowledge:outline-nav`;function He(e){let t=(0,Ae.c)(2),n;return t[0]===e?n=t[1]:(n=(0,V.jsx)(s,{name:`outline-panel`,children:(0,V.jsx)(Ue,{...e})}),t[0]=e,t[1]=n),n}function Ue(e){let t=(0,Ae.c)(50),{docName:r,isSourceMode:a,className:o}=e,s=o===void 0?``:o,{_:c}=n(),{pages:l,loading:d}=le(),f=ce(),{activeProvider:p,activeDocName:m}=u(),h,g;t[0]===r?(h=t[1],g=t[2]):(h=[`page-headings`,r],g=()=>Le(r),t[0]=r,t[1]=h,t[2]=g);let _;t[3]!==r||t[4]!==d||t[5]!==l?(_=!d&&l.has(r),t[3]=r,t[4]=d,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]})},Ie)};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,B.useEffect)(w,T);let E;t[19]===C?E=t[20]:(E=C.map(We),t[19]=C,t[20]=E);let D=Fe(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`&&Me(r,{kind:`outline`,detail:n}),window.dispatchEvent(new CustomEvent(Ve,{detail:n}))},t[24]=r,t[25]=a,t[26]=A):A=t[26];let de=A,fe=((k>=0?C[k].level:1)-1)*ze+(ze-Be)/2,j=k*Re+(Re-Be)/2,M;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,V.jsx)(oe,{children:(0,V.jsx)(i,{id:`dD7NPy`})}),t[27]=M):M=t[27];let N;t[28]!==C.length||t[29]!==b?(N=!b&&(0,V.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,V.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]!==de||t[38]!==C||t[39]!==b||t[40]!==fe||t[41]!==j?(F=x?(0,V.jsx)(ee,{className:`px-2`,children:x instanceof Error?x.message:c({id:`GuqOb1`})}):C.length===0&&!b?(0,V.jsx)(ne,{className:`px-2`,children:(0,V.jsx)(i,{id:`0BB9ID`})}):(0,V.jsxs)(`nav`,{"aria-label":c({id:`BymzO4`}),className:`relative`,children:[k>=0&&(0,V.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:Be,height:Be,transform:`translate(${fe}px, ${j}px)`}}),C.map((e,t)=>{let n=e.slug===D;return(0,V.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>de(t,e.slug),className:ue(`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)*ze+20}px`},title:e.text,children:e.text},t)})]}),t[33]=c,t[34]=k,t[35]=D,t[36]=x,t[37]=de,t[38]=C,t[39]=b,t[40]=fe,t[41]=j,t[42]=F):F=t[42];let I;t[43]!==b||t[44]!==F?(I=(0,V.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,V.jsxs)(se,{className:s,children:[P,I]}),t[46]=s,t[47]=P,t[48]=I,t[49]=L):L=t[49],L}function We(e){return e.slug}var Ge=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,H=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(Ge(e)):Ge,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+=Te(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`&&(H.prototype[Symbol.iterator]=function(){return this});var Ke={from:-1,to:-1,match:/.*/.exec(``)},qe=`gm`+(/x/.unicode==null?``:`u`),Je=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=Ke,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Ze(e,t,n,r,i);this.re=new RegExp(t,qe+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=$e(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=$e(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}}},Ye=new WeakMap,Xe=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=Ye.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return Ye.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)),Ye.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Ze=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Ke,this.matchPos=$e(e,r),this.re=new RegExp(t,qe+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Xe.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=$e(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Xe.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Je.prototype[Symbol.iterator]=Ze.prototype[Symbol.iterator]=function(){return this});function Qe(e){try{return new RegExp(e,qe),!0}catch{return!1}}function $e(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 et=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=pe(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))),ee=S.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[r,j.scrollIntoView(ee.from,{y:`center`})],selection:ee})}),!0},tt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},nt=O.define({combine(e){return y(e,tt,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function rt(e){let t=[lt,ct];return e&&t.push(nt.of(e)),t}var it=T.mark({class:`cm-selectionMatch`}),at=T.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function ot(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 st(e,t,n,r){return e(t.sliceDoc(n,n+1))==R.Word&&e(t.sliceDoc(r-1,r))==R.Word}var ct=A.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(nt),{state:n}=e,r=n.selection;if(r.ranges.length>1)return T.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return T.none;let e=n.wordAt(i.head);if(!e)return T.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 T.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(ot(o,n,i.from,i.to)&&st(o,n,i.from,i.to)))return T.none}else if(a=n.sliceDoc(i.from,i.to),!a)return T.none}let s=[];for(let r of e.visibleRanges){let e=new H(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||ot(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(at.range(r,a)):(r>=i.to||a<=i.from)&&s.push(it.range(r,a)),s.length>t.maxMatches))return T.none}}return T.set(s)}},{decorations:e=>e.decorations}),lt=j.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),ut=({state:e,dispatch:t})=>{let{selection:n}=e,r=S.create(n.ranges.map(t=>e.wordAt(t.head)||S.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function dt(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 H(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new H(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 ft=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return ut({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=dt(e,r);return i?(t(e.update({selection:e.selection.addRange(S.range(i.from,i.to),!1),effects:j.scrollIntoView(i.to)})),!0):!1},U=O.define({combine(e){return y(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Vt(e),scrollToMatch:e=>j.scrollIntoView(e)})}}),pt=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||Qe(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 St(this):new _t(this)}getCursor(e,t=0,n){let r=e.doc?e:b.create({doc:e});return n??=r.doc.length,this.regexp?G(this,r,t,n):W(this,r,t,n)}},mt=class{constructor(e){this.spec=e}};function ht(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 W(e,t,n,r){let i;return e.wholeWord&&(i=gt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=ht(e.test,t,i)),new H(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function gt(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(yt(i,n-a))!=R.Word||t(bt(i,n-a))!=R.Word)&&(t(bt(i,r-a))!=R.Word||t(yt(i,r-a))!=R.Word))}var _t=class extends mt{constructor(e){super(e)}nextMatch(e,t,n){let r=W(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=W(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=W(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=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-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 vt(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function G(e,t,n,r){let i;return e.wholeWord&&(i=xt(t.charCategorizer(t.selection.main.head))),e.test&&(i=vt(e.test,t,i)),new Je(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function yt(e,t){return e.slice(w(e,t,!1),t)}function bt(e,t){return e.slice(t,w(e,t))}function xt(e){return(t,n,r)=>!r[0].length||(e(yt(r.input,r.index))!=R.Word||e(bt(r.input,r.index))!=R.Word)&&(e(bt(r.input,r.index+r[0].length))!=R.Word||e(yt(r.input,r.index+r[0].length))!=R.Word)}var St=class extends mt{nextMatch(e,t,n){let r=G(this.spec,e,n,e.doc.length).next();return r.done&&(r=G(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=G(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=G(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=G(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)}},K=k.define(),Ct=k.define(),q=C.define({create(e){return new wt(Ft(e).create(),null)},update(e,t){for(let n of t.effects)n.is(K)?e=new wt(n.value.create(),e.panel):n.is(Ct)&&(e=new wt(e.query,n.value?Pt:null));return e},provide:e=>N.from(e,e=>e.panel)}),wt=class{constructor(e,t){this.query=e,this.panel=t}},Tt=T.mark({class:`cm-searchMatch`}),Et=T.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Dt=A.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(q))}update(e){let t=e.state.field(q);(t!=e.startState.field(q)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return T.none;let{view:n}=this,r=new E;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?Et:Tt)})}return r.finish()}},{decorations:e=>e.decorations});function J(e){return t=>{let n=t.state.field(q,!1);return n&&n.query.spec.valid?e(t,n):Rt(t)}}var Ot=J((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=S.single(r.from,r.to),a=e.state.facet(U);return e.dispatch({selection:i,effects:[Wt(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Lt(e),!0}),kt=J((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=S.single(i.from,i.to),o=e.state.facet(U);return e.dispatch({selection:a,effects:[Wt(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Lt(e),!0}),At=J((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:S.create(n.map(e=>S.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),jt=({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 H(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(S.range(t.value.from,t.value.to))}return t(e.update({selection:S.create(a,o),userEvent:`select.search.matches`})),!0},Mt=J((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(j.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`)));let d=e.state.changes(s);return o&&(c=S.single(o.from,o.to).map(d),u.push(Wt(e,o)),u.push(n.facet(U).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),Nt=J((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:j.announce.of(r),userEvent:`input.replace.all`}),!0});function Pt(e){return e.state.facet(U).createPanel(e)}function Ft(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(U);return new pt({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 It(e){let t=be(e,Pt);return t&&t.dom.querySelector(`[main-field]`)}function Lt(e){let t=It(e);t&&t==e.root.activeElement&&t.select()}var Rt=e=>{let t=e.state.field(q,!1);if(t&&t.panel){let n=It(e);if(n&&n!=e.root.activeElement){let r=Ft(e.state,t.query.spec);r.valid&&e.dispatch({effects:K.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Ct.of(!0),t?K.of(Ft(e.state,t.query.spec)):k.appendConfig.of(Kt)]});return!0},zt=e=>{let t=e.state.field(q,!1);if(!t||!t.panel)return!1;let n=be(e,Pt);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Ct.of(!1)}),!0},Bt=[{key:`Mod-f`,run:Rt,scope:`editor search-panel`},{key:`F3`,run:Ot,shift:kt,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:Ot,shift:kt,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:zt,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:jt},{key:`Mod-Alt-g`,run:et},{key:`Mod-d`,run:ft,preventDefault:!0}],Vt=class{constructor(e){this.view=e;let t=this.query=e.state.field(q).query.spec;this.commit=this.commit.bind(this),this.searchField=z(`input`,{value:t.search,placeholder:Y(e,`Find`),"aria-label":Y(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:Y(e,`Replace`),"aria-label":Y(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`,()=>Ot(e),[Y(e,`next`)]),n(`prev`,()=>kt(e),[Y(e,`previous`)]),n(`select`,()=>At(e),[Y(e,`all`)]),z(`label`,null,[this.caseField,Y(e,`match case`)]),z(`label`,null,[this.reField,Y(e,`regexp`)]),z(`label`,null,[this.wordField,Y(e,`by word`)]),...e.state.readOnly?[]:[z(`br`),this.replaceField,n(`replace`,()=>Mt(e),[Y(e,`replace`)]),n(`replaceAll`,()=>Nt(e),[Y(e,`replace all`)])],z(`button`,{name:`close`,onclick:()=>zt(e),"aria-label":Y(e,`close`),type:`button`},[`×`])])}commit(){let e=new pt({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:K.of(e)}))}keydown(e){me(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?kt:Ot)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Mt(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(K)&&!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(U).top}};function Y(e,t){return e.state.phrase(t)}var Ht=30,Ut=/[\s\.,:;?!]/;function Wt(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-Ht),o=Math.min(i,n+Ht),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<Ht;e++)if(!Ut.test(s[e+1])&&Ut.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-Ht;e--)if(!Ut.test(s[e-1])&&Ut.test(s[e])){s=s.slice(0,e);break}}return j.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Gt=j.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`}}),Kt=[q,v.low(Dt),Gt],qt=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},X=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet($).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new E,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=gn(s);if(i)o.add(n,n,T.widget({widget:new ln(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,T.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,Z(f))}};function Z(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 qt(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new qt(r.from,n,r.diagnostic)}),r}function Jt(e,t){let n=t.pos,r=t.end||n,i=e.state.facet($).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(Xt))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function Yt(e,t){return e.field(Q,!1)?t:t.concat(k.appendConfig.of(_n))}var Xt=k.define(),Zt=k.define(),Qt=k.define(),Q=C.define({create(){return new X(T.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=Z(n,e.selected.diagnostic,i)||Z(n,null,i)}!n.size&&i&&t.state.facet($).autoPanel&&(i=null),e=new X(n,i,r)}for(let n of t.effects)if(n.is(Xt)){let r=t.state.facet($).autoPanel?n.value.length?dn.open:null:e.panel;e=X.init(n.value,r,t.state)}else n.is(Zt)?e=new X(e.diagnostics,n.value?dn.open:null,e.selected):n.is(Qt)&&(e=new X(e.diagnostics,e.panel,n.value));return e},provide:e=>[N.from(e,e=>e.panel),j.decorations.from(e,e=>e.diagnostics)]}),$t=T.mark({class:`cm-lintRange cm-lintRange-active`});function en(e,t,n){let{diagnostics:r}=e.state.field(Q),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($).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:tn(e,i)}}}:null}function tn(e,t){return z(`ul`,{class:`cm-tooltip-lint`},t.map(t=>cn(e,t,!1)))}var nn=e=>{let t=e.state.field(Q,!1);(!t||!t.panel)&&e.dispatch({effects:Yt(e.state,[Zt.of(!0)])});let n=be(e,dn.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},rn=e=>{let t=e.state.field(Q,!1);return!t||!t.panel?!1:(e.dispatch({effects:Zt.of(!1)}),!0)},an=[{key:`Mod-Shift-m`,run:nn,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(Q,!1);if(!t)return!1;let n=e.state.selection.main,r=Z(t.diagnostics,null,n.to+1);return!r&&(r=Z(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)}}],$=O.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...y(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:on,tooltipFilter:on,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 on(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function sn(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 cn(e,t,n){let r=n?sn(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=Z(e.state.field(Q).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 ln=class extends _{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return z(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},un=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=cn(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},dn=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)rn(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=sn(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=Z(this.view.state.field(Q).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:()=>rn(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(Q).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(Q),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 un(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 un(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=Z(this.view.state.field(Q).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Qt.of(t)})}static open(t){return new e(t)}};function fn(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 pn(e){return fn(`<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 mn=j.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:pn(`#d11`)},".cm-lintRange-warning":{backgroundImage:pn(`orange`)},".cm-lintRange-info":{backgroundImage:pn(`#999`)},".cm-lintRange-hint":{backgroundImage:pn(`#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 hn(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function gn(e){let t=`hint`,n=1;for(let r of e){let e=hn(r.severity);e>n&&(n=e,t=r.severity)}return t}var _n=[Q,j.decorations.compute([Q],e=>{let{selected:t,panel:n}=e.field(Q);return!t||!n||t.from==t.to?T.none:T.set([$t.range(t.from,t.to)])}),ge(en,{hideOn:Jt}),mn],vn=[F(),xe(),P(),o(),M(),Se(),ve(),b.allowMultipleSelections.of(!0),x(),D(L,{fallback:!0}),he(),ke(),De(),_e(),I(),ye(),rt(),Ce.of([...Ee,...f,...Bt,...c,...we,...Oe,...an])];P(),o(),Se(),D(L,{fallback:!0}),Ce.of([...f,...c]);var yn={words:0,chars:0,tokens:0},bn=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,xn=/[\p{L}\p{N}]/u,Sn=new Set([`text`,`inlineCode`,`code`,`tag`]),Cn=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),wn=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function Tn(e,t){if(!e)return;let n=e.type;if(!Cn.has(n)){if(Sn.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
3
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)Tn(n,t);if(wn.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
4
4
  `)&&t.push(`
5
5
  `)}}}}function En(e){try{let t=d().parseToMdast(e),n=[];return Tn(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function Dn(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))xn.test(n)&&t++;return t}function On(e){let t=globalThis.Intl.Segmenter;if(!t)return Dn(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function kn(e){let t=bn.test(e)?1.5:4;return Math.ceil(e.length/t)}function An(e){return e?{words:bn.test(e)?On(e):Dn(e),chars:e.length,tokens:kn(e)}:{words:0,chars:0,tokens:0}}function jn(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=m(e);return t.trim()?An(En(t)):{words:0,chars:0,tokens:0}}function Mn(e,{isMarkdown:t}){let n=e.trim();return n?An(t?En(e):n):yn}var Nn=new Map,Pn=new Set,Fn=(e,t)=>`${t}:${e}`;function In(){for(let e of Pn)e()}function Ln(e,t,n){let r=Fn(e,t);if(n===null){Nn.delete(r)&&In();return}let i=Nn.get(r);i&&i.words===n.words&&i.chars===n.chars&&i.tokens===n.tokens||(Nn.set(r,n),In())}function Rn(e,t){return e===null?null:Nn.get(Fn(e,t))??null}function zn(e){return Pn.add(e),()=>{Pn.delete(e)}}function Bn(e){let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
@@ -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-DJYXzJag.js"></script>
51
+ <script type="module" crossorigin src="./assets/index-A7P-olmm.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-B5t0fahT.js">
@@ -61,24 +61,24 @@
61
61
  <link rel="modulepreload" crossorigin href="./assets/compiler-runtime-Cs91PcD2.js">
62
62
  <link rel="modulepreload" crossorigin href="./assets/trace-api-CiCjX4Sz.js">
63
63
  <link rel="modulepreload" crossorigin href="./assets/button-DenIdY-r.js">
64
- <link rel="modulepreload" crossorigin href="./assets/prop-types-3UnRySkO.js">
64
+ <link rel="modulepreload" crossorigin href="./assets/prop-types-DfshR72P.js">
65
65
  <link rel="modulepreload" crossorigin href="./assets/propagation-api-3kmMXRwS.js">
66
66
  <link rel="modulepreload" crossorigin href="./assets/collapsible-BhpeB6tu.js">
67
67
  <link rel="modulepreload" crossorigin href="./assets/dist-DicqJavT.js">
68
68
  <link rel="modulepreload" crossorigin href="./assets/dialog-B1es0EvU.js">
69
- <link rel="modulepreload" crossorigin href="./assets/DocumentContext-9X09oG0N.js">
69
+ <link rel="modulepreload" crossorigin href="./assets/DocumentContext-DBiTzPPp.js">
70
70
  <link rel="modulepreload" crossorigin href="./assets/panel-BNBODYwB.js">
71
- <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-D4PNvLF3.js">
71
+ <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-Hj7RQFt0.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/checkbox-Co7Tjlri.js">
73
73
  <link rel="modulepreload" crossorigin href="./assets/label-DwEePOBC.js">
74
74
  <link rel="modulepreload" crossorigin href="./assets/dist-P7DYrfOB.js">
75
75
  <link rel="modulepreload" crossorigin href="./assets/textarea-luaT-nOK.js">
76
76
  <link rel="modulepreload" crossorigin href="./assets/toggle-group-Cs-1L92l.js">
77
- <link rel="modulepreload" crossorigin href="./assets/config-validation-events-CTKSLfrC.js">
77
+ <link rel="modulepreload" crossorigin href="./assets/config-validation-events-Co2Fzxvd.js">
78
78
  <link rel="modulepreload" crossorigin href="./assets/agent-presence-DxGcS3q2.js">
79
- <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-SROx-nlb.js">
79
+ <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-o4RtIHjG.js">
80
80
  <link rel="modulepreload" crossorigin href="./assets/project-paths-CsGHlmFh.js">
81
- <link rel="modulepreload" crossorigin href="./assets/keyboard-shortcuts-D1ntCgJI.js">
81
+ <link rel="modulepreload" crossorigin href="./assets/keyboard-shortcuts-B7RaCLwK.js">
82
82
  <link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-CijO54Jd.js">
83
83
  <link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
84
84
  <link rel="stylesheet" crossorigin href="./assets/index-Bt-jLYAb.css">
@@ -1,2 +1,2 @@
1
- import{h as e,n as t}from"./init-Ciq04XPD.mjs";import{t as n}from"./is-object-C-4FJ0rP.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-XAE_JN-m.mjs.map
1
+ import{h as e,n as t}from"./init-T36y4VG4.mjs";import{t as n}from"./is-object-C-4FJ0rP.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-D2ZvteMx.mjs.map
@@ -1,2 +1,2 @@
1
- import{D as e,d as t,g as n,j as r,k as i}from"./init-Ciq04XPD.mjs";import{t as a}from"./mcp-migrate-event-BF8ILHwp.mjs";import{homedir as o}from"node:os";function s(t){let n=t.logger??u,r=t.home??o(),a=[];if(t.reclaimDisableEnv===`1`)return n({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of e){let e=i[o],s=c(()=>e.configPath(``,r));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:e,home:r,cwd:``,configPath:s,configPathOverride:void 0,logger:n})),e.projectConfigPath){let r=e.projectConfigPath,i=c(()=>r(t.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:e,home:void 0,cwd:t.projectDir,configPath:i,configPathOverride:i,logger:n}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(e){let i={scope:e.scope,editorId:e.editorId,configPath:e.configPath},o=t(e.target,e.cwd,e.home,e.configPathOverride);if(o===null)return{...i,outcome:`no-entry`};if(r(o))return{...i,outcome:`canonical`};e.logger(a({scope:e.scope,surface:`cli-repair`,editorId:e.editorId,configPath:e.configPath,priorEntry:o}));let s=n(e.target,e.cwd,{mode:`published`,skipAvailabilityCheck:!0},e.home,e.configPathOverride);if(s.action===`failed`){let t=s.error??`unknown write failure`;return e.logger({event:`mcp-config-repair-write-failed`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,error:t}),{...i,outcome:`write-failed`,error:t}}return{...i,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
2
- //# sourceMappingURL=repair-mcp-configs-DF6fmbaO.mjs.map
1
+ import{D as e,d as t,g as n,j as r,k as i}from"./init-T36y4VG4.mjs";import{t as a}from"./mcp-migrate-event-BF8ILHwp.mjs";import{homedir as o}from"node:os";function s(t){let n=t.logger??u,r=t.home??o(),a=[];if(t.reclaimDisableEnv===`1`)return n({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of e){let e=i[o],s=c(()=>e.configPath(``,r));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:e,home:r,cwd:``,configPath:s,configPathOverride:void 0,logger:n})),e.projectConfigPath){let r=e.projectConfigPath,i=c(()=>r(t.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:e,home:void 0,cwd:t.projectDir,configPath:i,configPathOverride:i,logger:n}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(e){let i={scope:e.scope,editorId:e.editorId,configPath:e.configPath},o=t(e.target,e.cwd,e.home,e.configPathOverride);if(o===null)return{...i,outcome:`no-entry`};if(r(o))return{...i,outcome:`canonical`};e.logger(a({scope:e.scope,surface:`cli-repair`,editorId:e.editorId,configPath:e.configPath,priorEntry:o}));let s=n(e.target,e.cwd,{mode:`published`,skipAvailabilityCheck:!0},e.home,e.configPathOverride);if(s.action===`failed`){let t=s.error??`unknown write failure`;return e.logger({event:`mcp-config-repair-write-failed`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,error:t}),{...i,outcome:`write-failed`,error:t}}return{...i,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
2
+ //# sourceMappingURL=repair-mcp-configs-B0Zod3GV.mjs.map
@@ -0,0 +1 @@
1
+ import{t as e}from"./repair-skills-PR-WFCoP.mjs";export{e as repairSkills};
@@ -1,3 +1,3 @@
1
- import{t as e}from"./esm-CEs3LWY3.mjs";import{Ni as t,Tr as n,_r as r,jr as i,xr as a}from"./dist-C0xnaEtj.mjs";import{t as o}from"./write-project-skill-AEaG6bcq.mjs";import{existsSync as s,mkdirSync as c,readFileSync as l,readdirSync as u,rmSync as d,statSync as f,writeFileSync as p}from"node:fs";import{dirname as m,join as h,resolve as g}from"node:path";import{homedir as _}from"node:os";const v=[{hostDir:`.claude`,editorId:`claude`},{hostDir:`.cursor`,editorId:`cursor`},{hostDir:`.agents`,editorId:`codex`}],y=`open-knowledge-discovery`,b=[`.agents`,`skills`,y],x={existsSync:e=>s(e),isDirectory:e=>{try{return f(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>u(e),readFileSync:e=>l(e),writeFileSync:(e,t)=>{p(e,t)},mkdirSync:(e,t)=>{c(e,t)},rmSync:(e,t)=>{d(e,t)}},S={resolveProjectBundledSkillDir:()=>i(`project`,{checkDesktop:!1}),resolveDiscoveryBundledSkillDir:()=>i(`discovery`,{checkDesktop:!1}),readBundledVersion:()=>r(),readRecordedVersion:e=>a(e,`cli-hosts`),writeRecordedVersion:(e,n)=>t(e,`cli-hosts`,n,`cli-start`),recordEvent:e=>n(e)};function C(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function w(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(m(t),{recursive:!0}),T(e,t,n)}function T(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=h(e,r),a=h(t,r);n.isDirectory(i)?T(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function E(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 v){let s=h(e,t.hostDir,`skills`,`open-knowledge`),c=h(s,`SKILL.md`);if(!n.existsSync(c)){a.push({editorId:t.editorId,hostDir:t.hostDir,path:s,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:s});continue}try{o(s,e),w(i,s,n),a.push({editorId:t.editorId,hostDir:t.hostDir,path:s,outcome:`reclaimed`}),r({event:`project-skill-reclaim-reclaimed`,scope:`project`,editorId:t.editorId,path:s})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:s,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:s,error:n})}}return{outcome:`done`,entries:a}}async function D(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=h(e,...b),d=n.existsSync(u);try{w(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 v){let i=h(e,t.hostDir),a=h(i,`skills`,y);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{w(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 O(e){let t=e.logger??C,n=e.fs??x,r=e.home??_(),i={...S,...e.deps};return e.reclaimDisableEnv===`1`?(t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`}):{status:`done`,project:E(e.projectDir,i,n,t),user:await D(r,i,n,t)}}function k(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 A(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===`no-token`).length,i=e.project.entries.filter(e=>e.outcome===`failed`).length;t.push(` Project: ${n} reclaimed, ${r} no-token, ${i} 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-CEs3LWY3.mjs";import{Ni as t,Tr as n,_r as r,jr as i,xr as a}from"./dist-CCyYJGQt.mjs";import{t as o}from"./write-project-skill-IhCllMlm.mjs";import{existsSync as s,mkdirSync as c,readFileSync as l,readdirSync as u,rmSync as d,statSync as f,writeFileSync as p}from"node:fs";import{dirname as m,join as h,resolve as g}from"node:path";import{homedir as _}from"node:os";const v=[{hostDir:`.claude`,editorId:`claude`},{hostDir:`.cursor`,editorId:`cursor`},{hostDir:`.agents`,editorId:`codex`}],y=`open-knowledge-discovery`,b=[`.agents`,`skills`,y],x={existsSync:e=>s(e),isDirectory:e=>{try{return f(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>u(e),readFileSync:e=>l(e),writeFileSync:(e,t)=>{p(e,t)},mkdirSync:(e,t)=>{c(e,t)},rmSync:(e,t)=>{d(e,t)}},S={resolveProjectBundledSkillDir:()=>i(`project`,{checkDesktop:!1}),resolveDiscoveryBundledSkillDir:()=>i(`discovery`,{checkDesktop:!1}),readBundledVersion:()=>r(),readRecordedVersion:e=>a(e,`cli-hosts`),writeRecordedVersion:(e,n)=>t(e,`cli-hosts`,n,`cli-start`),recordEvent:e=>n(e)};function C(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function w(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(m(t),{recursive:!0}),T(e,t,n)}function T(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=h(e,r),a=h(t,r);n.isDirectory(i)?T(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function E(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 v){let s=h(e,t.hostDir,`skills`,`open-knowledge`),c=h(s,`SKILL.md`);if(!n.existsSync(c)){a.push({editorId:t.editorId,hostDir:t.hostDir,path:s,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:s});continue}try{o(s,e),w(i,s,n),a.push({editorId:t.editorId,hostDir:t.hostDir,path:s,outcome:`reclaimed`}),r({event:`project-skill-reclaim-reclaimed`,scope:`project`,editorId:t.editorId,path:s})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:s,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:s,error:n})}}return{outcome:`done`,entries:a}}async function D(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=h(e,...b),d=n.existsSync(u);try{w(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 v){let i=h(e,t.hostDir),a=h(i,`skills`,y);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{w(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 O(e){let t=e.logger??C,n=e.fs??x,r=e.home??_(),i={...S,...e.deps};return e.reclaimDisableEnv===`1`?(t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`}):{status:`done`,project:E(e.projectDir,i,n,t),user:await D(r,i,n,t)}}function k(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 A(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===`no-token`).length,i=e.project.entries.filter(e=>e.outcome===`failed`).length;t.push(` Project: ${n} reclaimed, ${r} no-token, ${i} 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 j(){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 O({projectDir:g(process.cwd()),reclaimDisableEnv:process.env.OK_RECLAIM_DISABLE??null});process.stdout.write(`${A(e)}\n`),process.exitCode=k(e)})}export{j as n,O as t};
3
- //# sourceMappingURL=repair-skills-BRxi0rRb.mjs.map
3
+ //# sourceMappingURL=repair-skills-PR-WFCoP.mjs.map
@@ -424,5 +424,5 @@ $2`).split(`
424
424
  `;return l.join(f)},table(e,t,n,r){let i=n.enter(`table`),a=[],o=[],s=e.children??[];for(let e of s){let t=e.children??[],i=[],s=[];for(let e of t){let t=n.enter(`tableCell`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,{...r,before:` `,after:` `});a(),t(),i.push(o);let c=e.data?.sourcePadding;s.push(c&&typeof c.left==`number`&&typeof c.right==`number`?{left:c.left,right:c.right}:null)}a.push(i),o.push(s)}i();let c=e.align??[],l=e.data?.sourceDashCounts,u=a[0]?.length??0,d=a.slice(1).reduce((e,t)=>Math.max(e,t.length),0),f=Math.max(u,d,c.length),p=[];for(let e=0;e<f;e++){let t=c[e],n=``,r=``;t===`center`?(n=`:`,r=`:`):t===`left`?n=`:`:t===`right`&&(r=`:`);let i=l?.[e],a=typeof i==`number`&&i>=1?i:1;p.push(n+`-`.repeat(a)+r)}let m=(e,t)=>{let n=[];for(let r=0;r<f;r++){let i=e[r]??``,a=t[r]??{left:1,right:1};n.push(` `.repeat(a.left)+i+` `.repeat(a.right))}return`|${n.join(`|`)}|`},h=Array.from({length:f},()=>null);if(a.length===0)return m(p,h);let g=[];g.push(m(a[0],o[0]??[])),g.push(m(p,h));for(let e=1;e<a.length;e++)g.push(m(a[e],o[e]??[]));return g.join(`
425
425
  `)},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=IZ(i.attributes??[]);if(!i.children||i.children.length===0)return s?c?`<${s} ${c} />`:`<${s} />`:``;let l=c?`<${s} ${c}>`:`<${s}>`,u=`</${s}>`;return`${l}\n\n${n.containerFlow({type:`root`,children:i.children},r)}\n\n${u}`},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=IZ(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)=>n?`>`:s?.[c++]===`none`?`>${e}`:`> ${e}`)}};function IZ(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`){if(n.value.includes(`"`)){let r=n.value.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`);t.push(`${e}={"${r}"}`)}else t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function LZ(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function RZ(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 zZ(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>BZ(t)?e:`\\${e}`)}function BZ(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 VZ(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==="`"));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return zZ(i)}function HZ(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 UZ=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};constructor(e){this.schema=Ny(e.extensions),this.handlers=$Z(this.schema,this.parseCtx);let{nodeHandlers:t,markHandlers:n}=eQ(this.schema);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=EZ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=DZ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers,toMarkdownHandlers:FZ})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return OZ(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?kZ(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?$J(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 AZ(t,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}};const WZ=HJ();function GZ(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 KZ(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 qZ(e){return e.attrs.sourceDirty||KZ(e)}function JZ(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 YZ(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),Object.keys(n).length===0?e:{...e,data:n}}function XZ(e,t){if(e.length===0)return YZ({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return YZ({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:[XZ(n.children,t)]}}return YZ({type:`inlineCode`,value:ZZ(e)},t)}function ZZ(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=ZZ(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const QZ=HG;function $Z(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=GL(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=GL(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;return n.table.createAndFill({sourceDashCounts:s},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=PZ(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=[],l=0;for(let t of s){if(t.offset>l){let r=n.slice(l,t.offset).replaceAll(`\xA0`,` `);r&&c.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length).replaceAll(`\xA0`,` `);i&&(t.kind===`escape`?c.push(e.text(i,[r.escapeMark.create()])):r.sourceLiteral?c.push(e.text(i,[r.sourceLiteral.create({sourceRaw:t.raw})])):c.push(e.text(i))),l=t.offset+t.length}}if(l<n.length){let t=n.slice(l).replaceAll(`\xA0`,` `);t&&c.push(e.text(t))}return c.length===1?c[0]:c}),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})]));let a=r.strike??r.delete;if(a&&(i.delete=KL(a)),r.highlight&&(i.mark=KL(r.highlight)),r.comment&&(i.comment=KL(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=GL(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=KL(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=KL(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=GL(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}))),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`},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=GL(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=GL(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread}))),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=WZ.getOrWildcard(o),c=GZ(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=PZ(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})),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=cq(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&&QZ.has(l)&&n.jsxComponent&&WZ.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&&UG.has(l)&&n.jsxComponent&&WZ.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&&GG.has(l)&&n.jsxComponent&&WZ.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&&KG.has(l)&&n.jsxComponent&&WZ.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:HZ(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($G.has(l)&&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])}if(r.link){let t=r.link.create({href:o,title:null,linkStyle:`inline`,refLabel:null});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??``})),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=GL(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}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function eQ(e){let t={},n={},r=e.nodes,i=e.marks;r.paragraph&&(t.paragraph=ZL(`paragraph`)),r.blockquote&&(t.blockquote=ZL(`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=ZL(`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}}))),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}}}),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=ZL(`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&&JZ(r[0])?r.slice(1):r;return{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,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?{sourceDashCounts:s}:void 0,l={type:`table`,align:i,children:o};return c&&(l.data=c),l}),r.tableRow&&(t.tableRow=ZL(`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=ZL(`tableCell`,a)),r.tableHeader&&(t.tableHeader=ZL(`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!qZ(e)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:r,attributes:i,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:WZ.getOrWildcard(r??`*`).serialize(e,{all:e=>n.all(e),registry:WZ,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;return typeof n==`string`&&n.length>0?{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]}:{type:`inlineMath`,value:t}}),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},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=QL(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.strong&&(n.strong=QL(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.code&&(n.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return XZ(n,{sourceFenceChar:r,sourceFenceLength:i})}),i.strike??i.delete){let e=i.strike?`strike`:`delete`;n[e]=QL(`delete`)}return i.highlight&&(n.highlight=QL(`mark`)),i.comment&&(n.comment=QL(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),r.commentBlock&&(t.commentBlock=ZL(`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=ZL(`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??``,n=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,r=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?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}]}}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??{},t.data.escapedChars=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 XK(t,e.value)&&(e.data=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 tQ=/\p{M}+/gu,nQ=/[^\p{L}\p{N}]+/gu,rQ=/^-+|-+$/g;function iQ(e){return e.trim().normalize(`NFKD`).replace(tQ,``).toLowerCase().replace(nQ,`-`).replace(rQ,``)}function aQ(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function oQ(e,t){let n=iQ(e);return n?aQ(n,t):``}const sQ=VB(),cQ=aB(),lQ=oB();function uQ(){return BJ.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function dQ(){return uQ().filter(e=>fQ(e)!==`fence`)}function fQ(e){return e.name===`MermaidFence`?`fence`:e.hasChildren?`jsx-block`:`jsx-void`}function pQ(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:fQ(e)}}function mQ(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 hQ(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 gQ(e){let t=[];for(let n of e.props){let e=mQ(n);e!==void 0&&hQ(n,e)&&t.push($q(n.name,e))}return t}function _Q(e){return pz(e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`Body content here.`,{extensions:[sQ],mdastExtensions:[cQ]}).children}function vQ(e){let t=fQ(e),n;if(t===`fence`)n={type:`code`,lang:`mermaid`,meta:null,value:e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`graph LR
426
426
  A --> B`};else{let r=gQ(e),i=t===`jsx-block`?_Q(e):[];n={type:`mdxJsxFlowElement`,name:e.name,attributes:r,children:i}}return oP({type:`root`,children:[n]},{extensions:[lQ]}).trimEnd()}function yQ(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 bQ(e){return{...pQ(e),example:vQ(e),params:yQ(e)}}function xQ(){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 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.",``,...dQ().map(pQ).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
427
- `)}const SQ=N({docName:vq,summary:bq,content:k().optional(),...yq}).loose(),CQ=N({docName:vq,summary:bq,markdown:k(),position:P([`append`,`prepend`,`replace`]).optional(),extension:P([`.md`,`.mdx`]).optional(),...yq}).loose(),wQ=N({docName:vq,summary:bq,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...yq}).loose(),TQ=N({docName:vq,connectionId:k().min(1),scope:P([`last`,`session`,`file`]).optional(),...yq}).loose(),EQ=N({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),DQ=Zs(`kind`,[N({kind:F(`inline`),content:k()}),N({kind:F(`truncated`),byteLength:A().int().nonnegative(),hint:k()})]),OQ=N({kind:F(`content-divergence`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),divergenceType:k().optional(),currentState:DQ.optional(),hint:k().optional()}).loose(),kQ=N({type:F(`orphan`),parentCandidates:M(k()),message:k()}).loose(),AQ=Zs(`kind`,[OQ,N({kind:F(`disk-edit-reconciled`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),hint:k().optional()}).loose()]),jQ=N({timestamp:k().min(1),summary:EQ.optional(),warning:AQ.optional()}).loose(),MQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:M(kQ).optional(),summary:EQ.optional(),warning:AQ.optional()}).loose(),NQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:EQ.optional(),warning:AQ.optional()}).loose(),PQ=N({docName:k().min(1),scope:P([`last`,`session`]),undone:j()}).loose(),FQ=N({docName:vq,patch:tc(k(),Ys([jW,Rs()])),types:tc(k(),P(AW)).optional(),summary:bq,...yq}).loose(),IQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:M(k()),summary:EQ.optional(),warning:AQ.optional()}).loose(),LQ=N({entries:M(N({level:P([`info`,`warn`,`error`]),message:k().max(8192),event:k().optional(),fields:tc(k(),Hs()).optional(),ts:A().optional(),sourceId:k().optional(),lineNumber:A().optional()}).loose()).max(100)}).loose(),RQ=N({accepted:A().int().min(0)}).loose(),zQ=N({status:k().min(1),reason:k()}).loose(),BQ=N({docName:k().min(1),content:k(),lifecycle:zQ.nullable()}).loose(),VQ=N({documents:M(N({kind:P([`document`,`asset`,`folder`]).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.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName)`})),truncated:j().optional()}).loose(),HQ=N({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),UQ=N({docName:k().min(1),backlinks:M(HQ)}).loose(),WQ=N({counts:tc(k().min(1),A().int().nonnegative())}).loose(),GQ=Zs(`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()]),KQ=N({docName:k().min(1),forwardLinks:M(GQ)}).loose(),qQ=Zs(`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()]),JQ=N({source:k().min(1),target:k().min(1)}).loose(),YQ=N({nodes:M(qQ),links:M(JQ)}).loose(),XQ=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(),ZQ=N({app:Ys([F(`cursor`),F(`codex`),F(`claude`),Rs()]),signals_fired:M(k())}).loose(),QQ=N({entries:M(XQ),count:A().int().min(0),detection:ZQ}).loose(),$Q=N({writers:M(N({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),summary:bq,...yq}).loose(),e$=N({checkpointRef:k().min(1)}).loose(),t$=N({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:M(k()),summaries:M(k()).optional()}).loose(),n$=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(t$),checkpoint:Hs().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:j().optional()}).loose(),r$=N({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose(),i$=N({lines:M(N({type:P([`added`,`removed`,`unchanged`]),text:k()}).loose()),additions:A().int().nonnegative(),deletions:A().int().nonnegative()}).loose(),a$=N({contentDir:k().min(1),pathSeparator:P([`/`,`\\`]),symlinkResolved:j()}).loose(),o$=M(Zs(`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`."}),s$=N({orphans:M(N({docName:k().min(1),title:k()}).loose())}).loose(),c$=N({hubs:M(N({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),l$=N({source:k().min(1),title:k(),snippet:k().nullable()}).loose(),u$=N({deadLinks:M(N({target:k().min(1),sources:M(l$)}).loose())}).loose(),d$=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(),f$=N({dir:k().min(1),port:A().int().min(1).max(65535).optional()}).loose(),p$=N({port:A().int().positive()}).loose(),m$=N({projectPath:k().min(1)}).loose(),h$=P([`not-a-git-worktree`,`init-failed`]),g$=Zs(`ok`,[N({ok:F(!0),projectPath:k().min(1)}).loose(),N({ok:F(!1),reason:h$,message:k().min(1)}).loose()]),_$=N({host:k().min(1).optional()}).loose(),v$=N({pat:k().min(1),host:k().min(1).optional()}).loose(),y$=N({key:k().min(1)}).loose(),b$=N({keyPresent:j()}).loose(),x$=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(),S$=N({identity:N({name:k().min(1),email:k().min(1)}).loose().nullable()}).loose(),C$=N({authenticated:j()}).loose(),w$=N({type:F(`complete`).optional(),login:k().min(1).optional()}).loose(),T$=N({}).loose(),E$=N({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),D$=N({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:M(E$)}).loose(),O$=N({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),k$=N({sessionAlive:j(),agent:O$.nullable(),files:M(D$)}).loose(),A$=N({diff:k(),generatedAt:A().int().min(0)}).loose(),j$=N({}).loose(),M$=N({}).loose(),N$=N({}).loose(),P$=N({}).loose(),F$=N({}).loose(),I$=N({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:P([`idle`,`writing`]),ts:A().int().min(0)}).loose(),L$=N({presence:tc(k().min(1),I$)}).loose(),R$=tc(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 z$=N({}).loose(),B$=N({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),V$=N({fromPath:k().min(1),toPath:k().min(1)}).loose(),H$=N({}).loose(),U$=N({path:k().min(1),...yq,summary:bq}).loose(),W$=N({docName:k().min(1)}).loose(),G$=N({path:k().min(1),...yq,summary:bq}).loose(),K$=N({path:k().min(1)}).loose(),q$=N({kind:P([`file`,`folder`]),path:k().min(1),...yq,summary:bq}).loose(),J$=N({kind:P([`file`,`folder`]),path:k().min(1),duplicatedDocNames:M(k().min(1))}).loose(),Y$=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(),X$=N({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),Z$=N({docName:k().min(1),headings:M(X$)}).loose(),Q$=N({docName:k().min(1),rewrites:A().int().nonnegative()}).loose(),$$=N({kind:P([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...yq,summary:bq}).loose(),e1=N({renamed:M(B$),renamedAssets:M(V$),rewrittenDocs:M(Q$).optional(),summary:EQ.optional()}).loose(),t1=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...yq}).loose(),n1=N({deletedDocNames:M(k().min(1))}).loose(),r1=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...yq,summary:bq}).loose(),i1=N({deletedDocNames:M(k().min(1))}).loose(),a1=N({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:bq,...yq}).loose(),o1=N({restoredFrom:k().min(1),timestamp:k().min(1),summary:EQ.optional(),warning:OQ.optional()}).loose(),s1=P([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),c1=N({label:k().min(1),webUrl:_s().nullable()}).loose(),l1=Zs(`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()]),u1=P([`auth-403`,`auth-401`,`auth-scope-mismatch`,`semantic-protected-branch`]),d1=N({state:s1,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:c1.nullable().optional(),pushError:k().optional(),pushErrorCode:u1.optional(),pullError:k().optional(),pullErrorCode:u1.optional(),pausedReason:k().optional(),pushPermission:l1.optional()}).loose(),f1=N({op:P([`sync`,`push`,`pull`]).optional()}).loose(),p1=N({op:P([`sync`,`push`,`pull`])}).loose(),m1=N({conflicts:M(N({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose())}).loose(),h1=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`]}),g1=N({}).loose(),_1=N({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:P([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),v1=N({}).loose(),y1=N({plan:Tc(e=>e!==void 0,{message:`plan is required`})}).loose(),b1=N({plan:Tc(e=>e!==void 0,{message:`plan is required`})}).loose(),x1=N({result:Tc(e=>e!==void 0,{message:`result is required`})}).loose(),S1=N({path:k().min(1),summary:k().min(1)}).loose(),C1=N({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose(),w1=N({packs:M(N({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:M(S1),entryCounts:C1}).loose())}).loose(),T1=N({noOpen:j().optional(),out:k().min(1).optional()}).loose(),E1=N({reason:P([`unsupported-platform`,`spawn-error`]),message:k()}).loose(),D1=Zs(`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:E1.optional()}).loose(),N({status:F(`failed`),buildError:k()}).loose(),N({status:F(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]),O1=N({tags:M(N({name:k().min(1),count:A().int().nonnegative(),isLeaf:j()}).loose())}).loose(),k1=N({docName:k().min(1),title:k(),matchingTags:M(k().min(1)),snippet:k().nullable()}).loose(),A1=N({name:k().min(1),docs:M(k1)}).loose(),j1=N({folder:Hs(),frontmatter_local:tc(k(),Hs()).nullable()}).loose(),M1=N({path:k(),frontmatter:tc(k(),Hs()).optional()}).loose(),N1=N({applied:Hs()}).loose(),P1=tc(k(),Hs()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),F1=N({template:N({name:k().min(1),folder:k(),scope:P([`local`,`inherited`]),path:k().min(1),frontmatter:P1,body:k()}).strict()}).strict(),I1=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(),L1=N({folder:k(),name:k(),body:k().optional(),frontmatter:P1.optional(),...yq,summary:bq}).strict(),R1=N({path:k().min(1),created:j(),warnings:M(k())}).strict(),z1=N({existed:j(),path:k().min(1)}).strict(),B1=N({fromFolder:k(),fromName:k(),toFolder:k(),toName:k(),body:k().optional(),frontmatter:P1.optional(),...yq,summary:bq}).strict(),V1=N({from:k().min(1),to:k().min(1),committed:j()}).strict(),H1=N({query:k().optional(),intent:P([`autocomplete`,`full_text`,`omnibar`]).optional(),scopes:M(P([`page`,`folder`,`content`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional(),semantic:j().optional()}).loose(),U1=N({kind:P([`page`,`folder`,`content`]),path:k().min(1),title:k(),score:A(),signals:tc(k(),Hs()),snippet:k().optional()}).loose(),W1=N({capable:j(),applied:j(),coverage:N({embedded:A().int().nonnegative(),total:A().int().nonnegative()})}).loose(),G1=N({enabled:j(),keyPresent:j(),keySource:P([`file`,`env`]).nullable(),ready:j(),capable:j(),embedded:A().int().nonnegative(),total:A().int().nonnegative()}).loose(),K1=N({query:k(),intent:P([`autocomplete`,`full_text`,`omnibar`]),results:M(U1),elapsedMs:A().nonnegative(),semantic:W1.optional()}).loose(),q1=N({version:k().min(1),recordedAt:k().min(1)}).loose(),J1=N({currentVersion:k().min(1),targets:tc(k(),q1.nullable())}).loose(),Y1=`server-info`,X1=`branch-switched`,Z1=`disk-ack`,Q1=`config-validation-rejected`,$1=`config-ignore-nested-error`,e0=P([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),t0=N({v:F(1),ch:F(Y1),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),n0=N({v:F(1),ch:F(X1),seq:A(),branch:k().min(1)}).loose(),r0=N({v:F(1),ch:e0,seq:A()}).loose(),i0=N({v:F(1),ch:F(Z1),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),a0=N({v:F(1),ch:F(Q1),seq:A(),docName:k().min(1),error:al}).loose(),o0=N({v:F(1),ch:F($1),seq:A(),path:k().min(1),error:k().min(1)}).loose(),s0={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},c0=new WeakMap;function l0(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function u0(e){return e.trim().toLowerCase()}function d0(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function f0(e){return e.split(`/`).filter(Boolean).join(` `)}function p0(e){let t=d0(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0;return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:f0(e.path),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function m0(e){let t=jU({schema:s0});return e.length>0&&HU(t,e),t}function h0(e){let t={documents:e};return c0.set(t,m0(e)),t}function g0(e){let t=c0.get(e);if(t)return t;let n=m0(e.documents);return c0.set(e,n),n}function _0(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`]:[`page`,`folder`]}function v0(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function y0(e,t){let n=u0(t);if(!n)return 0;let r=u0(e.title),i=u0(e.name),a=u0(e.path),o=a.split(`/`);return r===n||i===n?700:a===n?650:r.startsWith(n)||i.startsWith(n)?600:o.some(e=>e.startsWith(n))?550:r.includes(n)||i.includes(n)?500:a.includes(n)?450:-1}function b0(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 x0(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function S0(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 C0(e,t){return u0(t).length<4?0:e===`full_text`?1:0}function w0(e,t,n={}){let r=n.intent??`omnibar`,i=l0(n.limit),a=new Set(n.scopes??_0(r)),o=e.documents.filter(e=>v0(e,a)),s=u0(t);if(!s)return o.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,i).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let c=vW(g0(e),{term:s,properties:x0(r),boost:S0(r),tolerance:C0(r,s),limit:Math.max(i*4,40)}),l=new Map(c.hits.filter(e=>v0(e.document,a)).map(e=>[e.document.id,e.score])),u=b0(o),d=new Map;for(let e of o)y0(e,s)>=0&&d.set(e.id,e);for(let e of c.hits)v0(e.document,a)&&d.set(e.document.id,e.document);return n.semantic?E0({scopedDocuments:o,candidates:d,fullTextScores:l,recency:u,normalizedQuery:s,semantic:n.semantic,limit:i}):[...d.values()].map(e=>{let t=Math.max(0,y0(e,s)),n=l.get(e.id)??0,r=u.get(e.id)??0;return{document:e,score:t+n*20+r,signals:{lexical:t,fullText:n,recency:r}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score).slice(0,i)}function T0(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function E0(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,semantic:o,limit:s}=e,c=o.rrfK??60,l=o.candidateLimit??64,u=o.similarityFloor??.35,d=o.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=[...n.values()].map(e=>{let t=Math.max(0,y0(e,a)),n=r.get(e.id)??0,o=i.get(e.id)??0,s=d.get(e.id),c=s!==void 0&&s>=u;return{document:e,score:t+n*20+o,signals:c?{lexical:t,fullText:n,recency:o,vector:s}:{lexical:t,fullText:n,recency:o},lexical:t,fullText:n,recency:o,cosine:s}}),h=T0(m.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),g=T0(m.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)),_=e=>{let t=0,n=h.get(e);n!==void 0&&(t+=1/(c+n));let r=g.get(e);return r!==void 0&&(t+=1/(c+r)),t};return m.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=_(e.document.id),a=_(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})).slice(0,s)}function D0(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),O0(n)}function O0(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 k0=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),A0=globalThis;A0[k0]===void 0&&(A0[k0]=Fi());const j0=A0[k0],M0=[`.ok`,`skill-state.yml`],N0=[`claude-cowork`,`cli-hosts`],P0=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],F0=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,I0=qs({version:k().regex(F0,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(j0,{description:`Recorded skill version for this target.`}),recordedAt:Vo().register(j0,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:P(P0).register(j0,{description:`Install-source surface that recorded this entry.`}).optional()}),L0=qs({schema:F(1).register(j0,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:qs({"claude-cowork":I0.optional(),"cli-hosts":I0.optional()}).register(j0,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function R0(){return{schema:1,targets:{}}}function z0(){let e=!1,t=``,n=0;return r=>{let i=B0(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 B0(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 V0=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],H0={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function U0(e,t=V0){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const W0={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function G0(e){return e?W0[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const K0={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function q0(e){let t=e?.trim();return t?K0[G0(t)]??t:`Agent`}function J0(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 Y0=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function X0(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function Z0(e){let t=e.trim();return Y0.test(t)||t.startsWith(`//`)}function Q0(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(Z0(n))return{kind:`external`,url:n};let r=J0(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=X0(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function $0(e,t){let n=e.trim();if(!n)return null;if(Z0(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=X0(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function e2(e,t){let n=e.trim();if(!n||Y0.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 t2(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function n2(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function r2(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function i2(e){return e.split(`/`).filter(e=>e!==``)}function a2(e,t){let n=r2(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function o2(e,t){let n=r2(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:i2(r).length}function s2(e,t){let n=i2(e),r=i2(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function c2(){let e=new Map;function t(t){let n=t2(t);if(n===``)return;let r=n2(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=t2(t),r=n2(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=r2(t2(n)),o=[],s=[];for(let e of i)a2(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=o2(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=o2(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=s2(a,r2(t));for(let r=1;r<e.length;r++){let i=e[r],o=s2(a,r2(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 l2(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 u2(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 d2(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function f2(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function p2(){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 m2=p2(),h2=1;var g2=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 _2(e,t){return _(e,`${t}.lock`)}const v2=new Map;function y2(e){v2.set(e,(v2.get(e)??0)+1)}function b2(e){let t=v2.get(e);return t===void 0||t<=1?(v2.delete(e),!0):(v2.set(e,t-1),!1)}function x2(e,t){try{let n=JSON.parse(d(e,`utf-8`));return n&&typeof n==`object`&&f2(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 S2(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;l(n,{recursive:!0});let a=_2(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??m2},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 y2(a),C2({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=x2(a,i);if(e){let r=e.hostname===y();if(r&&e.pid===process.pid)return p(a,d,{encoding:`utf-8`,mode:384}),y2(a),C2({lockName:t,lockDir:n,lockPath:a});if(r&&d2(e.pid))throw new g2(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 C2(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>D2({lockName:t,lockDir:n}),updatePort:e=>w2({lockName:t,lockDir:n,port:e})}}function w2(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=_2(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`||!f2(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 T2(e){let{lockName:t,lockDir:n}=e,r=_2(n,t);if(!c(r))return null;let i;try{let e=JSON.parse(d(r,`utf-8`));if(!e||typeof e!=`object`||!f2(e.pid))return null;i=e}catch{return null}if(i.hostname!==y())return null;if(!d2(i.pid)){try{f(r)}catch{}return null}return i}function E2(e){let{lockName:t,lockDir:n}=e,r=_2(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(!f2(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(!d2(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 D2(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=_2(n,t);if(b2(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 O2=class extends g2{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function k2(e,t){try{return S2({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof g2&&e.lockName===`server`?new O2(e.existing,e.lockPath):e}}function A2(e,t){w2({lockName:`server`,lockDir:e,port:t})}function j2(e){return T2({lockName:`server`,lockDir:e})}function M2(e){D2({lockName:`server`,lockDir:e})}export{xG as $,A as $i,f1 as $n,pK as $r,f$ as $t,Wq as A,hl as Ai,b1 as An,UX as Ar,IQ as At,i0 as B,Uc as Bi,jq as Bn,mq as Br,YQ as Bt,NQ as C,D as Ca,Rc as Ci,F0 as Cn,Kq as Cr,QQ as Ct,MQ as D,Fc as Di,e$ as Dn,U0 as Dr,N1 as Dt,CQ as E,Ic as Ei,$Q as En,_G as Er,M1 as Et,rG as F,ol as Fi,Hq as Fn,VW as Fr,ZG as Ft,Z1 as G,Bs as Gi,Zq as Gn,qJ as Gr,w$ as Gt,X1 as H,oc as Hi,J1 as Hn,HZ as Hr,_$ as Ht,n0 as I,pl as Ii,Sq as In,q0 as Ir,T1 as It,gG as J,Tc as Ji,_1 as Jn,Iq as Jr,Xq as Jt,Y1 as K,M as Ki,d$ as Kn,oq as Kr,x$ as Kt,o0 as L,Qc as Li,wq as Ln,R0 as Lr,D1 as Lt,UQ as M,Zc as Mi,w1 as Mn,p0 as Mr,n$ as Mt,Rq as N,vl as Ni,y1 as Nn,mG as Nr,r$ as Nt,SQ as O,xl as Oi,H1 as On,c2 as Or,KQ as Ot,QW as P,ll as Pi,G1 as Pn,pG as Pr,c$ as Pt,SG as Q,qs as Qi,d1 as Qn,Pq as Qr,g$ as Qt,a0 as R,Yc as Ri,kq as Rn,D0 as Rr,R$ as Rt,wQ as S,O as Sa,Bc as Si,N0 as Sn,YW as Sr,qG as St,PQ as T,ft as Ta,Lc as Ti,vG as Tn,$0 as Tr,j1 as Tt,$1 as U,P as Ui,L0 as Un,dQ as Ur,S$ as Ut,t0 as V,Ns as Vi,Nq as Vn,XW as Vr,T$ as Vt,Q1 as W,Rs as Wi,z$ as Wn,oQ as Wr,v$ as Wt,CG as X,$s as Xi,h1 as Xn,gq as Xr,y$ as Xt,wG as Y,Zs as Yi,m1 as Yn,NW as Yr,b$ as Yt,bG as Z,F as Zi,g1 as Zn,jG as Zr,m$ as Zt,H0 as _,fn as _a,hq as _i,a1 as _n,Jq as _r,VQ as _t,S2 as a,Ys as aa,bQ as ai,AG as an,B1 as ar,K$ as at,k$ as b,Lt as ba,I as bi,YG as bn,DW as br,J$ as bt,f2 as c,Vo as ca,e2 as ci,IG as cn,R1 as cr,QG as ct,E2 as d,Ua as da,uq as di,Y$ as dn,N$ as dr,MG as dt,N as ea,eG as ei,p$ as en,p1 as er,zq as et,j2 as f,Wa as fa,FW as fi,Uq as fn,j$ as fr,TG as ft,A2 as g,un as ga,LW as gi,o$ as gn,Yq as gr,i$ as gt,w2 as h,cn as ha,iQ as hi,e1 as hn,OG as hr,n1 as ht,O2 as i,k as ia,FG as ii,P$ as in,F1 as ir,G$ as it,WQ as j,Wc as ji,x1 as jn,h0 as jr,jW as jt,jQ as k,bl as ki,K1 as kn,z0 as kr,FQ as kt,_2 as l,zo as la,J0 as li,hG as ln,I1 as lr,kG as lt,M2 as m,vr as ma,ZW as mi,$$ as mn,i1 as mr,t1 as mt,m2 as n,Oc as na,zW as ni,L$ as nn,O1 as nr,LQ as nt,k2 as o,Hs as oa,WW as oi,s$ as on,V1 as or,U$ as ot,D2 as p,ai as pa,u2 as pi,qq as pn,r1 as pr,u$ as pt,yG as q,j as qi,v1 as qn,G0 as qr,C$ as qt,h2 as r,tc as ra,IW as ri,F$ as rn,z1 as rr,RQ as rt,d2 as s,_s as sa,xQ as si,PG as sn,L1 as sr,W$ as st,g2 as t,sc as ta,fG as ti,UZ as tn,A1 as tr,Vq as tt,T2 as u,da as ua,w0 as ui,Z$ as un,M$ as ur,LG as ut,EG as v,mn as va,Ny as vi,o1 as vn,a$ as vr,BQ as vt,TQ as w,pt as wa,zc as wi,NG as wn,Q0 as wr,H$ as wt,A$ as x,Tt as xa,yl as xi,M0 as xn,EW as xr,DG as xt,JG as y,on as ya,Cf as yi,XG as yn,AQ as yr,q$ as yt,r0 as z,Hc as zi,Oq as zn,l2 as zr,fK as zt};
428
- //# sourceMappingURL=server-lock-BpjJj3OD-BYyEdzAD.mjs.map
427
+ `)}const SQ=N({docName:vq,summary:bq,content:k().optional(),...yq}).loose(),CQ=N({docName:vq,summary:bq,markdown:k(),position:P([`append`,`prepend`,`replace`]).optional(),extension:P([`.md`,`.mdx`]).optional(),...yq}).loose(),wQ=N({docName:vq,summary:bq,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...yq}).loose(),TQ=N({docName:vq,connectionId:k().min(1),scope:P([`last`,`session`,`file`]).optional(),...yq}).loose(),EQ=N({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),DQ=Zs(`kind`,[N({kind:F(`inline`),content:k()}),N({kind:F(`truncated`),byteLength:A().int().nonnegative(),hint:k()})]),OQ=N({kind:F(`content-divergence`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),divergenceType:k().optional(),currentState:DQ.optional(),hint:k().optional()}).loose(),kQ=N({type:F(`orphan`),parentCandidates:M(k()),message:k()}).loose(),AQ=Zs(`kind`,[OQ,N({kind:F(`disk-edit-reconciled`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),hint:k().optional()}).loose()]),jQ=N({timestamp:k().min(1),summary:EQ.optional(),warning:AQ.optional()}).loose(),MQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:M(kQ).optional(),summary:EQ.optional(),warning:AQ.optional()}).loose(),NQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:EQ.optional(),warning:AQ.optional()}).loose(),PQ=N({docName:k().min(1),scope:P([`last`,`session`]),undone:j()}).loose(),FQ=N({docName:vq,patch:tc(k(),Ys([jW,Rs()])),types:tc(k(),P(AW)).optional(),summary:bq,...yq}).loose(),IQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:M(k()),summary:EQ.optional(),warning:AQ.optional()}).loose(),LQ=N({entries:M(N({level:P([`info`,`warn`,`error`]),message:k().max(8192),event:k().optional(),fields:tc(k(),Hs()).optional(),ts:A().optional(),sourceId:k().optional(),lineNumber:A().optional()}).loose()).max(100)}).loose(),RQ=N({accepted:A().int().min(0)}).loose(),zQ=N({status:k().min(1),reason:k()}).loose(),BQ=N({docName:k().min(1),content:k(),lifecycle:zQ.nullable()}).loose(),VQ=N({documents:M(N({kind:P([`document`,`asset`,`folder`]).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.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName)`})),truncated:j().optional()}).loose(),HQ=N({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),UQ=N({docName:k().min(1),backlinks:M(HQ)}).loose(),WQ=N({counts:tc(k().min(1),A().int().nonnegative())}).loose(),GQ=Zs(`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()]),KQ=N({docName:k().min(1),forwardLinks:M(GQ)}).loose(),qQ=Zs(`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()]),JQ=N({source:k().min(1),target:k().min(1)}).loose(),YQ=N({nodes:M(qQ),links:M(JQ)}).loose(),XQ=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(),ZQ=N({app:Ys([F(`cursor`),F(`codex`),F(`claude`),Rs()]),signals_fired:M(k())}).loose(),QQ=N({entries:M(XQ),count:A().int().min(0),detection:ZQ}).loose(),$Q=N({writers:M(N({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),summary:bq,...yq}).loose(),e$=N({checkpointRef:k().min(1)}).loose(),t$=N({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:M(k()),summaries:M(k()).optional()}).loose(),n$=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(t$),checkpoint:Hs().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:j().optional()}).loose(),r$=N({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose(),i$=N({lines:M(N({type:P([`added`,`removed`,`unchanged`]),text:k()}).loose()),additions:A().int().nonnegative(),deletions:A().int().nonnegative()}).loose(),a$=N({contentDir:k().min(1),pathSeparator:P([`/`,`\\`]),symlinkResolved:j()}).loose(),o$=M(Zs(`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`."}),s$=N({orphans:M(N({docName:k().min(1),title:k()}).loose())}).loose(),c$=N({hubs:M(N({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),l$=N({source:k().min(1),title:k(),snippet:k().nullable()}).loose(),u$=N({deadLinks:M(N({target:k().min(1),sources:M(l$)}).loose())}).loose(),d$=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(),f$=N({dir:k().min(1),port:A().int().min(1).max(65535).optional()}).loose(),p$=N({port:A().int().positive()}).loose(),m$=N({projectPath:k().min(1)}).loose(),h$=P([`not-a-git-worktree`,`init-failed`]),g$=Zs(`ok`,[N({ok:F(!0),projectPath:k().min(1)}).loose(),N({ok:F(!1),reason:h$,message:k().min(1)}).loose()]),_$=N({host:k().min(1).optional()}).loose(),v$=N({key:k().min(1)}).loose(),y$=N({keyPresent:j()}).loose(),b$=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(),x$=N({identity:N({name:k().min(1),email:k().min(1)}).loose().nullable()}).loose(),S$=N({authenticated:j()}).loose(),C$=N({}).loose(),w$=N({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),T$=N({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:M(w$)}).loose(),E$=N({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),D$=N({sessionAlive:j(),agent:E$.nullable(),files:M(T$)}).loose(),O$=N({diff:k(),generatedAt:A().int().min(0)}).loose(),k$=N({}).loose(),A$=N({}).loose(),j$=N({}).loose(),M$=N({}).loose(),N$=N({}).loose(),P$=N({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:P([`idle`,`writing`]),ts:A().int().min(0)}).loose(),F$=N({presence:tc(k().min(1),P$)}).loose(),I$=tc(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 L$=N({}).loose(),R$=N({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),z$=N({fromPath:k().min(1),toPath:k().min(1)}).loose(),B$=N({}).loose(),V$=N({path:k().min(1),...yq,summary:bq}).loose(),H$=N({docName:k().min(1)}).loose(),U$=N({path:k().min(1),...yq,summary:bq}).loose(),W$=N({path:k().min(1)}).loose(),G$=N({kind:P([`file`,`folder`]),path:k().min(1),...yq,summary:bq}).loose(),K$=N({kind:P([`file`,`folder`]),path:k().min(1),duplicatedDocNames:M(k().min(1))}).loose(),q$=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(),J$=N({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),Y$=N({docName:k().min(1),headings:M(J$)}).loose(),X$=N({docName:k().min(1),rewrites:A().int().nonnegative()}).loose(),Z$=N({kind:P([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...yq,summary:bq}).loose(),Q$=N({renamed:M(R$),renamedAssets:M(z$),rewrittenDocs:M(X$).optional(),summary:EQ.optional()}).loose(),$$=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...yq}).loose(),e1=N({deletedDocNames:M(k().min(1))}).loose(),t1=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...yq,summary:bq}).loose(),n1=N({deletedDocNames:M(k().min(1))}).loose(),r1=N({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:bq,...yq}).loose(),i1=N({restoredFrom:k().min(1),timestamp:k().min(1),summary:EQ.optional(),warning:OQ.optional()}).loose(),a1=P([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),o1=N({label:k().min(1),webUrl:_s().nullable()}).loose(),s1=Zs(`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()]),c1=P([`auth-403`,`auth-401`,`auth-scope-mismatch`,`semantic-protected-branch`]),l1=N({state:a1,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:o1.nullable().optional(),pushError:k().optional(),pushErrorCode:c1.optional(),pullError:k().optional(),pullErrorCode:c1.optional(),pausedReason:k().optional(),pushPermission:s1.optional()}).loose(),u1=N({op:P([`sync`,`push`,`pull`]).optional()}).loose(),d1=N({op:P([`sync`,`push`,`pull`])}).loose(),f1=N({conflicts:M(N({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose())}).loose(),p1=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`]}),m1=N({}).loose(),h1=N({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:P([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),g1=N({plan:Tc(e=>e!==void 0,{message:`plan is required`})}).loose(),_1=N({plan:Tc(e=>e!==void 0,{message:`plan is required`})}).loose(),v1=N({result:Tc(e=>e!==void 0,{message:`result is required`})}).loose(),y1=N({path:k().min(1),summary:k().min(1)}).loose(),b1=N({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose(),x1=N({packs:M(N({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:M(y1),entryCounts:b1}).loose())}).loose(),S1=N({noOpen:j().optional(),out:k().min(1).optional()}).loose(),C1=N({reason:P([`unsupported-platform`,`spawn-error`]),message:k()}).loose(),w1=Zs(`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:C1.optional()}).loose(),N({status:F(`failed`),buildError:k()}).loose(),N({status:F(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]),T1=N({tags:M(N({name:k().min(1),count:A().int().nonnegative(),isLeaf:j()}).loose())}).loose(),E1=N({docName:k().min(1),title:k(),matchingTags:M(k().min(1)),snippet:k().nullable()}).loose(),D1=N({name:k().min(1),docs:M(E1)}).loose(),O1=N({folder:Hs(),frontmatter_local:tc(k(),Hs()).nullable()}).loose(),k1=N({path:k(),frontmatter:tc(k(),Hs()).optional()}).loose(),A1=N({applied:Hs()}).loose(),j1=tc(k(),Hs()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),M1=N({template:N({name:k().min(1),folder:k(),scope:P([`local`,`inherited`]),path:k().min(1),frontmatter:j1,body:k()}).strict()}).strict(),N1=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(),P1=N({folder:k(),name:k(),body:k().optional(),frontmatter:j1.optional(),...yq,summary:bq}).strict(),F1=N({path:k().min(1),created:j(),warnings:M(k())}).strict(),I1=N({existed:j(),path:k().min(1)}).strict(),L1=N({fromFolder:k(),fromName:k(),toFolder:k(),toName:k(),body:k().optional(),frontmatter:j1.optional(),...yq,summary:bq}).strict(),R1=N({from:k().min(1),to:k().min(1),committed:j()}).strict(),z1=N({query:k().optional(),intent:P([`autocomplete`,`full_text`,`omnibar`]).optional(),scopes:M(P([`page`,`folder`,`content`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional(),semantic:j().optional()}).loose(),B1=N({kind:P([`page`,`folder`,`content`]),path:k().min(1),title:k(),score:A(),signals:tc(k(),Hs()),snippet:k().optional()}).loose(),V1=N({capable:j(),applied:j(),coverage:N({embedded:A().int().nonnegative(),total:A().int().nonnegative()})}).loose(),H1=N({enabled:j(),keyPresent:j(),keySource:P([`file`,`env`]).nullable(),ready:j(),capable:j(),embedded:A().int().nonnegative(),total:A().int().nonnegative()}).loose(),U1=N({query:k(),intent:P([`autocomplete`,`full_text`,`omnibar`]),results:M(B1),elapsedMs:A().nonnegative(),semantic:V1.optional()}).loose(),W1=N({version:k().min(1),recordedAt:k().min(1)}).loose(),G1=N({currentVersion:k().min(1),targets:tc(k(),W1.nullable())}).loose(),K1=`server-info`,q1=`branch-switched`,J1=`disk-ack`,Y1=`config-validation-rejected`,X1=`config-ignore-nested-error`,Z1=P([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),Q1=N({v:F(1),ch:F(K1),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),$1=N({v:F(1),ch:F(q1),seq:A(),branch:k().min(1)}).loose(),e0=N({v:F(1),ch:Z1,seq:A()}).loose(),t0=N({v:F(1),ch:F(J1),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),n0=N({v:F(1),ch:F(Y1),seq:A(),docName:k().min(1),error:al}).loose(),r0=N({v:F(1),ch:F(X1),seq:A(),path:k().min(1),error:k().min(1)}).loose(),i0={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},a0=new WeakMap;function o0(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function s0(e){return e.trim().toLowerCase()}function c0(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function l0(e){return e.split(`/`).filter(Boolean).join(` `)}function u0(e){let t=c0(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0;return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:l0(e.path),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function d0(e){let t=jU({schema:i0});return e.length>0&&HU(t,e),t}function f0(e){let t={documents:e};return a0.set(t,d0(e)),t}function p0(e){let t=a0.get(e);if(t)return t;let n=d0(e.documents);return a0.set(e,n),n}function m0(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`]:[`page`,`folder`]}function h0(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function g0(e,t){let n=s0(t);if(!n)return 0;let r=s0(e.title),i=s0(e.name),a=s0(e.path),o=a.split(`/`);return r===n||i===n?700:a===n?650:r.startsWith(n)||i.startsWith(n)?600:o.some(e=>e.startsWith(n))?550:r.includes(n)||i.includes(n)?500:a.includes(n)?450:-1}function _0(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 v0(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function y0(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 b0(e,t){return s0(t).length<4?0:e===`full_text`?1:0}function x0(e,t,n={}){let r=n.intent??`omnibar`,i=o0(n.limit),a=new Set(n.scopes??m0(r)),o=e.documents.filter(e=>h0(e,a)),s=s0(t);if(!s)return o.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,i).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let c=vW(p0(e),{term:s,properties:v0(r),boost:y0(r),tolerance:b0(r,s),limit:Math.max(i*4,40)}),l=new Map(c.hits.filter(e=>h0(e.document,a)).map(e=>[e.document.id,e.score])),u=_0(o),d=new Map;for(let e of o)g0(e,s)>=0&&d.set(e.id,e);for(let e of c.hits)h0(e.document,a)&&d.set(e.document.id,e.document);return n.semantic?C0({scopedDocuments:o,candidates:d,fullTextScores:l,recency:u,normalizedQuery:s,semantic:n.semantic,limit:i}):[...d.values()].map(e=>{let t=Math.max(0,g0(e,s)),n=l.get(e.id)??0,r=u.get(e.id)??0;return{document:e,score:t+n*20+r,signals:{lexical:t,fullText:n,recency:r}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score).slice(0,i)}function S0(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function C0(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,semantic:o,limit:s}=e,c=o.rrfK??60,l=o.candidateLimit??64,u=o.similarityFloor??.35,d=o.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=[...n.values()].map(e=>{let t=Math.max(0,g0(e,a)),n=r.get(e.id)??0,o=i.get(e.id)??0,s=d.get(e.id),c=s!==void 0&&s>=u;return{document:e,score:t+n*20+o,signals:c?{lexical:t,fullText:n,recency:o,vector:s}:{lexical:t,fullText:n,recency:o},lexical:t,fullText:n,recency:o,cosine:s}}),h=S0(m.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),g=S0(m.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)),_=e=>{let t=0,n=h.get(e);n!==void 0&&(t+=1/(c+n));let r=g.get(e);return r!==void 0&&(t+=1/(c+r)),t};return m.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=_(e.document.id),a=_(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})).slice(0,s)}function w0(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),T0(n)}function T0(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 E0=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),D0=globalThis;D0[E0]===void 0&&(D0[E0]=Fi());const O0=D0[E0],k0=[`.ok`,`skill-state.yml`],A0=[`claude-cowork`,`cli-hosts`],j0=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],M0=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,N0=qs({version:k().regex(M0,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(O0,{description:`Recorded skill version for this target.`}),recordedAt:Vo().register(O0,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:P(j0).register(O0,{description:`Install-source surface that recorded this entry.`}).optional()}),P0=qs({schema:F(1).register(O0,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:qs({"claude-cowork":N0.optional(),"cli-hosts":N0.optional()}).register(O0,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function F0(){return{schema:1,targets:{}}}function I0(){let e=!1,t=``,n=0;return r=>{let i=L0(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 L0(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 R0=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],z0={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function B0(e,t=R0){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const V0={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function H0(e){return e?V0[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const U0={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function W0(e){let t=e?.trim();return t?U0[H0(t)]??t:`Agent`}function G0(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 K0=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function q0(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function J0(e){let t=e.trim();return K0.test(t)||t.startsWith(`//`)}function Y0(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(J0(n))return{kind:`external`,url:n};let r=G0(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=q0(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function X0(e,t){let n=e.trim();if(!n)return null;if(J0(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=q0(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function Z0(e,t){let n=e.trim();if(!n||K0.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 Q0(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function $0(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function e2(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function t2(e){return e.split(`/`).filter(e=>e!==``)}function n2(e,t){let n=e2(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function r2(e,t){let n=e2(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:t2(r).length}function i2(e,t){let n=t2(e),r=t2(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function a2(){let e=new Map;function t(t){let n=Q0(t);if(n===``)return;let r=$0(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=Q0(t),r=$0(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=e2(Q0(n)),o=[],s=[];for(let e of i)n2(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=r2(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=r2(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=i2(a,e2(t));for(let r=1;r<e.length;r++){let i=e[r],o=i2(a,e2(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 o2(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 s2(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 c2(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function l2(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function u2(){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 d2=u2(),f2=1;var p2=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 m2(e,t){return _(e,`${t}.lock`)}const h2=new Map;function g2(e){h2.set(e,(h2.get(e)??0)+1)}function _2(e){let t=h2.get(e);return t===void 0||t<=1?(h2.delete(e),!0):(h2.set(e,t-1),!1)}function v2(e,t){try{let n=JSON.parse(d(e,`utf-8`));return n&&typeof n==`object`&&l2(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 y2(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;l(n,{recursive:!0});let a=m2(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??d2},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 g2(a),b2({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=v2(a,i);if(e){let r=e.hostname===y();if(r&&e.pid===process.pid)return p(a,d,{encoding:`utf-8`,mode:384}),g2(a),b2({lockName:t,lockDir:n,lockPath:a});if(r&&c2(e.pid))throw new p2(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 b2(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>w2({lockName:t,lockDir:n}),updatePort:e=>x2({lockName:t,lockDir:n,port:e})}}function x2(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=m2(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`||!l2(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 S2(e){let{lockName:t,lockDir:n}=e,r=m2(n,t);if(!c(r))return null;let i;try{let e=JSON.parse(d(r,`utf-8`));if(!e||typeof e!=`object`||!l2(e.pid))return null;i=e}catch{return null}if(i.hostname!==y())return null;if(!c2(i.pid)){try{f(r)}catch{}return null}return i}function C2(e){let{lockName:t,lockDir:n}=e,r=m2(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(!l2(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(!c2(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 w2(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=m2(n,t);if(_2(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 T2=class extends p2{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function E2(e,t){try{return y2({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof p2&&e.lockName===`server`?new T2(e.existing,e.lockPath):e}}function D2(e,t){x2({lockName:`server`,lockDir:e,port:t})}function O2(e){return S2({lockName:`server`,lockDir:e})}function k2(e){w2({lockName:`server`,lockDir:e})}export{xG as $,Oc as $i,T1 as $n,zW as $r,UZ as $t,Wq as A,vl as Ai,x1 as An,mG as Ar,IQ as At,t0 as B,P as Bi,G1 as Bn,dQ as Br,YQ as Bt,NQ as C,Ic as Ci,vG as Cn,_G as Cr,QQ as Ct,MQ as D,hl as Di,U1 as Dn,UX as Dr,A1 as Dt,CQ as E,bl as Ei,z1 as En,I0 as Er,k1 as Et,rG as F,Yc as Fi,wq as Fn,w0 as Fr,ZG as Ft,J1 as G,Tc as Gi,h1 as Gn,Iq as Gr,S$ as Gt,q1 as H,Bs as Hi,L$ as Hn,qJ as Hr,_$ as Ht,$1 as I,Hc as Ii,kq as In,o2 as Ir,S1 as It,gG as J,F as Ji,m1 as Jn,jG as Jr,v$ as Jt,K1 as K,Zs as Ki,f1 as Kn,NW as Kr,Xq as Kt,r0 as L,Uc as Li,Oq as Ln,mq as Lr,w1 as Lt,UQ as M,ol as Mi,H1 as Mn,VW as Mr,n$ as Mt,Rq as N,pl as Ni,Hq as Nn,W0 as Nr,r$ as Nt,SQ as O,Wc as Oi,_1 as On,f0 as Or,KQ as Ot,QW as P,Qc as Pi,Sq as Pn,F0 as Pr,c$ as Pt,SG as Q,sc as Qi,D1 as Qn,fG as Qr,p$ as Qt,n0 as R,Ns as Ri,jq as Rn,XW as Rr,I$ as Rt,wQ as S,ft as Sa,Lc as Si,NG as Sn,X0 as Sr,qG as St,PQ as T,xl as Ti,e$ as Tn,a2 as Tr,O1 as Tt,X1 as U,M as Ui,Zq as Un,oq as Ur,x$ as Ut,Q1 as V,Rs as Vi,P0 as Vn,oQ as Vr,C$ as Vt,Y1 as W,j as Wi,d$ as Wn,H0 as Wr,b$ as Wt,CG as X,A as Xi,u1 as Xn,pK as Xr,g$ as Xt,wG as Y,qs as Yi,l1 as Yn,Pq as Yr,m$ as Yt,bG as Z,N as Zi,d1 as Zn,eG as Zr,f$ as Zt,z0 as _,Lt as _a,I as _i,XG as _n,DW as _r,VQ as _t,y2 as a,Vo as aa,Z0 as ai,PG as an,F1 as ar,W$ as at,D$ as b,D as ba,Rc as bi,A0 as bn,Kq as br,K$ as bt,l2 as c,Ua as ca,uq as ci,Y$ as cn,j$ as cr,QG as ct,C2 as d,vr as da,ZW as di,qq as dn,n1 as dr,MG as dt,tc as ea,IW as ei,F$ as en,I1 as er,zq as et,O2 as f,cn as fa,iQ as fi,Z$ as fn,OG as fr,TG as ft,D2 as g,on as ga,Cf as gi,i1 as gn,AQ as gr,i$ as gt,x2 as h,mn as ha,Ny as hi,r1 as hn,a$ as hr,e1 as ht,T2 as i,_s as ia,xQ as ii,s$ as in,P1 as ir,U$ as it,WQ as j,ll as ji,g1 as jn,pG as jr,jW as jt,jQ as k,Zc as ki,v1 as kn,u0 as kr,FQ as kt,m2 as l,Wa as la,FW as li,q$ as ln,k$ as lr,kG as lt,k2 as m,fn as ma,hq as mi,o$ as mn,Jq as mr,$$ as mt,d2 as n,Ys as na,bQ as ni,M$ as nn,L1 as nr,LQ as nt,E2 as o,zo as oa,G0 as oi,IG as on,N1 as or,V$ as ot,w2 as p,un as pa,LW as pi,Q$ as pn,Yq as pr,u$ as pt,yG as q,$s as qi,p1 as qn,gq as qr,y$ as qt,f2 as r,Hs as ra,WW as ri,AG as rn,R1 as rr,RQ as rt,c2 as s,da as sa,x0 as si,hG as sn,A$ as sr,H$ as st,p2 as t,k as ta,FG as ti,N$ as tn,M1 as tr,Vq as tt,S2 as u,ai as ua,s2 as ui,Uq as un,t1 as ur,LG as ut,EG as v,Tt as va,yl as vi,YG as vn,EW as vr,BQ as vt,TQ as w,Fc as wi,$Q as wn,B0 as wr,B$ as wt,O$ as x,pt as xa,zc as xi,M0 as xn,Y0 as xr,DG as xt,JG as y,O as ya,Bc as yi,k0 as yn,YW as yr,G$ as yt,e0 as z,oc as zi,Nq as zn,HZ as zr,fK as zt};
428
+ //# sourceMappingURL=server-lock-BpjJj3OD-BIHTaNk6.mjs.map
@@ -0,0 +1 @@
1
+ import{g as e}from"./server-lock-BpjJj3OD-BIHTaNk6.mjs";export{e as updateServerLockPort};