@inkeep/open-knowledge 0.79.3 → 0.79.4

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 (45) hide show
  1. package/dist/cli.mjs +70 -68
  2. package/dist/constants-C6wMiGgw.mjs +1 -0
  3. package/dist/dist-CeD-QmMk.mjs +1 -0
  4. package/dist/{dist-Cmgb0r3p.mjs → dist-Dci-h_mV.mjs} +1 -1
  5. package/dist/index.mjs +1 -1
  6. package/dist/init-D6ZJF6PV.mjs +1 -0
  7. package/dist/{init-D_DKMj1s.mjs → init-PYX9s0p3.mjs} +14 -14
  8. package/dist/{launch-json-removal-CMIL2ikQ.mjs → launch-json-removal-DE_lefaT.mjs} +1 -1
  9. package/dist/loader-CNWGHRCV.mjs +1 -0
  10. package/dist/{loader-N7jiS4w0.mjs → loader-SBH7CBDL.mjs} +1 -1
  11. package/dist/{open-browser-CNVUL-A_.mjs → open-browser-CmAzRurP.mjs} +1 -1
  12. package/dist/{preview-wLB8OL2o.mjs → preview-CYBCI8OL.mjs} +1 -1
  13. package/dist/preview-Ch3iH9hA.mjs +1 -0
  14. package/dist/public/assets/FeedbackForm-B2kRhtsR.js +1 -0
  15. package/dist/public/assets/{ImageAttachments-Cooc1nca.js → ImageAttachments-mkcDupGd.js} +1 -1
  16. package/dist/public/assets/{ReportBugDialogBody-Bb5if0pW.js → ReportBugDialogBody-ABNMdMUU.js} +1 -1
  17. package/dist/public/assets/{ReportBugMenuTrigger-DHmYILeX.js → ReportBugMenuTrigger-DRki3qOn.js} +1 -1
  18. package/dist/public/assets/{SessionsHost-Cdic3R-Y.js → SessionsHost-BqU3aWOR.js} +2 -2
  19. package/dist/public/assets/{TerminalWindowApp-C9GosoJU.js → TerminalWindowApp-QDFQJvJI.js} +1 -1
  20. package/dist/public/assets/{ThreadView-CPLHpCdR.js → ThreadView-e6Emlmew.js} +17 -17
  21. package/dist/public/assets/image-attachment-C1B_QOlM.js +1 -0
  22. package/dist/public/assets/index-B4DpftwC.js +2205 -0
  23. package/dist/public/assets/{progress-0Dfq8VnS.js → progress-ChqYJ_wo.js} +1 -1
  24. package/dist/public/assets/{use-installed-clis-BzQZdtk_.js → use-installed-clis-SziirqY4.js} +2 -2
  25. package/dist/public/index.html +6 -6
  26. package/dist/registry-probes-Dege_xbr.mjs +17 -0
  27. package/dist/{removal-file-path-CSUwOdaZ.mjs → removal-file-path-CVCUJzdD.mjs} +1 -1
  28. package/dist/{repair-launch-json-CHU3DQHD.mjs → repair-launch-json-B9YcmXBD.mjs} +1 -1
  29. package/dist/{repair-mcp-configs-BhdagblW.mjs → repair-mcp-configs-BM8NXaJm.mjs} +1 -1
  30. package/dist/{src-DPs9CRCY.mjs → src-B5SmbFF9.mjs} +5 -5
  31. package/dist/src-DsMWEyve.mjs +1 -0
  32. package/dist/{start-C8VxoPil.mjs → start-CtAMwLgE.mjs} +3 -3
  33. package/dist/start-sCxyzBNh.mjs +1 -0
  34. package/package.json +5 -5
  35. package/dist/constants-CNxoEQ5b.mjs +0 -1
  36. package/dist/dist-DzdGKL8W.mjs +0 -1
  37. package/dist/init-DsGKNoaN.mjs +0 -1
  38. package/dist/loader-DAk_l84X.mjs +0 -1
  39. package/dist/preview-CRnYd6sw.mjs +0 -1
  40. package/dist/public/assets/FeedbackForm-CXLWTOXd.js +0 -1
  41. package/dist/public/assets/image-attachment-IlVZ-iwe.js +0 -1
  42. package/dist/public/assets/index-CFr0XcXQ.js +0 -2205
  43. package/dist/registry-probes-V6HkuVVa.mjs +0 -17
  44. package/dist/src-CXxDQ4LC.mjs +0 -1
  45. package/dist/start-Du6cCuDw.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{$l as r,Ft as i,Gd as a,Gl as o,Jd as s,Kd as c,Qu as l,Uu as u,Xd as d,Zd as f,ef as p,qu as m,ru as h,sc as g,tf as _,xs as v,ys as y,zd as b}from"./md-manager-BGnqyqi1-BWyJhS5F.mjs";import{$i as x,Ao as S,Ar as ee,Bn as te,H as ne,L as re,Lr as ie,Mo as ae,No as oe,Po as se,Qi as ce,R as le,Ro as C,Tt as ue,Wo as de,Xo as fe,Xr as pe,_o as me,at as he,en as ge,ha as _e,jo as ve,m as ye,mo as be,na as xe,qn as Se,rt as Ce,wr as we,yo as Te}from"./dist-Cmgb0r3p.mjs";import{i as w,n as T,o as E,r as D,s as O,t as k}from"./colors-r_owlCuY.mjs";import{t as A}from"./is-object-BGze3w87.mjs";import{t as Ee}from"./constants-CNxoEQ5b.mjs";import{t as De}from"./preview-wLB8OL2o.mjs";import{createRequire as Oe}from"node:module";import{execFileSync as ke}from"node:child_process";import Ae,{basename as je,dirname as j,isAbsolute as Me,join as M,posix as Ne,relative as N,resolve as P,sep as F,win32 as Pe}from"node:path";import I from"node:process";import{fileURLToPath as Fe}from"node:url";import{cpSync as Ie,existsSync as L,lstatSync as Le,mkdirSync as Re,readFileSync as R,readdirSync as ze,readlinkSync as Be,realpathSync as Ve,rmSync as He,statSync as Ue,writeFileSync as We}from"node:fs";import{homedir as z}from"node:os";import{inspect as Ge,stripVTControlCharacters as Ke,styleText as B}from"node:util";import*as qe from"node:readline";import{AsyncLocalStorage as Je,AsyncResource as Ye}from"node:async_hooks";var Xe=n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),Ze=n((e=>{let{InvalidArgumentError:t}=Xe();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),Qe=n((e=>{let{humanReadableArgName:t}=Ze();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
1
+ import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{$l as r,Ft as i,Gd as a,Gl as o,Jd as s,Kd as c,Qu as l,Uu as u,Xd as d,Zd as f,ef as p,qu as m,ru as h,sc as g,tf as _,xs as v,ys as y,zd as b}from"./md-manager-BGnqyqi1-BWyJhS5F.mjs";import{$i as x,Ao as S,Ar as ee,Bn as te,Go as ne,H as re,L as ie,Lr as ae,Mo as C,No as oe,Po as se,Qi as ce,R as le,Tt as ue,Xr as de,Zo as fe,_o as pe,at as me,en as he,ha as ge,jo as _e,m as ve,mo as ye,na as be,qn as xe,rt as Se,wr as Ce,yo as we,zo as w}from"./dist-Dci-h_mV.mjs";import{i as T,n as E,o as D,r as Te,s as O,t as k}from"./colors-r_owlCuY.mjs";import{t as A}from"./is-object-BGze3w87.mjs";import{t as Ee}from"./constants-C6wMiGgw.mjs";import{t as De}from"./preview-CYBCI8OL.mjs";import{createRequire as Oe}from"node:module";import{execFileSync as ke}from"node:child_process";import Ae,{basename as je,dirname as j,isAbsolute as Me,join as M,posix as Ne,relative as N,resolve as P,sep as F,win32 as Pe}from"node:path";import I from"node:process";import{fileURLToPath as Fe}from"node:url";import{cpSync as Ie,existsSync as L,lstatSync as Le,mkdirSync as Re,readFileSync as R,readdirSync as ze,readlinkSync as Be,realpathSync as Ve,rmSync as He,statSync as Ue,writeFileSync as We}from"node:fs";import{homedir as z}from"node:os";import{inspect as Ge,stripVTControlCharacters as Ke,styleText as B}from"node:util";import*as qe from"node:readline";import{AsyncLocalStorage as Je,AsyncResource as Ye}from"node:async_hooks";var Xe=n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),Ze=n((e=>{let{InvalidArgumentError:t}=Xe();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),Qe=n((e=>{let{humanReadableArgName:t}=Ze();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
2
2
  `)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
3
3
  `+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
4
4
  `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),$e=n((e=>{let{InvalidArgumentError:t}=Xe();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r!==void 0&&r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
@@ -321,13 +321,13 @@ exit 127`,$r=`// ok-pi-bridge`,ei=`${$r}-v1`;function ti(e){if(typeof e!=`object
321
321
  `,f=l.length===0?``:`${l.join(`
322
322
  `)}\n`;try{We(r.path,`${s}${d}${f}`,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:l,alreadyPresent:u,removed:o}}function Gi(e,t){let n=$i(e);if(n.kind!==`ok`)return n.result;if(!L(n.path))return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let r=t.map(e=>ea(e)),i=new Set;for(let e of r)for(let t of e)i.add(t);i.add(Bi),i.add(Vi);for(let t of Ui(e))i.add(t);let a;try{a=R(n.path,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}let o=a.split(`
323
323
  `),s=new Set,c=[];for(let e of o){let t=e.trim();if(i.has(t)){s.add(t);continue}c.push(e)}let l=[...s];if(s.size===0)return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let u=c.join(`
324
- `);if(u!==a)try{We(n.path,u,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:[],alreadyPresent:[],removed:l}}function Ki(e){let t=$i(e);if(t.kind!==`ok`)return t.result.reason===`no-git`||t.result.reason===`malformed-pointer`||t.result.reason===`inaccessible`?`no-git`:`shared`;if(!L(t.path))return`shared`;let n;try{n=R(t.path,`utf-8`)}catch{return`shared`}let r=na(n),i=Hi(e);for(let e of i)if(ta(r,e))return`local-only`;return r.has(Bi)?`local-only`:`shared`}function qi(e){let t=$i(e);if(t.kind!==`ok`||!L(t.path))return[];let n;try{n=R(t.path,`utf-8`)}catch{return[]}let r=na(n),i=[...Hi(e),...Ui(e)].filter(e=>ta(r,e)),a=new Set(i),o=[];for(let e of Object.values(s))e!==null&&o.push(e);let c=[];for(let e of r){if(a.has(e))continue;if(e===Bi||e===Vi){c.push(e);continue}let t=e.replace(/^\//,``).replace(/\/$/,``);o.some(e=>t.startsWith(`${e}/`)&&t.length>e.length+1)&&c.push(e)}return[...i,...c]}function Ji(e,t){let n=[];for(let r of t){let t=P(e,r);if(L(t))try{ke(`git`,[`ls-files`,`--error-unmatch`,...v([r])],be({cwd:e,stdio:[`ignore`,`ignore`,`ignore`]})),n.push(r)}catch{}}return{tracked:n}}const Yi=/^[\w.\-/]+$/;function Xi(e){return process.platform===`win32`?`"${e.replaceAll(`"`,``)}"`:`'${e.replaceAll(`'`,`'\\''`)}'`}function Zi(e){return Yi.test(e)?e:Xi(g(e))}function Qi(e){let t=[];t.push(`Cannot switch OpenKnowledge to local-only — these OK files are tracked upstream:`),t.push(``);for(let n of e)t.push(` ${n}`);t.push(``),t.push(`.git/info/exclude only hides files that git isn't already tracking. To proceed, untrack them first:`),t.push(``);for(let n of e){let e=n.replace(/\/$/,``),r=n.endsWith(`/`)?`-r `:``;t.push(` git rm --cached ${r}-- ${Zi(e)}`)}return t.push(``),t.push("Then re-run the command. Note: `git rm --cached` removes the files from the index — your teammates will see a deletion on their next pull. If you don't want that, leave sharing mode set to 'shared'."),t.join(`
324
+ `);if(u!==a)try{We(n.path,u,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:[],alreadyPresent:[],removed:l}}function Ki(e){let t=$i(e);if(t.kind!==`ok`)return t.result.reason===`no-git`||t.result.reason===`malformed-pointer`||t.result.reason===`inaccessible`?`no-git`:`shared`;if(!L(t.path))return`shared`;let n;try{n=R(t.path,`utf-8`)}catch{return`shared`}let r=na(n),i=Hi(e);for(let e of i)if(ta(r,e))return`local-only`;return r.has(Bi)?`local-only`:`shared`}function qi(e){let t=$i(e);if(t.kind!==`ok`||!L(t.path))return[];let n;try{n=R(t.path,`utf-8`)}catch{return[]}let r=na(n),i=[...Hi(e),...Ui(e)].filter(e=>ta(r,e)),a=new Set(i),o=[];for(let e of Object.values(s))e!==null&&o.push(e);let c=[];for(let e of r){if(a.has(e))continue;if(e===Bi||e===Vi){c.push(e);continue}let t=e.replace(/^\//,``).replace(/\/$/,``);o.some(e=>t.startsWith(`${e}/`)&&t.length>e.length+1)&&c.push(e)}return[...i,...c]}function Ji(e,t){let n=[];for(let r of t){let t=P(e,r);if(L(t))try{ke(`git`,[`ls-files`,`--error-unmatch`,...v([r])],ye({cwd:e,stdio:[`ignore`,`ignore`,`ignore`]})),n.push(r)}catch{}}return{tracked:n}}const Yi=/^[\w.\-/]+$/;function Xi(e){return process.platform===`win32`?`"${e.replaceAll(`"`,``)}"`:`'${e.replaceAll(`'`,`'\\''`)}'`}function Zi(e){return Yi.test(e)?e:Xi(g(e))}function Qi(e){let t=[];t.push(`Cannot switch OpenKnowledge to local-only — these OK files are tracked upstream:`),t.push(``);for(let n of e)t.push(` ${n}`);t.push(``),t.push(`.git/info/exclude only hides files that git isn't already tracking. To proceed, untrack them first:`),t.push(``);for(let n of e){let e=n.replace(/\/$/,``),r=n.endsWith(`/`)?`-r `:``;t.push(` git rm --cached ${r}-- ${Zi(e)}`)}return t.push(``),t.push("Then re-run the command. Note: `git rm --cached` removes the files from the index — your teammates will see a deletion on their next pull. If you don't want that, leave sharing mode set to 'shared'."),t.join(`
325
325
  `)}function $i(e){let t=fe(e);switch(t.kind){case`repository`:{let e=t.repository.readCommonDir();if(e.kind===`unreadable`)return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}};let n=M(e.path,`info`);return L(n)?{kind:`ok`,path:M(n,`exclude`)}:{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-info-dir`}}}case`absent`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-git`}};case`malformed-pointer`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`malformed-pointer`}};case`inaccessible`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}}}}function ea(e){let t=e.replace(/\/$/,``);return new Set([e,t,`/${e}`,`/${t}`])}function ta(e,t){for(let n of ea(t))if(e.has(n))return!0;return!1}function na(e){let t=new Set;for(let n of e.split(`
326
- `)){let e=n.trim();e.length!==0&&t.add(e)}return t}function ra(e,t){return ia(N(t,e))}function ia(e){return F===`/`?e:e.split(F).join(`/`)}var aa=class extends Error{name=`ProjectPathSafetyError`;code=`PROJECT_PATH_SAFETY`};function oa(e,t){let n;try{n=Le(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw new aa(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);ca(e,t)}function sa(e,t){ca(e,t)}function ca(e,t){la(e,t)}function la(e,t){let n=t,r;try{r=Ve(n)}catch{r=P(n)}let i=j(e);for(;i.length>1&&i!==F;){let t;try{t=Ve(i)}catch(e){if(e.code===`ENOENT`){i=j(i);continue}throw e}let n=N(r,t);if(n===``||!n.startsWith(`..`)&&!Me(n))return;throw new aa(`Refusing to write at ${e}: ancestor ${i} resolves to ${t}, which is outside the project directory ${r}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function ua(e,t){let n=j(t),r=L(t)?`overwritten`:`written`;if(r===`written`&&L(n))throw Error(`Refusing to replace ${n}: it exists but holds no SKILL.md, so it is not a bundle OpenKnowledge wrote. Move it aside and try again.`);return He(n,{recursive:!0,force:!0}),Re(j(n),{recursive:!0}),Ie(e,n,{recursive:!0}),r}function da(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fa(e,t,n){try{if(Ue(n).size>10485760)return!1}catch{return!1}let r;try{r=R(n,`utf-8`)}catch{return!1}let i=[],a=oe(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!da(a))return!1;let o=a[e.topLevelKey];if(!da(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;if(!da(s))return!1;let c=s[e.serverName(t)];return da(c)&&c.enabled===!1?!1:pi(c)||mi(c)}function pa(e){let t=m[e]?.satisfiers.find(e=>e.piece===`mcp`&&e.scope===`project`),n=t?.pathId===void 0?null:l(t.pathId);return n===null||n.kind!==`editor-project-config`||n.editor===e?null:$[n.editor]??null}function ma(e,t,n={}){if(!_.includes(e.id))return!0;let r=pa(e.id),i=r?.projectConfigPath?.(t);if(r!==null&&i!==void 0&&fa(r,t,i))return!0;try{return fa(e,t,e.configPath(t,n.home))}catch{return!1}}function ha(e){let t=new Set(f.filter(e=>e.scope===`project`).map(e=>e.editorId));return e.filter(e=>t.has(e))}function ga(e,t){if(ha(t).length===0)return null;let n=M(e,o,p,`SKILL.md`);try{let t=xe(`project`,{checkDesktop:!0});return oa(j(n),e),{editorId:`agents`,label:`.agents hub`,action:ua(t,n),path:n}}catch(e){return{editorId:`agents`,label:`.agents hub`,action:`failed`,path:n,error:e instanceof Error?e.message:String(e)}}}function _a(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!ma(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=xe(`project`,{checkDesktop:!0});oa(j(r),t);let i=ua(n,r);return{editorId:e.id,label:e.label,action:i,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function va(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=j(n);return L(n)?(sa(r,t),He(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function ya(e){switch(e?.code){case`EACCES`:case`EPERM`:return`permission-denied`;case`ELOOP`:return`unresolved-symlink`;case`EISDIR`:case`ENOTDIR`:return`not-a-file`;case`ENOENT`:return`disappeared`;default:return`unreadable`}}function ba(e){switch(e){case`permission-denied`:return`permission denied; check file and parent-directory permissions, then retry`;case`missing-symlink-target`:return`the symlink target is missing; restore the target or correct the symlink, then retry`;case`unresolved-symlink`:return`the path or symlink could not be resolved; check path permissions and repair any symlink cycle, then retry`;case`not-a-file`:return`the path is not a regular file; restore the intended configuration file, then retry`;case`disappeared`:return`the file disappeared; retry to check its current state`;case`unreadable`:return`the file could not be read; check that the path is accessible, then retry`;default:throw Error(`unhandled configuration file decline reason: ${e}`)}}function xa(e){for(let t of e.split(`
326
+ `)){let e=n.trim();e.length!==0&&t.add(e)}return t}function ra(e,t){return ia(N(t,e))}function ia(e){return F===`/`?e:e.split(F).join(`/`)}var aa=class extends Error{name=`ProjectPathSafetyError`;code=`PROJECT_PATH_SAFETY`};function oa(e,t){let n;try{n=Le(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw new aa(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);ca(e,t)}function sa(e,t){ca(e,t)}function ca(e,t){la(e,t)}function la(e,t){let n=t,r;try{r=Ve(n)}catch{r=P(n)}let i=j(e);for(;i.length>1&&i!==F;){let t;try{t=Ve(i)}catch(e){if(e.code===`ENOENT`){i=j(i);continue}throw e}let n=N(r,t);if(n===``||!n.startsWith(`..`)&&!Me(n))return;throw new aa(`Refusing to write at ${e}: ancestor ${i} resolves to ${t}, which is outside the project directory ${r}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function ua(e,t){let n=j(t),r=L(t)?`overwritten`:`written`;if(r===`written`&&L(n))throw Error(`Refusing to replace ${n}: it exists but holds no SKILL.md, so it is not a bundle OpenKnowledge wrote. Move it aside and try again.`);return He(n,{recursive:!0,force:!0}),Re(j(n),{recursive:!0}),Ie(e,n,{recursive:!0}),r}function da(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fa(e,t,n){try{if(Ue(n).size>10485760)return!1}catch{return!1}let r;try{r=R(n,`utf-8`)}catch{return!1}let i=[],a=oe(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!da(a))return!1;let o=a[e.topLevelKey];if(!da(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;if(!da(s))return!1;let c=s[e.serverName(t)];return da(c)&&c.enabled===!1?!1:pi(c)||mi(c)}function pa(e){let t=m[e]?.satisfiers.find(e=>e.piece===`mcp`&&e.scope===`project`),n=t?.pathId===void 0?null:l(t.pathId);return n===null||n.kind!==`editor-project-config`||n.editor===e?null:$[n.editor]??null}function ma(e,t,n={}){if(!_.includes(e.id))return!0;let r=pa(e.id),i=r?.projectConfigPath?.(t);if(r!==null&&i!==void 0&&fa(r,t,i))return!0;try{return fa(e,t,e.configPath(t,n.home))}catch{return!1}}function ha(e){let t=new Set(f.filter(e=>e.scope===`project`).map(e=>e.editorId));return e.filter(e=>t.has(e))}function ga(e,t){if(ha(t).length===0)return null;let n=M(e,o,p,`SKILL.md`);try{let t=be(`project`,{checkDesktop:!0});return oa(j(n),e),{editorId:`agents`,label:`.agents hub`,action:ua(t,n),path:n}}catch(e){return{editorId:`agents`,label:`.agents hub`,action:`failed`,path:n,error:e instanceof Error?e.message:String(e)}}}function _a(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!ma(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=be(`project`,{checkDesktop:!0});oa(j(r),t);let i=ua(n,r);return{editorId:e.id,label:e.label,action:i,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function va(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=j(n);return L(n)?(sa(r,t),He(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function ya(e){switch(e?.code){case`EACCES`:case`EPERM`:return`permission-denied`;case`ELOOP`:return`unresolved-symlink`;case`EISDIR`:case`ENOTDIR`:return`not-a-file`;case`ENOENT`:return`disappeared`;default:return`unreadable`}}function ba(e){switch(e){case`permission-denied`:return`permission denied; check file and parent-directory permissions, then retry`;case`missing-symlink-target`:return`the symlink target is missing; restore the target or correct the symlink, then retry`;case`unresolved-symlink`:return`the path or symlink could not be resolved; check path permissions and repair any symlink cycle, then retry`;case`not-a-file`:return`the path is not a regular file; restore the intended configuration file, then retry`;case`disappeared`:return`the file disappeared; retry to check its current state`;case`unreadable`:return`the file could not be read; check that the path is accessible, then retry`;default:throw Error(`unhandled configuration file decline reason: ${e}`)}}function xa(e){for(let t of e.split(`
327
327
  `)){let e=t.trimStart();if(e.length!==0&&e.length!==t.length)return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function Sa(e){let t=(e.match(/\r\n/g)??[]).length;return t!==0&&t>=(e.match(/\n/g)??[]).length-t}function Ca(e){try{return Ue(e).mode&511}catch{return}}function wa(e,t){let n=e.charCodeAt(0)===65279,r=n?e.slice(1):e,i=r.includes(`\r
328
328
  `)?`\r
329
329
  `:`
330
- `,a=ae(r,t,void 0,{formattingOptions:{...xa(r),eol:i}});if(a.length===0)return{text:e,changed:!1};let o=`${n?``:``}${S(r,a)}`;return{text:o,changed:o!==e}}const Ta={icon:{checked:B(`green`,W.circleFilled),unchecked:W.circle,cursor:W.pointer,disabledChecked:B(`green`,W.circleDouble),disabledUnchecked:`-`},style:{disabled:e=>B(`dim`,e),renderSelectedChoices:e=>e.map(e=>e.short).join(`, `),description:e=>B(`cyan`,e),keysHelpTip:e=>e.map(([e,t])=>`${B(`bold`,e)} ${B(`dim`,t)}`).join(B(`dim`,` • `))},i18n:{disabledError:`This option is disabled and cannot be toggled.`}};function Ea(e){return!K.isSeparator(e)&&!e.disabled}function Da(e){return!K.isSeparator(e)}function Oa(e){return!K.isSeparator(e)&&e.checked}function ka(e){return Ea(e)?{...e,checked:!e.checked}:e}function Aa(e){return function(t){return Ea(t)?{...t,checked:e}:t}}function ja(e){return e.map(e=>{if(K.isSeparator(e))return e;if(typeof e!=`object`||!e||!(`value`in e)){let t=String(e);return{value:e,name:t,short:t,checkedName:t,disabled:!1,checked:!1}}let t=e.name??String(e.value),n={value:e.value,name:t,short:e.short??t,checkedName:e.checkedName??t,disabled:e.disabled??!1,checked:e.checked??!1};return e.description&&(n.description=e.description),n})}var Ma=Qn((e,t)=>{let{pageSize:n=7,loop:r=!0,required:i,validate:a=()=>!0}=e,o={all:`a`,invert:`i`,...e.shortcuts},s=Kt(Ta,e.theme),{keybindings:c}=s,[l,u]=U(`idle`),d=qt({status:l,theme:s}),[f,p]=U(ja(e.choices)),m=Jt(()=>{let e=f.findIndex(Da),t=f.findLastIndex(Da);if(e===-1)throw new Tt(`[checkbox prompt] No selectable choices. All choices are disabled.`);return{first:e,last:t}},[f]),[h,g]=U(m.first),[_,v]=U();Xt(async e=>{if(bt(e)){let e=f.filter(Oa),n=await a([...e]);i&&!e.length?v(`At least one choice must be selected`):n===!0?(u(`done`),t(e.map(e=>e.value))):v(n||`You must select a valid value`)}else if(V(e,c)||gt(e,c)){if(_&&v(void 0),r||V(e,c)&&h!==m.first||gt(e,c)&&h!==m.last){let t=V(e,c)?-1:1,n=h;do n=(n+t+f.length)%f.length;while(!Da(f[n]));g(n)}}else if(_t(e)){let e=f[h];e&&!K.isSeparator(e)&&(e.disabled?v(s.i18n.disabledError):(v(void 0),p(f.map((e,t)=>t===h?ka(e):e))))}else if(e.name===o.all){let e=f.some(e=>Ea(e)&&!e.checked);p(f.map(Aa(e)))}else if(e.name===o.invert)p(f.map(ka));else if(yt(e)){let t=Number(e.name)-1,n=-1,r=f.findIndex(e=>!K.isSeparator(e)&&(n++,n===t)),i=f[r];i&&Ea(i)&&(g(r),p(f.map((e,t)=>t===r?ka(e):e)))}});let y=s.style.message(e.message,l),b,x=Tn({items:f,active:h,renderItem({item:e,isActive:t}){if(K.isSeparator(e))return` ${e.separator}`;let n=t?s.icon.cursor:` `;if(e.disabled){let t=typeof e.disabled==`string`?e.disabled:`(disabled)`,r=e.checked?s.icon.disabledChecked:s.icon.disabledUnchecked;return s.style.disabled(`${n}${r} ${e.name} ${t}`)}t&&(b=e.description);let r=e.checked?s.icon.checked:s.icon.unchecked,i=e.checked?e.checkedName:e.name;return(t?s.style.highlight:e=>e)(`${n}${r} ${i}`)},pageSize:n,loop:r});if(l===`done`){let e=f.filter(Oa);return[d,y,s.style.answer(s.style.renderSelectedChoices(e,f))].filter(Boolean).join(` `)}let S=[[`↑↓`,`navigate`],[`space`,`select`]];o.all&&S.push([o.all,`all`]),o.invert&&S.push([o.invert,`invert`]),S.push([`⏎`,`submit`]);let ee=s.style.keysHelpTip(S);return`${[[d,y].filter(Boolean).join(` `),x,` `,b?s.style.description(b):``,_?s.style.error(_):``,ee].filter(Boolean).join(`
330
+ `,a=C(r,t,void 0,{formattingOptions:{...xa(r),eol:i}});if(a.length===0)return{text:e,changed:!1};let o=`${n?``:``}${S(r,a)}`;return{text:o,changed:o!==e}}const Ta={icon:{checked:B(`green`,W.circleFilled),unchecked:W.circle,cursor:W.pointer,disabledChecked:B(`green`,W.circleDouble),disabledUnchecked:`-`},style:{disabled:e=>B(`dim`,e),renderSelectedChoices:e=>e.map(e=>e.short).join(`, `),description:e=>B(`cyan`,e),keysHelpTip:e=>e.map(([e,t])=>`${B(`bold`,e)} ${B(`dim`,t)}`).join(B(`dim`,` • `))},i18n:{disabledError:`This option is disabled and cannot be toggled.`}};function Ea(e){return!K.isSeparator(e)&&!e.disabled}function Da(e){return!K.isSeparator(e)}function Oa(e){return!K.isSeparator(e)&&e.checked}function ka(e){return Ea(e)?{...e,checked:!e.checked}:e}function Aa(e){return function(t){return Ea(t)?{...t,checked:e}:t}}function ja(e){return e.map(e=>{if(K.isSeparator(e))return e;if(typeof e!=`object`||!e||!(`value`in e)){let t=String(e);return{value:e,name:t,short:t,checkedName:t,disabled:!1,checked:!1}}let t=e.name??String(e.value),n={value:e.value,name:t,short:e.short??t,checkedName:e.checkedName??t,disabled:e.disabled??!1,checked:e.checked??!1};return e.description&&(n.description=e.description),n})}var Ma=Qn((e,t)=>{let{pageSize:n=7,loop:r=!0,required:i,validate:a=()=>!0}=e,o={all:`a`,invert:`i`,...e.shortcuts},s=Kt(Ta,e.theme),{keybindings:c}=s,[l,u]=U(`idle`),d=qt({status:l,theme:s}),[f,p]=U(ja(e.choices)),m=Jt(()=>{let e=f.findIndex(Da),t=f.findLastIndex(Da);if(e===-1)throw new Tt(`[checkbox prompt] No selectable choices. All choices are disabled.`);return{first:e,last:t}},[f]),[h,g]=U(m.first),[_,v]=U();Xt(async e=>{if(bt(e)){let e=f.filter(Oa),n=await a([...e]);i&&!e.length?v(`At least one choice must be selected`):n===!0?(u(`done`),t(e.map(e=>e.value))):v(n||`You must select a valid value`)}else if(V(e,c)||gt(e,c)){if(_&&v(void 0),r||V(e,c)&&h!==m.first||gt(e,c)&&h!==m.last){let t=V(e,c)?-1:1,n=h;do n=(n+t+f.length)%f.length;while(!Da(f[n]));g(n)}}else if(_t(e)){let e=f[h];e&&!K.isSeparator(e)&&(e.disabled?v(s.i18n.disabledError):(v(void 0),p(f.map((e,t)=>t===h?ka(e):e))))}else if(e.name===o.all){let e=f.some(e=>Ea(e)&&!e.checked);p(f.map(Aa(e)))}else if(e.name===o.invert)p(f.map(ka));else if(yt(e)){let t=Number(e.name)-1,n=-1,r=f.findIndex(e=>!K.isSeparator(e)&&(n++,n===t)),i=f[r];i&&Ea(i)&&(g(r),p(f.map((e,t)=>t===r?ka(e):e)))}});let y=s.style.message(e.message,l),b,x=Tn({items:f,active:h,renderItem({item:e,isActive:t}){if(K.isSeparator(e))return` ${e.separator}`;let n=t?s.icon.cursor:` `;if(e.disabled){let t=typeof e.disabled==`string`?e.disabled:`(disabled)`,r=e.checked?s.icon.disabledChecked:s.icon.disabledUnchecked;return s.style.disabled(`${n}${r} ${e.name} ${t}`)}t&&(b=e.description);let r=e.checked?s.icon.checked:s.icon.unchecked,i=e.checked?e.checkedName:e.name;return(t?s.style.highlight:e=>e)(`${n}${r} ${i}`)},pageSize:n,loop:r});if(l===`done`){let e=f.filter(Oa);return[d,y,s.style.answer(s.style.renderSelectedChoices(e,f))].filter(Boolean).join(` `)}let S=[[`↑↓`,`navigate`],[`space`,`select`]];o.all&&S.push([o.all,`all`]),o.invert&&S.push([o.invert,`invert`]),S.push([`⏎`,`submit`]);let ee=s.style.keysHelpTip(S);return`${[[d,y].filter(Boolean).join(` `),x,` `,b?s.style.description(b):``,_?s.style.error(_):``,ee].filter(Boolean).join(`
331
331
  `).trimEnd()}${Vn}`});const Na={icon:{cursor:W.pointer},style:{disabled:e=>B(`dim`,e),description:e=>B(`cyan`,e),keysHelpTip:e=>e.map(([e,t])=>`${B(`bold`,e)} ${B(`dim`,t)}`).join(B(`dim`,` • `))},i18n:{disabledError:`This option is disabled and cannot be selected.`},indexMode:`hidden`};function Pa(e){return!K.isSeparator(e)&&!e.disabled}function Fa(e){return!K.isSeparator(e)}function Ia(e){return e.map(e=>{if(K.isSeparator(e))return e;if(typeof e!=`object`||!e||!(`value`in e)){let t=String(e);return{value:e,name:t,short:t,disabled:!1}}let t=e.name??String(e.value),n={value:e.value,name:t,short:e.short??t,disabled:e.disabled??!1};return e.description&&(n.description=e.description),n})}var La=Qn((e,t)=>{let{loop:n=!0,pageSize:r=7}=e,i=Kt(Na,e.theme),{keybindings:a}=i,[o,s]=U(`idle`),c=qt({status:o,theme:i}),l=Yt(),u=!a.includes(`vim`),d=Jt(()=>Ia(e.choices),[e.choices]),f=Jt(()=>{let e=d.findIndex(Fa),t=d.findLastIndex(Fa);if(e===-1)throw new Tt(`[select prompt] No selectable choices. All choices are disabled.`);return{first:e,last:t}},[d]),p=Jt(()=>`default`in e?d.findIndex(t=>Pa(t)&&t.value===e.default):-1,[e.default,d]),[m,h]=U(p===-1?f.first:p),g=d[m];if(g==null||K.isSeparator(g))throw Error(`Active index does not point to a choice`);let[_,v]=U();Xt((e,r)=>{if(clearTimeout(l.current),_&&v(void 0),bt(e))g.disabled?v(i.i18n.disabledError):(s(`done`),t(g.value));else if(V(e,a)||gt(e,a)){if(r.clearLine(0),n||V(e,a)&&m!==f.first||gt(e,a)&&m!==f.last){let t=V(e,a)?-1:1,n=m;do n=(n+t+d.length)%d.length;while(!Fa(d[n]));h(n)}}else if(yt(e)&&!Number.isNaN(Number(r.line))){let e=Number(r.line)-1,t=-1,n=d.findIndex(n=>!K.isSeparator(n)&&(t++,t===e)),i=d[n];i!=null&&Pa(i)&&h(n),l.current=setTimeout(()=>{r.clearLine(0)},700)}else if(vt(e))r.clearLine(0);else if(u){let e=r.line.toLowerCase(),t=d.findIndex(t=>K.isSeparator(t)||!Pa(t)?!1:t.name.toLowerCase().startsWith(e));t!==-1&&h(t),l.current=setTimeout(()=>{r.clearLine(0)},700)}}),Ft(()=>()=>{clearTimeout(l.current)},[]);let y=i.style.message(e.message,o),b=i.style.keysHelpTip([[`↑↓`,`navigate`],[`⏎`,`select`]]),x=0,S=Tn({items:d,active:m,renderItem({item:e,isActive:t,index:n}){if(K.isSeparator(e))return x++,` ${e.separator}`;let r=t?i.icon.cursor:` `,a=i.indexMode===`number`?`${n+1-x}. `:``;if(e.disabled){let n=typeof e.disabled==`string`?e.disabled:`(disabled)`,r=t?i.icon.cursor:`-`;return i.style.disabled(`${r} ${a}${e.name} ${n}`)}return(t?i.style.highlight:e=>e)(`${r} ${a}${e.name}`)},pageSize:r,loop:n});if(o===`done`)return[c,y,i.style.answer(g.short)].filter(Boolean).join(` `);let{description:ee}=g;return`${[[c,y].filter(Boolean).join(` `),S,` `,ee?i.style.description(ee):``,_?i.style.error(_):``,b].filter(Boolean).join(`
332
332
  `).trimEnd()}${Vn}`});const Ra=`${$r}-dev`;function za(e){return e.startsWith($r)}function Ba(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command!==`ok-pi-managed-extension`||!Array.isArray(t.args))return!1;let n=t.args[0];return typeof n==`string`&&za(n)}function Va(e){return{command:`ok-pi-managed-extension`,args:[e]}}function Ha(e={}){let t=e.mode===`dev`?Ra:ei,n={unix:Z({...e,platformName:`darwin`}),win32:Z({...e,platformName:`win32`})};return`${t}
333
333
  /**
@@ -672,22 +672,22 @@ export default function okBridge(pi: {
672
672
  }
673
673
  });
674
674
  }
675
- `}function Ua(e,t){let n=N(ge(t),ge(e));return n.length>0&&!n.startsWith(`..`)&&!Me(n)}const Wa=e=>{try{let t=ke(`git`,[`rev-parse`,`--show-toplevel`],be({cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]})).trim();return t.length>0?t:null}catch{return null}};function Ga(e,t={}){let n=t.homeDir??z(),r=t.gitTopLevel??Wa,i=P(e),a;try{a=Ve(i)}catch{a=i}let o=a,s=0;for(;s<30&&o!==n&&o!==`/`&&o!==``;){if(pe(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=j(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&Ua(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}function Ka(){let e=Pr();return e&&typeof e.resolveSymlinkWritePath==`function`?e:null}function qa(e){let t=e,n=new Set;for(;;){let r;try{r=Le(t).isSymbolicLink()}catch(n){return n.code===`ENOENT`?{readPath:t,writePath:t}:{readPath:null,writePath:e}}if(!r)return{readPath:t,writePath:t};if(n.has(t))return{readPath:null,writePath:e};n.add(t);let i;try{i=Be(t)}catch(t){return Y(`readlinkSync threw during symlink walk`,t),{readPath:null,writePath:e}}t=Me(i)?i:M(j(t),i)}}let Ja;function Ya(){return Ja===void 0&&(Ja=Ka()),Ja}function Xa(e,t=Ya){let n=t();if(n)try{let t=n.resolveSymlinkWritePath(e);return{readPath:t.readPath??null,writePath:t.writePath}}catch(e){Y(`resolveSymlinkWritePath threw`,e)}return qa(e)}const Za={allowTrailingComma:!0,disallowComments:!1};function Qa(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function $a(e){let t=[],n=se(e,t,Za);return t.some(t=>!Qa(t,e))||n?.type!==`object`?null:n}function eo(e,t){let n=0;for(let r of e.children??[]){let e=r.children?.[0];e!==void 0&&ve(e)===t&&(n+=1)}return n}function to(e,t){C(e,`${JSON.stringify(t,null,2)}\n`)}function no(e,t){let n=Or(t);C(e,n.endsWith(`
676
- `)?n:`${n}\n`)}function ro(e,t){let n=(0,kr.stringify)(t);C(e,n.endsWith(`
675
+ `}function Ua(e,t){let n=N(he(t),he(e));return n.length>0&&!n.startsWith(`..`)&&!Me(n)}const Wa=e=>{try{let t=ke(`git`,[`rev-parse`,`--show-toplevel`],ye({cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]})).trim();return t.length>0?t:null}catch{return null}};function Ga(e,t={}){let n=t.homeDir??z(),r=t.gitTopLevel??Wa,i=P(e),a;try{a=Ve(i)}catch{a=i}let o=a,s=0;for(;s<30&&o!==n&&o!==`/`&&o!==``;){if(de(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=j(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&Ua(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}function Ka(){let e=Pr();return e&&typeof e.resolveSymlinkWritePath==`function`?e:null}function qa(e){let t=e,n=new Set;for(;;){let r;try{r=Le(t).isSymbolicLink()}catch(n){return n.code===`ENOENT`?{readPath:t,writePath:t}:{readPath:null,writePath:e}}if(!r)return{readPath:t,writePath:t};if(n.has(t))return{readPath:null,writePath:e};n.add(t);let i;try{i=Be(t)}catch(t){return Y(`readlinkSync threw during symlink walk`,t),{readPath:null,writePath:e}}t=Me(i)?i:M(j(t),i)}}let Ja;function Ya(){return Ja===void 0&&(Ja=Ka()),Ja}function Xa(e,t=Ya){let n=t();if(n)try{let t=n.resolveSymlinkWritePath(e);return{readPath:t.readPath??null,writePath:t.writePath}}catch(e){Y(`resolveSymlinkWritePath threw`,e)}return qa(e)}const Za={allowTrailingComma:!0,disallowComments:!1};function Qa(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function $a(e){let t=[],n=se(e,t,Za);return t.some(t=>!Qa(t,e))||n?.type!==`object`?null:n}function eo(e,t){let n=0;for(let r of e.children??[]){let e=r.children?.[0];e!==void 0&&_e(e)===t&&(n+=1)}return n}function to(e,t){w(e,`${JSON.stringify(t,null,2)}\n`)}function no(e,t){let n=Or(t);w(e,n.endsWith(`
676
+ `)?n:`${n}\n`)}function ro(e,t){let n=(0,kr.stringify)(t);w(e,n.endsWith(`
677
677
  `)?n:`${n}\n`)}const io=10485760;function ao(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>ao(e,t[n]));if(A(e)&&A(t)){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&ao(e[n],t[n]))}return!1}function oo(e,t,n){return A(e)&&n.every(n=>ao(e[n],t[n]))}function so(e){for(let t of e.split(`
678
- `)){let e=t.trimStart();if(e.length!==0&&e.length!==t.length)return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function co(e,t,n){return t===void 0?[e,n]:[e,t,n]}function lo(e,t,n,r){let i={[n]:r};return{[e]:t===void 0?i:{[t]:i}}}function uo(e,t,n){let r=e[t];return n===void 0?r:A(r)?r[n]:void 0}function fo(e,t,n,r,i,a=!1,o=!1){if(!L(e))return o?{kind:`unchanged`}:(to(e,lo(t,i,n,r)),{kind:`written`});let s;try{s=R(e,`utf-8`)}catch(e){return Y(`json config read failed`,e),{kind:`declined`,reason:ya(e)}}if(s.trim()===``)return o?{kind:`unchanged`}:(to(e,lo(t,i,n,r)),{kind:`written`});if(Buffer.byteLength(s,`utf-8`)>io)return{kind:`declined`,reason:`oversize`};let c=$a(s);if(!c)return{kind:`declined`,reason:`unparseable`};if(eo(c,t)>1)return{kind:`declined`,reason:`duplicate-container`};let l=uo(ve(c),t,i),u=A(l)?l[n]:void 0,d=u!==void 0,f=_i(r);if(d&&a?ii(u):d&&oo(u,r,f))return{kind:o?`unchanged`:`overwritten`};let p=s.charCodeAt(0)===65279,m=p?s.slice(1):s,h=m.includes(`\r
678
+ `)){let e=t.trimStart();if(e.length!==0&&e.length!==t.length)return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function co(e,t,n){return t===void 0?[e,n]:[e,t,n]}function lo(e,t,n,r){let i={[n]:r};return{[e]:t===void 0?i:{[t]:i}}}function uo(e,t,n){let r=e[t];return n===void 0?r:A(r)?r[n]:void 0}function fo(e,t,n,r,i,a=!1,o=!1){if(!L(e))return o?{kind:`unchanged`}:(to(e,lo(t,i,n,r)),{kind:`written`});let s;try{s=R(e,`utf-8`)}catch(e){return Y(`json config read failed`,e),{kind:`declined`,reason:ya(e)}}if(s.trim()===``)return o?{kind:`unchanged`}:(to(e,lo(t,i,n,r)),{kind:`written`});if(Buffer.byteLength(s,`utf-8`)>io)return{kind:`declined`,reason:`oversize`};let c=$a(s);if(!c)return{kind:`declined`,reason:`unparseable`};if(eo(c,t)>1)return{kind:`declined`,reason:`duplicate-container`};let l=uo(_e(c),t,i),u=A(l)?l[n]:void 0,d=u!==void 0,f=_i(r);if(d&&a?ii(u):d&&oo(u,r,f))return{kind:o?`unchanged`:`overwritten`};let p=s.charCodeAt(0)===65279,m=p?s.slice(1):s,h=m.includes(`\r
679
679
  `)?`\r
680
680
  `:`
681
- `,g={...so(m),eol:h},_=co(t,i,n),v=m;if(o)for(let e of d?vi(u,r):[]){let t=ae(v,[..._,e],void 0,{formattingOptions:g});v=S(v,t)}else if(d&&!a&&pi(u))for(let e of f){let t=ae(v,[..._,e],r[e],{formattingOptions:g});v=S(v,t)}else{let e=ae(v,_,r,{formattingOptions:g});v=S(v,e)}let y=`${p?``:``}${v}`;return y!==s&&C(e,y,{mode:Ca(e)}),o&&y===s?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}function po(e,t,n,r,i,a=!1,o=!1){let s=``;if(L(t))try{s=R(t,`utf-8`)}catch(e){return Y(`toml config read failed`,e),{kind:`declined`,reason:ya(e)}}let c=s.trim()===``;if(c&&o)return{kind:`unchanged`};if(e.backend===`fallback`)return c?(no(t,{[n]:{[r]:i}}),{kind:`written`}):{kind:`declined`,reason:`no-native-writer`};let l=s.charCodeAt(0)===65279,u=l?s.slice(1):s,d=Sa(u),f=c||u.endsWith(`
681
+ `,g={...so(m),eol:h},_=co(t,i,n),v=m;if(o)for(let e of d?vi(u,r):[]){let t=C(v,[..._,e],void 0,{formattingOptions:g});v=S(v,t)}else if(d&&!a&&pi(u))for(let e of f){let t=C(v,[..._,e],r[e],{formattingOptions:g});v=S(v,t)}else{let e=C(v,_,r,{formattingOptions:g});v=S(v,e)}let y=`${p?``:``}${v}`;return y!==s&&w(e,y,{mode:Ca(e)}),o&&y===s?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}function po(e,t,n,r,i,a=!1,o=!1){let s=``;if(L(t))try{s=R(t,`utf-8`)}catch(e){return Y(`toml config read failed`,e),{kind:`declined`,reason:ya(e)}}let c=s.trim()===``;if(c&&o)return{kind:`unchanged`};if(e.backend===`fallback`)return c?(no(t,{[n]:{[r]:i}}),{kind:`written`}):{kind:`declined`,reason:`no-native-writer`};let l=s.charCodeAt(0)===65279,u=l?s.slice(1):s,d=Sa(u),f=c||u.endsWith(`
682
682
  `),p,m=!1;try{let t=mo(e,u,n,r);if(o){let n=u;for(let a of t===void 0?[]:vi(t,i))n=e.removeEntryKey(n,r,a).text;p={text:n,existed:t!==void 0}}else{let n=ho(t,i,a);m=n.kind===`replace`;let o=m?e.removeEntry(u,r).text:u;if(n.kind===`merge`)for(let t of n.prune)o=e.removeEntryKey(o,r,t).text;p=e.upsertEntry(o,r,i)}}catch(e){return Y(`upsertEntry failed`,e),{kind:`declined`,reason:`unparseable`}}let h=p.text;f?h.endsWith(`
683
683
  `)||(h=`${h}\n`):h=h.replace(/\n+$/,``),d&&(h=h.replace(/\r\n/g,`
684
684
  `).replace(/\n/g,`\r
685
- `));let g=`${l?``:``}${h}`;return g!==s&&C(t,g,{mode:Ca(t)}),o&&g===s?{kind:`unchanged`}:{kind:p.existed||m?`overwritten`:`written`}}function mo(e,t,n,r){if(t.trim()===``)return;let i=e.parseToObject(t)[n],a=A(i)?i[r]:void 0;return A(a)?a:void 0}function ho(e,t,n){return e===void 0||ii(e)?{kind:`merge`,prune:[]}:n||!pi(e)?{kind:`replace`}:{kind:`merge`,prune:vi(e,t)}}function go(e,t,n,r,i=!1,a=!1){let o=``;if(L(e))try{o=R(e,`utf-8`)}catch(e){return Y(`yaml config read failed`,e),{kind:`declined`,reason:ya(e)}}if(o.trim()===``)return a?{kind:`unchanged`}:(ro(e,{[t]:{[n]:r}}),{kind:`written`});if(Buffer.byteLength(o,`utf-8`)>io)return{kind:`declined`,reason:`oversize`};let s=o.charCodeAt(0)===65279,c=s?o.slice(1):o,l=(0,kr.parseDocument)(c);if(l.errors.length>0)return{kind:`declined`,reason:`unparseable`};let u=[t,n],d=l.hasIn(u);l.hasIn([t])&&!(0,kr.isCollection)(l.getIn([t],!0))&&l.deleteIn([t]);let f=l.getIn(u,!0),p=d&&(0,kr.isCollection)(f)&&(i?ii(f.toJSON()):pi(f.toJSON()));if(a){if(d&&(0,kr.isCollection)(f))for(let e of vi(f.toJSON(),r))l.deleteIn([...u,e])}else if(p)for(let e of _i(r))r[e]===void 0?l.deleteIn([...u,e]):l.setIn([...u,e],l.createNode(r[e]));else l.setIn(u,l.createNode(r));let m=l.toString(),h=Sa(c);c.endsWith(`
685
+ `));let g=`${l?``:``}${h}`;return g!==s&&w(t,g,{mode:Ca(t)}),o&&g===s?{kind:`unchanged`}:{kind:p.existed||m?`overwritten`:`written`}}function mo(e,t,n,r){if(t.trim()===``)return;let i=e.parseToObject(t)[n],a=A(i)?i[r]:void 0;return A(a)?a:void 0}function ho(e,t,n){return e===void 0||ii(e)?{kind:`merge`,prune:[]}:n||!pi(e)?{kind:`replace`}:{kind:`merge`,prune:vi(e,t)}}function go(e,t,n,r,i=!1,a=!1){let o=``;if(L(e))try{o=R(e,`utf-8`)}catch(e){return Y(`yaml config read failed`,e),{kind:`declined`,reason:ya(e)}}if(o.trim()===``)return a?{kind:`unchanged`}:(ro(e,{[t]:{[n]:r}}),{kind:`written`});if(Buffer.byteLength(o,`utf-8`)>io)return{kind:`declined`,reason:`oversize`};let s=o.charCodeAt(0)===65279,c=s?o.slice(1):o,l=(0,kr.parseDocument)(c);if(l.errors.length>0)return{kind:`declined`,reason:`unparseable`};let u=[t,n],d=l.hasIn(u);l.hasIn([t])&&!(0,kr.isCollection)(l.getIn([t],!0))&&l.deleteIn([t]);let f=l.getIn(u,!0),p=d&&(0,kr.isCollection)(f)&&(i?ii(f.toJSON()):pi(f.toJSON()));if(a){if(d&&(0,kr.isCollection)(f))for(let e of vi(f.toJSON(),r))l.deleteIn([...u,e])}else if(p)for(let e of _i(r))r[e]===void 0?l.deleteIn([...u,e]):l.setIn([...u,e],l.createNode(r[e]));else l.setIn(u,l.createNode(r));let m=l.toString(),h=Sa(c);c.endsWith(`
686
686
  `)?m.endsWith(`
687
687
  `)||(m=`${m}\n`):m=m.replace(/\n+$/,``),h&&(m=m.replace(/\r\n/g,`
688
688
  `).replace(/\n/g,`\r
689
- `));let g=`${s?``:``}${m}`;return g!==o&&C(e,g,{mode:Ca(e)}),a&&g===o?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}const _o=e=>e!==`project`,vo=e=>e!==`user`;async function yo(){let e=await Ma({message:`Where should the MCP server be configured?
690
- `,required:!1,theme:{icon:{checked:`[x]`,unchecked:`[ ]`}},choices:[{name:`User-level (~/.claude.json, ~/.cursor/mcp.json, …)`,value:`user`,checked:!0},{name:`Project-level (.mcp.json, .cursor/mcp.json, …)`,value:`project`,checked:!0}]});return e.includes(`user`)&&e.includes(`project`)?`both`:e.includes(`user`)?`user`:e.includes(`project`)?`project`:null}async function bo(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??yo)():`both`}async function xo(e){return La({message:`How do you want to handle OpenKnowledge config files (.ok/, .mcp.json)?`,default:e,choices:[{name:`Share with my team (commit alongside content)`,value:`shared`,description:`OK config gets committed alongside your project content.`},{name:`Local only (keep out of git via .git/info/exclude)`,value:`local-only`,description:"OK config stays on this machine only; teammates do not see it. Safe escape hatch via `ok config-sharing share`."}]})}async function So(e){if(e.sharing!==void 0)return e.sharing;let t=Ki(e.projectRoot)===`local-only`||e.freshProject===!0?`local-only`:`shared`;return e.isTTY??process.stdout.isTTY?(e.promptFn??xo)(t):t}var Co=class extends Error{constructor(e){super(e),this.name=`ContentDirError`}};function wo(e){if(e===void 0||e===!0)return new Set(Ce);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(ue.filter(e=>t.includes(e)))}function To(e,t,n){let r=P(n,e),i;try{i=Ue(r)}catch(e){let t=e.code;throw t===`ENOENT`?new Co(`--content-dir path does not exist: ${r}`):new Co(`--content-dir path is not accessible (${t??`unknown error`}): ${r}`)}if(!i.isDirectory())throw new Co(`--content-dir must be a directory: ${r}`);let a=Eo(t),o=Eo(r),s=N(a,o);if(s.startsWith(`..`)||Me(s))throw new Co(`--content-dir must be inside the project root (${t}); got ${r}`);return s===``?`.`:s}function Eo(e){try{return Ve(e)}catch{return e}}const Do=`open-knowledge-ui`;function Oo(e,t,n){try{let r=e.detectPath?.(t,n)??j(e.configPath(t,n));return L(r)}catch{return!1}}function ko(e,t,n){try{let r=P(j(e.configPath(t,n))),i=P(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+F)}catch{return!1}}function Ao(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=n.pruneOnly===!0;if(s&&(e.format===`file`||!L(o)))return{editorId:e.id,label:e.label,action:`skipped-flag`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}};let c=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||ko(e,t,r);if(!i&&c&&!Oo(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{oa(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return Mo(e,o,a,n,{isProjectScope:i!==void 0});let l;try{l=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{s||Re(j(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let u={action:`written`},d;try{de(`${o}.lock`,()=>{let t=Xa(o).writePath;if(s||Re(j(t),{recursive:!0}),e.format===`toml`){let r=po(Hr(),t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}if(e.format===`yaml`){let r=go(t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}let r=fo(t,e.topLevelKey,a,l,e.serverMapSubKey,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){d=e instanceof Error?e:Error(String(e))}return d?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:d.message,...i===void 0?{}:{configScope:`project`}}:u.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:u.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:u.action===`unchanged`?`skipped-flag`:u.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const jo={pi:Ha};function Mo(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=jo[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{Re(j(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{de(`${t}.lock`,()=>{let e=null;try{e=R(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}C(t,c,e===null?void 0:{mode:Ca(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}function No(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}async function Po(e){let t=zi(e.editors).filter(e=>e.scope===`global`),n={mode:`published`,skipAvailabilityCheck:!0,...e.replaceEntry===!0?{replaceEntry:!0}:{},...e.pruneOnly===!0?{pruneOnly:!0}:{}};return t.map(t=>Ao(t,``,n,e.home))}function Fo(e,t,n,r){let i=Lo(e,t,n,r);return i.kind===`present`?i.entry:null}function Io(e,t,n,r){let i=uo(e,t,r);if(!A(i))return{kind:`no-entry`};let a=i[n];return A(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function Lo(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};try{if(Ue(i).size>io)return{kind:`decline`,reason:`oversize`}}catch(e){return{kind:`decline`,reason:ya(e)}}let a;try{a=R(i,`utf-8`)}catch(e){return{kind:`decline`,reason:ya(e)}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:Va(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=Hr().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return Io(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,kr.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:Io(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=$a(a);return s?eo(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:Io(ve(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function Ro(e={}){let t=P(e.cwd??process.cwd()),n=Ga(t,{homeDir:e.home}),r=n.projectRoot;if(ie(r,e.home??z()))throw new ne(r);let i=!L(M(r,`.ok`)),a=n.gitRootPromoted?N(r,t):void 0,o=e.contentDir===void 0?n.defaultContentDir:To(e.contentDir,r,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&o===`.`&&process.stderr.write(`${O(`[ok] Content scope promoted to the git repo root: ${r}`)}\n Ran in ${a}/, but .ok/ lives at the git root (one .ok/ per git repo),\n so the whole repo is now the content scope. To narrow it, re-run with\n \`ok init --content-dir .\`, or set content.dir: ${a} in .ok/config.yml.\n`);let s={mode:e.devMcp?`dev`:`published`},c=await Se(r),l;try{l=we(r,{contentDir:o})}catch(t){let i=$.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:c.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDirRequested:e.contentDir,contentScaffoldFailed:!0,mcpAction:`failed`,mcpPath:i,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`,sharing:{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:!1}}}let u=l.created.includes(Ee),d=!1;if(c.didInit)try{d=Te(r)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${r}: ${e instanceof Error?e.message:String(e)}`)}try{ce(r)===`removed`&&console.warn(`[ok] Removed the OpenKnowledge project-skill lines from .gitignore. The skill is ordinary project content now — commit it if your team wants it on clone.`)}catch(e){console.warn(`[ok] Skipping project-skill .gitignore cleanup at ${r}: ${e instanceof Error?e.message:String(e)}`)}let f=await bo({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),p=e.editors??Wo(r,e.home),m=e.editors??p,g=zi(p),_=zi(m),v=e.mcp===!1||f===null,y=Array.from(new Map([...g,...v?[]:_].map(e=>[e.id,e])).values()),b=g.filter(t=>Oo(t,r,e.home)),S=[],re=[],ae=new Set;for(let t of y){if(v){let n=``;try{n=t.configPath(r,e.home)}catch{}S.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(_o(f)&&g.includes(t)&&t.scope===`global`&&S.push(Ao(t,r,s,e.home)),vo(f)&&_.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Ao(t,r,s,e.home,n);S.push(i),(i.action===`written`||i.action===`overwritten`)&&ae.add(n)}}let oe=new Set;for(let t of _){let n=t.projectSkillPath?.(r);!n||oe.has(n)||(oe.add(n),re.push(_a(t,r,{home:e.home})))}let se=ga(r,_.map(e=>e.id));se&&re.push(se);let le=re.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.editorId);if(le.length>0){let t=e.home??z();x({source:h,skills:[ye.project],agents:le,scope:r},{home:t,enabled:_e(t).enabled})}let C=!v&&f!==null&&vo(f)?_.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,de=v?[]:b.map(e=>No(e,r)).filter(e=>e!==void 0).filter(e=>!ae.has(e.path)),fe=e.installUserSkill??ee,pe=e.home??z(),he=wo(e.skills),ge=!1,ve=!1,be=!1,xe=!1,Ce=!1;for(let t of ue){if(!he.has(t))continue;await me(pe,ye[t],!0).catch(()=>{}),ge=!0;let n=await fe({home:e.home,bundleId:t,force:!0});n===`installed`?ve=!0:n===`failed`?be=!0:n===`no-hosts`?Ce=!0:xe=!0}let w=be?`failed`:ve?`installed`:ge&&xe?`skip-current`:ge&&Ce?`no-hosts`:`declined`,T=ve?te(pe).map(e=>e.editorId):[],E=v?`skipped-flag`:`skipped-missing`,D=S.find(e=>e.editorId===`claude`)??S[0]??{action:E,configPath:$.claude.configPath(r,e.home)},k=await zo({projectRoot:r,desiredMode:await So({sharing:e.sharing,projectRoot:r,isTTY:e.isTTY,freshProject:i,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:r,contentCreated:l.created,contentUpdated:l.updated,contentSkipped:l.skipped,editors:S,projectSkills:re,legacyProjectConfigs:de,skillInstall:w,skillHosts:T,didGitInit:c.didInit,rootGitignoreCreated:d,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDir:u?o:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:D.action,mcpPath:D.configPath,mcpError:`error`in D?D.error:void 0,projectScopeUnsupportedLabels:C,sharing:k}}async function zo(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=Ki(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=Hi(t);if(n===`local-only`){let e=Wi(t,a);if(e.kind===`refused-tracked`){let t=e;return{kind:`refused-tracked`,tracked:t.tracked,remediation:t.remediation}}return e.kind===`no-exclude`?{kind:`no-exclude`,reason:e.reason,localOnlyRequested:r===`local-only`}:Bo(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=Gi(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:Bo(t,o,`remove`)}function Bo(e,t,n){let r=Ki(e);return n===`add`?{kind:`applied`,mode:r,action:t.appended.length>0?`added`:t.removed.length>0?`cleaned`:`noop`,appended:t.appended,alreadyPresent:t.alreadyPresent,removed:t.removed}:{kind:`applied`,mode:r,action:`removed`,appended:[],alreadyPresent:[],removed:t.removed}}function Vo(e){switch(e){case`permission-denied`:return`permission denied; check file and parent-directory permissions`;case`unresolved-symlink`:return`could not resolve the path or symlink; check permissions and symlink cycles`;case`not-a-file`:return`config path is not a regular file`;case`disappeared`:return`config disappeared while being read; retry to check its current state`;case`unreadable`:return`could not read the config file; check that the path is accessible`;case`unparseable`:return`config could not be parsed`;case`oversize`:return`config too large to edit safely`;case`duplicate-container`:return`duplicate server block`;case`no-native-writer`:return`no format-preserving writer available`;case void 0:return`config not readable`;default:throw Error(`unhandled MCP decline reason: ${e}`)}}function Ho(e,t){let n=[],r=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),i=e.editors.some(e=>e.action===`failed`)||e.projectSkills.some(e=>e.action===`failed`),a=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),o=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`);e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`),e.rootGitignoreCreated&&n.push(`Seeded .gitignore at ${t}/.gitignore (.DS_Store)`);let s=M(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(k(`Content scaffolded at ${s}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(k(`Content already present at ${s}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0){if(n.push(k(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`)}else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(k(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(k(`MCP server configuration:`));for(let r of e.editors){let e=r.configPath.startsWith(t)?N(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),i=r.serverName===`open-knowledge`?``:` (${r.serverName})`,a=r.configScope===`project`?` (project)`:``,o=`${r.label}${a}`,s=` `.repeat(Math.max(1,20-o.length)),c=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${o}${s}${e} ${E(`registered`)}${i}${c}`);break;case`overwritten`:n.push(` ${o}${s}${e} ${E(`updated`)}${i}${c}`);break;case`skipped-missing`:n.push(` ${o}${s}${e} config root missing; skipped`);break;case`failed`:n.push(` ${o}${s}${e} ${D(`FAILED`)}: ${r.error}`);break;case`declined`:n.push(` ${o}${s}${e} left unchanged (${Vo(r.declineReason)})`);break;case`skipped-flag`:break;default:r.action}}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}}if(e.projectSkills.length>0){n.push(``),n.push(k(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?N(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${E(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${E(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`skipped-prerequisite`:n.push(` ${e}${i}OpenKnowledge MCP is not configured; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${D(`FAILED`)}: ${r.error}`)}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${N(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall)switch(n.push(``),n.push(k(`User-global skill:`)),e.skillInstall){case`installed`:{let t=(e.skillHosts??[]).map(e=>X[e]??e),r=t.length>0?t.join(`, `):`the shared ~/.agents store`;n.push(` open-knowledge ${E(`installed for ${r}`)}`),n.push(` ${T(`Counted on skills.sh (skill name + source repo, once per machine).`)}`),n.push(` ${T(`Opt out: DO_NOT_TRACK=1, or Settings → User → Preferences.`)}`);break}case`skip-current`:n.push(` open-knowledge ${E(`already installed at current version`)}`);break;case`declined`:n.push(` open-knowledge ${T(`skipped for this run (--no-skills)`)}`),n.push(` ${T(`Nothing was installed or removed. Any built-in skills already on this`)}`),n.push(` ${T(`machine are untouched. Run init without the flag to install them:`)}`),n.push(` ${T(` ok init`)}`);break;case`no-hosts`:n.push(` open-knowledge ${T(`skipped — no supported agent host detected in your home directory`)}`);break;case`failed`:n.push(` ${O(`open-knowledge install failed — MCP still configured; retry with:`)}`),n.push(` ${O(` ok repair-skills`)}`)}if(e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(O(`⚠ --content-dir ${e.contentDirRequested} ignored — .ok/config.yml already exists`)),n.push(` Edit .ok/config.yml → content.dir directly to change the content scope.`)):e.contentDir!==void 0&&e.contentDir!==`.`?(n.push(``),n.push(`Content scope set to ${e.contentDir}/ (content.dir in .ok/config.yml).`)):e.gitRootPromoted&&e.contentDir===`.`&&e.contentDirRequested===void 0&&(n.push(``),n.push(O(`⚠ Content scope promoted to the git repo root`)),n.push(` .ok/ was initialized at ${t} because it contains a .git folder (one .ok/ per git repo),`),n.push(` not the sub-folder you ran \`ok init\` in${e.promotedFromDir?` (${e.promotedFromDir})`:``}. The whole repo is now the content scope.`),e.promotedFromDir&&(n.push(" To scope to just that sub-folder, re-run `ok init --content-dir .` from there, or set"),n.push(` content.dir: ${e.promotedFromDir} in .ok/config.yml.`))),e.preview?(n.push(``),n.push(De(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(...qo(e.sharing,t)),r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${E(`✓`)} ${k(`Next steps:`)}`),n.push(` 1. Open your editor (${w(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${w(`ok seed --list-packs`)} — browse the starter packs`),n.push(` - ${w(`ok seed`)} — scaffold an empty repo`),n.push(` 4. Ask your agent to capture a source, research a topic, or build a wiki —`),n.push(` the procedures ship as skills alongside the MCP tools.`)}return n.join(`
691
- `)}function Uo(e,t){return{projectRoot:e.projectRoot,gitRootPromoted:e.gitRootPromoted,promotedFromDir:e.promotedFromDir??null,contentDir:t.contentDir,contentDirRequested:e.contentDirRequested??null,contentDirApplied:e.contentDir!==void 0,contentFileCount:t.contentFileCount,previewError:e.previewWarning??null,didGitInit:e.didGitInit,mcpAction:e.mcpAction,editors:e.editors.map(e=>({editorId:e.editorId,label:e.label,action:e.action,configPath:e.configPath,scope:e.configScope===`project`?`project`:`user`}))}}function Wo(e,t){let n=[];for(let r of Wr)r!==`claude-desktop`&&Oo($[r],e,t)&&n.push(r);return n}function Go(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:Ge(e)).join(` `)}\n`)};return console.log=t,console.info=t,console.debug=t,()=>{console.log=e.log,console.info=e.info,console.debug=e.debug}}function Ko(){return new lt(`init`).description(`Scaffold .ok/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the .ok/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry using node + packages/cli/dist/cli.mjs with debug logging`).option(`--content-dir <dir>`,`Limit content to <dir> instead of the whole project. <dir> is interpreted relative to your current directory (e.g. "." = the folder you run the command in), then saved to .ok/config.yml as content.dir.`).option(`--json`,`Emit a structured JSON summary to stdout (diagnostics stay on stderr)`).option(`--skills <ids>`,`Install only the named user-global skill bundles (comma list: discovery,write-skill)`).option(`--no-skills`,`Do not install any user-global skill bundles`).addOption(new dt(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new dt(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new dt(`--local-only`,`Keep OK config out of git via .git/info/exclude (per-clone, not committed)`).conflicts(`shared`)).action(async e=>{let t=process.cwd(),n=e.shared?`shared`:e.localOnly?`local-only`:void 0,r=e.json?Go():null;try{let r;try{r=await Ro({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof Co||e instanceof ne){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof re||e instanceof le){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof he){process.stderr.write(`open-knowledge could not initialize a git repo for this project. Re-run, or run 'git init' yourself in the project folder.
692
- `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-DAk_l84X.mjs`),{resolveContentDir:s}=await import(`./dist-DzdGKL8W.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-CRnYd6sw.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(Uo(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${Ho(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function qo(e,t){let n=[];switch(e.kind){case`applied`:return n.push(k(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${E(`local-only`)} — appended ${e.appended.length} path(s) to ${k(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${E(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${E(`local-only`)} — already excluded; nothing to do.`):n.push(` ${E(`local-only`)}`):e.action===`removed`?n.push(` ${E(`shared`)} — removed OK paths from ${k(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${E(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(O(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
693
- `))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${w(`ok config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(O(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${w(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${w(`ok config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(O(`Sharing mode unavailable: ${e.reason}.`));return n}}export{yi as $,wa as A,Wi as B,Ga as C,lt as Ct,Ma as D,La as E,oa as F,Ji as G,qi as H,sa as I,Wr as J,Ki as K,va as L,ya as M,aa as N,Ca as O,la as P,Z as Q,ua as R,Xa as S,bt as St,Ba as T,dt as Tt,Ui as U,Qi as V,Hi as W,$ as X,X as Y,Gr as Z,Ro as _,Vn as _t,Uo as a,Si as at,Po as b,Kt as bt,Ho as c,Pi as ct,Oo as d,Hr as dt,vi as et,Fo as f,Y as ft,So as g,Qn as gt,To as h,Pr as ht,zo as i,ii as it,ba as j,Sa as k,qo as l,ci as lt,bo as m,jr as mt,Do as n,xi as nt,Lo as o,Q as ot,wo as p,Mr as pt,Gi as q,jo as r,ti as rt,Wo as s,Ci as st,Co as t,bi as tt,Ko as u,Ur as ut,co as v,Xt as vt,Ha as w,st as wt,ko as x,U as xt,Ao as y,qt as yt,_a as z};
689
+ `));let g=`${s?``:``}${m}`;return g!==o&&w(e,g,{mode:Ca(e)}),a&&g===o?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}const _o=e=>e!==`project`,vo=e=>e!==`user`;async function yo(){let e=await Ma({message:`Where should the MCP server be configured?
690
+ `,required:!1,theme:{icon:{checked:`[x]`,unchecked:`[ ]`}},choices:[{name:`User-level (~/.claude.json, ~/.cursor/mcp.json, …)`,value:`user`,checked:!0},{name:`Project-level (.mcp.json, .cursor/mcp.json, …)`,value:`project`,checked:!0}]});return e.includes(`user`)&&e.includes(`project`)?`both`:e.includes(`user`)?`user`:e.includes(`project`)?`project`:null}async function bo(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??yo)():`both`}async function xo(e){return La({message:`How do you want to handle OpenKnowledge config files (.ok/, .mcp.json)?`,default:e,choices:[{name:`Share with my team (commit alongside content)`,value:`shared`,description:`OK config gets committed alongside your project content.`},{name:`Local only (keep out of git via .git/info/exclude)`,value:`local-only`,description:"OK config stays on this machine only; teammates do not see it. Safe escape hatch via `ok config-sharing share`."}]})}async function So(e){if(e.sharing!==void 0)return e.sharing;let t=Ki(e.projectRoot)===`local-only`||e.freshProject===!0?`local-only`:`shared`;return e.isTTY??process.stdout.isTTY?(e.promptFn??xo)(t):t}var Co=class extends Error{constructor(e){super(e),this.name=`ContentDirError`}};function wo(e){if(e===void 0||e===!0)return new Set(Se);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(ue.filter(e=>t.includes(e)))}function To(e,t,n){let r=P(n,e),i;try{i=Ue(r)}catch(e){let t=e.code;throw t===`ENOENT`?new Co(`--content-dir path does not exist: ${r}`):new Co(`--content-dir path is not accessible (${t??`unknown error`}): ${r}`)}if(!i.isDirectory())throw new Co(`--content-dir must be a directory: ${r}`);let a=Eo(t),o=Eo(r),s=N(a,o);if(s.startsWith(`..`)||Me(s))throw new Co(`--content-dir must be inside the project root (${t}); got ${r}`);return s===``?`.`:s}function Eo(e){try{return Ve(e)}catch{return e}}const Do=`open-knowledge-ui`;function Oo(e,t,n){try{let r=e.detectPath?.(t,n)??j(e.configPath(t,n));return L(r)}catch{return!1}}function ko(e,t,n){try{let r=P(j(e.configPath(t,n))),i=P(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+F)}catch{return!1}}function Ao(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=n.pruneOnly===!0;if(s&&(e.format===`file`||!L(o)))return{editorId:e.id,label:e.label,action:`skipped-flag`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}};let c=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||ko(e,t,r);if(!i&&c&&!Oo(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{oa(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return Mo(e,o,a,n,{isProjectScope:i!==void 0});let l;try{l=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{s||Re(j(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let u={action:`written`},d;try{ne(`${o}.lock`,()=>{let t=Xa(o).writePath;if(s||Re(j(t),{recursive:!0}),e.format===`toml`){let r=po(Hr(),t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}if(e.format===`yaml`){let r=go(t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}let r=fo(t,e.topLevelKey,a,l,e.serverMapSubKey,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){d=e instanceof Error?e:Error(String(e))}return d?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:d.message,...i===void 0?{}:{configScope:`project`}}:u.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:u.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:u.action===`unchanged`?`skipped-flag`:u.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const jo={pi:Ha};function Mo(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=jo[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{Re(j(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{ne(`${t}.lock`,()=>{let e=null;try{e=R(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}w(t,c,e===null?void 0:{mode:Ca(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}function No(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}async function Po(e){let t=zi(e.editors).filter(e=>e.scope===`global`),n={mode:`published`,skipAvailabilityCheck:!0,...e.replaceEntry===!0?{replaceEntry:!0}:{},...e.pruneOnly===!0?{pruneOnly:!0}:{}};return t.map(t=>Ao(t,``,n,e.home))}function Fo(e,t,n,r){let i=Lo(e,t,n,r);return i.kind===`present`?i.entry:null}function Io(e,t,n,r){let i=uo(e,t,r);if(!A(i))return{kind:`no-entry`};let a=i[n];return A(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function Lo(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};try{if(Ue(i).size>io)return{kind:`decline`,reason:`oversize`}}catch(e){return{kind:`decline`,reason:ya(e)}}let a;try{a=R(i,`utf-8`)}catch(e){return{kind:`decline`,reason:ya(e)}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:Va(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=Hr().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return Io(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,kr.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:Io(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=$a(a);return s?eo(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:Io(_e(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function Ro(e={}){let t=P(e.cwd??process.cwd()),n=Ga(t,{homeDir:e.home}),r=n.projectRoot;if(ae(r,e.home??z()))throw new re(r);let i=!L(M(r,`.ok`)),a=n.gitRootPromoted?N(r,t):void 0,o=e.contentDir===void 0?n.defaultContentDir:To(e.contentDir,r,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&o===`.`&&process.stderr.write(`${O(`[ok] Content scope promoted to the git repo root: ${r}`)}\n Ran in ${a}/, but .ok/ lives at the git root (one .ok/ per git repo),\n so the whole repo is now the content scope. To narrow it, re-run with\n \`ok init --content-dir .\`, or set content.dir: ${a} in .ok/config.yml.\n`);let s={mode:e.devMcp?`dev`:`published`},c=await xe(r),l;try{l=Ce(r,{contentDir:o})}catch(t){let i=$.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:c.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDirRequested:e.contentDir,contentScaffoldFailed:!0,mcpAction:`failed`,mcpPath:i,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`,sharing:{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:!1}}}let u=l.created.includes(Ee),d=!1;if(c.didInit)try{d=we(r)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${r}: ${e instanceof Error?e.message:String(e)}`)}try{ce(r)===`removed`&&console.warn(`[ok] Removed the OpenKnowledge project-skill lines from .gitignore. The skill is ordinary project content now — commit it if your team wants it on clone.`)}catch(e){console.warn(`[ok] Skipping project-skill .gitignore cleanup at ${r}: ${e instanceof Error?e.message:String(e)}`)}let f=await bo({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),p=e.editors??Wo(r,e.home),m=e.editors??p,g=zi(p),_=zi(m),v=e.mcp===!1||f===null,y=Array.from(new Map([...g,...v?[]:_].map(e=>[e.id,e])).values()),b=g.filter(t=>Oo(t,r,e.home)),S=[],ne=[],ie=new Set;for(let t of y){if(v){let n=``;try{n=t.configPath(r,e.home)}catch{}S.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(_o(f)&&g.includes(t)&&t.scope===`global`&&S.push(Ao(t,r,s,e.home)),vo(f)&&_.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Ao(t,r,s,e.home,n);S.push(i),(i.action===`written`||i.action===`overwritten`)&&ie.add(n)}}let C=new Set;for(let t of _){let n=t.projectSkillPath?.(r);!n||C.has(n)||(C.add(n),ne.push(_a(t,r,{home:e.home})))}let oe=ga(r,_.map(e=>e.id));oe&&ne.push(oe);let se=ne.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.editorId);if(se.length>0){let t=e.home??z();x({source:h,skills:[ve.project],agents:se,scope:r},{home:t,enabled:ge(t).enabled})}let le=!v&&f!==null&&vo(f)?_.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,de=v?[]:b.map(e=>No(e,r)).filter(e=>e!==void 0).filter(e=>!ie.has(e.path)),fe=e.installUserSkill??ee,me=e.home??z(),he=wo(e.skills),_e=!1,ye=!1,be=!1,Se=!1,w=!1;for(let t of ue){if(!he.has(t))continue;await pe(me,ve[t],!0).catch(()=>{}),_e=!0;let n=await fe({home:e.home,bundleId:t,force:!0});n===`installed`?ye=!0:n===`failed`?be=!0:n===`no-hosts`?w=!0:Se=!0}let T=be?`failed`:ye?`installed`:_e&&Se?`skip-current`:_e&&w?`no-hosts`:`declined`,E=ye?te(me).map(e=>e.editorId):[],D=v?`skipped-flag`:`skipped-missing`,Te=S.find(e=>e.editorId===`claude`)??S[0]??{action:D,configPath:$.claude.configPath(r,e.home)},k=await zo({projectRoot:r,desiredMode:await So({sharing:e.sharing,projectRoot:r,isTTY:e.isTTY,freshProject:i,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:r,contentCreated:l.created,contentUpdated:l.updated,contentSkipped:l.skipped,editors:S,projectSkills:ne,legacyProjectConfigs:de,skillInstall:T,skillHosts:E,didGitInit:c.didInit,rootGitignoreCreated:d,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDir:u?o:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:Te.action,mcpPath:Te.configPath,mcpError:`error`in Te?Te.error:void 0,projectScopeUnsupportedLabels:le,sharing:k}}async function zo(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=Ki(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=Hi(t);if(n===`local-only`){let e=Wi(t,a);if(e.kind===`refused-tracked`){let t=e;return{kind:`refused-tracked`,tracked:t.tracked,remediation:t.remediation}}return e.kind===`no-exclude`?{kind:`no-exclude`,reason:e.reason,localOnlyRequested:r===`local-only`}:Bo(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=Gi(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:Bo(t,o,`remove`)}function Bo(e,t,n){let r=Ki(e);return n===`add`?{kind:`applied`,mode:r,action:t.appended.length>0?`added`:t.removed.length>0?`cleaned`:`noop`,appended:t.appended,alreadyPresent:t.alreadyPresent,removed:t.removed}:{kind:`applied`,mode:r,action:`removed`,appended:[],alreadyPresent:[],removed:t.removed}}function Vo(e){switch(e){case`permission-denied`:return`permission denied; check file and parent-directory permissions`;case`unresolved-symlink`:return`could not resolve the path or symlink; check permissions and symlink cycles`;case`not-a-file`:return`config path is not a regular file`;case`disappeared`:return`config disappeared while being read; retry to check its current state`;case`unreadable`:return`could not read the config file; check that the path is accessible`;case`unparseable`:return`config could not be parsed`;case`oversize`:return`config too large to edit safely`;case`duplicate-container`:return`duplicate server block`;case`no-native-writer`:return`no format-preserving writer available`;case void 0:return`config not readable`;default:throw Error(`unhandled MCP decline reason: ${e}`)}}function Ho(e,t){let n=[],r=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),i=e.editors.some(e=>e.action===`failed`)||e.projectSkills.some(e=>e.action===`failed`),a=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),o=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`);e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`),e.rootGitignoreCreated&&n.push(`Seeded .gitignore at ${t}/.gitignore (.DS_Store)`);let s=M(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(k(`Content scaffolded at ${s}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(k(`Content already present at ${s}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0){if(n.push(k(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`)}else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(k(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(k(`MCP server configuration:`));for(let r of e.editors){let e=r.configPath.startsWith(t)?N(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),i=r.serverName===`open-knowledge`?``:` (${r.serverName})`,a=r.configScope===`project`?` (project)`:``,o=`${r.label}${a}`,s=` `.repeat(Math.max(1,20-o.length)),c=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${o}${s}${e} ${D(`registered`)}${i}${c}`);break;case`overwritten`:n.push(` ${o}${s}${e} ${D(`updated`)}${i}${c}`);break;case`skipped-missing`:n.push(` ${o}${s}${e} config root missing; skipped`);break;case`failed`:n.push(` ${o}${s}${e} ${Te(`FAILED`)}: ${r.error}`);break;case`declined`:n.push(` ${o}${s}${e} left unchanged (${Vo(r.declineReason)})`);break;case`skipped-flag`:break;default:r.action}}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}}if(e.projectSkills.length>0){n.push(``),n.push(k(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?N(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${D(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${D(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`skipped-prerequisite`:n.push(` ${e}${i}OpenKnowledge MCP is not configured; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${Te(`FAILED`)}: ${r.error}`)}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${N(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall)switch(n.push(``),n.push(k(`User-global skill:`)),e.skillInstall){case`installed`:{let t=(e.skillHosts??[]).map(e=>X[e]??e),r=t.length>0?t.join(`, `):`the shared ~/.agents store`;n.push(` open-knowledge ${D(`installed for ${r}`)}`),n.push(` ${E(`Counted on skills.sh (skill name + source repo, once per machine).`)}`),n.push(` ${E(`Opt out: DO_NOT_TRACK=1, or Settings → User → Preferences.`)}`);break}case`skip-current`:n.push(` open-knowledge ${D(`already installed at current version`)}`);break;case`declined`:n.push(` open-knowledge ${E(`skipped for this run (--no-skills)`)}`),n.push(` ${E(`Nothing was installed or removed. Any built-in skills already on this`)}`),n.push(` ${E(`machine are untouched. Run init without the flag to install them:`)}`),n.push(` ${E(` ok init`)}`);break;case`no-hosts`:n.push(` open-knowledge ${E(`skipped — no supported agent host detected in your home directory`)}`);break;case`failed`:n.push(` ${O(`open-knowledge install failed — MCP still configured; retry with:`)}`),n.push(` ${O(` ok repair-skills`)}`)}if(e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(O(`⚠ --content-dir ${e.contentDirRequested} ignored — .ok/config.yml already exists`)),n.push(` Edit .ok/config.yml → content.dir directly to change the content scope.`)):e.contentDir!==void 0&&e.contentDir!==`.`?(n.push(``),n.push(`Content scope set to ${e.contentDir}/ (content.dir in .ok/config.yml).`)):e.gitRootPromoted&&e.contentDir===`.`&&e.contentDirRequested===void 0&&(n.push(``),n.push(O(`⚠ Content scope promoted to the git repo root`)),n.push(` .ok/ was initialized at ${t} because it contains a .git folder (one .ok/ per git repo),`),n.push(` not the sub-folder you ran \`ok init\` in${e.promotedFromDir?` (${e.promotedFromDir})`:``}. The whole repo is now the content scope.`),e.promotedFromDir&&(n.push(" To scope to just that sub-folder, re-run `ok init --content-dir .` from there, or set"),n.push(` content.dir: ${e.promotedFromDir} in .ok/config.yml.`))),e.preview?(n.push(``),n.push(De(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(...qo(e.sharing,t)),r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${D(`✓`)} ${k(`Next steps:`)}`),n.push(` 1. Open your editor (${T(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${T(`ok seed --list-packs`)} — browse the starter packs`),n.push(` - ${T(`ok seed`)} — scaffold an empty repo`),n.push(` 4. Ask your agent to capture a source, research a topic, or build a wiki —`),n.push(` the procedures ship as skills alongside the MCP tools.`)}return n.join(`
691
+ `)}function Uo(e,t){return{projectRoot:e.projectRoot,gitRootPromoted:e.gitRootPromoted,promotedFromDir:e.promotedFromDir??null,contentDir:t.contentDir,contentDirRequested:e.contentDirRequested??null,contentDirApplied:e.contentDir!==void 0,contentFileCount:t.contentFileCount,previewError:e.previewWarning??null,didGitInit:e.didGitInit,mcpAction:e.mcpAction,editors:e.editors.map(e=>({editorId:e.editorId,label:e.label,action:e.action,configPath:e.configPath,scope:e.configScope===`project`?`project`:`user`}))}}function Wo(e,t){let n=[];for(let r of Wr)r!==`claude-desktop`&&Oo($[r],e,t)&&n.push(r);return n}function Go(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:Ge(e)).join(` `)}\n`)};return console.log=t,console.info=t,console.debug=t,()=>{console.log=e.log,console.info=e.info,console.debug=e.debug}}function Ko(){return new lt(`init`).description(`Scaffold .ok/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the .ok/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry using node + packages/cli/dist/cli.mjs with debug logging`).option(`--content-dir <dir>`,`Limit content to <dir> instead of the whole project. <dir> is interpreted relative to your current directory (e.g. "." = the folder you run the command in), then saved to .ok/config.yml as content.dir.`).option(`--json`,`Emit a structured JSON summary to stdout (diagnostics stay on stderr)`).option(`--skills <ids>`,`Install only the named user-global skill bundles (comma list: discovery,write-skill)`).option(`--no-skills`,`Do not install any user-global skill bundles`).addOption(new dt(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new dt(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new dt(`--local-only`,`Keep OK config out of git via .git/info/exclude (per-clone, not committed)`).conflicts(`shared`)).action(async e=>{let t=process.cwd(),n=e.shared?`shared`:e.localOnly?`local-only`:void 0,r=e.json?Go():null;try{let r;try{r=await Ro({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof Co||e instanceof re){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof ie||e instanceof le){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof me){process.stderr.write(`open-knowledge could not initialize a git repo for this project. Re-run, or run 'git init' yourself in the project folder.
692
+ `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-CNWGHRCV.mjs`),{resolveContentDir:s}=await import(`./dist-CeD-QmMk.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-Ch3iH9hA.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(Uo(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${Ho(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function qo(e,t){let n=[];switch(e.kind){case`applied`:return n.push(k(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${D(`local-only`)} — appended ${e.appended.length} path(s) to ${k(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${D(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${D(`local-only`)} — already excluded; nothing to do.`):n.push(` ${D(`local-only`)}`):e.action===`removed`?n.push(` ${D(`shared`)} — removed OK paths from ${k(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${D(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(O(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
693
+ `))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${T(`ok config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(O(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${T(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${T(`ok config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(O(`Sharing mode unavailable: ${e.reason}.`));return n}}export{yi as $,wa as A,Wi as B,Ga as C,lt as Ct,Ma as D,La as E,oa as F,Ji as G,qi as H,sa as I,Wr as J,Ki as K,va as L,ya as M,aa as N,Ca as O,la as P,Z as Q,ua as R,Xa as S,bt as St,Ba as T,dt as Tt,Ui as U,Qi as V,Hi as W,$ as X,X as Y,Gr as Z,Ro as _,Vn as _t,Uo as a,Si as at,Po as b,Kt as bt,Ho as c,Pi as ct,Oo as d,Hr as dt,vi as et,Fo as f,Y as ft,So as g,Qn as gt,To as h,Pr as ht,zo as i,ii as it,ba as j,Sa as k,qo as l,ci as lt,bo as m,jr as mt,Do as n,xi as nt,Lo as o,Q as ot,wo as p,Mr as pt,Gi as q,jo as r,ti as rt,Wo as s,Ci as st,Co as t,bi as tt,Ko as u,Ur as ut,co as v,Xt as vt,Ha as w,st as wt,ko as x,U as xt,Ao as y,qt as yt,_a as z};
@@ -1 +1 @@
1
- import{Po as e,Ro as t,jo as n}from"./dist-Cmgb0r3p.mjs";import{A as r,M as i,O as a}from"./init-D_DKMj1s.mjs";import{t as o}from"./is-object-BGze3w87.mjs";import{t as s}from"./removal-file-path-CSUwOdaZ.mjs";import{join as c}from"node:path";import{readFileSync as l}from"node:fs";const u={allowTrailingComma:!0,disallowComments:!1};function d(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function f(o){let f=s(c(o,`.claude`,`launch.json`));if(f.kind!==`ready`)return f;let m=f.path,h;try{h=l(m,`utf-8`)}catch(e){return{kind:`declined`,reason:i(e)}}let g=[],_=e(h,g,u)??void 0;if(g.some(e=>!d(e,h))||_?.type!==`object`)return{kind:`declined`,reason:`unparseable`};let v=n(_).configurations;if(!Array.isArray(v))return{kind:`not-present`};let y=v.findIndex(p);if(y===-1)return{kind:`not-present`};let{text:b,changed:x}=r(h,[`configurations`,y]);return x?(t(m,b,{mode:a(m)}),{kind:`removed`}):{kind:`not-present`}}function p(e){if(!o(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?m.some(e=>h(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const m=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function h(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{f as t};
1
+ import{Po as e,jo as t,zo as n}from"./dist-Dci-h_mV.mjs";import{A as r,M as i,O as a}from"./init-PYX9s0p3.mjs";import{t as o}from"./is-object-BGze3w87.mjs";import{t as s}from"./removal-file-path-CVCUJzdD.mjs";import{join as c}from"node:path";import{readFileSync as l}from"node:fs";const u={allowTrailingComma:!0,disallowComments:!1};function d(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function f(o){let f=s(c(o,`.claude`,`launch.json`));if(f.kind!==`ready`)return f;let m=f.path,h;try{h=l(m,`utf-8`)}catch(e){return{kind:`declined`,reason:i(e)}}let g=[],_=e(h,g,u)??void 0;if(g.some(e=>!d(e,h))||_?.type!==`object`)return{kind:`declined`,reason:`unparseable`};let v=t(_).configurations;if(!Array.isArray(v))return{kind:`not-present`};let y=v.findIndex(p);if(y===-1)return{kind:`not-present`};let{text:b,changed:x}=r(h,[`configurations`,y]);return x?(n(m,b,{mode:a(m)}),{kind:`removed`}):{kind:`not-present`}}function p(e){if(!o(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?m.some(e=>h(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const m=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function h(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{f as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./loader-SBH7CBDL.mjs";export{e as loadConfig};
@@ -1 +1 @@
1
- import{Ml as e,Uu as t,ao as n,bl as r,fl as i,ls as a,ul as o}from"./md-manager-BGnqyqi1-BWyJhS5F.mjs";import{Bo as s,Ho as c,x as l}from"./dist-Cmgb0r3p.mjs";import{t as u}from"./is-object-BGze3w87.mjs";import{t as d}from"./constants-CNxoEQ5b.mjs";import{resolve as f}from"node:path";import{existsSync as p,readFileSync as m}from"node:fs";import{realpath as h}from"node:fs/promises";var g=t();async function _(e){let t=f(e);try{return await h(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}function v(e){if(!p(e))return{value:null,path:e,source:null,doc:null};let t;try{t=m(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,g.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return u(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=r({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...i,source:e}}return i})}function b(t){let r=t??process.cwd(),u=[],p=[],m=[],h=[],g=c(`user`,r),_=s({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&u.push(g);let b=(t,r=!1)=>{let i=v(t);if(i.diagnostic!==void 0&&p.push(i.diagnostic),i.value===null)return{};let a=o({value:i.value,file:i.path,source:i.source,doc:i.doc});p.push(...a),u.push(t);let s=a.length>0?e(i.value):i.value;return r&&h.push(...n({value:s,file:i.path,source:i.source,doc:i.doc})),s},x=f(r,`.ok`,d),S=b(x,!0),C=b(c(`project-local`,r)),w=a(_.value,S,C),T=l.safeParse(w);if(!T.success){let e=v(x),t={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(i(t))}return{config:T.data,sources:u,diagnostics:p,sidelined:m,ignoredCommittedKeys:h}}function x(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=_(e.startupCwd);return async o=>{let s=await _(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,x as t};
1
+ import{Ml as e,Uu as t,ao as n,bl as r,fl as i,ls as a,ul as o}from"./md-manager-BGnqyqi1-BWyJhS5F.mjs";import{Uo as s,Vo as c,x as l}from"./dist-Dci-h_mV.mjs";import{t as u}from"./is-object-BGze3w87.mjs";import{t as d}from"./constants-C6wMiGgw.mjs";import{resolve as f}from"node:path";import{existsSync as p,readFileSync as m}from"node:fs";import{realpath as h}from"node:fs/promises";var g=t();async function _(e){let t=f(e);try{return await h(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}function v(e){if(!p(e))return{value:null,path:e,source:null,doc:null};let t;try{t=m(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,g.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return u(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=r({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...i,source:e}}return i})}function b(t){let r=t??process.cwd(),u=[],p=[],m=[],h=[],g=s(`user`,r),_=c({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&u.push(g);let b=(t,r=!1)=>{let i=v(t);if(i.diagnostic!==void 0&&p.push(i.diagnostic),i.value===null)return{};let a=o({value:i.value,file:i.path,source:i.source,doc:i.doc});p.push(...a),u.push(t);let s=a.length>0?e(i.value):i.value;return r&&h.push(...n({value:s,file:i.path,source:i.source,doc:i.doc})),s},x=f(r,`.ok`,d),S=b(x,!0),C=b(s(`project-local`,r)),w=a(_.value,S,C),T=l.safeParse(w);if(!T.success){let e=v(x),t={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(i(t))}return{config:T.data,sources:u,diagnostics:p,sidelined:m,ignoredCommittedKeys:h}}function x(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=_(e.startupCwd);return async o=>{let s=await _(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,x as t};
@@ -1 +1 @@
1
- import{mo as e}from"./dist-Cmgb0r3p.mjs";import{execFile as t}from"node:child_process";const n=new Set([`http:`,`https:`]),r=/[\u0000-\u0020\u007F-\u009F"'`\\&|<>^()$;{}[\]*?!~]/;function i(e,t){console.warn(`Could not auto-open browser (${t}); visit ${e} manually`)}function a(a){let o;try{o=new URL(a)}catch{i(a,`invalid URL`);return}if(!n.has(o.protocol)){i(a,`unsupported scheme '${o.protocol}'`);return}if(r.test(a)){i(a,`URL contains unsafe characters`);return}let s=process.platform===`darwin`?`open`:process.platform===`win32`?`cmd`:`xdg-open`,c=process.platform===`win32`?[`/c`,`start`,``,a]:[a];t(s,c,e({}),e=>{e&&console.warn(`Could not auto-open browser (${e.message}); visit ${a} manually`)})}export{a as openBrowser};
1
+ import{mo as e}from"./dist-Dci-h_mV.mjs";import{execFile as t}from"node:child_process";const n=new Set([`http:`,`https:`]),r=/[\u0000-\u0020\u007F-\u009F"'`\\&|<>^()$;{}[\]*?!~]/;function i(e,t){console.warn(`Could not auto-open browser (${t}); visit ${e} manually`)}function a(a){let o;try{o=new URL(a)}catch{i(a,`invalid URL`);return}if(!n.has(o.protocol)){i(a,`unsupported scheme '${o.protocol}'`);return}if(r.test(a)){i(a,`URL contains unsafe characters`);return}let s=process.platform===`darwin`?`open`:process.platform===`win32`?`cmd`:`xdg-open`,c=process.platform===`win32`?[`/c`,`start`,``,a]:[a];t(s,c,e({}),e=>{e&&console.warn(`Could not auto-open browser (${e.message}); visit ${a} manually`)})}export{a as openBrowser};
@@ -1,2 +1,2 @@
1
- import{xn as e}from"./dist-Cmgb0r3p.mjs";import"./constants-CNxoEQ5b.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);a.push(``);let c=t(i,`.ok`,`config.yml`);return r(c)?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
1
+ import{xn as e}from"./dist-Dci-h_mV.mjs";import"./constants-C6wMiGgw.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);a.push(``);let c=t(i,`.ok`,`config.yml`);return r(c)?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
2
2
  `)}export{c as n,l as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./preview-CYBCI8OL.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -0,0 +1 @@
1
+ import{t as e}from"./index-B4DpftwC.js";export{e as FeedbackForm};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{r as s,t as c}from"./button-HKX9wT1K.js";import{i as l,n as u,r as d,t as f}from"./tooltip-DVBVVaAs.js";import{lt as p,o as m,s as h}from"./dist-bQ5kvrpa.js";import{t as g}from"./paperclip-BbzLnmPD.js";import{t as _}from"./x-BcfoD9-8.js";import{t as v}from"./input-B87iFAAQ.js";import{h as y}from"./file-tree-adapter-BqzkXC53.js";import{i as b}from"./image-attachment-IlVZ-iwe.js";import{t as x}from"./textarea-DVoGSfK8.js";var S=e(n(),1),C=a(),w=3,T=p,E=m,D=h;function O(e){return E.includes(e)}function k(e){return e.reduce((e,t)=>e+t.size,0)}function A(e){return e.length>w?`count`:e.every(e=>O(e.type))?k(e)>T?`total`:null:`type`}function j(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var M=t(),N=s(`group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed`,{variants:{size:{default:`gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2`,sm:`gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5`,xs:`gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1`},orientation:{horizontal:`min-w-40 items-center`,vertical:`w-24 flex-col has-data-[slot=attachment-content]:w-30`}}});function P(e){let t=(0,C.c)(16),n,r,i,a,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5]):({className:n,state:i,size:a,orientation:s,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s);let c=i===void 0?`done`:i,l=a===void 0?`default`:a,u=s===void 0?`horizontal`:s,d;t[6]!==n||t[7]!==u||t[8]!==l?(d=o(N({size:l,orientation:u}),n),t[6]=n,t[7]=u,t[8]=l,t[9]=d):d=t[9];let f;return t[10]!==u||t[11]!==r||t[12]!==l||t[13]!==c||t[14]!==d?(f=(0,M.jsx)(`div`,{"data-slot":`attachment`,"data-state":c,"data-size":l,"data-orientation":u,className:d,...r}),t[10]=u,t[11]=r,t[12]=l,t[13]=c,t[14]=d,t[15]=f):f=t[15],f}var F=s(`relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5`,{variants:{variant:{icon:``,image:`opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover`}},defaultVariants:{variant:`icon`}});function I(e){let t=(0,C.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`icon`:i,s;t[4]!==n||t[5]!==a?(s=o(F({variant:a}),n),t[4]=n,t[5]=a,t[6]=s):s=t[6];let c;return t[7]!==r||t[8]!==s||t[9]!==a?(c=(0,M.jsx)(`div`,{"data-slot":`attachment-media`,"data-variant":a,className:s,...r}),t[7]=r,t[8]=s,t[9]=a,t[10]=c):c=t[10],c}function L(e){let t=(0,C.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`div`,{"data-slot":`attachment-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function R(e){let t=(0,C.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`span`,{"data-slot":`attachment-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function z(e){let t=(0,C.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80`,`max-w-full`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`span`,{"data-slot":`attachment-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function B(e){let t=(0,C.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`div`,{"data-slot":`attachment-actions`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function V(e){let t=(0,C.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:a,size:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let s=i===void 0?`icon-xs`:i,l=a??`ghost`,u;t[5]===n?u=t[6]:(u=o(n),t[5]=n,t[6]=u);let d;return t[7]!==r||t[8]!==s||t[9]!==l||t[10]!==u?(d=(0,M.jsx)(c,{"data-slot":`attachment-action`,variant:l,size:s,className:u,...r}),t[7]=r,t[8]=s,t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function H(e){let t=(0,C.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`div`,{"data-slot":`attachment-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var U=w,W=e=>{let t=(0,C.c)(5),{file:n}=e,[r,i]=(0,S.useState)(null),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=URL.createObjectURL(n);return i(e),()=>URL.revokeObjectURL(e)},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,S.useEffect)(a,o);let s;return t[3]===r?s=t[4]:(s=r?(0,M.jsx)(`img`,{src:r,alt:``,className:`size-full object-cover`}):null,t[3]=r,t[4]=s),s},G=e=>{let t=(0,C.c)(22),{files:n,onPick:i,disabled:a,className:s}=e,p=a===void 0?!1:a,m=(0,S.useRef)(null),h=n.length>=U,_=p||h,y=_&&`cursor-not-allowed`,b;t[0]!==s||t[1]!==y?(b=o(`inline-flex`,y,s),t[0]=s,t[1]=y,t[2]=b):b=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>m.current?.click(),t[3]=x):x=t[3];let w;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,M.jsx)(g,{className:`size-4`}),t[4]=w):w=t[4];let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,M.jsx)(`span`,{className:`sr-only`,children:(0,M.jsx)(r,{id:`3LbBJn`})}),t[5]=T):T=t[5];let D;t[6]===_?D=t[7]:(D=(0,M.jsxs)(c,{type:`button`,variant:`ghost`,size:`icon`,disabled:_,onClick:x,className:`size-7 text-muted-foreground`,children:[w,T]}),t[6]=_,t[7]=D);let O;t[8]!==b||t[9]!==D?(O=(0,M.jsx)(l,{asChild:!0,children:(0,M.jsx)(`span`,{className:b,children:D})}),t[8]=b,t[9]=D,t[10]=O):O=t[10];let k;t[11]===h?k=t[12]:(k=(0,M.jsx)(u,{children:h?(0,M.jsx)(r,{id:`ASqqsQ`,values:{MAX_ATTACHMENTS:U}}):(0,M.jsx)(r,{id:`3LbBJn`})}),t[11]=h,t[12]=k);let A;t[13]!==O||t[14]!==k?(A=(0,M.jsx)(d,{children:(0,M.jsxs)(f,{children:[O,k]})}),t[13]=O,t[14]=k,t[15]=A):A=t[15];let j;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(j=E.join(`,`),t[16]=j):j=t[16];let N;t[17]===i?N=t[18]:(N=(0,M.jsx)(v,{ref:m,type:`file`,accept:j,multiple:!0,className:`hidden`,onChange:e=>{i(e.target.files),e.target.value=``}}),t[17]=i,t[18]=N);let P;return t[19]!==A||t[20]!==N?(P=(0,M.jsxs)(M.Fragment,{children:[A,N]}),t[19]=A,t[20]=N,t[21]=P):P=t[21],P},K=e=>{let t=(0,C.c)(9),{files:n,onChange:r,error:a}=e,o=a===void 0?null:a,{_:s}=i();if(n.length===0&&o===null)return null;let c;t[0]!==s||t[1]!==n||t[2]!==r?(c=n.length>0&&(0,M.jsx)(H,{children:n.map((e,t)=>(0,M.jsxs)(P,{size:`xs`,children:[(0,M.jsx)(I,{variant:`image`,children:(0,M.jsx)(W,{file:e})}),(0,M.jsxs)(L,{children:[(0,M.jsx)(R,{children:e.name}),(0,M.jsx)(z,{children:j(e.size)})]}),(0,M.jsx)(B,{children:(0,M.jsx)(V,{type:`button`,"aria-label":s({id:`w61W3L`,values:{0:e.name}}),onClick:()=>r(n.filter((e,n)=>n!==t)),children:(0,M.jsx)(_,{className:`size-3.5`})})})]},`${e.name}:${e.size}`))}),t[0]=s,t[1]=n,t[2]=r,t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=o!==null&&(0,M.jsx)(`p`,{role:`alert`,className:`text-destructive text-sm`,children:o}),t[4]=o,t[5]=l);let u;return t[6]!==c||t[7]!==l?(u=(0,M.jsxs)(M.Fragment,{children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8],u};function q(){let{_:e}=i();return t=>t===null?null:e(t===`count`?{id:`E9gh86`,values:{MAX_ATTACHMENTS:U}}:t===`type`?{id:`s7us1p`}:{id:`ItxGi3`})}function J(e){let t=(0,C.c)(4),{count:n}=e,i;t[0]===n?i=t[1]:(i=n>0&&(0,M.jsx)(r,{id:`L2Bye8`,values:{count:n}}),t[0]=n,t[1]=i);let a;return t[2]===i?a=t[3]:(a=(0,M.jsx)(`span`,{role:`status`,className:`sr-only`,children:i}),t[2]=i,t[3]=a),a}function Y(e){let t=(0,C.c)(12),{files:n,onChange:r,disabled:i}=e,[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(null),l;t[0]!==i||t[1]!==n||t[2]!==r?(l=function(e){if(i||e===null||e.length===0)return;let t=new Map(n.map(X));for(let n of Array.from(e))t.set(`${n.name}:${n.size}`,n);let a=[...t.values()],o=A(a);c(o===null?null:{files:n,problem:o}),o===null&&r(a)},t[0]=i,t[1]=n,t[2]=r,t[3]=l):l=t[3];let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>c(null),t[4]=d):d=t[4];let f=s?.files===n?s.problem:null,p=a&&!i,m;return t[5]!==u||t[6]!==i||t[7]!==n||t[8]!==r||t[9]!==f||t[10]!==p?(m={files:n,setFiles:r,disabled:i,add:u,clearProblem:d,problem:f,dragging:p,onPaste(e){if(i||!(e.target instanceof Node)||!e.currentTarget.contains(e.target))return;let t=b(e.clipboardData);t.length!==0&&(e.preventDefault(),u(t))},onDragOver(e){y(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=i?`none`:`copy`,i||o(!0))},onDragLeave(e){(!(e.relatedTarget instanceof Node)||!e.currentTarget.contains(e.relatedTarget))&&o(!1)},onDrop(e){o(!1),y(e)&&(e.preventDefault(),e.stopPropagation(),u(e.dataTransfer.files))}},t[5]=u,t[6]=i,t[7]=n,t[8]=r,t[9]=f,t[10]=p,t[11]=m):m=t[11],m}function X(e){return[`${e.name}:${e.size}`,e]}function Z(e){let t=(0,C.c)(49),n,i,a,s,c,l;t[0]===e?(n=t[1],i=t[2],a=t[3],s=t[4],c=t[5],l=t[6]):({intake:s,error:c,hint:a,className:n,"aria-describedby":i,...l}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a,t[4]=s,t[5]=c,t[6]=l);let u=c===void 0?null:c,d=(0,S.useId)(),f=q(),p=s.onDragOver,m=s.onDragLeave,h=s.onDrop,g=s.disabled,_;t[7]!==i||t[8]!==d?(_=[i,d].filter(Boolean),t[7]=i,t[8]=d,t[9]=_):_=t[9];let v=_.join(` `),y=s.dragging&&`border-primary bg-primary/5`,b;t[10]!==n||t[11]!==y?(b=o(`resize-none pb-9`,n,y),t[10]=n,t[11]=y,t[12]=b):b=t[12];let w;t[13]!==s.disabled||t[14]!==v||t[15]!==b||t[16]!==l?(w=(0,M.jsx)(x,{...l,disabled:g,"aria-describedby":v,className:b}),t[13]=s.disabled,t[14]=v,t[15]=b,t[16]=l,t[17]=w):w=t[17];let T;t[18]!==s.add||t[19]!==s.disabled||t[20]!==s.files?(T=(0,M.jsx)(G,{files:s.files,onPick:s.add,disabled:s.disabled,className:`absolute bottom-1.5 start-1.5`}),t[18]=s.add,t[19]=s.disabled,t[20]=s.files,t[21]=T):T=t[21];let E;t[22]===s.files.length?E=t[23]:(E=(0,M.jsx)(J,{count:s.files.length}),t[22]=s.files.length,t[23]=E);let D;t[24]!==s.onDragLeave||t[25]!==s.onDragOver||t[26]!==s.onDrop||t[27]!==w||t[28]!==T||t[29]!==E?(D=(0,M.jsxs)(`div`,{className:`relative`,onDragOver:p,onDragLeave:m,onDrop:h,children:[w,T,E]}),t[24]=s.onDragLeave,t[25]=s.onDragOver,t[26]=s.onDrop,t[27]=w,t[28]=T,t[29]=E,t[30]=D):D=t[30];let O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,M.jsx)(r,{id:`eqSy2M`,values:{MAX_ATTACHMENTS:U}}),t[31]=O):O=t[31];let k;t[32]===a?k=t[33]:(k=a!==void 0&&(0,M.jsxs)(M.Fragment,{children:[` `,a]}),t[32]=a,t[33]=k);let A;t[34]!==d||t[35]!==k?(A=(0,M.jsxs)(`p`,{id:d,className:`text-xs text-muted-foreground`,children:[O,k]}),t[34]=d,t[35]=k,t[36]=A):A=t[36];let j;t[37]!==u||t[38]!==s.problem||t[39]!==f?(j=u??(s.problem===null?null:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(r,{id:`w7IPNE`}),` `,(0,M.jsx)(`span`,{children:f(s.problem)})]})),t[37]=u,t[38]=s.problem,t[39]=f,t[40]=j):j=t[40];let N;t[41]!==s.files||t[42]!==s.setFiles||t[43]!==j?(N=(0,M.jsx)(K,{files:s.files,onChange:s.setFiles,error:j}),t[41]=s.files,t[42]=s.setFiles,t[43]=j,t[44]=N):N=t[44];let P;return t[45]!==D||t[46]!==A||t[47]!==N?(P=(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[D,A,N]}),t[45]=D,t[46]=A,t[47]=N,t[48]=P):P=t[48],P}export{w as a,D as i,Y as n,T as o,E as r,O as s,Z as t};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{r as s,t as c}from"./button-HKX9wT1K.js";import{i as l,n as u,r as d,t as f}from"./tooltip-DVBVVaAs.js";import{lt as p,o as m,s as h}from"./dist-bQ5kvrpa.js";import{t as g}from"./paperclip-BbzLnmPD.js";import{t as _}from"./x-BcfoD9-8.js";import{t as v}from"./input-B87iFAAQ.js";import{h as y}from"./file-tree-adapter-BqzkXC53.js";import{i as b}from"./image-attachment-C1B_QOlM.js";import{t as x}from"./textarea-DVoGSfK8.js";var S=e(n(),1),C=a(),w=3,T=p,E=m,D=h;function O(e){return E.includes(e)}function k(e){return e.reduce((e,t)=>e+t.size,0)}function A(e){return e.length>w?`count`:e.every(e=>O(e.type))?k(e)>T?`total`:null:`type`}function j(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var M=t(),N=s(`group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed`,{variants:{size:{default:`gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2`,sm:`gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5`,xs:`gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1`},orientation:{horizontal:`min-w-40 items-center`,vertical:`w-24 flex-col has-data-[slot=attachment-content]:w-30`}}});function P(e){let t=(0,C.c)(16),n,r,i,a,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5]):({className:n,state:i,size:a,orientation:s,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s);let c=i===void 0?`done`:i,l=a===void 0?`default`:a,u=s===void 0?`horizontal`:s,d;t[6]!==n||t[7]!==u||t[8]!==l?(d=o(N({size:l,orientation:u}),n),t[6]=n,t[7]=u,t[8]=l,t[9]=d):d=t[9];let f;return t[10]!==u||t[11]!==r||t[12]!==l||t[13]!==c||t[14]!==d?(f=(0,M.jsx)(`div`,{"data-slot":`attachment`,"data-state":c,"data-size":l,"data-orientation":u,className:d,...r}),t[10]=u,t[11]=r,t[12]=l,t[13]=c,t[14]=d,t[15]=f):f=t[15],f}var F=s(`relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5`,{variants:{variant:{icon:``,image:`opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover`}},defaultVariants:{variant:`icon`}});function I(e){let t=(0,C.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`icon`:i,s;t[4]!==n||t[5]!==a?(s=o(F({variant:a}),n),t[4]=n,t[5]=a,t[6]=s):s=t[6];let c;return t[7]!==r||t[8]!==s||t[9]!==a?(c=(0,M.jsx)(`div`,{"data-slot":`attachment-media`,"data-variant":a,className:s,...r}),t[7]=r,t[8]=s,t[9]=a,t[10]=c):c=t[10],c}function L(e){let t=(0,C.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`div`,{"data-slot":`attachment-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function R(e){let t=(0,C.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`span`,{"data-slot":`attachment-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function z(e){let t=(0,C.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80`,`max-w-full`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`span`,{"data-slot":`attachment-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function B(e){let t=(0,C.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`div`,{"data-slot":`attachment-actions`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function V(e){let t=(0,C.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:a,size:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let s=i===void 0?`icon-xs`:i,l=a??`ghost`,u;t[5]===n?u=t[6]:(u=o(n),t[5]=n,t[6]=u);let d;return t[7]!==r||t[8]!==s||t[9]!==l||t[10]!==u?(d=(0,M.jsx)(c,{"data-slot":`attachment-action`,variant:l,size:s,className:u,...r}),t[7]=r,t[8]=s,t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function H(e){let t=(0,C.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,M.jsx)(`div`,{"data-slot":`attachment-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var U=w,W=e=>{let t=(0,C.c)(5),{file:n}=e,[r,i]=(0,S.useState)(null),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=URL.createObjectURL(n);return i(e),()=>URL.revokeObjectURL(e)},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,S.useEffect)(a,o);let s;return t[3]===r?s=t[4]:(s=r?(0,M.jsx)(`img`,{src:r,alt:``,className:`size-full object-cover`}):null,t[3]=r,t[4]=s),s},G=e=>{let t=(0,C.c)(22),{files:n,onPick:i,disabled:a,className:s}=e,p=a===void 0?!1:a,m=(0,S.useRef)(null),h=n.length>=U,_=p||h,y=_&&`cursor-not-allowed`,b;t[0]!==s||t[1]!==y?(b=o(`inline-flex`,y,s),t[0]=s,t[1]=y,t[2]=b):b=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>m.current?.click(),t[3]=x):x=t[3];let w;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,M.jsx)(g,{className:`size-4`}),t[4]=w):w=t[4];let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,M.jsx)(`span`,{className:`sr-only`,children:(0,M.jsx)(r,{id:`3LbBJn`})}),t[5]=T):T=t[5];let D;t[6]===_?D=t[7]:(D=(0,M.jsxs)(c,{type:`button`,variant:`ghost`,size:`icon`,disabled:_,onClick:x,className:`size-7 text-muted-foreground`,children:[w,T]}),t[6]=_,t[7]=D);let O;t[8]!==b||t[9]!==D?(O=(0,M.jsx)(l,{asChild:!0,children:(0,M.jsx)(`span`,{className:b,children:D})}),t[8]=b,t[9]=D,t[10]=O):O=t[10];let k;t[11]===h?k=t[12]:(k=(0,M.jsx)(u,{children:h?(0,M.jsx)(r,{id:`ASqqsQ`,values:{MAX_ATTACHMENTS:U}}):(0,M.jsx)(r,{id:`3LbBJn`})}),t[11]=h,t[12]=k);let A;t[13]!==O||t[14]!==k?(A=(0,M.jsx)(d,{children:(0,M.jsxs)(f,{children:[O,k]})}),t[13]=O,t[14]=k,t[15]=A):A=t[15];let j;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(j=E.join(`,`),t[16]=j):j=t[16];let N;t[17]===i?N=t[18]:(N=(0,M.jsx)(v,{ref:m,type:`file`,accept:j,multiple:!0,className:`hidden`,onChange:e=>{i(e.target.files),e.target.value=``}}),t[17]=i,t[18]=N);let P;return t[19]!==A||t[20]!==N?(P=(0,M.jsxs)(M.Fragment,{children:[A,N]}),t[19]=A,t[20]=N,t[21]=P):P=t[21],P},K=e=>{let t=(0,C.c)(9),{files:n,onChange:r,error:a}=e,o=a===void 0?null:a,{_:s}=i();if(n.length===0&&o===null)return null;let c;t[0]!==s||t[1]!==n||t[2]!==r?(c=n.length>0&&(0,M.jsx)(H,{children:n.map((e,t)=>(0,M.jsxs)(P,{size:`xs`,children:[(0,M.jsx)(I,{variant:`image`,children:(0,M.jsx)(W,{file:e})}),(0,M.jsxs)(L,{children:[(0,M.jsx)(R,{children:e.name}),(0,M.jsx)(z,{children:j(e.size)})]}),(0,M.jsx)(B,{children:(0,M.jsx)(V,{type:`button`,"aria-label":s({id:`w61W3L`,values:{0:e.name}}),onClick:()=>r(n.filter((e,n)=>n!==t)),children:(0,M.jsx)(_,{className:`size-3.5`})})})]},`${e.name}:${e.size}`))}),t[0]=s,t[1]=n,t[2]=r,t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=o!==null&&(0,M.jsx)(`p`,{role:`alert`,className:`text-destructive text-sm`,children:o}),t[4]=o,t[5]=l);let u;return t[6]!==c||t[7]!==l?(u=(0,M.jsxs)(M.Fragment,{children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8],u};function q(){let{_:e}=i();return t=>t===null?null:e(t===`count`?{id:`E9gh86`,values:{MAX_ATTACHMENTS:U}}:t===`type`?{id:`s7us1p`}:{id:`ItxGi3`})}function J(e){let t=(0,C.c)(4),{count:n}=e,i;t[0]===n?i=t[1]:(i=n>0&&(0,M.jsx)(r,{id:`L2Bye8`,values:{count:n}}),t[0]=n,t[1]=i);let a;return t[2]===i?a=t[3]:(a=(0,M.jsx)(`span`,{role:`status`,className:`sr-only`,children:i}),t[2]=i,t[3]=a),a}function Y(e){let t=(0,C.c)(12),{files:n,onChange:r,disabled:i}=e,[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(null),l;t[0]!==i||t[1]!==n||t[2]!==r?(l=function(e){if(i||e===null||e.length===0)return;let t=new Map(n.map(X));for(let n of Array.from(e))t.set(`${n.name}:${n.size}`,n);let a=[...t.values()],o=A(a);c(o===null?null:{files:n,problem:o}),o===null&&r(a)},t[0]=i,t[1]=n,t[2]=r,t[3]=l):l=t[3];let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>c(null),t[4]=d):d=t[4];let f=s?.files===n?s.problem:null,p=a&&!i,m;return t[5]!==u||t[6]!==i||t[7]!==n||t[8]!==r||t[9]!==f||t[10]!==p?(m={files:n,setFiles:r,disabled:i,add:u,clearProblem:d,problem:f,dragging:p,onPaste(e){if(i||!(e.target instanceof Node)||!e.currentTarget.contains(e.target))return;let t=b(e.clipboardData);t.length!==0&&(e.preventDefault(),u(t))},onDragOver(e){y(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=i?`none`:`copy`,i||o(!0))},onDragLeave(e){(!(e.relatedTarget instanceof Node)||!e.currentTarget.contains(e.relatedTarget))&&o(!1)},onDrop(e){o(!1),y(e)&&(e.preventDefault(),e.stopPropagation(),u(e.dataTransfer.files))}},t[5]=u,t[6]=i,t[7]=n,t[8]=r,t[9]=f,t[10]=p,t[11]=m):m=t[11],m}function X(e){return[`${e.name}:${e.size}`,e]}function Z(e){let t=(0,C.c)(49),n,i,a,s,c,l;t[0]===e?(n=t[1],i=t[2],a=t[3],s=t[4],c=t[5],l=t[6]):({intake:s,error:c,hint:a,className:n,"aria-describedby":i,...l}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a,t[4]=s,t[5]=c,t[6]=l);let u=c===void 0?null:c,d=(0,S.useId)(),f=q(),p=s.onDragOver,m=s.onDragLeave,h=s.onDrop,g=s.disabled,_;t[7]!==i||t[8]!==d?(_=[i,d].filter(Boolean),t[7]=i,t[8]=d,t[9]=_):_=t[9];let v=_.join(` `),y=s.dragging&&`border-primary bg-primary/5`,b;t[10]!==n||t[11]!==y?(b=o(`resize-none pb-9`,n,y),t[10]=n,t[11]=y,t[12]=b):b=t[12];let w;t[13]!==s.disabled||t[14]!==v||t[15]!==b||t[16]!==l?(w=(0,M.jsx)(x,{...l,disabled:g,"aria-describedby":v,className:b}),t[13]=s.disabled,t[14]=v,t[15]=b,t[16]=l,t[17]=w):w=t[17];let T;t[18]!==s.add||t[19]!==s.disabled||t[20]!==s.files?(T=(0,M.jsx)(G,{files:s.files,onPick:s.add,disabled:s.disabled,className:`absolute bottom-1.5 start-1.5`}),t[18]=s.add,t[19]=s.disabled,t[20]=s.files,t[21]=T):T=t[21];let E;t[22]===s.files.length?E=t[23]:(E=(0,M.jsx)(J,{count:s.files.length}),t[22]=s.files.length,t[23]=E);let D;t[24]!==s.onDragLeave||t[25]!==s.onDragOver||t[26]!==s.onDrop||t[27]!==w||t[28]!==T||t[29]!==E?(D=(0,M.jsxs)(`div`,{className:`relative`,onDragOver:p,onDragLeave:m,onDrop:h,children:[w,T,E]}),t[24]=s.onDragLeave,t[25]=s.onDragOver,t[26]=s.onDrop,t[27]=w,t[28]=T,t[29]=E,t[30]=D):D=t[30];let O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,M.jsx)(r,{id:`eqSy2M`,values:{MAX_ATTACHMENTS:U}}),t[31]=O):O=t[31];let k;t[32]===a?k=t[33]:(k=a!==void 0&&(0,M.jsxs)(M.Fragment,{children:[` `,a]}),t[32]=a,t[33]=k);let A;t[34]!==d||t[35]!==k?(A=(0,M.jsxs)(`p`,{id:d,className:`text-xs text-muted-foreground`,children:[O,k]}),t[34]=d,t[35]=k,t[36]=A):A=t[36];let j;t[37]!==u||t[38]!==s.problem||t[39]!==f?(j=u??(s.problem===null?null:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(r,{id:`w7IPNE`}),` `,(0,M.jsx)(`span`,{children:f(s.problem)})]})),t[37]=u,t[38]=s.problem,t[39]=f,t[40]=j):j=t[40];let N;t[41]!==s.files||t[42]!==s.setFiles||t[43]!==j?(N=(0,M.jsx)(K,{files:s.files,onChange:s.setFiles,error:j}),t[41]=s.files,t[42]=s.setFiles,t[43]=j,t[44]=N):N=t[44];let P;return t[45]!==D||t[46]!==A||t[47]!==N?(P=(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[D,A,N]}),t[45]=D,t[46]=A,t[47]=N,t[48]=P):P=t[48],P}export{w as a,D as i,Y as n,T as o,E as r,O as s,Z as t};
@@ -1,3 +1,3 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-HKX9wT1K.js";import{n as s,r as c,t as l}from"./collapsible-DYySK8La.js";import{t as u}from"./checkbox-BZdMjUlq.js";import{Pr as d,Vc as f,ai as p,c as m,oi as h,si as g}from"./dist-bQ5kvrpa.js";import{t as _}from"./createLucideIcon-B6ULg5PN.js";import{t as v}from"./chevron-right-C-g4JuT4.js";import{t as y}from"./circle-alert-Czw40trT.js";import{t as b}from"./spinner-D7ppCG-D.js";import{a as ee,r as x,t as te}from"./bug-report-send-manager-BCkcP5rY.js";import{n as ne}from"./BugReportHistory-BQMbH-qH.js";import{t as re}from"./triangle-alert--Fl5KoVX.js";import{a as S,c as ie,i as ae,l as oe,n as se,o as ce,s as le,t as ue}from"./dialog-Q2r_wm4I.js";import{t as de}from"./input-B87iFAAQ.js";import{t as fe}from"./badge-MuddhvBr.js";import{n as C}from"./platform-labels-w7hAI_JL.js";import{n as w,t as pe}from"./contact-email-store-BIZ55WhY.js";import{n as me,s as he,t as ge}from"./ImageAttachments-Cooc1nca.js";var _e=_(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),ve=_(`expand`,[[`path`,{d:`m15 15 6 6`,key:`1s409w`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}],[`path`,{d:`M21 16v5h-5`,key:`1ck2sf`}],[`path`,{d:`M21 8V3h-5`,key:`1qoq8a`}],[`path`,{d:`M3 16v5h5`,key:`1t08am`}],[`path`,{d:`m3 21 6-6`,key:`wwnumi`}],[`path`,{d:`M3 8V3h5`,key:`1ln10m`}],[`path`,{d:`M9 9 3 3`,key:`v551iv`}]]),ye=_(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),be=a(),T=e(n(),1);function xe(e){let t=e===void 0?w:e;return(0,T.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot)}function Se(e){return f().safeParse(e).success}var E=t();function Ce(e,t){let n=e.trim();if(t===void 0)return n===``?void 0:n;let r=t.join(`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-HKX9wT1K.js";import{n as s,r as c,t as l}from"./collapsible-DYySK8La.js";import{t as u}from"./checkbox-BZdMjUlq.js";import{Pr as d,Vc as f,ai as p,c as m,oi as h,si as g}from"./dist-bQ5kvrpa.js";import{t as _}from"./createLucideIcon-B6ULg5PN.js";import{t as v}from"./chevron-right-C-g4JuT4.js";import{t as y}from"./circle-alert-Czw40trT.js";import{t as b}from"./spinner-D7ppCG-D.js";import{a as ee,r as x,t as te}from"./bug-report-send-manager-BCkcP5rY.js";import{n as ne}from"./BugReportHistory-BQMbH-qH.js";import{t as re}from"./triangle-alert--Fl5KoVX.js";import{a as S,c as ie,i as ae,l as oe,n as se,o as ce,s as le,t as ue}from"./dialog-Q2r_wm4I.js";import{t as de}from"./input-B87iFAAQ.js";import{t as fe}from"./badge-MuddhvBr.js";import{n as C}from"./platform-labels-w7hAI_JL.js";import{n as w,t as pe}from"./contact-email-store-BIZ55WhY.js";import{n as me,s as he,t as ge}from"./ImageAttachments-mkcDupGd.js";var _e=_(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),ve=_(`expand`,[[`path`,{d:`m15 15 6 6`,key:`1s409w`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}],[`path`,{d:`M21 16v5h-5`,key:`1ck2sf`}],[`path`,{d:`M21 8V3h-5`,key:`1qoq8a`}],[`path`,{d:`M3 16v5h5`,key:`1t08am`}],[`path`,{d:`m3 21 6-6`,key:`wwnumi`}],[`path`,{d:`M3 8V3h5`,key:`1ln10m`}],[`path`,{d:`M9 9 3 3`,key:`v551iv`}]]),ye=_(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),be=a(),T=e(n(),1);function xe(e){let t=e===void 0?w:e;return(0,T.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot)}function Se(e){return f().safeParse(e).success}var E=t();function Ce(e,t){let n=e.trim();if(t===void 0)return n===``?void 0:n;let r=t.join(`
2
2
  `);return n===``?r:`${n}\n\n${r}`}var D=25;function we(e){return e.replace(/\(([^)]*)\)/,(e,t)=>{let n=t.split(/[/\\]/).pop();return n===void 0||n===``?e:`(${n})`})}function O(e){let t=e.split(`
3
3
  `).map(e=>we(e.trim())).filter(e=>e!==``);if(t.length===0)return[];let n=t.slice(0,D),r=t.length-n.length;return[`Component stack:`,...n,...r>0?[`... ${r} more frame(s) omitted`]:[]]}function Te(e){let t=[`Crash source: ${e.source}`];return e.docName!==void 0&&t.push(`Document: ${e.docName}`),e.errorMessage!==void 0&&t.push(`Error: ${e.errorMessage}`),e.componentStack!==void 0&&t.push(...O(e.componentStack)),t}function Ee(e){let t=[`Crash source: ${e.kind===`render-process-gone`?`renderer process crash (reason: ${e.context.reason})`:e.kind===`child-process-gone`?`${e.context.processType} process crash (reason: ${e.context.reason})`:e.context.dirtyShutdown?`previous session ended without a clean quit`:`new crash dump found from the previous session`}`,`Crash event: ${e.eventId}`];return e.kind===`boot`&&e.crashedAppVersion!==void 0&&t.push(`Crashed app version: ${e.crashedAppVersion}`),e.kind===`boot`&&e.crashedAt!==void 0&&t.push(`Crashed at: ${e.crashedAt} (${d(e.crashedAt)})`),t}var De={step:`compose`,creating:!1,createError:null};function Oe(e){return e.summary.files.some(g)}function ke(e){return e.summary.files.some(h)}async function Ae(e){let t=[];for(let n of e)he(n.type)&&t.push({contentType:n.type,bytes:new Uint8Array(await n.arrayBuffer())});return t}function k(e){let t=(0,be.c)(87),{open:n,onOpenChange:a,systemWide:d,crashContext:f,crashInvite:h,screenshot:g,pointerMarked:_,crashDumpAvailable:ee,agentChat:x}=e,C=d===void 0?!1:d,w=g===void 0?null:g,he=_===void 0?!1:_,_e=ee===void 0?!1:ee,{_:D}=i(),we=(typeof window<`u`?window.okDesktop?.platform:void 0)===`darwin`,[O,k]=(0,T.useState)(De),[A,Me]=(0,T.useState)(``),[j,Ne]=(0,T.useState)(f!==void 0||h!==void 0),M=h===void 0?_e:h.minidumpAvailable===!0,[N,Pe]=(0,T.useState)(h?.minidumpAvailable===!0),[P,Fe]=(0,T.useState)(!0),[F,Ie]=(0,T.useState)(!0),I;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(I=[],t[0]=I):I=t[0];let[L,Le]=(0,T.useState)(I),Re=O.step!==`compose`||O.creating,R;t[1]!==L||t[2]!==Re?(R={files:L,onChange:Le,disabled:Re},t[1]=L,t[2]=Re,t[3]=R):R=t[3];let z=me(R),[B,ze]=(0,T.useState)(!1),[V,Be]=(0,T.useState)(``),[H,U]=(0,T.useState)(null),W=(0,T.useRef)(0),G=(0,T.useId)(),K=(0,T.useId)(),Ve=(0,T.useId)(),He=(0,T.useId)(),Ue=(0,T.useId)(),We=(0,T.useId)(),Ge=(0,T.useId)(),Ke=(0,T.useId)(),qe=(0,T.useId)(),Je=(0,T.useId)(),Ye=(0,T.useId)(),Xe=(0,T.useId)(),Ze=(0,T.useId)(),Qe=(0,T.useId)(),q=xe().email,$e,J;t[4]!==n||t[5]!==q?($e=()=>{n&&(ze(q!==null),Be(q??``),U(null))},J=[n,q],t[4]=n,t[5]=q,t[6]=$e,t[7]=J):($e=t[6],J=t[7]),(0,T.useEffect)($e,J);let et;t[8]!==f||t[9]!==h?(et=f===void 0?h===void 0?void 0:Ee(h):Te(f),t[8]=f,t[9]=h,t[10]=et):et=t[10];let Y=et,tt;t[11]===a?tt=t[12]:(tt=function(e){e||(W.current+=1,k(De)),a(e)},t[11]=a,t[12]=tt);let X=tt,nt;t[13]!==D||t[14]!==x||t[15]!==z||t[16]!==L||t[17]!==M||t[18]!==j||t[19]!==V||t[20]!==F||t[21]!==N||t[22]!==P||t[23]!==A||t[24]!==Y||t[25]!==w||t[26]!==B?(nt=async function(){let e=window.okDesktop?.bugReport;if(!e){k({step:`compose`,creating:!1,createError:D({id:`_0JUKX`})});return}if(B&&!Se(V.trim())){U(D({id:`fwrPh4`}));return}U(null);let t=W.current+=1;k({step:`compose`,creating:!0,createError:null});let n=await Ae(L);if(W.current!==t)return;let r=x!==void 0&&F,i=await e.create({level:j?`full`:`standard`,note:Ce(A,Y),...M?{includeCrashDump:N}:{},...w===null?{}:{includeScreenshot:P},...n.length>0?{attachments:n}:{},...r?{agentChatThreadId:x.threadId}:{}});W.current===t&&(i.ok?(z.clearProblem(),k({step:`review`,report:{zipPath:i.zipPath,zipSizeBytes:i.zipSizeBytes,summary:i.summary},conversationMissing:r&&!i.summary.files.some(p)})):k({step:`compose`,creating:!1,createError:i.error}))},t[13]=D,t[14]=x,t[15]=z,t[16]=L,t[17]=M,t[18]=j,t[19]=V,t[20]=F,t[21]=N,t[22]=P,t[23]=A,t[24]=Y,t[25]=w,t[26]=B,t[27]=nt):nt=t[27];let rt=nt,it;t[28]!==f||t[29]!==h||t[30]!==V||t[31]!==X||t[32]!==A||t[33]!==Y||t[34]!==B?(it=function(e){let t=V.trim();pe(B,t),te.startBugReportSend({kind:`created-report`,report:e,note:Ce(A,Y),includeScreenshot:e.summary.files.includes(m),includeAttachments:ke(e),...B&&Se(t)?{email:t}:{}}),Me(``),Ne(f!==void 0||h!==void 0),Pe(h?.minidumpAvailable===!0),Fe(!0),Ie(!0),Le([]),X(!1)},t[28]=f,t[29]=h,t[30]=V,t[31]=X,t[32]=A,t[33]=Y,t[34]=B,t[35]=it):it=t[35];let at=it,ot;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ot=function(e){window.okDesktop?.shell.showItemInFolder(e)},t[36]=ot):ot=t[36];let st=ot,Z;t[37]!==D||t[38]!==x||t[39]!==z||t[40]!==qe||t[41]!==Ke||t[42]!==f||t[43]!==M||t[44]!==h||t[45]!==j||t[46]!==Ue||t[47]!==He||t[48]!==Ge||t[49]!==We||t[50]!==V||t[51]!==H||t[52]!==Qe||t[53]!==Ze||t[54]!==rt||t[55]!==X||t[56]!==F||t[57]!==N||t[58]!==P||t[59]!==Ve||t[60]!==K||t[61]!==A||t[62]!==G||t[63]!==O.createError||t[64]!==O.creating||t[65]!==O.step||t[66]!==he||t[67]!==w||t[68]!==Ye||t[69]!==Je||t[70]!==B||t[71]!==Xe||t[72]!==C?(Z=O.step===`compose`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(le,{className:`gap-2 pr-6`,children:[(0,E.jsx)(ie,{children:(0,E.jsx)(r,{id:`cd5EXh`})}),h===void 0&&(0,E.jsx)(S,{children:(0,E.jsx)(r,{id:`2H5Zhu`})})]}),(0,E.jsxs)(se,{className:`flex flex-auto flex-col gap-2 pb-2 [&>*]:shrink-0`,children:[h!==void 0&&(0,E.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-md border border-chart-3/35 bg-chart-3/10 px-3 py-2.5 text-sm`,children:[(0,E.jsx)(re,{className:`mt-0.5 size-4 shrink-0 text-chart-3`,"aria-hidden":`true`}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`p`,{className:`font-medium`,children:(0,E.jsx)(r,{id:`_IGfXZ`})}),(0,E.jsx)(S,{className:`mt-0.5 text-xs`,children:(0,E.jsx)(r,{id:`03wKPg`})})]})]}),O.createError!==null&&(0,E.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2.5 rounded-md border border-destructive/35 bg-destructive/10 px-3 py-2.5 text-sm`,children:[(0,E.jsx)(y,{className:`mt-0.5 size-4 shrink-0 text-destructive`,"aria-hidden":`true`}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`p`,{className:`font-medium`,children:(0,E.jsx)(r,{id:`wVa83H`})}),(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:O.createError}),(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:(0,E.jsx)(r,{id:`5PHgV2`,components:{0:(0,E.jsx)(`code`,{className:`font-mono`})}})})]})]}),f!==void 0&&(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,E.jsx)(r,{id:`CJ59QJ`})}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,E.jsxs)(`label`,{htmlFor:G,className:`text-sm font-medium`,children:[h===void 0?(0,E.jsx)(r,{id:`y_K0Dz`}):(0,E.jsx)(r,{id:`60vpJN`}),` `,(0,E.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:(0,E.jsx)(r,{id:`NzluOx`})})]}),(0,E.jsx)(ge,{id:G,value:A,onChange:e=>Me(e.target.value),placeholder:D(h===void 0?{id:`YLMBSd`}:{id:`T3j-7o`}),rows:2,className:`min-h-20`,intake:z,hint:(0,E.jsx)(r,{id:`XoMG7W`})})]}),w!==null&&(0,E.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2.5 pt-0.5`,children:[(0,E.jsx)(u,{id:Je,checked:P,onCheckedChange:e=>Fe(e===!0),"aria-describedby":Ye,disabled:O.creating}),(0,E.jsx)(`label`,{htmlFor:Je,className:`text-sm font-medium`,children:(0,E.jsx)(r,{id:`IxyZXD`})})]}),(0,E.jsxs)(ue,{children:[(0,E.jsx)(oe,{asChild:!0,children:(0,E.jsxs)(o,{variant:`outline`,className:`relative block h-auto w-40 shrink-0 overflow-hidden rounded-md bg-muted/40 p-0`,"aria-label":D({id:`AkJx1j`}),children:[(0,E.jsx)(`img`,{src:w.dataUrl,alt:D({id:`WuntOK`}),className:`h-24 w-full object-contain ${P?``:`opacity-40`}`}),(0,E.jsx)(`span`,{className:`absolute end-1 top-1 flex items-center rounded bg-popover/90 p-1`,children:(0,E.jsx)(ve,{className:`size-3`,"aria-hidden":`true`})})]})}),(0,E.jsxs)(ae,{className:`sm:max-w-5xl`,children:[(0,E.jsxs)(le,{className:`pr-6`,children:[(0,E.jsx)(ie,{children:(0,E.jsx)(r,{id:`xvv5gL`})}),(0,E.jsx)(S,{children:(0,E.jsx)(r,{id:`qApCYm`})})]}),(0,E.jsx)(se,{children:(0,E.jsx)(`img`,{src:w.dataUrl,alt:D({id:`WuntOK`}),className:`max-h-[70dvh] w-full object-contain`})})]})]}),(0,E.jsxs)(`p`,{id:Ye,className:`min-w-40 flex-1 text-xs text-muted-foreground`,children:[he?(0,E.jsx)(r,{id:`ZBZEkP`}):(0,E.jsx)(r,{id:`nczGih`}),` `,(0,E.jsx)(r,{id:`qApCYm`})]})]}),(0,E.jsxs)(`fieldset`,{className:`grid min-w-0 gap-3 border-t pt-3 sm:grid-cols-[1fr_1.25fr]`,children:[(0,E.jsx)(`legend`,{className:`sr-only`,children:(0,E.jsx)(r,{id:`WJjviG`})}),(0,E.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,E.jsx)(u,{id:K,checked:!0,disabled:!0,"aria-describedby":Ve,className:`mt-0.5`}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,E.jsxs)(`label`,{htmlFor:K,className:`flex flex-wrap items-center gap-2 text-sm font-medium text-foreground`,children:[(0,E.jsx)(r,{id:`FgRAvd`}),(0,E.jsx)(fe,{variant:`primary`,className:`text-2xs`,children:(0,E.jsx)(r,{id:`C0hoX6`})})]}),(0,E.jsx)(`p`,{id:Ve,className:`text-1sm text-muted-foreground`,children:C?(0,E.jsx)(r,{id:`DqyItq`}):(0,E.jsx)(r,{id:`0wkh7o`})})]})]}),(0,E.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,E.jsx)(u,{id:He,checked:j,onCheckedChange:e=>Ne(e===!0),"aria-describedby":Ue,disabled:O.creating,className:`mt-0.5`}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,E.jsx)(`label`,{htmlFor:He,className:`text-sm font-medium`,children:(0,E.jsx)(r,{id:`zvjCD4`})}),(0,E.jsx)(fe,{variant:`primary`,className:`text-2xs`,children:(0,E.jsx)(r,{id:`WEYdDv`})})]}),(0,E.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,E.jsx)(r,{id:`mx_oWI`})}),(0,E.jsx)(`p`,{id:Ue,className:`text-1sm text-muted-foreground`,children:(0,E.jsx)(r,{id:`Z5q-I8`})}),(0,E.jsxs)(l,{children:[(0,E.jsx)(c,{asChild:!0,children:(0,E.jsxs)(o,{variant:`ghost`,size:`sm`,className:`group -ms-2 h-7 justify-start px-2 text-1sm font-normal`,children:[(0,E.jsx)(v,{className:`size-3.5 group-data-[state=open]:rotate-90`,"aria-hidden":`true`}),(0,E.jsx)(r,{id:`0cGsQh`})]})}),(0,E.jsx)(s,{children:(0,E.jsxs)(`p`,{className:`rounded-md bg-muted/50 p-3 text-1sm text-muted-foreground`,children:[(0,E.jsx)(r,{id:`fRVBiq`}),` `,we&&(0,E.jsx)(r,{id:`7xEWbL`})]})})]})]})]})]}),M&&(0,E.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,E.jsx)(u,{id:We,checked:N,onCheckedChange:e=>Pe(e===!0),"aria-describedby":Ge,disabled:O.creating,className:`mt-0.5`}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,E.jsx)(`label`,{htmlFor:We,className:`text-sm font-medium`,children:(0,E.jsx)(r,{id:`8TvlHF`})}),(0,E.jsx)(`p`,{id:Ge,className:`text-1sm text-muted-foreground`,children:(0,E.jsx)(r,{id:`jnCROW`})})]})]}),x!==void 0&&(0,E.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,E.jsx)(u,{id:Ke,checked:F,onCheckedChange:e=>Ie(e===!0),"aria-describedby":qe,disabled:O.creating,className:`mt-0.5`}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,E.jsx)(`label`,{htmlFor:Ke,className:`text-sm font-medium`,children:(0,E.jsx)(r,{id:`U8novP`})}),(0,E.jsx)(`p`,{id:qe,className:`text-1sm text-muted-foreground`,children:(0,E.jsx)(r,{id:`nXK5bR`})})]})]}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,E.jsx)(r,{id:`ko-CKk`})}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,E.jsx)(u,{id:Xe,checked:B,onCheckedChange:e=>{ze(e===!0),U(null)},disabled:O.creating}),(0,E.jsx)(`label`,{htmlFor:Xe,className:`text-sm`,children:(0,E.jsx)(r,{id:`SF9qpO`})})]}),B&&(0,E.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,E.jsx)(de,{id:Ze,"aria-label":D({id:`DFQ2Sj`}),type:`email`,value:V,onChange:e=>{Be(e.target.value),U(null)},placeholder:D({id:`JHf6qZ`}),disabled:O.creating,"aria-invalid":H!==null,"aria-describedby":H===null?void 0:Qe}),H!==null&&(0,E.jsx)(`p`,{id:Qe,className:`text-destructive text-sm`,children:H})]})]}),h===void 0&&f===void 0?(0,E.jsx)(ne,{}):null]}),(0,E.jsxs)(ce,{children:[(0,E.jsx)(o,{variant:`ghost`,onClick:()=>X(!1),children:h===void 0?(0,E.jsx)(r,{id:`dEgA5A`}):(0,E.jsx)(r,{id:`PBxg_E`})}),(0,E.jsxs)(o,{onClick:()=>void rt(),disabled:O.creating,children:[O.creating&&(0,E.jsx)(b,{className:`size-4`,"aria-hidden":`true`}),(0,E.jsx)(r,{id:`Si7mIR`})]})]})]}),t[37]=D,t[38]=x,t[39]=z,t[40]=qe,t[41]=Ke,t[42]=f,t[43]=M,t[44]=h,t[45]=j,t[46]=Ue,t[47]=He,t[48]=Ge,t[49]=We,t[50]=V,t[51]=H,t[52]=Qe,t[53]=Ze,t[54]=rt,t[55]=X,t[56]=F,t[57]=N,t[58]=P,t[59]=Ve,t[60]=K,t[61]=A,t[62]=G,t[63]=O.createError,t[64]=O.creating,t[65]=O.step,t[66]=he,t[67]=w,t[68]=Ye,t[69]=Je,t[70]=B,t[71]=Xe,t[72]=C,t[73]=Z):Z=t[73];let Q;t[74]!==at||t[75]!==O.conversationMissing||t[76]!==O.report||t[77]!==O.step?(Q=O.step===`review`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(le,{children:[(0,E.jsx)(ie,{children:(0,E.jsx)(r,{id:`2AIVbm`})}),(0,E.jsx)(S,{children:(0,E.jsx)(r,{id:`3l_cXP`})})]}),(0,E.jsxs)(se,{className:`flex flex-col gap-4`,children:[(0,E.jsx)(je,{zipPath:O.report.zipPath,zipSizeBytes:O.report.zipSizeBytes,fileCount:O.report.summary.files.length,rawDumpIncluded:Oe(O.report),onReveal:st}),O.conversationMissing?(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,E.jsx)(r,{id:`nRX05G`})}):null,(0,E.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border bg-muted/50 px-3 py-2.5 text-xs text-muted-foreground`,children:[(0,E.jsx)(ye,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,E.jsx)(`span`,{children:(0,E.jsx)(r,{id:`-o5XAG`})})]})]}),(0,E.jsxs)(ce,{className:`sm:justify-between`,children:[(0,E.jsx)(o,{variant:`ghost`,onClick:()=>k(De),children:(0,E.jsx)(r,{id:`iH8pgl`})}),(0,E.jsx)(o,{onClick:()=>at(O.report),children:(0,E.jsx)(r,{id:`O9oQJS`})})]})]}),t[74]=at,t[75]=O.conversationMissing,t[76]=O.report,t[77]=O.step,t[78]=Q):Q=t[78];let $;t[79]!==z.onPaste||t[80]!==Z||t[81]!==Q?($=(0,E.jsxs)(ae,{className:`gap-2 sm:max-w-[46.25rem]`,onPaste:z.onPaste,children:[Z,Q]}),t[79]=z.onPaste,t[80]=Z,t[81]=Q,t[82]=$):$=t[82];let ct;return t[83]!==X||t[84]!==n||t[85]!==$?(ct=(0,E.jsx)(ue,{open:n,onOpenChange:X,children:$}),t[83]=X,t[84]=n,t[85]=$,t[86]=ct):ct=t[86],ct}function je(e){let t=(0,be.c)(23),{zipPath:n,zipSizeBytes:i,fileCount:a,rawDumpIncluded:s,onReveal:c}=e,l;t[0]===n?l=t[1]:(l=ee(n),t[0]=n,t[1]=l);let u=l,d;t[2]===i?d=t[3]:(d=x(i),t[2]=i,t[3]=d);let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,E.jsx)(`div`,{className:`flex items-center justify-center size-8 rounded-md bg-muted`,children:(0,E.jsx)(_e,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`})}),t[4]=p):p=t[4];let m;t[5]===u?m=t[6]:(m=(0,E.jsx)(`p`,{className:`truncate text-1sm`,title:u,children:u}),t[5]=u,t[6]=m);let h;t[7]!==a||t[8]!==s||t[9]!==f?(h=(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s?(0,E.jsx)(r,{id:`sn5BEU`,values:{sizeText:f,fileCount:a}}):(0,E.jsx)(r,{id:`3DJEEt`,values:{sizeText:f,fileCount:a}})}),t[7]=a,t[8]=s,t[9]=f,t[10]=h):h=t[10];let g;t[11]!==m||t[12]!==h?(g=(0,E.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[m,h]}),t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==c||t[15]!==n?(_=()=>c(n),t[14]=c,t[15]=n,t[16]=_):_=t[16];let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=C(typeof window<`u`?window.okDesktop?.platform:void 0),t[17]=v):v=t[17];let y;t[18]===_?y=t[19]:(y=(0,E.jsx)(o,{variant:`link`,className:`h-auto shrink-0 p-0 text-xs`,onClick:_,children:v}),t[18]=_,t[19]=y);let b;return t[20]!==g||t[21]!==y?(b=(0,E.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md border px-3 py-2.5`,children:[p,g,y]}),t[20]=g,t[21]=y,t[22]=b):b=t[22],b}export{k as default};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{n as i}from"./use-installed-clis-BzQZdtk_.js";import{n as a}from"./local-menu-action-bus-DaoT7_kL.js";var o=r(),s=e(n(),1),c=t();function l(e){let t=(0,o.c)(7),{systemWide:n}=e,[r,l]=(0,s.useState)(null),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>a((e,t)=>{e===`report-bug`&&l(e=>e??t)}),d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),(0,s.useEffect)(u,d);let f=r!==null,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||l(null)},t[2]=p):p=t[2];let m=r?.launcherBorne===!0,h;return t[3]!==n||t[4]!==f||t[5]!==m?(h=(0,c.jsx)(i,{open:f,onOpenChange:p,launcherBorne:m,systemWide:n}),t[3]=n,t[4]=f,t[5]=m,t[6]=h):h=t[6],h}export{l as t};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{n as i}from"./use-installed-clis-SziirqY4.js";import{n as a}from"./local-menu-action-bus-DaoT7_kL.js";var o=r(),s=e(n(),1),c=t();function l(e){let t=(0,o.c)(7),{systemWide:n}=e,[r,l]=(0,s.useState)(null),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>a((e,t)=>{e===`report-bug`&&l(e=>e??t)}),d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),(0,s.useEffect)(u,d);let f=r!==null,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||l(null)},t[2]=p):p=t[2];let m=r?.launcherBorne===!0,h;return t[3]!==n||t[4]!==f||t[5]!==m?(h=(0,c.jsx)(i,{open:f,onOpenChange:p,launcherBorne:m,systemWide:n}),t[3]=n,t[4]=f,t[5]=m,t[6]=h):h=t[6],h}export{l as t};