@inkeep/open-knowledge 0.46.0-beta.26 → 0.46.0-beta.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/THIRD_PARTY_NOTICES.md +1 -0
- package/dist/{acp-harness-probe-CWSgVEXp.mjs → acp-harness-probe-C4K02btZ.mjs} +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/constants-CebxEtu9.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-BvETsSk1.mjs +1 -0
- package/dist/{init-Cp1cLnZk.mjs → init-D3b5DYrW.mjs} +3 -3
- package/dist/{launch-json-removal-DUge6f_e.mjs → launch-json-removal-aEKVez2R.mjs} +2 -2
- package/dist/{loader-CQZle2jn.mjs → loader-BgySxNwQ.mjs} +2 -2
- package/dist/loader-CUtunuYD.mjs +1 -0
- package/dist/preview-BITMjtP0.mjs +1 -0
- package/dist/{preview-CVEIuiZH.mjs → preview-BR5g8VAw.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-CZsut2kK.js → ActivityModeContent-CMOWl-z7.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-Glfn8BNa.js → AgentDiffPane-Dx-cuJon.js} +1 -1
- package/dist/public/assets/{ChangedOutsideBadge-D3NWhSWI.js → ChangedOutsideBadge-B0Dyi398.js} +1 -1
- package/dist/public/assets/{DocumentContext-BYAIHlLG.js → DocumentContext-DQRTQdaE.js} +1 -1
- package/dist/public/assets/FeedbackForm-CCwMhLuO.js +1 -0
- package/dist/public/assets/{ImportSkillDialog-BmK5Zi4Y.js → ImportSkillDialog-Dm59r2Nu.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-DX6VEhcK.js → ManagedArtifactProperties-DeXNU1el.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-Dy-tXH79.js +1 -0
- package/dist/public/assets/{SessionsHost-DfHGA3JK.js → SessionsHost-BNp9EldK.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-DKXJqt7T.js → SettingsDialogBody-CxB1-ao9.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-B-dV8j9p.js → SkillToolbarControls-WRSmfM68.js} +1 -1
- package/dist/public/assets/{SourceEditor-CgLBpfga.js → SourceEditor-BBalK1ec.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-B3Nw6A9a.js → TerminalWindowApp-eRSc3meK.js} +1 -1
- package/dist/public/assets/{ThreadView-Di5TkV_e.js → ThreadView-C7FjdMgM.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-N5K-0E_Q.js → TimelineDiffPane-DMSguMtd.js} +1 -1
- package/dist/public/assets/{agent-diff-store-kv64r9C1.js → agent-diff-store-BeYvAuVe.js} +1 -1
- package/dist/public/assets/{auth-state-cache-CDJruLs7.js → auth-state-cache-D0ltCh07.js} +1 -1
- package/dist/public/assets/{index-Cp_NinKw.js → index-Xl8wsXmv.js} +8 -8
- package/dist/public/assets/{selection-context-BXUHt52S.js → selection-context-DarY9K7o.js} +1 -1
- package/dist/public/assets/{skill-actions-Dba4au8l.js → skill-actions-Cfel0Z_Z.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-CC7bIjEV.js → typing-burst-detector-D9fP8xnK.js} +1 -1
- package/dist/public/assets/{use-activity-panel-D9D0qVT-.js → use-activity-panel-CwELvNbY.js} +1 -1
- package/dist/public/assets/{use-open-skill-7MNEmyfe.js → use-open-skill-BSfRSbaQ.js} +1 -1
- package/dist/public/assets/{use-skill-directory-ByVFCtzx.js → use-skill-directory-B03ue0No.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-TOhNAiEO.js → use-timeline-entry-diff-CKrGc_k3.js} +1 -1
- package/dist/public/index.html +11 -11
- package/dist/{repair-launch-json-BLsGi3mb.mjs → repair-launch-json-Dxpqu8Bq.mjs} +2 -2
- package/dist/{repair-mcp-configs-BBKSodto.mjs → repair-mcp-configs-Hb6q_ldK.mjs} +2 -2
- package/dist/{src-B3Ey-N80.mjs → src-v9Dwzzez.mjs} +2 -2
- package/dist/{start-CKOa3i5A.mjs → start-CFhMDjAF.mjs} +2 -2
- package/dist/start-CvsMhP5B.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-DVpRelLO.mjs +0 -2
- package/dist/init-BmRhHNNm.mjs +0 -1
- package/dist/loader-Bh_ZTHZc.mjs +0 -1
- package/dist/preview-Cxdw_wal.mjs +0 -1
- package/dist/public/assets/FeedbackForm-CXjxL9--.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-Cv2PfiCt.js +0 -1
- package/dist/start-9wytEH8K.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{E as e}from"./DocumentContext-
|
|
1
|
+
import{E as e}from"./DocumentContext-DQRTQdaE.js";function t(e){return e.lineCount===1&&e.charLen<100?{kind:`inline`,markdown:e.markdown}:e.surface===`source`&&e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?{kind:`lines`,startLine:e.sourceLineStart,endLine:e.sourceLineEnd}:{kind:`anchor`,markdown:e.markdown}}function n(e,t){return e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?`${t} (${e.sourceLineStart===e.sourceLineEnd?`${e.sourceLineStart}`:`${e.sourceLineStart}-${e.sourceLineEnd}`})`:e.lineCount>1?`${t} (${e.lineCount} lines)`:`${t} (selection)`}function r(e){let t=e.replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),n=[],r=!1;for(let e of t){let t=e.trim();if(/^(```|~~~)/.test(t)){r||n.push(`code`),r=!r;continue}if(r||t===``)continue;if(/^\|.*\|?$/.test(t)&&t.includes(`|`)){n[n.length-1]!==`table`&&n.push(`table`);continue}if(/^<\/?[A-Za-z]/.test(t)){n[n.length-1]!==`component`&&n.push(`component`);continue}let i=t.match(/^#{1,6}\s+(.*)$/);if(i){n.push(i[1]??``);continue}let a=t.match(/^[-*+]\s+(.*)$/);if(a){n.push(`• ${a[1]??``}`);continue}let o=t.match(/^\d+\.\s+(.*)$/);if(o){n.push(`• ${o[1]??``}`);continue}let s=t.match(/^>\s?(.*)$/);if(s){n.push(s[1]??``);continue}n.push(t)}return n.join(` `).replace(/\s+/g,` `).trim()}var i=new Map,a=new Set,o=(e,t)=>`${t}:${e}`;function s(){for(let e of a)e()}function c(e,t){return e.markdown===t.markdown&&e.sourceLineStart===t.sourceLineStart&&e.sourceLineEnd===t.sourceLineEnd}function l(e,t,n){let r=o(e,t);if(n===null){i.delete(r)&&s();return}let a=i.get(r);a&&c(a,n)||(i.set(r,n),s())}function u(e,t){return e===null?null:i.get(o(e,t))??null}function d(e){return a.add(e),()=>{a.delete(e)}}function f(t,n){if(t.state.selection.empty)return null;let r=e(t);return r.trim()?{surface:`wysiwyg`,docName:n,markdown:r,charLen:r.trim().length,lineCount:(r.match(/\n/g)?.length??0)+1}:null}function p(e,t){return e.trim()?{surface:`frontmatter`,docName:t,markdown:e,charLen:e.trim().length,lineCount:(e.match(/\n/g)?.length??0)+1}:null}function m(e,t){let n=[],r=1/0,i=-1;for(let t of e.state.selection.ranges)t.empty||(n.push(e.state.sliceDoc(t.from,t.to)),r=Math.min(r,t.from),i=Math.max(i,t.to));if(n.length===0)return null;let a=n.join(`
|
|
4
4
|
`);if(!a.trim())return null;let o=e.state.doc.lineAt(r).number,s=e.state.doc.lineAt(i).number;return{surface:`source`,docName:t,markdown:a,charLen:a.trim().length,lineCount:s-o+1,sourceLineStart:o,sourceLineEnd:s}}export{p as a,t as c,n as i,d as l,r as n,m as o,l as r,f as s,u as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{F as n,I as r,Nn as i,P as a,gn as o,i as s}from"./DocumentContext-BYAIHlLG.js";import{t as c}from"./react-f2sANaYj.js";import{n as l,r as u}from"./dist-Nvb76hAm.js";import{t as d}from"./compiler-runtime-BfE3aGVn.js";import{l as f}from"./terminal-input-events-D7rv6nZZ.js";import{c as p,i as m,n as h,o as g,s as _,t as v}from"./ChangedOutsideBadge-D3NWhSWI.js";import{t as y}from"./button-D3xSRfT4.js";import{i as b,n as x,t as S}from"./tooltip-CtvLp_YK.js";import{a as C,c as w,i as T,n as E,o as D,r as O,s as ee,t as te}from"./dialog-C1XaLkpS.js";import{a as k,d as A,f as j,i as M,n as N,o as P,p as F,u as I}from"./dropdown-menu-BvpO8ueR.js";import{t as L}from"./label-CGqMAe0S.js";import{C as R,a as z,f as B,h as V,m as H,n as U,o as W,p as G,r as K,s as q,t as J}from"./agent-visibility-BiwwzWZK.js";import{$t as Y,Dt as ne,Ia as X,Kt as re,Mt as ie,Ra as ae,Sn as oe,Va as se,Zt as ce,_n as le,bn as ue,en as de,fn as fe,hn as pe,jt as me,mn as he,nt as ge,pa as _e,pn as ve,ri as ye,tt as be,xn as xe,xt as Se,yn as Ce,yr as we}from"./dist-lf4nG52q2.js";import{t as Te}from"./createLucideIcon-wbFLvDA-.js";import{t as Ee}from"./RegisteredAgentIcon-CKpJ_hgB.js";import{n as De,r as Oe}from"./ManagedArtifactProperties-DX6VEhcK.js";import{n as ke}from"./CopyButton-Dk8yDsPs.js";import{t as Ae}from"./folder-open-DxWbBr3T.js";import{t as je}from"./folder-CyL8AyXY.js";import{t as Me}from"./trash-2-4ZuuBm4P.js";import{n as Z}from"./dist-Dr52ya0i.js";import{t as Ne}from"./input-CdGQDWjM.js";import{t as Pe}from"./dist-D1YpGD7x.js";import{i as Fe}from"./use-settings-route-Cj3iyYQM.js";import{t as Ie}from"./parse-api-error-9c-Rs5WJ.js";import{G as Le,O as Re,W as ze}from"./navigation-targets-CIvGC6UT.js";import{c as Be,n as Ve,o as He}from"./documents-events-Bz6CFw_P.js";import{d as Ue,n as We,r as Ge,s as Ke}from"./skill-scope-C8db1Nmk.js";import{A as qe,D as Je,O as Ye,S as Xe,_ as Ze,c as Qe,f as $e,i as et,n as tt,t as nt,v as rt,x as it,y as at}from"./skills-api-DF632dit.js";import{n as ot}from"./config-context-7il4AXHf.js";import{t as st}from"./use-skills-CjgBfNqJ.js";import{t as ct}from"./use-open-skill-7MNEmyfe.js";import{t as lt}from"./use-workspace-DX49f8pU.js";import{n as ut}from"./clipboard-adapter-DdkYoUY3.js";import{t as dt}from"./DiffView-ChmPu7VO.js";var ft=Te(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),pt=Te(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),mt=Te(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),ht=Te(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),gt=Te(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Q=t(),$=e(c(),1),_t=d();function vt(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function yt(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Ie(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function bt(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?vt(e):yt()}var xt=`ok:skill:cowork:installed`,St=`1`,Ct=250,wt=`/api/skill/install-state`;function Tt(e){return`${xt}:v${e}`}var Et=new Map;async function Dt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Et.get(n);if(r)return r;let i=Ot(e,t);return Et.set(n,i),i.finally(()=>{Et.get(n)===i&&Et.delete(n)}),i}async function Ot(e,t){let n=e.installer===void 0?bt():e.installer,r=kt(e.storage),i=e.fetchSnapshot??jt,a=e.serverTimeoutMs??Ct,o=null;if(!t.force){try{o=await Mt(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Tt(o?.currentVersion??e.fallbackSkillVersion??At());if(!t.force&&r?.getItem(s)===St)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,St)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function kt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function At(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function jt(){let e;try{e=await fetch(wt,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Mt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Nt(e){return Dt({},e)}function Pt(){return Dt({},{force:!0})}async function Ft(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function It(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Ft({target:`claude-cowork`,url:ce({mode:`cowork`},e)},n);case`claude-code`:return Ft({target:`claude-code`,url:ce({mode:`code`},e)},n);case`codex`:return Ft({target:`codex`,url:Y(e)},n);case`cursor`:return Ft({target:`cursor`,url:de(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Lt(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var Rt=`open-knowledge:agent-thread-launch`;function zt(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(Rt,{detail:e}))}function Bt(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(Rt,n),()=>t.removeEventListener(Rt,n)}function Vt(e){if(!e.docName||!e.workspace)return null;let t=a(e.docName),{contentDir:r,pathSeparator:i}=e.workspace;return{docContext:{relativePath:t},projectDir:r,docPath:n(r,t,i)}}function Ht(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function Ut(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function Wt(e){return G(e.installUrl).then(()=>void 0)}function Gt(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function Kt(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function qt(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:r}=e.workspace;if(e.docName){let i=e.docRelativePath??a(e.docName),o={scope:`doc`,docRelativePath:i,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?o:{...o,selection:e.selection},projectDir:t,docPath:n(t,i,r)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function Jt(e){return`Opened in ${e}.`}function Yt(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function Xt(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function Zt(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function Qt(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function $t(e,t,n,r){return e.compose?re(Qt(e.compose,t,n,r)):e.selection?Ce({...e.selection,target:t,transport:r}):e.skill?ue(e.skill.name,e.skill.scope,n):e.ask?fe(e.ask.relativePath,e.ask.instruction,n,t,r):ye(e.docContext===null?e.folderRelativePath?le(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?he(n,e.instruction,r):ve(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):pe(e.docContext.relativePath,n,e.instruction,r))}function en(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${be} ${$t(e,me[t].handoffTarget,!1,`terminal`)}`:xe(e.docContext?.relativePath??null)}function tn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${ge} ${$t(e,`claude-code`,!1,`terminal`)}`:oe(e.docContext?.relativePath??null)}function nn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function rn(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function an(e,t){zt({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:tn(e),docName:nn(e),titleHint:rn(e)})}async function on(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`OpenKnowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:$t(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=Zt(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(Jt(u));else{let i=Xt(r),a=Yt(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{on(e,t,n,r+1)}}})}return a}function sn(e){return H.find(t=>t.id===e)?.displayName??e}function cn(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function ln(){return{dispatchHandoff:It,recordHandoff:Lt,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>cn(),getDisplayName:sn,ensureCoworkSkillInstalled:Nt,autoOpen:!0}}function un(){let e=(0,_t.c)(2),{merged:t}=ot(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>on(e,t,{...ln(),autoOpen:n}),reinstallCoworkSkill:Pt},e[0]=n,e[1]=r),r}var dn=Object.freeze({hosts:null,source:null}),fn=new Map,pn=new Map;function mn(e,t){return`${e}:${t}`}function hn(e){return fn.get(e)??dn}function gn(e,t){let n=pn.get(e)??new Set;return pn.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&pn.delete(e)}}function _n(e,t){let n=hn(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?fn.delete(e):fn.set(e,r);for(let t of pn.get(e)??[])t()}}var vn=ne.options,yn=`min-w-[24rem]`;function bn(e,t){let n=(0,_t.c)(45),r=t.installingName===e.name,i=(0,$.useRef)(e),[a,o]=(0,$.useState)(!1),s=(0,$.useRef)(!1),c,l;n[0]===r?(c=n[1],l=n[2]):(c=()=>{s.current&&!r&&o(!0),s.current=r},l=[r],n[0]=r,n[1]=c,n[2]=l),(0,$.useEffect)(c,l);let u,d;n[3]===e?(u=n[4],d=n[5]):(u=()=>{e!==i.current&&(i.current=e,o(!1))},d=[e],n[3]=e,n[4]=u,n[5]=d),(0,$.useEffect)(u,d);let f=r||a,p;n[6]!==e.name||n[7]!==e.scope?(p=mn(e.scope,e.name),n[6]=e.name,n[7]=e.scope,n[8]=p):p=n[8];let m=p,h,g;n[9]===m?(h=n[10],g=n[11]):(h=e=>gn(m,e),g=()=>hn(m),n[9]=m,n[10]=h,n[11]=g);let _=(0,$.useSyncExternalStore)(h,g),v=_.hosts,y=_.source,b,x;n[12]!==y||n[13]!==m||n[14]!==e.hosts?(b=()=>{y!==null&&e.hosts[0]===y&&_n(m,{source:null})},x=[e.hosts,y,m],n[12]=y,n[13]=m,n[14]=e.hosts,n[15]=b,n[16]=x):(b=n[15],x=n[16]),(0,$.useEffect)(b,x);let S=e.linkMode===!0,C=v??e.hosts,w;n[17]===C?w=n[18]:(w=new Set(C),n[17]=C,n[18]=w);let T=w,E=v?v.length>0:e.installed,D=(0,$.useRef)(e.hosts),O,ee;n[19]!==v||n[20]!==e.hosts?(O=()=>{v===null&&(D.current=e.hosts)},ee=[v,e.hosts],n[19]=v,n[20]=e.hosts,n[21]=O,n[22]=ee):(O=n[21],ee=n[22]),(0,$.useEffect)(O,ee);let te;n[23]===e.hosts?te=n[24]:(te=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=te);let k=te,A,j;n[25]!==m||n[26]!==k?(A=()=>{let e=hn(m).hosts;e&&[...e].sort().join(`,`)===k&&_n(m,{hosts:null})},j=[k,m],n[25]=m,n[26]=k,n[27]=A,n[28]=j):(A=n[27],j=n[28]),(0,$.useEffect)(A,j);let M=(0,$.useRef)(null),N=(0,$.useRef)(null),P,F;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>()=>{M.current&&clearTimeout(M.current),N.current?.(),N.current=null},F=[],n[29]=P,n[30]=F):(P=n[29],F=n[30]),(0,$.useEffect)(P,F);let I;n[31]!==t||n[32]!==m||n[33]!==e?(I=function(n,r){D.current=n,_n(m,{hosts:n}),M.current&&clearTimeout(M.current);let i=async()=>{N.current=null,M.current=null;let r=await t.install(e,n.filter(we));if(!r.ok){_n(m,{hosts:null});return}D.current=[...r.hosts],_n(m,{hosts:[...r.hosts]})};r?(N.current=()=>void i(),M.current=setTimeout(()=>void i(),350)):(N.current=null,i())},n[31]=t,n[32]=m,n[33]=e,n[34]=I):I=n[34];let L=I,R;return n[35]!==t||n[36]!==L||n[37]!==T||n[38]!==E||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(R={hostSet:T,installed:E,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),L([...n],!0)},installAll(){let t=D.current.filter(Cn),n=e.installableEditors??vn,r=vn.filter(e=>n.includes(e)||D.current.includes(e));L([...t,...r],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>rt({scope:e.scope,name:e.name,dir:n,mode:r})).then(Sn)},unplaceAt(n){t.runLocationWrite(e,()=>Ye({scope:e.scope,name:e.name,path:n})).then(xn)},setSource(n){_n(m,{source:n}),t.runLocationWrite(e,()=>Je({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(_n(m,{source:null}),Z.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=L,n[37]=T,n[38]=E,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=R):R=n[44],R}function xn(e){e.ok||Z.error(e.error)}function Sn(e){e.ok||Z.error(e.error)}function Cn(e){return!vn.includes(e)}function wn(e){let t=(0,_t.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Q.jsx)(b,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Q.jsx)(x,{side:`right`,className:`max-w-xs`,children:n}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(S,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Tn(e){let t=(0,_t.c)(155),{toggles:n,skill:r,onResolveFork:i,onRunStart:a}=e,{_:o}=u(),{hostSet:s,toggleEditor:c,installAll:d}=n,f;t[0]===r?f=t[1]:(f=e=>r?`${Ke(e,r.scope)}/${r.name}`:null,t[0]=r,t[1]=f);let p=f,m=st(),g;t[2]!==m.data||t[3]!==m.status||t[4]!==r?(g=r!==void 0&&((r.hosts??[]).includes(`agents`)||m.status===`ready`&&m.data.some(Ln)),t[2]=m.data,t[3]=m.status,t[4]=r,t[5]=g):g=t[5];let _=g,b;t[6]!==m.data||t[7]!==m.status||t[8]!==r?(b=r?.hostAliases??(r&&m.status===`ready`?Object.assign({},...m.data.filter(e=>e.scope===r.scope).map(In)):{}),t[6]=m.data,t[7]=m.status,t[8]=r,t[9]=b):b=t[9];let x=b,S;t[10]!==m.data||t[11]!==m.status||t[12]!==r?(S=r?.installableEditors??(r&&m.status===`ready`?m.data.find(e=>e.scope===r.scope)?.installableEditors:void 0),t[10]=m.data,t[11]=m.status,t[12]=r,t[13]=S):S=t[13];let C=S,w,T,E,D,O,ee,te;if(t[14]!==o||t[15]!==x||t[16]!==m.data||t[17]!==m.status||t[18]!==s||t[19]!==_||t[20]!==d||t[21]!==C||t[22]!==i||t[23]!==a||t[24]!==p||t[25]!==r||t[26]!==c||t[27]!==n){let e=C?new Set(C):null,u;t[35]===x?u=t[36]:(u=e=>!(e in x),t[35]=x,t[36]=u);let f=(_?[`agents`,...vn]:vn).filter(u).filter(t=>t===`agents`||e===null||e.has(t)||s.has(t)),g;t[37]===p?g=t[38]:(g=e=>p(e),t[37]=p,t[38]=g);let b=new Set(f.map(g)),S=r?.scope===`global`?`~/`:``,k;t[39]!==S||t[40]!==r?(k=r?.path?.includes(`/`)?`${S}${r.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,t[39]=S,t[40]=r,t[41]=k):k=t[41];let A=k,j=A!==null&&!b.has(A)?A:null,M=j===null?n.sourceHost??r?.hosts?.[0]:void 0,F;t[42]===x?F=t[43]:(F=e=>We(x,e),t[42]=x,t[43]=F);let I=F,L=Fn,R;t[44]!==o||t[45]!==I?(R=e=>{let t=I(e);return t.length===0?!0:window.confirm(o({id:`Uobeu9`,values:{0:t.map(L).join(`, `),rootRel:e}}))},t[44]=o,t[45]=I,t[46]=R):R=t[46];let z=R,B;t[47]!==o||t[48]!==r?(B=(e,t)=>{let n=e.includes(`/`)?e:Ke(e,r?.scope??`project`);return(0,Q.jsx)(wn,{hint:o({id:`0dslv8`,values:{0:L(e),1:L(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":o({id:`G6Lrs_`,values:{0:L(e)}}),onClick:i=>{i.preventDefault(),i.stopPropagation(),window.confirm(o({id:`iiqOKM`,values:{0:L(e),1:r.name,2:L(e),subRoot:n,poolRootRel:t}}))&&at({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?He():Z.error(o({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,Q.jsx)(h,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[47]=o,t[48]=r,t[49]=B):B=t[49];let V=B,H;t[50]===r?.conflictHosts?H=t[51]:(H=r?.conflictHosts??[],t[50]=r?.conflictHosts,t[51]=H);let U;t[52]===H?U=t[53]:(U=new Set(H),t[52]=H,t[53]=U);let W=U,G;t[54]===r?.driftPaths?G=t[55]:(G=r?.driftPaths??[],t[54]=r?.driftPaths,t[55]=G);let K;t[56]===G?K=t[57]:(K=new Set(G),t[56]=G,t[57]=K);let q=K;w=n.installing;let J=Pn,Y;t[58]===r?.symlinkedHosts?Y=t[59]:(Y=r?.symlinkedHosts??[],t[58]=r?.symlinkedHosts,t[59]=Y);let ne;t[60]===Y?ne=t[61]:(ne=new Set(Y),t[60]=Y,t[61]=ne);let X=ne,re=[...[...s].filter(e=>e!==M&&!(e in x)&&!W.has(e)&&!e.includes(`/`)).map(e=>X.has(e)?`link`:`copy`),...(r?.customPlacements??[]).map(Nn)],ie=re.filter(Mn).length;E=re.length===0?n.linkMode?`link`:`copy`:ie*2>=re.length?`link`:`copy`;let ae;t[62]!==x||t[63]!==W||t[64]!==s||t[65]!==X||t[66]!==p||t[67]!==M?(ae=[...s].filter(e=>e!==M&&!(e in x)&&!W.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:p(e)??L(e),mode:X.has(e)?`link`:`copy`})),t[62]=x,t[63]=W,t[64]=s,t[65]=X,t[66]=p,t[67]=M,t[68]=ae):ae=t[68];let oe;t[69]===r?.customPlacements?oe=t[70]:(oe=r?.customPlacements??[],t[69]=r?.customPlacements,t[70]=oe);let se;if(t[71]!==S||t[72]!==ae||t[73]!==oe){let e;t[75]===S?e=t[76]:(e=e=>({target:Ge(e),display:`${S}${e.path}`,mode:e.mode}),t[75]=S,t[76]=e),se=[...ae,...oe.map(e)],t[71]=S,t[72]=ae,t[73]=oe,t[74]=se}else se=t[74];T=se;let ce;t[77]!==o||t[78]!==a||t[79]!==n?(ce=(e,t,r)=>{let i=r===`link`?`copy`:`link`;return(0,Q.jsx)(wn,{hint:o(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 font-normal text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(o(i===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(a?.(),n.convertLocation?.(e,i))},"data-testid":`skill-convert-${e}`,children:r===`link`?(0,Q.jsx)(l,{id:`uUCrBv`}):(0,Q.jsx)(l,{id:`iaPtht`})})})},t[77]=o,t[78]=a,t[79]=n,t[80]=ce):ce=t[80];let le=ce,ue;t[81]===r?.customPlacements?ue=t[82]:(ue=r?.customPlacements??[],t[81]=r?.customPlacements,t[82]=ue);let de=new Map(ue.map(jn)),fe=new Set(de.keys());if(m.status===`ready`&&r){for(let e of m.data)if(e.scope===r.scope)for(let t of e.customPlacements??[]){let e=Ge(t);e!==``&&fe.add(e)}}let pe=r===void 0?[]:[...fe].sort().map(e=>({root:e,display:`${S}${e}/${r.name}`,placed:de.get(e)??null})).filter(e=>!b.has(e.display)&&e.display!==A&&!(e.root in x)),me;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Q.jsx)(l,{id:`npcziF`}),t[83]=me):me=t[83];let he;t[84]===o?he=t[85]:(he=o({id:`6f_UX4`}),t[84]=o,t[85]=he);let ge;t[86]===d?ge=t[87]:(ge=()=>d(),t[86]=d,t[87]=ge);let ve;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(l,{id:`N40H-G`}),t[88]=ve):ve=t[88];let ye;t[89]!==w||t[90]!==ge?(ye=(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:w,onClick:ge,"data-testid":`skill-install-all`,children:ve}),t[89]=w,t[90]=ge,t[91]=ye):ye=t[91],t[92]!==he||t[93]!==ye?(D=(0,Q.jsxs)(P,{className:`flex items-center justify-between gap-2`,children:[me,(0,Q.jsx)(wn,{hint:he,children:ye})]}),t[92]=he,t[93]=ye,t[94]=D):D=t[94],t[95]!==o||t[96]!==V||t[97]!==w||t[98]!==j||t[99]!==I?(O=j===null?null:(0,Q.jsx)(wn,{hint:o({id:`pXB6SL`}),children:(0,Q.jsxs)(N,{disabled:w,checked:!0,onSelect:An,"data-testid":`skill-source-row`,children:[(0,Q.jsx)(je,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:j}),(()=>{let e=J(j).split(`/`).slice(0,-1).join(`/`),t=I(e);return t.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>V(t,e))}):null})(),(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(l,{id:`tiFPjk`})})]})]})}),t[95]=o,t[96]=V,t[97]=w,t[98]=j,t[99]=I,t[100]=O):O=t[100];let be;t[101]!==o||t[102]!==V||t[103]!==w||t[104]!==z||t[105]!==W||t[106]!==le||t[107]!==q||t[108]!==E||t[109]!==s||t[110]!==X||t[111]!==i||t[112]!==p||t[113]!==r?.hosts||t[114]!==M||t[115]!==I||t[116]!==c||t[117]!==n?(be=e=>{let t=p(e),a=e===`agents`?`.agents`:_e[e],u=J(t).split(`/`).slice(0,-1).join(`/`),d=I(u);return(0,Q.jsx)(wn,{hint:W.has(e)?o({id:`8HvJlU`,values:{0:t??a}}):e===M?t?o({id:`ssk6rl`,values:{path:t}}):a:s.has(e)?o(t?{id:`9ieZhu`,values:{path:t}}:{id:`n3T3EE`,values:{label:a}}):o(t?E===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}:{id:`Pp0Vgd`,values:{label:a}}),children:(0,Q.jsxs)(N,{disabled:w,checked:s.has(e),onCheckedChange:t=>{W.has(e)||t===!0&&!z(u)||c(e,t===!0)},onSelect:kn,className:`group`,"data-testid":`skill-install-editor-${e}`,children:[(0,Q.jsx)(h,{host:e,"aria-hidden":!0,className:`size-4`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:t??a}),d.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${e}`,children:d.map(e=>V(e,u))}):null,W.has(e)?(0,Q.jsx)(wn,{hint:o({id:`_O7dJS`}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:t=>{t.preventDefault(),i?.(e)},"data-testid":`skill-fork-chip-${e}`,children:(0,Q.jsx)(l,{id:`jng7Ko`})})}):e===M?(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(l,{id:`tiFPjk`})}):s.has(e)&&r?.hosts?(0,Q.jsxs)(Q.Fragment,{children:[!w&&(X.has(e)?`link`:`copy`)!==E?le(e,t??a,X.has(e)?`link`:`copy`):null,(0,Q.jsx)(wn,{hint:o({id:`nBgzKO`}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e)},"data-testid":`skill-set-source-${e}`,children:(0,Q.jsx)(l,{id:`VNNRfN`})})})]}):null,!w&&q.has(J(t))?(0,Q.jsx)(wn,{hint:o({id:`iz1LdD`}),children:(0,Q.jsx)(v,{testId:`skill-drift-${e}`})}):null]})]})},e)},t[101]=o,t[102]=V,t[103]=w,t[104]=z,t[105]=W,t[106]=le,t[107]=q,t[108]=E,t[109]=s,t[110]=X,t[111]=i,t[112]=p,t[113]=r?.hosts,t[114]=M,t[115]=I,t[116]=c,t[117]=n,t[118]=be):be=t[118],ee=f.map(be);let xe;t[119]!==o||t[120]!==V||t[121]!==w||t[122]!==z||t[123]!==le||t[124]!==q||t[125]!==E||t[126]!==I||t[127]!==n?(xe=e=>(0,Q.jsx)(wn,{hint:e.placed===null?o(E===`link`?{id:`ybWWR2`,values:{0:e.display}}:{id:`fDjZxw`,values:{0:e.display}}):o({id:`C0cll5`,values:{0:e.display}}),children:(0,Q.jsxs)(N,{disabled:w,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!z(e.root))return;n.placeAt(e.root,E)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:On,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,Q.jsx)(h,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,Q.jsx)(je,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),I(e.root).length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-custom-${e.root}`,children:I(e.root).map(t=>V(t,e.root))}):null,!w&&e.placed!==null&&q.has(e.placed.path)?(0,Q.jsx)(wn,{hint:o({id:`iz1LdD`}),children:(0,Q.jsx)(v,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,Q.jsxs)(Q.Fragment,{children:[!w&&e.placed.mode!==E?le(e.root,e.display,e.placed.mode):null,(0,Q.jsx)(wn,{hint:o({id:`nBgzKO`}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e.root)},"data-testid":`skill-set-source-custom-${e.root}`,children:(0,Q.jsx)(l,{id:`VNNRfN`})})})]})]})]})},e.root),t[119]=o,t[120]=V,t[121]=w,t[122]=z,t[123]=le,t[124]=q,t[125]=E,t[126]=I,t[127]=n,t[128]=xe):xe=t[128],te=pe.map(xe),t[14]=o,t[15]=x,t[16]=m.data,t[17]=m.status,t[18]=s,t[19]=_,t[20]=d,t[21]=C,t[22]=i,t[23]=a,t[24]=p,t[25]=r,t[26]=c,t[27]=n,t[28]=w,t[29]=T,t[30]=E,t[31]=D,t[32]=O,t[33]=ee,t[34]=te}else w=t[28],T=t[29],E=t[30],D=t[31],O=t[32],ee=t[33],te=t[34];let A;t[129]!==o||t[130]!==w||t[131]!==T||t[132]!==E||t[133]!==a||t[134]!==n?(A=T.length>0&&n.convertLocations?(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-auto whitespace-normal p-0 text-left font-normal text-[11px] text-muted-foreground leading-snug hover:bg-transparent hover:text-foreground`,onClick:e=>{e.preventDefault();let t=E===`link`?`copy`:`link`,r=T.filter(e=>e.mode!==t);if(r.length===0)return;let i=o(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),s=o(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),c=r.map(Dn).join(`
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{F as n,I as r,Nn as i,P as a,gn as o,i as s}from"./DocumentContext-DQRTQdaE.js";import{t as c}from"./react-f2sANaYj.js";import{n as l,r as u}from"./dist-Nvb76hAm.js";import{t as d}from"./compiler-runtime-BfE3aGVn.js";import{l as f}from"./terminal-input-events-D7rv6nZZ.js";import{c as p,i as m,n as h,o as g,s as _,t as v}from"./ChangedOutsideBadge-B0Dyi398.js";import{t as y}from"./button-D3xSRfT4.js";import{i as b,n as x,t as S}from"./tooltip-CtvLp_YK.js";import{a as C,c as w,i as T,n as E,o as D,r as O,s as ee,t as te}from"./dialog-C1XaLkpS.js";import{a as k,d as A,f as j,i as M,n as N,o as P,p as F,u as I}from"./dropdown-menu-BvpO8ueR.js";import{t as L}from"./label-CGqMAe0S.js";import{C as R,a as z,f as B,h as V,m as H,n as U,o as W,p as G,r as K,s as q,t as J}from"./agent-visibility-BiwwzWZK.js";import{$t as Y,Dt as ne,Ia as X,Kt as re,Mt as ie,Ra as ae,Sn as oe,Va as se,Zt as ce,_n as le,bn as ue,en as de,fn as fe,hn as pe,jt as me,mn as he,nt as ge,pa as _e,pn as ve,ri as ye,tt as be,xn as xe,xt as Se,yn as Ce,yr as we}from"./dist-lf4nG52q2.js";import{t as Te}from"./createLucideIcon-wbFLvDA-.js";import{t as Ee}from"./RegisteredAgentIcon-CKpJ_hgB.js";import{n as De,r as Oe}from"./ManagedArtifactProperties-DeXNU1el.js";import{n as ke}from"./CopyButton-Dk8yDsPs.js";import{t as Ae}from"./folder-open-DxWbBr3T.js";import{t as je}from"./folder-CyL8AyXY.js";import{t as Me}from"./trash-2-4ZuuBm4P.js";import{n as Z}from"./dist-Dr52ya0i.js";import{t as Ne}from"./input-CdGQDWjM.js";import{t as Pe}from"./dist-D1YpGD7x.js";import{i as Fe}from"./use-settings-route-Cj3iyYQM.js";import{t as Ie}from"./parse-api-error-9c-Rs5WJ.js";import{G as Le,O as Re,W as ze}from"./navigation-targets-CIvGC6UT.js";import{c as Be,n as Ve,o as He}from"./documents-events-Bz6CFw_P.js";import{d as Ue,n as We,r as Ge,s as Ke}from"./skill-scope-C8db1Nmk.js";import{A as qe,D as Je,O as Ye,S as Xe,_ as Ze,c as Qe,f as $e,i as et,n as tt,t as nt,v as rt,x as it,y as at}from"./skills-api-DF632dit.js";import{n as ot}from"./config-context-7il4AXHf.js";import{t as st}from"./use-skills-CjgBfNqJ.js";import{t as ct}from"./use-open-skill-BSfRSbaQ.js";import{t as lt}from"./use-workspace-DX49f8pU.js";import{n as ut}from"./clipboard-adapter-DdkYoUY3.js";import{t as dt}from"./DiffView-ChmPu7VO.js";var ft=Te(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),pt=Te(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),mt=Te(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),ht=Te(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),gt=Te(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Q=t(),$=e(c(),1),_t=d();function vt(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function yt(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Ie(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function bt(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?vt(e):yt()}var xt=`ok:skill:cowork:installed`,St=`1`,Ct=250,wt=`/api/skill/install-state`;function Tt(e){return`${xt}:v${e}`}var Et=new Map;async function Dt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Et.get(n);if(r)return r;let i=Ot(e,t);return Et.set(n,i),i.finally(()=>{Et.get(n)===i&&Et.delete(n)}),i}async function Ot(e,t){let n=e.installer===void 0?bt():e.installer,r=kt(e.storage),i=e.fetchSnapshot??jt,a=e.serverTimeoutMs??Ct,o=null;if(!t.force){try{o=await Mt(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Tt(o?.currentVersion??e.fallbackSkillVersion??At());if(!t.force&&r?.getItem(s)===St)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,St)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function kt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function At(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function jt(){let e;try{e=await fetch(wt,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Mt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Nt(e){return Dt({},e)}function Pt(){return Dt({},{force:!0})}async function Ft(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function It(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Ft({target:`claude-cowork`,url:ce({mode:`cowork`},e)},n);case`claude-code`:return Ft({target:`claude-code`,url:ce({mode:`code`},e)},n);case`codex`:return Ft({target:`codex`,url:Y(e)},n);case`cursor`:return Ft({target:`cursor`,url:de(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Lt(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var Rt=`open-knowledge:agent-thread-launch`;function zt(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(Rt,{detail:e}))}function Bt(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(Rt,n),()=>t.removeEventListener(Rt,n)}function Vt(e){if(!e.docName||!e.workspace)return null;let t=a(e.docName),{contentDir:r,pathSeparator:i}=e.workspace;return{docContext:{relativePath:t},projectDir:r,docPath:n(r,t,i)}}function Ht(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function Ut(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function Wt(e){return G(e.installUrl).then(()=>void 0)}function Gt(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function Kt(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function qt(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:r}=e.workspace;if(e.docName){let i=e.docRelativePath??a(e.docName),o={scope:`doc`,docRelativePath:i,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?o:{...o,selection:e.selection},projectDir:t,docPath:n(t,i,r)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function Jt(e){return`Opened in ${e}.`}function Yt(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function Xt(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function Zt(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function Qt(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function $t(e,t,n,r){return e.compose?re(Qt(e.compose,t,n,r)):e.selection?Ce({...e.selection,target:t,transport:r}):e.skill?ue(e.skill.name,e.skill.scope,n):e.ask?fe(e.ask.relativePath,e.ask.instruction,n,t,r):ye(e.docContext===null?e.folderRelativePath?le(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?he(n,e.instruction,r):ve(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):pe(e.docContext.relativePath,n,e.instruction,r))}function en(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${be} ${$t(e,me[t].handoffTarget,!1,`terminal`)}`:xe(e.docContext?.relativePath??null)}function tn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${ge} ${$t(e,`claude-code`,!1,`terminal`)}`:oe(e.docContext?.relativePath??null)}function nn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function rn(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function an(e,t){zt({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:tn(e),docName:nn(e),titleHint:rn(e)})}async function on(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`OpenKnowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:$t(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=Zt(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(Jt(u));else{let i=Xt(r),a=Yt(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{on(e,t,n,r+1)}}})}return a}function sn(e){return H.find(t=>t.id===e)?.displayName??e}function cn(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function ln(){return{dispatchHandoff:It,recordHandoff:Lt,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>cn(),getDisplayName:sn,ensureCoworkSkillInstalled:Nt,autoOpen:!0}}function un(){let e=(0,_t.c)(2),{merged:t}=ot(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>on(e,t,{...ln(),autoOpen:n}),reinstallCoworkSkill:Pt},e[0]=n,e[1]=r),r}var dn=Object.freeze({hosts:null,source:null}),fn=new Map,pn=new Map;function mn(e,t){return`${e}:${t}`}function hn(e){return fn.get(e)??dn}function gn(e,t){let n=pn.get(e)??new Set;return pn.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&pn.delete(e)}}function _n(e,t){let n=hn(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?fn.delete(e):fn.set(e,r);for(let t of pn.get(e)??[])t()}}var vn=ne.options,yn=`min-w-[24rem]`;function bn(e,t){let n=(0,_t.c)(45),r=t.installingName===e.name,i=(0,$.useRef)(e),[a,o]=(0,$.useState)(!1),s=(0,$.useRef)(!1),c,l;n[0]===r?(c=n[1],l=n[2]):(c=()=>{s.current&&!r&&o(!0),s.current=r},l=[r],n[0]=r,n[1]=c,n[2]=l),(0,$.useEffect)(c,l);let u,d;n[3]===e?(u=n[4],d=n[5]):(u=()=>{e!==i.current&&(i.current=e,o(!1))},d=[e],n[3]=e,n[4]=u,n[5]=d),(0,$.useEffect)(u,d);let f=r||a,p;n[6]!==e.name||n[7]!==e.scope?(p=mn(e.scope,e.name),n[6]=e.name,n[7]=e.scope,n[8]=p):p=n[8];let m=p,h,g;n[9]===m?(h=n[10],g=n[11]):(h=e=>gn(m,e),g=()=>hn(m),n[9]=m,n[10]=h,n[11]=g);let _=(0,$.useSyncExternalStore)(h,g),v=_.hosts,y=_.source,b,x;n[12]!==y||n[13]!==m||n[14]!==e.hosts?(b=()=>{y!==null&&e.hosts[0]===y&&_n(m,{source:null})},x=[e.hosts,y,m],n[12]=y,n[13]=m,n[14]=e.hosts,n[15]=b,n[16]=x):(b=n[15],x=n[16]),(0,$.useEffect)(b,x);let S=e.linkMode===!0,C=v??e.hosts,w;n[17]===C?w=n[18]:(w=new Set(C),n[17]=C,n[18]=w);let T=w,E=v?v.length>0:e.installed,D=(0,$.useRef)(e.hosts),O,ee;n[19]!==v||n[20]!==e.hosts?(O=()=>{v===null&&(D.current=e.hosts)},ee=[v,e.hosts],n[19]=v,n[20]=e.hosts,n[21]=O,n[22]=ee):(O=n[21],ee=n[22]),(0,$.useEffect)(O,ee);let te;n[23]===e.hosts?te=n[24]:(te=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=te);let k=te,A,j;n[25]!==m||n[26]!==k?(A=()=>{let e=hn(m).hosts;e&&[...e].sort().join(`,`)===k&&_n(m,{hosts:null})},j=[k,m],n[25]=m,n[26]=k,n[27]=A,n[28]=j):(A=n[27],j=n[28]),(0,$.useEffect)(A,j);let M=(0,$.useRef)(null),N=(0,$.useRef)(null),P,F;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>()=>{M.current&&clearTimeout(M.current),N.current?.(),N.current=null},F=[],n[29]=P,n[30]=F):(P=n[29],F=n[30]),(0,$.useEffect)(P,F);let I;n[31]!==t||n[32]!==m||n[33]!==e?(I=function(n,r){D.current=n,_n(m,{hosts:n}),M.current&&clearTimeout(M.current);let i=async()=>{N.current=null,M.current=null;let r=await t.install(e,n.filter(we));if(!r.ok){_n(m,{hosts:null});return}D.current=[...r.hosts],_n(m,{hosts:[...r.hosts]})};r?(N.current=()=>void i(),M.current=setTimeout(()=>void i(),350)):(N.current=null,i())},n[31]=t,n[32]=m,n[33]=e,n[34]=I):I=n[34];let L=I,R;return n[35]!==t||n[36]!==L||n[37]!==T||n[38]!==E||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(R={hostSet:T,installed:E,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),L([...n],!0)},installAll(){let t=D.current.filter(Cn),n=e.installableEditors??vn,r=vn.filter(e=>n.includes(e)||D.current.includes(e));L([...t,...r],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>rt({scope:e.scope,name:e.name,dir:n,mode:r})).then(Sn)},unplaceAt(n){t.runLocationWrite(e,()=>Ye({scope:e.scope,name:e.name,path:n})).then(xn)},setSource(n){_n(m,{source:n}),t.runLocationWrite(e,()=>Je({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(_n(m,{source:null}),Z.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=L,n[37]=T,n[38]=E,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=R):R=n[44],R}function xn(e){e.ok||Z.error(e.error)}function Sn(e){e.ok||Z.error(e.error)}function Cn(e){return!vn.includes(e)}function wn(e){let t=(0,_t.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Q.jsx)(b,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Q.jsx)(x,{side:`right`,className:`max-w-xs`,children:n}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(S,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Tn(e){let t=(0,_t.c)(155),{toggles:n,skill:r,onResolveFork:i,onRunStart:a}=e,{_:o}=u(),{hostSet:s,toggleEditor:c,installAll:d}=n,f;t[0]===r?f=t[1]:(f=e=>r?`${Ke(e,r.scope)}/${r.name}`:null,t[0]=r,t[1]=f);let p=f,m=st(),g;t[2]!==m.data||t[3]!==m.status||t[4]!==r?(g=r!==void 0&&((r.hosts??[]).includes(`agents`)||m.status===`ready`&&m.data.some(Ln)),t[2]=m.data,t[3]=m.status,t[4]=r,t[5]=g):g=t[5];let _=g,b;t[6]!==m.data||t[7]!==m.status||t[8]!==r?(b=r?.hostAliases??(r&&m.status===`ready`?Object.assign({},...m.data.filter(e=>e.scope===r.scope).map(In)):{}),t[6]=m.data,t[7]=m.status,t[8]=r,t[9]=b):b=t[9];let x=b,S;t[10]!==m.data||t[11]!==m.status||t[12]!==r?(S=r?.installableEditors??(r&&m.status===`ready`?m.data.find(e=>e.scope===r.scope)?.installableEditors:void 0),t[10]=m.data,t[11]=m.status,t[12]=r,t[13]=S):S=t[13];let C=S,w,T,E,D,O,ee,te;if(t[14]!==o||t[15]!==x||t[16]!==m.data||t[17]!==m.status||t[18]!==s||t[19]!==_||t[20]!==d||t[21]!==C||t[22]!==i||t[23]!==a||t[24]!==p||t[25]!==r||t[26]!==c||t[27]!==n){let e=C?new Set(C):null,u;t[35]===x?u=t[36]:(u=e=>!(e in x),t[35]=x,t[36]=u);let f=(_?[`agents`,...vn]:vn).filter(u).filter(t=>t===`agents`||e===null||e.has(t)||s.has(t)),g;t[37]===p?g=t[38]:(g=e=>p(e),t[37]=p,t[38]=g);let b=new Set(f.map(g)),S=r?.scope===`global`?`~/`:``,k;t[39]!==S||t[40]!==r?(k=r?.path?.includes(`/`)?`${S}${r.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,t[39]=S,t[40]=r,t[41]=k):k=t[41];let A=k,j=A!==null&&!b.has(A)?A:null,M=j===null?n.sourceHost??r?.hosts?.[0]:void 0,F;t[42]===x?F=t[43]:(F=e=>We(x,e),t[42]=x,t[43]=F);let I=F,L=Fn,R;t[44]!==o||t[45]!==I?(R=e=>{let t=I(e);return t.length===0?!0:window.confirm(o({id:`Uobeu9`,values:{0:t.map(L).join(`, `),rootRel:e}}))},t[44]=o,t[45]=I,t[46]=R):R=t[46];let z=R,B;t[47]!==o||t[48]!==r?(B=(e,t)=>{let n=e.includes(`/`)?e:Ke(e,r?.scope??`project`);return(0,Q.jsx)(wn,{hint:o({id:`0dslv8`,values:{0:L(e),1:L(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":o({id:`G6Lrs_`,values:{0:L(e)}}),onClick:i=>{i.preventDefault(),i.stopPropagation(),window.confirm(o({id:`iiqOKM`,values:{0:L(e),1:r.name,2:L(e),subRoot:n,poolRootRel:t}}))&&at({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?He():Z.error(o({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,Q.jsx)(h,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[47]=o,t[48]=r,t[49]=B):B=t[49];let V=B,H;t[50]===r?.conflictHosts?H=t[51]:(H=r?.conflictHosts??[],t[50]=r?.conflictHosts,t[51]=H);let U;t[52]===H?U=t[53]:(U=new Set(H),t[52]=H,t[53]=U);let W=U,G;t[54]===r?.driftPaths?G=t[55]:(G=r?.driftPaths??[],t[54]=r?.driftPaths,t[55]=G);let K;t[56]===G?K=t[57]:(K=new Set(G),t[56]=G,t[57]=K);let q=K;w=n.installing;let J=Pn,Y;t[58]===r?.symlinkedHosts?Y=t[59]:(Y=r?.symlinkedHosts??[],t[58]=r?.symlinkedHosts,t[59]=Y);let ne;t[60]===Y?ne=t[61]:(ne=new Set(Y),t[60]=Y,t[61]=ne);let X=ne,re=[...[...s].filter(e=>e!==M&&!(e in x)&&!W.has(e)&&!e.includes(`/`)).map(e=>X.has(e)?`link`:`copy`),...(r?.customPlacements??[]).map(Nn)],ie=re.filter(Mn).length;E=re.length===0?n.linkMode?`link`:`copy`:ie*2>=re.length?`link`:`copy`;let ae;t[62]!==x||t[63]!==W||t[64]!==s||t[65]!==X||t[66]!==p||t[67]!==M?(ae=[...s].filter(e=>e!==M&&!(e in x)&&!W.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:p(e)??L(e),mode:X.has(e)?`link`:`copy`})),t[62]=x,t[63]=W,t[64]=s,t[65]=X,t[66]=p,t[67]=M,t[68]=ae):ae=t[68];let oe;t[69]===r?.customPlacements?oe=t[70]:(oe=r?.customPlacements??[],t[69]=r?.customPlacements,t[70]=oe);let se;if(t[71]!==S||t[72]!==ae||t[73]!==oe){let e;t[75]===S?e=t[76]:(e=e=>({target:Ge(e),display:`${S}${e.path}`,mode:e.mode}),t[75]=S,t[76]=e),se=[...ae,...oe.map(e)],t[71]=S,t[72]=ae,t[73]=oe,t[74]=se}else se=t[74];T=se;let ce;t[77]!==o||t[78]!==a||t[79]!==n?(ce=(e,t,r)=>{let i=r===`link`?`copy`:`link`;return(0,Q.jsx)(wn,{hint:o(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 font-normal text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(o(i===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(a?.(),n.convertLocation?.(e,i))},"data-testid":`skill-convert-${e}`,children:r===`link`?(0,Q.jsx)(l,{id:`uUCrBv`}):(0,Q.jsx)(l,{id:`iaPtht`})})})},t[77]=o,t[78]=a,t[79]=n,t[80]=ce):ce=t[80];let le=ce,ue;t[81]===r?.customPlacements?ue=t[82]:(ue=r?.customPlacements??[],t[81]=r?.customPlacements,t[82]=ue);let de=new Map(ue.map(jn)),fe=new Set(de.keys());if(m.status===`ready`&&r){for(let e of m.data)if(e.scope===r.scope)for(let t of e.customPlacements??[]){let e=Ge(t);e!==``&&fe.add(e)}}let pe=r===void 0?[]:[...fe].sort().map(e=>({root:e,display:`${S}${e}/${r.name}`,placed:de.get(e)??null})).filter(e=>!b.has(e.display)&&e.display!==A&&!(e.root in x)),me;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Q.jsx)(l,{id:`npcziF`}),t[83]=me):me=t[83];let he;t[84]===o?he=t[85]:(he=o({id:`6f_UX4`}),t[84]=o,t[85]=he);let ge;t[86]===d?ge=t[87]:(ge=()=>d(),t[86]=d,t[87]=ge);let ve;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(l,{id:`N40H-G`}),t[88]=ve):ve=t[88];let ye;t[89]!==w||t[90]!==ge?(ye=(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:w,onClick:ge,"data-testid":`skill-install-all`,children:ve}),t[89]=w,t[90]=ge,t[91]=ye):ye=t[91],t[92]!==he||t[93]!==ye?(D=(0,Q.jsxs)(P,{className:`flex items-center justify-between gap-2`,children:[me,(0,Q.jsx)(wn,{hint:he,children:ye})]}),t[92]=he,t[93]=ye,t[94]=D):D=t[94],t[95]!==o||t[96]!==V||t[97]!==w||t[98]!==j||t[99]!==I?(O=j===null?null:(0,Q.jsx)(wn,{hint:o({id:`pXB6SL`}),children:(0,Q.jsxs)(N,{disabled:w,checked:!0,onSelect:An,"data-testid":`skill-source-row`,children:[(0,Q.jsx)(je,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:j}),(()=>{let e=J(j).split(`/`).slice(0,-1).join(`/`),t=I(e);return t.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>V(t,e))}):null})(),(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(l,{id:`tiFPjk`})})]})]})}),t[95]=o,t[96]=V,t[97]=w,t[98]=j,t[99]=I,t[100]=O):O=t[100];let be;t[101]!==o||t[102]!==V||t[103]!==w||t[104]!==z||t[105]!==W||t[106]!==le||t[107]!==q||t[108]!==E||t[109]!==s||t[110]!==X||t[111]!==i||t[112]!==p||t[113]!==r?.hosts||t[114]!==M||t[115]!==I||t[116]!==c||t[117]!==n?(be=e=>{let t=p(e),a=e===`agents`?`.agents`:_e[e],u=J(t).split(`/`).slice(0,-1).join(`/`),d=I(u);return(0,Q.jsx)(wn,{hint:W.has(e)?o({id:`8HvJlU`,values:{0:t??a}}):e===M?t?o({id:`ssk6rl`,values:{path:t}}):a:s.has(e)?o(t?{id:`9ieZhu`,values:{path:t}}:{id:`n3T3EE`,values:{label:a}}):o(t?E===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}:{id:`Pp0Vgd`,values:{label:a}}),children:(0,Q.jsxs)(N,{disabled:w,checked:s.has(e),onCheckedChange:t=>{W.has(e)||t===!0&&!z(u)||c(e,t===!0)},onSelect:kn,className:`group`,"data-testid":`skill-install-editor-${e}`,children:[(0,Q.jsx)(h,{host:e,"aria-hidden":!0,className:`size-4`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:t??a}),d.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${e}`,children:d.map(e=>V(e,u))}):null,W.has(e)?(0,Q.jsx)(wn,{hint:o({id:`_O7dJS`}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:t=>{t.preventDefault(),i?.(e)},"data-testid":`skill-fork-chip-${e}`,children:(0,Q.jsx)(l,{id:`jng7Ko`})})}):e===M?(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(l,{id:`tiFPjk`})}):s.has(e)&&r?.hosts?(0,Q.jsxs)(Q.Fragment,{children:[!w&&(X.has(e)?`link`:`copy`)!==E?le(e,t??a,X.has(e)?`link`:`copy`):null,(0,Q.jsx)(wn,{hint:o({id:`nBgzKO`}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e)},"data-testid":`skill-set-source-${e}`,children:(0,Q.jsx)(l,{id:`VNNRfN`})})})]}):null,!w&&q.has(J(t))?(0,Q.jsx)(wn,{hint:o({id:`iz1LdD`}),children:(0,Q.jsx)(v,{testId:`skill-drift-${e}`})}):null]})]})},e)},t[101]=o,t[102]=V,t[103]=w,t[104]=z,t[105]=W,t[106]=le,t[107]=q,t[108]=E,t[109]=s,t[110]=X,t[111]=i,t[112]=p,t[113]=r?.hosts,t[114]=M,t[115]=I,t[116]=c,t[117]=n,t[118]=be):be=t[118],ee=f.map(be);let xe;t[119]!==o||t[120]!==V||t[121]!==w||t[122]!==z||t[123]!==le||t[124]!==q||t[125]!==E||t[126]!==I||t[127]!==n?(xe=e=>(0,Q.jsx)(wn,{hint:e.placed===null?o(E===`link`?{id:`ybWWR2`,values:{0:e.display}}:{id:`fDjZxw`,values:{0:e.display}}):o({id:`C0cll5`,values:{0:e.display}}),children:(0,Q.jsxs)(N,{disabled:w,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!z(e.root))return;n.placeAt(e.root,E)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:On,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,Q.jsx)(h,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,Q.jsx)(je,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),I(e.root).length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-custom-${e.root}`,children:I(e.root).map(t=>V(t,e.root))}):null,!w&&e.placed!==null&&q.has(e.placed.path)?(0,Q.jsx)(wn,{hint:o({id:`iz1LdD`}),children:(0,Q.jsx)(v,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,Q.jsxs)(Q.Fragment,{children:[!w&&e.placed.mode!==E?le(e.root,e.display,e.placed.mode):null,(0,Q.jsx)(wn,{hint:o({id:`nBgzKO`}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e.root)},"data-testid":`skill-set-source-custom-${e.root}`,children:(0,Q.jsx)(l,{id:`VNNRfN`})})})]})]})]})},e.root),t[119]=o,t[120]=V,t[121]=w,t[122]=z,t[123]=le,t[124]=q,t[125]=E,t[126]=I,t[127]=n,t[128]=xe):xe=t[128],te=pe.map(xe),t[14]=o,t[15]=x,t[16]=m.data,t[17]=m.status,t[18]=s,t[19]=_,t[20]=d,t[21]=C,t[22]=i,t[23]=a,t[24]=p,t[25]=r,t[26]=c,t[27]=n,t[28]=w,t[29]=T,t[30]=E,t[31]=D,t[32]=O,t[33]=ee,t[34]=te}else w=t[28],T=t[29],E=t[30],D=t[31],O=t[32],ee=t[33],te=t[34];let A;t[129]!==o||t[130]!==w||t[131]!==T||t[132]!==E||t[133]!==a||t[134]!==n?(A=T.length>0&&n.convertLocations?(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,className:`h-auto whitespace-normal p-0 text-left font-normal text-[11px] text-muted-foreground leading-snug hover:bg-transparent hover:text-foreground`,onClick:e=>{e.preventDefault();let t=E===`link`?`copy`:`link`,r=T.filter(e=>e.mode!==t);if(r.length===0)return;let i=o(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),s=o(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),c=r.map(Dn).join(`
|
|
2
2
|
`);window.confirm(`${i}\n\n${s}\n\n${c}\n\n${o({id:`Cu6GXQ`})}`)&&(a?.(),n.convertLocations?.(r.map(e=>({target:e.target,mode:t}))))},disabled:w,"data-testid":`skill-convert-all`,children:E===`link`?(0,Q.jsx)(l,{id:`rcJmK8`}):(0,Q.jsx)(l,{id:`LBv_TR`})}),(0,Q.jsx)(wn,{hint:o({id:`0J6nhG`}),children:(0,Q.jsx)(y,{variant:`ghost`,size:`sm`,"aria-label":o({id:`qJSo0_`}),className:`size-4 shrink-0 rounded-full border border-border/60 p-0 font-normal text-[9px] text-muted-foreground hover:border-foreground/40 hover:bg-transparent hover:text-foreground`,onClick:En,"data-testid":`skill-convert-all-help`,children:`?`})})]}):null,t[129]=o,t[130]=w,t[131]=T,t[132]=E,t[133]=a,t[134]=n,t[135]=A):A=t[135];let j;t[136]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(I,{}),t[136]=j):j=t[136];let M;t[137]===o?M=t[138]:(M=o({id:`jqe7Yq`}),t[137]=o,t[138]=M);let F;t[139]===r?.scope?F=t[140]:(F=()=>{window.location.hash=r?.scope===`global`?`#settings/user-skills`:`#settings/skills`},t[139]=r?.scope,t[140]=F);let L,R;t[141]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(gt,{"aria-hidden":!0}),R=(0,Q.jsx)(l,{id:`ZBF9fn`}),t[141]=L,t[142]=R):(L=t[141],R=t[142]);let z;t[143]===F?z=t[144]:(z=(0,Q.jsxs)(k,{onSelect:F,children:[L,R]}),t[143]=F,t[144]=z);let B;t[145]!==M||t[146]!==z?(B=(0,Q.jsx)(wn,{hint:M,children:z}),t[145]=M,t[146]=z,t[147]=B):B=t[147];let V;return t[148]!==B||t[149]!==D||t[150]!==O||t[151]!==ee||t[152]!==te||t[153]!==A?(V=(0,Q.jsxs)(Q.Fragment,{children:[D,O,ee,te,A,j,B]}),t[148]=B,t[149]=D,t[150]=O,t[151]=ee,t[152]=te,t[153]=A,t[154]=V):V=t[154],V}function En(e){return e.preventDefault()}function Dn(e){return e.display}function On(e){return e.preventDefault()}function kn(e){return e.preventDefault()}function An(e){return e.preventDefault()}function jn(e){return[Ge(e),e]}function Mn(e){return e===`link`}function Nn(e){return e.mode}function Pn(e){return(e??``).replace(/^~\//,``)}function Fn(e){return e===`agents`?`.agents`:_e[e]??e}function In(e){return e.hostAliases??{}}function Ln(e){return e.hosts.includes(`agents`)||e.path.startsWith(`.agents/`)}function Rn(e){let t=(0,_t.c)(10),{onAddProperty:n,className:r}=e,{_:i}=u(),a;t[0]===i?a=t[1]:(a=i({id:`81H_23`}),t[0]=i,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(b,{children:(0,Q.jsx)(mt,{})}),t[2]=o):o=t[2];let s;t[3]!==r||t[4]!==n||t[5]!==a?(s=(0,Q.jsx)(y,{variant:`ghost`,size:`icon`,"aria-label":a,onClick:n,"data-testid":`add-properties-button`,className:r,asChild:!0,children:o}),t[3]=r,t[4]=n,t[5]=a,t[6]=s):s=t[6];let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(x,{side:`bottom`,children:(0,Q.jsx)(l,{id:`81H_23`})}),t[7]=c):c=t[7];let d;return t[8]===s?d=t[9]:(d=(0,Q.jsxs)(S,{children:[s,c]}),t[8]=s,t[9]=d),d}function zn(e){return e?Pe._({id:`wTcjov`}):null}function Bn(e){let t=(0,_t.c)(47),{_:n}=u(),i=r(),a=g(),s=R(),c=B();if(i)return null;let{input:d,installStates:p,dispatch:m,onBeforeLaunch:h}=e,_=d===null,v,y,b,x,S,C,w,T,E,D,O;if(t[0]!==n||t[1]!==m||t[2]!==d||t[3]!==_||t[4]!==p||t[5]!==h||t[6]!==c||t[7]!==s||t[8]!==a){let e=zn(_),r;t[20]===c?r=t[21]:(r=e=>J(c,e.id),t[20]=c,t[21]=r);let i=V.filter(r),u;t[22]===c?u=t[23]:(u=e=>U(c,e.source,e.id,!0,e.supported),t[22]=c,t[23]=u);let f=s.filter(u),g=a?ie.filter(e=>K(c,e,a.installedClis)):[];b=i.length>0,x=a!==null&&g.length>0,S=f.length>0,y=A,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsxs)(F,{children:[(0,Q.jsx)(o,{"aria-hidden":`true`}),(0,Q.jsx)(l,{id:`O7_W_a`})]}),t[24]=O):O=t[24],v=j,C=`max-h-80`,w=S?(0,Q.jsxs)(M,{"aria-label":n({id:`vPKX2i`}),children:[(0,Q.jsxs)(P,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(l,{id:`RXEbZy`}),(0,Q.jsx)(q,{})]}),f.map(t=>{let r=t.name;return(0,Q.jsxs)(k,{onSelect:()=>{d!==null&&(h?.(),an(d,{agent:{source:t.source,id:t.id}}))},disabled:_,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":e?n({id:`gtGQ9S`,values:{agentName:r,hint:e}}):void 0,children:[(0,Q.jsx)(Ee,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(l,{id:`5PrrYw`,values:{agentName:r}})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==b||t[26]!==x||t[27]!==S?(T=S&&(x||b)?(0,Q.jsx)(I,{}):null,t[25]=b,t[26]=x,t[27]=S,t[28]=T):T=t[28],E=x?(0,Q.jsxs)(M,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(P,{children:(0,Q.jsx)(l,{id:`ALhMYW`})}),g.map(t=>{let{displayName:r}=me[t];return(0,Q.jsxs)(k,{onSelect:()=>{d!==null&&(h?.(),a.launchInTerminal(d,t))},disabled:_,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Q.jsx)(W,{id:z(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,D=b?(0,Q.jsxs)(Q.Fragment,{children:[x?(0,Q.jsx)(I,{}):null,(0,Q.jsxs)(M,{"aria-label":n({id:`BBqGS9`}),children:[(0,Q.jsx)(P,{children:(0,Q.jsx)(l,{id:`BBqGS9`})}),i.map(t=>{let r=!_,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Q.jsxs)(k,{disabled:!r,onSelect:()=>{if(d){if(h?.(),p[t.id]?.installed!==!0){Wt(t);return}m(t.id,d)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(W,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=m,t[2]=d,t[3]=_,t[4]=p,t[5]=h,t[6]=c,t[7]=s,t[8]=a,t[9]=v,t[10]=y,t[11]=b,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D,t[19]=O}else v=t[9],y=t[10],b=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18],O=t[19];let ee;t[29]!==b||t[30]!==x||t[31]!==S?(ee=S||x||b?(0,Q.jsx)(I,{}):null,t[29]=b,t[30]=x,t[31]=S,t[32]=ee):ee=t[32];let te;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(f,{"aria-hidden":`true`}),t[33]=te):te=t[33];let N;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsxs)(k,{onSelect:Fe,"data-testid":`file-tree-open-in-settings`,children:[te,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(l,{id:`jRAGrQ`})})]}),t[34]=N):N=t[34];let L;t[35]!==v||t[36]!==C||t[37]!==w||t[38]!==T||t[39]!==E||t[40]!==D||t[41]!==ee?(L=(0,Q.jsxs)(v,{className:C,children:[w,T,E,D,ee,N]}),t[35]=v,t[36]=C,t[37]=w,t[38]=T,t[39]=E,t[40]=D,t[41]=ee,t[42]=L):L=t[42];let H;return t[43]!==y||t[44]!==O||t[45]!==L?(H=(0,Q.jsxs)(y,{children:[O,L]}),t[43]=y,t[44]=O,t[45]=L,t[46]=H):H=t[46],H}function Vn(e){let t=ae(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=X(e);return n?{scope:`global`,name:n.name,rel:n.rel}:null}function Hn(e,t,n){return e.filter(e=>{let r=Re(e);if(r.kind===`skill-file`)return r.scope===t&&r.name===n;if(r.kind!==`doc`)return!1;let i=Vn(r.docName);return i?.scope===t&&i.name===n})}function Un(e,t){let n=new Map(t.map(e=>[`${e.scope}\u0000${e.name}`,e])),r=[];for(let t of e){let e=Vn(t);if(!e||n.has(`${e.scope}\u0000${e.name}`))continue;let i=e.scope===`project`?`global`:`project`,a=n.get(`${i}\u0000${e.name}`);e.rel===null&&a!==void 0?r.push({kind:`retarget`,fromDocName:t,toDocName:Le(a)}):r.push({kind:`close`,docName:t})}return r}function Wn(){let e=(0,_t.c)(15),{openTabs:t,closeDocument:n}=s(),r=De(),i;e[0]===t?i=e[1]:(i=t.some(Kn),e[0]=t,e[1]=i);let a=i,o;e[2]===a?o=e[3]:(o={enabled:a},e[2]=a,e[3]=o);let c=st(o),l=(0,$.useRef)(null),u;e[4]!==n||e[5]!==t||e[6]!==r||e[7]!==c.data||e[8]!==c.status?(u=()=>{if(c.status!==`ready`)return;let e=c.data,i=`${t.join(``)}\u0002${e.map(Gn).sort().join(``)}`;if(l.current===i)return;l.current=i;let a=Un(t,e);for(let e of a)e.kind===`retarget`?r(e.fromDocName,e.toDocName):n(e.docName)},e[4]=n,e[5]=t,e[6]=r,e[7]=c.data,e[8]=c.status,e[9]=u):u=e[9];let d;e[10]!==n||e[11]!==t||e[12]!==r||e[13]!==c?(d=[c,t,r,n],e[10]=n,e[11]=t,e[12]=r,e[13]=c,e[14]=d):d=e[14],(0,$.useEffect)(u,d)}function Gn(e){return`${e.scope}\u0000${e.name}`}function Kn(e){return Vn(e)!==null}function qn(e){let t=(0,_t.c)(19),{skill:n,onOpenChange:r,onDeleted:i}=e,{_:a}=u(),{setSkillsSidebar:o,closeTabs:c,openTabs:l}=s(),[d,f]=(0,$.useState)(!1),p;t[0]!==a||t[1]!==c||t[2]!==i||t[3]!==r||t[4]!==l||t[5]!==o?(p=async function(e){o(!0),f(!0);let t=await tt(e.scope,e.name);if(f(!1),!t.ok){let{error:e}=t;Z.error(a({id:`AtBdnD`,values:{error:e}}));return}Z.success(a({id:`h9QFb9`,values:{0:e.name}})),c(Hn(l,e.scope,e.name),{force:!0}),i(),r(!1)},t[0]=a,t[1]=c,t[2]=i,t[3]=r,t[4]=l,t[5]=o,t[6]=p):p=t[6];let h=p,g=n!==null,_;t[7]!==d||t[8]!==r?(_=e=>{!e&&!d&&r(!1)},t[7]=d,t[8]=r,t[9]=_):_=t[9];let v;t[10]!==a||t[11]!==d||t[12]!==h||t[13]!==n?(v=n?(0,Q.jsx)(m,{itemName:a({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:d,onDelete:()=>h(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?a({id:`WnsbUT`,values:{0:n.path}}):a({id:`E1Da_b`,values:{0:n.path}})}):null,t[10]=a,t[11]=d,t[12]=h,t[13]=n,t[14]=v):v=t[14];let y;return t[15]!==g||t[16]!==_||t[17]!==v?(y=(0,Q.jsx)(te,{open:g,onOpenChange:_,children:v}),t[15]=g,t[16]=_,t[17]=v,t[18]=y):y=t[18],y}function Jn(e){let t=e.split(`/`);return t.some(e=>e===``||e===`.`||e===`..`)||t.length===0||t.length===1&&t[0].toLowerCase()===`skill.md`?!1:!/\s/.test(e)}function Yn(e){let t=(0,_t.c)(66),{target:n,onOpenChange:r}=e,{_:i}=u(),{openTarget:a}=s(),o=(0,$.useId)(),[c,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.prefix??`references/`)},t[0]=n,t[1]=m);let h=n?.skill.scope,g=n?.skill.name,_=n?.prefix,v;if(t[2]!==h||t[3]!==g||t[4]!==_?(v=[h,g,_],t[2]=h,t[3]=g,t[4]=_,t[5]=v):v=t[5],(0,$.useEffect)(m,v),!n)return null;let b,x,S,E;t[6]!==c||t[7]!==f?(E=c.trim(),x=E===``||!Jn(E),b=!x&&!f,S=E.includes(`/`)?E.split(`/`).slice(0,-1).join(`/`):null,t[6]=c,t[7]=f,t[8]=b,t[9]=x,t[10]=S,t[11]=E):(b=t[8],x=t[9],S=t[10],E=t[11]);let O=S,k;t[12]!==i||t[13]!==b||t[14]!==r||t[15]!==a||t[16]!==n||t[17]!==E?(k=async function(){if(!n||!b)return;p(!0);let e=/\.mdx?$/i.test(E),t=await qe({scope:n.skill.scope,name:n.skill.name,path:E,content:e?`# ${E.split(`/`).pop()?.replace(/\.mdx?$/i,``)??``}\n`:``});if(p(!1),!t.ok){Z.error(i({id:`a_2_uB`,values:{0:t.error,trimmed:E}}));return}if(Z.success(i({id:`MXSt4t`,values:{0:t.path}})),e){let e=ze(n.skill,E);a({kind:`doc`,target:e,docName:e})}r(!1)},t[12]=i,t[13]=b,t[14]=r,t[15]=a,t[16]=n,t[17]=E,t[18]=k):k=t[18];let A=k,j;t[19]!==r||t[20]!==f?(j=e=>{!e&&!f&&r(!1)},t[19]=r,t[20]=f,t[21]=j):j=t[21];let M;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(w,{children:(0,Q.jsx)(l,{id:`wQvvZY`})}),t[22]=M):M=t[22];let N;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsxs)(ee,{children:[M,(0,Q.jsx)(C,{children:(0,Q.jsx)(l,{id:`lM4c-I`})})]}),t[23]=N):N=t[23];let P;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(l,{id:`I6gXOa`}),t[24]=P):P=t[24];let F;t[25]===o?F=t[26]:(F=(0,Q.jsx)(L,{htmlFor:o,children:P}),t[25]=o,t[26]=F);let I;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>d(e.target.value),t[27]=I):I=t[27];let R=x&&E!==``,z;t[28]===A?z=t[29]:(z=e=>{e.key===`Enter`&&A()},t[28]=A,t[29]=z);let B;t[30]!==o||t[31]!==c||t[32]!==R||t[33]!==z?(B=(0,Q.jsx)(Ne,{id:o,value:c,onChange:I,placeholder:`references/notes.md`,"aria-invalid":R,onKeyDown:z}),t[30]=o,t[31]=c,t[32]=R,t[33]=z,t[34]=B):B=t[34];let V;t[35]!==O||t[36]!==x||t[37]!==E?(V=x&&E!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(l,{id:`fVzizW`})}):O?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(l,{id:`9lso1Y`,values:{folderPart:O},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):null,t[35]=O,t[36]=x,t[37]=E,t[38]=V):V=t[38];let H;t[39]!==F||t[40]!==B||t[41]!==V?(H=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[F,B,V]}),t[39]=F,t[40]=B,t[41]=V,t[42]=H):H=t[42];let U;t[43]===r?U=t[44]:(U=()=>r(!1),t[43]=r,t[44]=U);let W;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(l,{id:`dEgA5A`}),t[45]=W):W=t[45];let G;t[46]!==f||t[47]!==U?(G=(0,Q.jsx)(y,{variant:`outline`,onClick:U,disabled:f,children:W}),t[46]=f,t[47]=U,t[48]=G):G=t[48];let K;t[49]===A?K=t[50]:(K=()=>void A(),t[49]=A,t[50]=K);let q=!b,J;t[51]===f?J=t[52]:(J=f?(0,Q.jsx)(l,{id:`E9bKSA`}):(0,Q.jsx)(l,{id:`hYgDIe`}),t[51]=f,t[52]=J);let Y;t[53]!==K||t[54]!==q||t[55]!==J?(Y=(0,Q.jsx)(y,{onClick:K,disabled:q,children:J}),t[53]=K,t[54]=q,t[55]=J,t[56]=Y):Y=t[56];let ne;t[57]!==G||t[58]!==Y?(ne=(0,Q.jsxs)(D,{children:[G,Y]}),t[57]=G,t[58]=Y,t[59]=ne):ne=t[59];let X;t[60]!==H||t[61]!==ne?(X=(0,Q.jsxs)(T,{className:`sm:max-w-md`,children:[N,H,ne]}),t[60]=H,t[61]=ne,t[62]=X):X=t[62];let re;return t[63]!==X||t[64]!==j?(re=(0,Q.jsx)(te,{open:!0,onOpenChange:j,children:X}),t[63]=X,t[64]=j,t[65]=re):re=t[65],re}function Xn(e){let t=(0,_t.c)(64),{target:n,onOpenChange:r}=e,{_:i}=u(),a=De(),o=(0,$.useId)(),[s,c]=(0,$.useState)(``),[d,f]=(0,$.useState)(!1),p;t[0]===n?p=t[1]:(p=()=>{n&&c(n.filePath)},t[0]=n,t[1]=p);let m=n?.skill.scope,h=n?.skill.name,g=n?.filePath,_;if(t[2]!==m||t[3]!==h||t[4]!==g?(_=[m,h,g],t[2]=m,t[3]=h,t[4]=g,t[5]=_):_=t[5],(0,$.useEffect)(p,_),!n)return null;let v,b,x;t[6]!==s||t[7]!==n.filePath?(b=s.trim(),x=b===n.filePath,v=b===``||!Jn(b),t[6]=s,t[7]=n.filePath,t[8]=v,t[9]=b,t[10]=x):(v=t[8],b=t[9],x=t[10]);let S=v,E=!S&&!x&&!d,O;t[11]!==i||t[12]!==E||t[13]!==r||t[14]!==a||t[15]!==n||t[16]!==b?(O=async function(){if(!n||!E)return;f(!0);let e=await it({scope:n.skill.scope,name:n.skill.name,from:n.filePath,to:b});if(f(!1),!e.ok){Z.error(i({id:`11ukmX`,values:{0:e.error}}));return}e.fromDocName!==void 0&&e.toDocName!==void 0&&a(e.fromDocName,e.toDocName),Z.success(i({id:`XszXjc`,values:{0:e.to}})),r(!1)},t[11]=i,t[12]=E,t[13]=r,t[14]=a,t[15]=n,t[16]=b,t[17]=O):O=t[17];let k=O,A;t[18]!==r||t[19]!==d?(A=e=>{!e&&!d&&r(!1)},t[18]=r,t[19]=d,t[20]=A):A=t[20];let j;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(w,{children:(0,Q.jsx)(l,{id:`yckias`})}),t[21]=j):j=t[21];let M;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsxs)(ee,{children:[j,(0,Q.jsx)(C,{children:(0,Q.jsx)(l,{id:`HzVAoz`})})]}),t[22]=M):M=t[22];let N;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(l,{id:`I6gXOa`}),t[23]=N):N=t[23];let P;t[24]===o?P=t[25]:(P=(0,Q.jsx)(L,{htmlFor:o,children:N}),t[24]=o,t[25]=P);let F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>c(e.target.value),t[26]=F):F=t[26];let I=S&&b!==``,R;t[27]===k?R=t[28]:(R=e=>{e.key===`Enter`&&k()},t[27]=k,t[28]=R);let z;t[29]!==o||t[30]!==s||t[31]!==I||t[32]!==R?(z=(0,Q.jsx)(Ne,{id:o,value:s,onChange:F,"aria-invalid":I,onKeyDown:R}),t[29]=o,t[30]=s,t[31]=I,t[32]=R,t[33]=z):z=t[33];let B;t[34]!==S||t[35]!==b?(B=S&&b!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(l,{id:`fVzizW`})}):null,t[34]=S,t[35]=b,t[36]=B):B=t[36];let V;t[37]!==P||t[38]!==z||t[39]!==B?(V=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[P,z,B]}),t[37]=P,t[38]=z,t[39]=B,t[40]=V):V=t[40];let H;t[41]===r?H=t[42]:(H=()=>r(!1),t[41]=r,t[42]=H);let U;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(l,{id:`dEgA5A`}),t[43]=U):U=t[43];let W;t[44]!==d||t[45]!==H?(W=(0,Q.jsx)(y,{variant:`outline`,onClick:H,disabled:d,children:U}),t[44]=d,t[45]=H,t[46]=W):W=t[46];let G;t[47]===k?G=t[48]:(G=()=>void k(),t[47]=k,t[48]=G);let K=!E,q;t[49]===d?q=t[50]:(q=d?(0,Q.jsx)(l,{id:`tHKQ6j`}):(0,Q.jsx)(l,{id:`2wxgft`}),t[49]=d,t[50]=q);let J;t[51]!==G||t[52]!==K||t[53]!==q?(J=(0,Q.jsx)(y,{onClick:G,disabled:K,children:q}),t[51]=G,t[52]=K,t[53]=q,t[54]=J):J=t[54];let Y;t[55]!==W||t[56]!==J?(Y=(0,Q.jsxs)(D,{children:[W,J]}),t[55]=W,t[56]=J,t[57]=Y):Y=t[57];let ne;t[58]!==V||t[59]!==Y?(ne=(0,Q.jsxs)(T,{className:`sm:max-w-md`,children:[M,V,Y]}),t[58]=V,t[59]=Y,t[60]=ne):ne=t[60];let X;return t[61]!==ne||t[62]!==A?(X=(0,Q.jsx)(te,{open:!0,onOpenChange:A,children:ne}),t[61]=ne,t[62]=A,t[63]=X):X=t[63],X}function Zn(e){let t=(0,_t.c)(59),{target:n,onOpenChange:r}=e,{_:i}=u(),a=(0,$.useId)(),[o,s]=(0,$.useState)(null),[c,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(``),[v,b]=(0,$.useState)(!1),x;t[0]===n?x=t[1]:(x=()=>{if(s(null),d(null),p(!1),h(!1),!n)return;let{skill:e,editor:t}=n,r=e.absolutePath?.slice(0,-`/${e.path}`.length)??null;if(r===null){p(!0);return}let i=`${r}/${e.path.replace(/\/SKILL\.mdx?$/i,``)}`,a=`${r}/${Ke(t,e.scope)}/${e.name}`,o=new AbortController;for(let[t,n]of[[i,d],[a,s]])Qe({source:t,name:e.name},o.signal).then(e=>{o.signal.aborted||(e.ok?n(e.skillMd):p(!0))}).catch(()=>{o.signal.aborted||p(!0)});return()=>o.abort()},t[0]=n,t[1]=x);let S=n?.skill.scope,O=n?.skill.name,k=n?.editor,A;if(t[2]!==S||t[3]!==O||t[4]!==k?(A=[S,O,k],t[2]=S,t[3]=O,t[4]=k,t[5]=A):A=t[5],(0,$.useEffect)(x,A),!n)return null;let{skill:j,editor:M}=n,N;t[6]!==i||t[7]!==M||t[8]!==r||t[9]!==j.name||t[10]!==j.scope||t[11]!==n||t[12]!==g?(N=async function(e){if(!n)return;b(!0);let t=await Xe({scope:j.scope,name:j.name,editor:M,action:e,...e===`rename`?{toName:g.trim()}:{}});if(b(!1),!t.ok){Z.error(i({id:`MIF36T`,values:{0:t.error}}));return}Z.success(i(e===`align`?{id:`QKgePK`,values:{editor:M}}:e===`make-source`?{id:`It9oAP`,values:{editor:M}}:{id:`b2ezG_`,values:{0:g.trim()}})),r(!1)},t[6]=i,t[7]=M,t[8]=r,t[9]=j.name,t[10]=j.scope,t[11]=n,t[12]=g,t[13]=N):N=t[13];let P=N,F,I;t[14]!==j.name||t[15]!==g?(I=g.trim(),F=I===``||!Se.test(I)||I===j.name,t[14]=j.name,t[15]=g,t[16]=F,t[17]=I):(F=t[16],I=t[17]);let R=F,z;t[18]!==v||t[19]!==r?(z=e=>{!e&&!v&&r(!1)},t[18]=v,t[19]=r,t[20]=z):z=t[20];let B;t[21]!==M||t[22]!==j.name?(B=(0,Q.jsx)(w,{children:(0,Q.jsx)(l,{id:`q8aCbb`,values:{0:j.name,editor:M}})}),t[21]=M,t[22]=j.name,t[23]=B):B=t[23];let V;t[24]===M?V=t[25]:(V=(0,Q.jsx)(C,{children:(0,Q.jsx)(l,{id:`QASTNu`,values:{editor:M}})}),t[24]=M,t[25]=V);let H;t[26]!==V||t[27]!==B?(H=(0,Q.jsxs)(ee,{children:[B,V]}),t[26]=V,t[27]=B,t[28]=H):H=t[28];let U;t[29]!==c||t[30]!==o||t[31]!==f?(U=c!==null&&o!==null?(0,Q.jsx)(dt,{oldContent:c,newContent:o,layout:`unified`}):f?(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center px-6 text-center text-muted-foreground text-sm`,children:(0,Q.jsx)(l,{id:`5BlXTD`})}):(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center text-muted-foreground text-sm`,children:(0,Q.jsx)(l,{id:`1V17kO`})}),t[29]=c,t[30]=o,t[31]=f,t[32]=U):U=t[32];let W;t[33]!==P||t[34]!==M||t[35]!==a||t[36]!==R||t[37]!==m||t[38]!==j.name||t[39]!==g||t[40]!==I?(W=m?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,Q.jsx)(L,{htmlFor:a,children:(0,Q.jsx)(l,{id:`pSimwP`,values:{editor:M}})}),(0,Q.jsx)(Ne,{id:a,value:g,onChange:e=>_(e.target.value),placeholder:`${j.name}-${M}`,"aria-invalid":R&&I!==``,onKeyDown:e=>{e.key===`Enter`&&!R&&P(`rename`)}})]}):null,t[33]=P,t[34]=M,t[35]=a,t[36]=R,t[37]=m,t[38]=j.name,t[39]=g,t[40]=I,t[41]=W):W=t[41];let G;t[42]!==U||t[43]!==W?(G=(0,Q.jsxs)(E,{className:`min-h-0 flex-1 overflow-auto`,children:[U,W]}),t[42]=U,t[43]=W,t[44]=G):G=t[44];let K;t[45]!==P||t[46]!==v||t[47]!==M||t[48]!==R||t[49]!==m||t[50]!==j.name?(K=(0,Q.jsx)(D,{children:m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{variant:`outline`,onClick:()=>h(!1),disabled:v,children:(0,Q.jsx)(l,{id:`iH8pgl`})}),(0,Q.jsx)(y,{onClick:()=>void P(`rename`),disabled:v||R,children:(0,Q.jsx)(l,{id:`AT0e50`})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{variant:`outline`,onClick:()=>{_(`${j.name}-${M}`),h(!0)},disabled:v,children:(0,Q.jsx)(l,{id:`AT0e50`})}),(0,Q.jsx)(y,{variant:`outline`,onClick:()=>void P(`make-source`),disabled:v,children:(0,Q.jsx)(l,{id:`xWomUD`,values:{editor:M}})}),(0,Q.jsx)(y,{onClick:()=>void P(`align`),disabled:v,children:(0,Q.jsx)(l,{id:`PZn2LP`})})]})}),t[45]=P,t[46]=v,t[47]=M,t[48]=R,t[49]=m,t[50]=j.name,t[51]=K):K=t[51];let q;t[52]!==H||t[53]!==G||t[54]!==K?(q=(0,Q.jsxs)(T,{className:`flex max-h-[85vh] w-full max-w-3xl flex-col`,children:[H,G,K]}),t[52]=H,t[53]=G,t[54]=K,t[55]=q):q=t[55];let J;return t[56]!==q||t[57]!==z?(J=(0,Q.jsx)(te,{open:!0,onOpenChange:z,children:q}),t[56]=q,t[57]=z,t[58]=J):J=t[58],J}function Qn(e){let t=(0,_t.c)(75),{skill:n,existingNames:r,onOpenChange:i,onRenamed:a}=e,o=Oe(),s=n!==null,c=(0,$.useId)(),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.name)},t[0]=n,t[1]=m);let h=n?.scope,g=n?.name,_;if(t[2]!==h||t[3]!==g?(_=[h,g],t[2]=h,t[3]=g,t[4]=_):_=t[4],(0,$.useEffect)(m,_),!n)return null;let v,b,x,S,E,O;if(t[5]!==r||t[6]!==u||t[7]!==n.name){E=u.trim(),O=E===n.name;let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\s/,t[14]=e):e=t[14];let i;t[15]===u?i=t[16]:(i=e.test(u),t[15]=u,t[16]=i),v=i,S=E.length>64,b=E===``||!Se.test(E)||S,x=!b&&!O&&r.has(E),t[5]=r,t[6]=u,t[7]=n.name,t[8]=v,t[9]=b,t[10]=x,t[11]=S,t[12]=E,t[13]=O}else v=t[8],b=t[9],x=t[10],S=t[11],E=t[12],O=t[13];let k=x,A=!b&&!k&&!O&&!f,j;t[17]!==A||t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==n||t[22]!==E?(j=async function(){if(!n||!A)return;p(!0);let e=await o({scope:n.scope,name:n.name},E);p(!1),e.ok&&(a?.(E),i(!1))},t[17]=A,t[18]=i,t[19]=a,t[20]=o,t[21]=n,t[22]=E,t[23]=j):j=t[23];let M=j,N;t[24]===i?N=t[25]:(N=e=>e?null:i(!1),t[24]=i,t[25]=N);let P;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(w,{children:(0,Q.jsx)(l,{id:`dw_3cv`})}),t[26]=P):P=t[26];let F;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsxs)(ee,{children:[P,(0,Q.jsx)(C,{children:(0,Q.jsx)(l,{id:`R9IDFz`})})]}),t[27]=F):F=t[27];let I;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(l,{id:`6YtxFj`}),t[28]=I):I=t[28];let R;t[29]===c?R=t[30]:(R=(0,Q.jsx)(L,{htmlFor:c,children:I}),t[29]=c,t[30]=R);let z;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>d(e.target.value),t[31]=z):z=t[31];let B;t[32]===M?B=t[33]:(B=e=>{e.key===`Enter`&&M()},t[32]=M,t[33]=B);let V=b||k,H=b&&E!==``||k?`${c}-error`:void 0,U;t[34]!==c||t[35]!==u||t[36]!==B||t[37]!==V||t[38]!==H?(U=(0,Q.jsx)(Ne,{id:c,value:u,onChange:z,onKeyDown:B,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:64,"aria-invalid":V,"aria-describedby":H,className:`font-mono`}),t[34]=c,t[35]=u,t[36]=B,t[37]=V,t[38]=H,t[39]=U):U=t[39];let W;t[40]!==k||t[41]!==v||t[42]!==c||t[43]!==b||t[44]!==S||t[45]!==E?(W=b&&E!==``?(0,Q.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:v?(0,Q.jsx)(l,{id:`iUwpZI`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}}):S?(0,Q.jsx)(l,{id:`lK9c4T`}):(0,Q.jsx)(l,{id:`A50vr3`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):k?(0,Q.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:(0,Q.jsx)(l,{id:`YJ1BTp`})}):null,t[40]=k,t[41]=v,t[42]=c,t[43]=b,t[44]=S,t[45]=E,t[46]=W):W=t[46];let G;t[47]!==R||t[48]!==U||t[49]!==W?(G=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[R,U,W]}),t[47]=R,t[48]=U,t[49]=W,t[50]=G):G=t[50];let K;t[51]===i?K=t[52]:(K=()=>i(!1),t[51]=i,t[52]=K);let q;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Q.jsx)(l,{id:`dEgA5A`}),t[53]=q):q=t[53];let J;t[54]!==f||t[55]!==K?(J=(0,Q.jsx)(y,{variant:`outline`,className:`font-mono uppercase`,onClick:K,disabled:f,children:q}),t[54]=f,t[55]=K,t[56]=J):J=t[56];let Y;t[57]===M?Y=t[58]:(Y=()=>void M(),t[57]=M,t[58]=Y);let ne=!A,X;t[59]===f?X=t[60]:(X=f?(0,Q.jsx)(l,{id:`tHKQ6j`}):(0,Q.jsx)(l,{id:`2wxgft`}),t[59]=f,t[60]=X);let re;t[61]!==Y||t[62]!==ne||t[63]!==X?(re=(0,Q.jsx)(y,{onClick:Y,disabled:ne,children:X}),t[61]=Y,t[62]=ne,t[63]=X,t[64]=re):re=t[64];let ie;t[65]!==J||t[66]!==re?(ie=(0,Q.jsxs)(D,{children:[J,re]}),t[65]=J,t[66]=re,t[67]=ie):ie=t[67];let ae;t[68]!==G||t[69]!==ie?(ae=(0,Q.jsxs)(T,{children:[F,G,ie]}),t[68]=G,t[69]=ie,t[70]=ae):ae=t[70];let oe;return t[71]!==s||t[72]!==ae||t[73]!==N?(oe=(0,Q.jsx)(te,{open:s,onOpenChange:N,children:ae}),t[71]=s,t[72]=ae,t[73]=N,t[74]=oe):oe=t[74],oe}function $n(){let e=(0,_t.c)(5),{_:t}=u(),n=Ue(),r=De(),i=st(),a;return e[0]!==t||e[1]!==r||e[2]!==n||e[3]!==i?(a=async(e,a)=>{if(a===e.scope)return!1;Ve(e.scope,e.name);let o=await Ze({name:e.name,fromScope:e.scope,toScope:a});if(Be(e.scope,e.name),!o.ok)return Z.error(t({id:`07eGJB`,values:{0:o.error}})),!1;Z.success(t({id:`yhI6P0`,values:{0:e.name,1:n[a]}}));let s=i.status===`ready`?i.data.find(t=>t.scope===e.scope&&t.name===e.name):void 0;return r(s?Le(s):se(e.scope,e.name),a===`project`&&o.path!==void 0?`${o.path.replace(/\/+$/,``)}/SKILL`:se(a,e.name)),!0},e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function er(e){let t=(0,_t.c)(38),{target:n,onOpenChange:r}=e,i=Ue(),a=$n(),[o,s]=(0,$.useState)(!1);if(!n)return null;let{scope:c,name:u,toScope:d}=n,f;t[0]!==o||t[1]!==r?(f=e=>!e&&!o&&r(!1),t[0]=o,t[1]=r,t[2]=f):f=t[2];let p=i[d],m;t[3]===p?m=t[4]:(m=(0,Q.jsx)(w,{children:(0,Q.jsx)(l,{id:`SXEdCq`,values:{0:p}})}),t[3]=p,t[4]=m);let h=i[c],g=i[d],_=i[d],v;t[5]!==u||t[6]!==h||t[7]!==g||t[8]!==_?(v={0:h,1:g,2:_,name:u},t[5]=u,t[6]=h,t[7]=g,t[8]=_,t[9]=v):v=t[9];let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b={0:(0,Q.jsx)(`code`,{className:`font-mono`})},t[10]=b):b=t[10];let x;t[11]===v?x=t[12]:(x=(0,Q.jsx)(C,{children:(0,Q.jsx)(l,{id:`7bIiJ7`,values:v,components:b})}),t[11]=v,t[12]=x);let S;t[13]!==m||t[14]!==x?(S=(0,Q.jsxs)(ee,{children:[m,x]}),t[13]=m,t[14]=x,t[15]=S):S=t[15];let E;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(l,{id:`dEgA5A`}),t[16]=E):E=t[16];let k;t[17]===o?k=t[18]:(k=(0,Q.jsx)(O,{asChild:!0,children:(0,Q.jsx)(y,{variant:`outline`,disabled:o,children:E})}),t[17]=o,t[18]=k);let A;t[19]!==a||t[20]!==u||t[21]!==r||t[22]!==c||t[23]!==d?(A=async()=>{s(!0),await a({scope:c,name:u},d),s(!1),r(!1)},t[19]=a,t[20]=u,t[21]=r,t[22]=c,t[23]=d,t[24]=A):A=t[24];let j;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(l,{id:`QWdKwH`}),t[25]=j):j=t[25];let M;t[26]!==o||t[27]!==A?(M=(0,Q.jsx)(y,{"data-testid":`skill-scope-move-confirm`,disabled:o,onClick:A,children:j}),t[26]=o,t[27]=A,t[28]=M):M=t[28];let N;t[29]!==k||t[30]!==M?(N=(0,Q.jsxs)(D,{children:[k,M]}),t[29]=k,t[30]=M,t[31]=N):N=t[31];let P;t[32]!==S||t[33]!==N?(P=(0,Q.jsxs)(T,{className:`sm:max-w-md`,children:[S,N]}),t[32]=S,t[33]=N,t[34]=P):P=t[34];let F;return t[35]!==f||t[36]!==P?(F=(0,Q.jsx)(te,{open:!0,onOpenChange:f,children:P}),t[35]=f,t[36]=P,t[37]=F):F=t[37],F}function tr(){let e=(0,_t.c)(45),{_:t}=u(),n=ct(),[r,i]=(0,$.useState)(null),[a,o]=(0,$.useState)(null),[s,c]=(0,$.useState)(null),[l,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(null),[g,_]=(0,$.useState)(null),v;e[0]===t?v=e[1]:(v=async function(e,n,r){_(e.name);let i=await $e({scope:e.scope,name:e.name,...n?{targets:[...n]}:{},...r?.linkMode===void 0?{}:{linkMode:r.linkMode}});if(_(null),!i.ok)return Z.error(t({id:`Mj8R8K`,values:{0:i.error}})),i;let a=nr,o=new Set(i.hosts),s=i.hosts.filter(t=>!e.hosts.includes(t)),c=e.hosts.filter(e=>!o.has(e)),l=e=>{let t=i.warningCodes.indexOf(e);return t>=0?i.warnings[t]:void 0},u=l(`no-targets`);if(u)return Z.warning(u),i;if(s.length>0){let e=l(`scripts-present`);e&&Z.warning(e);let t=l(`no-description`);t&&Z.warning(t)}return i.hosts.length===0?Z.success(t({id:`4pDZ2N`,values:{0:e.name}})):s.length>0&&c.length===0?Z.success(t({id:`PPFQ3o`,values:{0:e.name,1:a(s)}})):c.length>0&&s.length===0?Z.success(t({id:`OOIVJo`,values:{0:e.name,1:a(c)}})):s.length>0&&c.length>0?Z.success(t({id:`OxplNM`,values:{0:e.name,1:a(s),2:a(c)}})):Z.success(t({id:`wDgmsr`,values:{0:e.name,1:a(i.hosts)}})),i},e[0]=t,e[1]=v);let y=v,b;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=async function(e,t){if(t.length!==0){_(e.name);for(let{target:n,mode:r}of t){let t=await nt({scope:e.scope,name:e.name,target:n,mode:r});if(!t.ok){Z.error(t.error);break}}_(null)}},e[2]=b):b=e[2];let x=b,S;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(S=async function(e,t){_(e.name);let n=await t();return _(null),n},e[3]=S):S=e[3];let C=S,w;e[4]!==t||e[5]!==n?(w=async function(e,r){let i=await et({scope:e.scope,name:e.name,existingNames:r});if(!i.ok){Z.error(t({id:`UPjaXD`,values:{0:e.name,1:i.error}}));return}Z.success(t({id:`0g7rCZ`,values:{0:i.name}})),n(e.scope,i.name)},e[4]=t,e[5]=n,e[6]=w):w=e[6];let T=w,E,D;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||i(null)},D=()=>i(null),e[7]=E,e[8]=D):(E=e[7],D=e[8]);let O;e[9]===r?O=e[10]:(O=(0,Q.jsx)(qn,{skill:r,onOpenChange:E,onDeleted:D}),e[9]=r,e[10]=O);let ee=a?.skill??null,te=a?.existingNames??ir,k,A;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||o(null)},k=()=>o(null),e[11]=k,e[12]=A):(k=e[11],A=e[12]);let j;e[13]!==ee||e[14]!==te?(j=(0,Q.jsx)(Qn,{skill:ee,existingNames:te,onOpenChange:A,onRenamed:k}),e[13]=ee,e[14]=te,e[15]=j):j=e[15];let M;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{e||c(null)},e[16]=M):M=e[16];let N;e[17]===s?N=e[18]:(N=(0,Q.jsx)(er,{target:s,onOpenChange:M}),e[17]=s,e[18]=N);let P;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{e||d(null)},e[19]=P):P=e[19];let F;e[20]===l?F=e[21]:(F=(0,Q.jsx)(Xn,{target:l,onOpenChange:P}),e[20]=l,e[21]=F);let I;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>{e||p(null)},e[22]=I):I=e[22];let L;e[23]===f?L=e[24]:(L=(0,Q.jsx)(Yn,{target:f,onOpenChange:I}),e[23]=f,e[24]=L);let R;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{e||h(null)},e[25]=R):R=e[25];let z;e[26]===m?z=e[27]:(z=(0,Q.jsx)(Zn,{target:m,onOpenChange:R}),e[26]=m,e[27]=z);let B;e[28]!==j||e[29]!==N||e[30]!==F||e[31]!==L||e[32]!==z||e[33]!==O?(B=(0,Q.jsxs)(Q.Fragment,{children:[O,j,N,F,L,z]}),e[28]=j,e[29]=N,e[30]=F,e[31]=L,e[32]=z,e[33]=O,e[34]=B):B=e[34];let V=B,H,U,W,G,K;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=(e,t)=>o({skill:e,existingNames:t}),U=(e,t)=>c({scope:e.scope,name:e.name,toScope:t}),W=(e,t)=>d({skill:e,filePath:t}),G=(e,t)=>p(t===void 0?{skill:e}:{skill:e,prefix:t}),K=(e,t)=>h({skill:e,editor:t}),e[35]=H,e[36]=U,e[37]=W,e[38]=G,e[39]=K):(H=e[35],U=e[36],W=e[37],G=e[38],K=e[39]);let q;return e[40]!==V||e[41]!==T||e[42]!==y||e[43]!==g?(q={installingName:g,install:y,convertLocations:x,runLocationWrite:C,duplicate:T,requestDelete:i,requestRename:H,requestScopeMove:U,requestFileRename:W,requestFileCreate:G,requestForkResolve:K,dialogs:V},e[40]=V,e[41]=T,e[42]=y,e[43]=g,e[44]=q):q=e[44],q}function nr(e){return e.map(rr).join(`, `)}function rr(e){return _e[e]??e}var ir=new Set;function ar(e){let t=(0,_t.c)(29),{skill:n,filePath:r,actions:i}=e,{_:a}=u(),o=typeof window<`u`?window.okDesktop:void 0,s=n.absolutePath?`${n.absolutePath}/${r}`:void 0,c=`${n.path}/${r}`,d;t[0]===a?d=t[1]:(d=async function(e){try{await ut(e),Z.success(a({id:`SXCSQd`}))}catch{Z.error(a({id:`cRHuuI`}))}},t[0]=a,t[1]=d);let f=d,p;t[2]!==i||t[3]!==r||t[4]!==n?(p=()=>i.requestFileRename(n,r),t[2]=i,t[3]=r,t[4]=n,t[5]=p):p=t[5];let m,h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(ht,{"aria-hidden":!0}),h=(0,Q.jsx)(l,{id:`2wxgft`}),t[6]=m,t[7]=h):(m=t[6],h=t[7]);let g;t[8]===p?g=t[9]:(g=(0,Q.jsxs)(k,{onSelect:p,children:[m,h]}),t[8]=p,t[9]=g);let _;t[10]===s?_=t[11]:(_=o&&s?(0,Q.jsxs)(k,{onSelect:()=>void o.shell.showItemInFolder(s),children:[(0,Q.jsx)(Ae,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`LtSYdi`})]}):null,t[10]=s,t[11]=_);let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsxs)(F,{children:[(0,Q.jsx)(ke,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`zd00pH`})]}),t[12]=v):v=t[12];let y;t[13]!==s||t[14]!==f?(y=s?(0,Q.jsx)(k,{onSelect:()=>void f(s),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[13]=s,t[14]=f,t[15]=y):y=t[15];let b;t[16]!==f||t[17]!==c?(b=()=>void f(c),t[16]=f,t[17]=c,t[18]=b):b=t[18];let x;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(l,{id:`xloBjn`}),t[19]=x):x=t[19];let S;t[20]===b?S=t[21]:(S=(0,Q.jsx)(k,{onSelect:b,children:x}),t[20]=b,t[21]=S);let C;t[22]!==S||t[23]!==y?(C=(0,Q.jsxs)(A,{children:[v,(0,Q.jsxs)(j,{children:[y,S]})]}),t[22]=S,t[23]=y,t[24]=C):C=t[24];let w;return t[25]!==C||t[26]!==g||t[27]!==_?(w=(0,Q.jsxs)(Q.Fragment,{children:[g,_,C]}),t[25]=C,t[26]=g,t[27]=_,t[28]=w):w=t[28],w}function or(e){let t=(0,_t.c)(86),{skill:n,actions:r,existingNames:a}=e,{_:o}=u(),s=lt(),c=Ue(),d=_().states,{dispatch:f}=un(),m=bn(n,r),h=typeof window<`u`?window.okDesktop:void 0,g=n.absolutePath,v;t[0]===o?v=t[1]:(v=async function(e){try{await ut(e),Z.success(o({id:`SXCSQd`}))}catch{Z.error(o({id:`cRHuuI`}))}},t[0]=o,t[1]=v);let y=v,b;t[2]===g?b=t[3]:(b=h&&g?(0,Q.jsxs)(k,{onSelect:()=>void h.shell.showItemInFolder(g),children:[(0,Q.jsx)(Ae,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`LtSYdi`})]}):null,t[2]=g,t[3]=b);let x;t[4]!==n.name||t[5]!==n.scope||t[6]!==s?(x=Kt({skillName:n.name,scope:n.scope,workspace:s}),t[4]=n.name,t[5]=n.scope,t[6]=s,t[7]=x):x=t[7];let S;t[8]!==f||t[9]!==d||t[10]!==x?(S=(0,Q.jsx)(Bn,{input:x,installStates:d,isElectronHost:h!=null,dispatch:f}),t[8]=f,t[9]=d,t[10]=x,t[11]=S):S=t[11];let C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsxs)(F,{children:[(0,Q.jsx)(ke,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`zd00pH`})]}),t[12]=C):C=t[12];let w;t[13]!==g||t[14]!==y?(w=g?(0,Q.jsx)(k,{onSelect:()=>void y(g),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[13]=g,t[14]=y,t[15]=w):w=t[15];let T;t[16]!==y||t[17]!==n.path?(T=()=>void y(n.path),t[16]=y,t[17]=n.path,t[18]=T):T=t[18];let E;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(l,{id:`xloBjn`}),t[19]=E):E=t[19];let D;t[20]===T?D=t[21]:(D=(0,Q.jsx)(k,{onSelect:T,children:E}),t[20]=T,t[21]=D);let O;t[22]!==w||t[23]!==D?(O=(0,Q.jsxs)(A,{children:[C,(0,Q.jsxs)(j,{children:[w,D]})]}),t[22]=w,t[23]=D,t[24]=O):O=t[24];let ee;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(I,{}),t[25]=ee):ee=t[25];let te;t[26]!==r||t[27]!==a||t[28]!==n?(te=()=>void r.duplicate(n,a),t[26]=r,t[27]=a,t[28]=n,t[29]=te):te=t[29];let M,N;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(i,{"aria-hidden":!0}),N=(0,Q.jsx)(l,{id:`euc6Ns`}),t[30]=M,t[31]=N):(M=t[30],N=t[31]);let P;t[32]===te?P=t[33]:(P=(0,Q.jsxs)(k,{onSelect:te,children:[M,N]}),t[32]=te,t[33]=P);let L;t[34]!==r||t[35]!==a||t[36]!==n?(L=()=>r.requestRename(n,a),t[34]=r,t[35]=a,t[36]=n,t[37]=L):L=t[37];let R,z;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(ht,{"aria-hidden":!0}),z=(0,Q.jsx)(l,{id:`2wxgft`}),t[38]=R,t[39]=z):(R=t[38],z=t[39]);let B;t[40]===L?B=t[41]:(B=(0,Q.jsxs)(k,{onSelect:L,children:[R,z]}),t[40]=L,t[41]=B);let V;t[42]!==r||t[43]!==n?(V=()=>r.requestFileCreate(n),t[42]=r,t[43]=n,t[44]=V):V=t[44];let H,U;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(p,{"aria-hidden":!0}),U=(0,Q.jsx)(l,{id:`HdkSiO`}),t[45]=H,t[46]=U):(H=t[45],U=t[46]);let W;t[47]===V?W=t[48]:(W=(0,Q.jsxs)(k,{onSelect:V,children:[H,U]}),t[47]=V,t[48]=W);let G;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsxs)(F,{children:[(0,Q.jsx)(pt,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`TKQ7K-`})]}),t[49]=G):G=t[49];let K;t[50]!==r||t[51]!==n?(K=e=>r.requestForkResolve(n,e),t[50]=r,t[51]=n,t[52]=K):K=t[52];let q;t[53]!==m||t[54]!==n||t[55]!==K?(q=(0,Q.jsxs)(A,{children:[G,(0,Q.jsx)(j,{className:yn,children:(0,Q.jsx)(Tn,{toggles:m,skill:n,onResolveFork:K})})]}),t[53]=m,t[54]=n,t[55]=K,t[56]=q):q=t[56];let J;t[57]!==r||t[58]!==n?(J=()=>r.requestScopeMove(n,n.scope===`project`?`global`:`project`),t[57]=r,t[58]=n,t[59]=J):J=t[59];let Y;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(ft,{"aria-hidden":!0}),t[60]=Y):Y=t[60];let ne;t[61]!==c.global||t[62]!==c.project||t[63]!==n.scope?(ne=n.scope===`project`?(0,Q.jsx)(l,{id:`bpytj4`,values:{0:c.global}}):(0,Q.jsx)(l,{id:`bpytj4`,values:{0:c.project}}),t[61]=c.global,t[62]=c.project,t[63]=n.scope,t[64]=ne):ne=t[64];let X;t[65]!==J||t[66]!==ne?(X=(0,Q.jsxs)(k,{onSelect:J,children:[Y,ne]}),t[65]=J,t[66]=ne,t[67]=X):X=t[67];let re;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(I,{}),t[68]=re):re=t[68];let ie;t[69]!==r||t[70]!==n?(ie=()=>r.requestDelete(n),t[69]=r,t[70]=n,t[71]=ie):ie=t[71];let ae,oe;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(Me,{"aria-hidden":!0}),oe=(0,Q.jsx)(l,{id:`cnGeoo`}),t[72]=ae,t[73]=oe):(ae=t[72],oe=t[73]);let se;t[74]===ie?se=t[75]:(se=(0,Q.jsxs)(k,{variant:`destructive`,onSelect:ie,children:[ae,oe]}),t[74]=ie,t[75]=se);let ce;return t[76]!==O||t[77]!==P||t[78]!==B||t[79]!==b||t[80]!==W||t[81]!==q||t[82]!==X||t[83]!==se||t[84]!==S?(ce=(0,Q.jsxs)(Q.Fragment,{children:[b,S,O,ee,P,B,W,q,X,re,se]}),t[76]=O,t[77]=P,t[78]=B,t[79]=b,t[80]=W,t[81]=q,t[82]=X,t[83]=se,t[84]=S,t[85]=ce):ce=t[85],ce}export{gt as C,Bt as S,ft as T,en as _,Wn as a,an as b,vn as c,bn as d,qt as f,Ht as g,Vt as h,er as i,yn as l,Gt as m,ar as n,Bn as o,Ut as p,tr as r,Rn as s,or as t,Tn as u,sn as v,mt as w,un as x,Wt as y};
|
package/dist/public/assets/{typing-burst-detector-CC7bIjEV.js → typing-burst-detector-D9fP8xnK.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{$ as n,Ht as r,It as i,Pt as a,Tn as o,dt as s,et as c,gn as l,ht as u,i as d,lt as f,w as p,yt as m}from"./DocumentContext-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{$ as n,Ht as r,It as i,Pt as a,Tn as o,dt as s,et as c,gn as l,ht as u,i as d,lt as f,w as p,yt as m}from"./DocumentContext-DQRTQdaE.js";import{t as h}from"./react-f2sANaYj.js";import{n as g,r as _}from"./dist-Nvb76hAm.js";import{r as v,t as y}from"./useQuery-ZeEDLtxh.js";import{t as b}from"./compiler-runtime-BfE3aGVn.js";import{t as x}from"./utils-CPqDy6Hr.js";import{t as S}from"./button-D3xSRfT4.js";import{i as C,n as w,t as T}from"./tooltip-CtvLp_YK.js";import{n as E,r as D,t as O}from"./collapsible-BTn3nxAn.js";import{A as k,E as A,j,ot as M}from"./CodeMirrorPropInput-yJZmvoN3.js";import{n as N,t as P}from"./toggle-group-DpvWeoN9.js";import{Bt as F,En as I,Ma as L,P as R,Tn as z,Ua as B,Vr as V,Vt as H,_a as U,ct as W,ft as G}from"./dist-lf4nG52q2.js";import{t as ee}from"./chevron-right-COaV_K3r.js";import{r as te}from"./CopyButton-Dk8yDsPs.js";import{i as ne,r as re}from"./prop-types-lRaJp2DY.js";import{t as ie}from"./refresh-cw-CsRXA9N2.js";import{t as ae}from"./triangle-alert-BB_1Bz59.js";import{t as oe}from"./wrench-BHZvMfZp.js";import{n as se}from"./dist-Dr52ya0i.js";import{t as K}from"./dist-D1YpGD7x.js";import{f as ce,u as le}from"./doc-paths-D9TaK83y.js";import{o as ue}from"./use-settings-route-Cj3iyYQM.js";import{d as de}from"./documents-events-Bz6CFw_P.js";import{a as q,i as fe}from"./startup-marks-BFvG00Uu.js";import{t as J}from"./badge-BTPyRUGW.js";import{C as pe,y as me}from"./config-provider-CH2tG_0H.js";import{Dt as he,Ft as ge,It as _e,J as ve,Q as ye,X as be}from"./dist-pl6OT5yc.js";import{a as xe,c as Se,i as Ce,n as we,r as Te,s as Ee,t as De}from"./panel-Boo96yEj.js";import{t as Oe}from"./lint-plugin-meta-7A6ZrPoH.js";import{t as ke}from"./skeleton-CD1oYYfF.js";import{a as Ae,c as je,d as Me}from"./lint-config-client-C5EEYoJ7.js";var Ne=56,Pe=2,Fe=150,Ie=2e3;function Le(e,t,n){return e.top+e.height/2-(n+t)/2}function Re(e,t){let n=Math.max(0,t.scrollHeight-t.clientHeight);return Math.max(0,Math.min(e,n))}function ze(e){let{docName:t,container:n,measureTarget:r,placement:i,intent:a,grade:o,landedMode:c,transition:l,onOutcome:d,onDiscardQueuedTarget:f,toolbarOffset:p=Ne,driftThresholdPx:h=Pe,quietMs:g=Fe,abandonAfterMs:_=Ie}=e,v=e.contentColumn??n.firstElementChild,y=s(t),b=u(t,{yieldsToNavigation:a===`toggle`,supersede:()=>P(`superseded`)}),x=n.style.overflowAnchor;n.style.overflowAnchor=`none`,l&&q(`ok/mode-switch/transition`,{from:l.from,to:l.to,grade:o});let S=!1,C=null,w,T,E=0,D,O=()=>{let e=r();return e===null?null:Re(i===`center`?Le(e,n.clientHeight,p):e.top-p,n)},k=()=>{let e=O();if(e===null)return{measurable:!1,moved:!1};C=e;let t=Math.abs(n.scrollTop-e)>h;return t&&(n.scrollTop=e),{measurable:!0,moved:t}},A=()=>n.scrollTop-(O()??C??n.scrollTop),j=()=>{w&&clearTimeout(w),T&&clearTimeout(T),E&&cancelAnimationFrame(E),D?.disconnect(),n.removeEventListener(`wheel`,I),n.removeEventListener(`touchstart`,I),n.removeEventListener(`contentvisibilityautostatechange`,L,!0),n.style.overflowAnchor=x,y.release(),b.release()},M=()=>{if(S)return;S=!0;let e;try{k(),e=A(),C!==null&&m({docName:t,container:n,targetScrollTop:n.scrollTop,mode:c})}finally{j()}q(`ok/landing/land`,{grade:o,delta:e}),d?.({status:`landed`,delta:e})},N=()=>{if(S)return;S=!0;let e=C??n.scrollTop,t;try{t=A()}finally{j()}q(`ok/landing/abandoned`,{grade:o,target:e,delta:t}),d?.({status:`abandoned`,delta:t})},P=e=>{S||(S=!0,j(),e===`mode-flip`&&f?.(),d?.({status:`cancelled`,reason:e}))},F=()=>{w&&clearTimeout(w),w=setTimeout(M,g)};function I(){P(`user-scroll`)}function L(){if(S)return;let{measurable:e,moved:t}=k();e&&(t||w===void 0)&&F()}try{k().measurable&&F(),n.addEventListener(`contentvisibilityautostatechange`,L,!0),n.addEventListener(`wheel`,I,{passive:!0}),n.addEventListener(`touchstart`,I,{passive:!0}),typeof ResizeObserver<`u`&&v&&(D=new ResizeObserver(L),D.observe(v)),E=requestAnimationFrame(L),T=setTimeout(N,_)}catch(e){throw S=!0,j(),e}return{cancel:P}}function Be(e){switch(e){case`bulletList`:case`orderedList`:case`taskList`:case`list`:return`list`;case`codeBlock`:case`code`:return`code`;case`horizontalRule`:case`thematicBreak`:return`thematicBreak`;case`jsxComponent`:case`mdxJsxFlowElement`:case`mdxJsxTextElement`:return`jsx`;case`htmlBlock`:case`html`:return`html`;default:return e}}function Ve(e){return typeof e!=`object`||!e?``:`value`in e&&typeof e.value==`string`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(Ve).join(``):``}function He(e,t){let{frontmatter:n,body:r}=B(e),i=n===``?0:n.split(`
|
|
2
2
|
`).length-1;try{return{blocks:t.parseToEditorMdast(r).children.map(e=>({start:(e.position?.start.line??1/0)+i,end:(e.position?.end.line??-1/0)+i,kind:Be(e.type),text:Ve(e)})),fmLineCount:i}}catch{return performance.mark(`ok/block-spans/parse-failed`),{blocks:[],fmLineCount:i}}}function Ue(e,t){let{blocks:n,fmLineCount:r}=He(e,t);return{spans:n.map(e=>({start:e.start,end:e.end})),fmLineCount:r}}function We(e,t){if(e.length===0)return null;let n=0,r=e.length-1,i=e.length-1;for(;n<=r;){let a=n+r>>1,o=e[a];o!==void 0&&o.end>=t?(i=a,r=a-1):n=a+1}return i}function Ge(e){let t=e.childCount>0?e.child(e.childCount-1):null;return t!==null&&t.type.name===`paragraph`&&t.content.size===0?e.childCount-1:e.childCount}function Ke(e,t,n){let r=e.childCount,i=Math.max(0,Math.min(t,r)),a=Math.max(i,Math.min(n,r));if(a<=i)return null;let o=0;for(let t=0;t<i;t++)o+=e.child(t).nodeSize;let s=o;for(let t=i;t<a;t++)o+=e.child(t).nodeSize;let c=o,l=e.content.size,u=Math.max(0,Math.min(s,l)),d=Math.max(u,Math.min(c,l));return d<=u?null:{from:u,to:d}}function qe(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
3
3
|
`&&t.push(n+1);return t}function Je(e,t,n){return t<=1?0:t-1>=e.length?n:e[t-1]??n}function Ye(e,t){let n=0,r=e.length-1,i=1;for(;n<=r;){let a=n+r>>1;(e[a]??0)<=t?(i=a+1,n=a+1):r=a-1}return i}function Xe(e,t,n){return Math.max(t,Math.min(e,n))}function Ze(e,t){let n=e=>e.replace(/\s+/g,` `).trim();return n(e)===n(t)}function Qe(e,t){return t.inRange?t.tripwireOk?Ze(e.content,t.text)?`exact`:e.kind===t.kind?`same-type-ordinal`:`ordinal`:`ordinal`:`clamped`}function $e(e){let t=null,n=null;function r(r){return n!==null&&t===r?n:(n={blocks:He(r,e).blocks,lineStarts:qe(r)},t=r,n)}return{captureFromWysiwyg(e,t,n){if(e.childCount===0)return null;let r=Xe(t,0,e.content.size),i=0,a=e.childCount-1,o=0;for(let t=0;t<e.childCount;t++){let n=e.child(t).nodeSize;if(r<i+n){a=t,o=i+1;break}i+=n,o=i+1}let s=e.child(a),c={blockIndex:a,kind:Be(s.type.name),content:s.textContent};return n?.refine&&(c.selectionInBlock=Math.max(0,r-o)),c},captureFromSource(e,t,n){let{blocks:i,lineStarts:a}=r(e);if(i.length===0)return null;let o=Xe(t,0,e.length),s=We(i,Ye(a,o));if(s===null)return null;let c=i[s];if(!c)return null;let l={blockIndex:s,kind:c.kind,content:c.text};if(n?.refine){let t=Je(a,c.start,e.length);l.selectionInBlock=Math.max(0,o-t)}return l},resolveInSource(e,{source:t,doc:n}){let{blocks:i,lineStarts:a}=r(t);if(i.length===0)return null;let o=e.blockIndex>=0&&e.blockIndex<i.length,s=Ge(n)===i.length,c=i[Xe(e.blockIndex,0,i.length-1)],l=Je(a,c.start,t.length),u=Math.min(Je(a,c.end+1,t.length),t.length),d=Qe(e,{inRange:o,tripwireOk:s,kind:c.kind,text:c.text}),f=l;return d===`exact`&&e.selectionInBlock!==void 0&&(f=Xe(l+e.selectionInBlock,l,u)),{blockStart:l,blockEnd:u,point:f,confidence:d}},resolveInWysiwyg(e,{source:t,doc:n}){let i=Ge(n);if(i===0)return null;let{blocks:a}=r(t),o=e.blockIndex>=0&&e.blockIndex<i,s=i===a.length,c=Xe(e.blockIndex,0,i-1),l=Ke(n,c,c+1);if(l===null)return null;let u=n.child(c),d=Qe(e,{inRange:o,tripwireOk:s,kind:Be(u.type.name),text:u.textContent});return{blockStart:l.from,blockEnd:l.to,point:l.from,confidence:d}}}}var et=ge.define(),tt=ge.define(),nt=ve.mark({class:n}),rt=_e.define({create(){return ve.none},update(e,t){let n=e.map(t.changes);for(let e of t.effects)e.is(et)?n=ve.set([nt.range(e.value.from,e.value.to)]):e.is(tt)&&(n=ve.none);return n},provide:e=>be.decorations.from(e)}),it=new WeakMap,at=ye.define(e=>({destroy(){let t=it.get(e);t!==void 0&&(clearTimeout(t),it.delete(e))}}));function ot(e,t,n,r){let i=c(e.state.doc.length,t,n,r);if(!i)return;e.dispatch({effects:et.of(i)});let a=it.get(e);a!==void 0&&clearTimeout(a);let o=setTimeout(()=>{it.delete(e),e.dispatch({effects:tt.of(null)})},R);it.set(e,o)}function st(){return[rt,at]}var ct=3e4;function lt(){let e=new Map,t=e=>e?Date.now()-e.rememberedAt>ct?null:e.navigation:null;return{remember(t,n){e.set(t,{navigation:n,rememberedAt:Date.now()})},peek(n){return t(e.get(n))},consume(n){let r=e.get(n);return e.delete(n),t(r)},clear(t){e.delete(t)},clearForTest(){e.clear()}}}var ut=lt(),dt=lt(),ft=ut.remember,pt=ut.peek,mt=ut.consume,ht=ut.clear;ut.clearForTest;var gt=dt.remember,_t=dt.peek,vt=dt.consume,yt=dt.clear;dt.clearForTest;function bt(e,t,n){return{start:pe(e,t),end:pe(e,n)}}function xt(e,t){let n=me(e.start,t),r=me(e.end,t);return n===null||r===null||r.index<=n.index?null:n.index}var St=`open-knowledge:view-in-source`,Y=56,Ct=null;function wt(){return Ct??=$e(k()),Ct}function Tt(e,t,n,r,i=`toggle`){let a=r.captureFromWysiwyg(e,t,{refine:i===`jump`});if(!a)return null;let o=r.resolveInSource(a,{source:n.toString(),doc:e});return{kind:`selection-offset`,intent:i,anchor:a,pin:o?bt(n,o.blockStart,o.blockEnd):void 0}}function Et(e){let{editor:t,docName:n,ytext:r}=e,i=A(t);if(!i)return;let a=i.state.selection.from,o=Tt(i.state.doc,a,r,wt(),`jump`);o&&ft(n,o),window.dispatchEvent(new CustomEvent(St,{detail:{docName:n}}))}function Dt(e,t,n,r,i){let a=r.captureFromSource(e,t);if(!a)return null;let o=i?r.resolveInSource(a,{source:e,doc:i}):null;return{kind:`selection-offset`,anchor:a,pin:o?bt(n,o.blockStart,o.blockEnd):void 0}}function Ot(e,t){let{source:n,pmDoc:r,ydoc:i,resolver:a}=t;if(e.pin){let t=xt(e.pin,i);if(t===null){let t=a.resolveInWysiwyg(e.anchor,{source:n,doc:r});return t?{...t,point:t.blockStart,confidence:`clamped`}:null}let o=a.captureFromSource(n,t);if(o)return a.resolveInWysiwyg(o,{source:n,doc:r})}return a.resolveInWysiwyg(e.anchor,{source:n,doc:r})}function kt(e,t){let{source:n,pmDoc:r,ydoc:i,resolver:a}=t;if(e.pin){let t=xt(e.pin,i);if(t===null){let t=a.resolveInSource(e.anchor,{source:n,doc:r});return t?{...t,point:t.blockStart,confidence:`clamped`}:null}let o=a.captureFromSource(n,t);if(o)return a.resolveInSource(o,{source:n,doc:r})}return a.resolveInSource(e.anchor,{source:n,doc:r})}function At(e,t){try{return e.coordsAtPos(t)}catch{return null}}function jt(e,t,n){let r=Math.max(0,Math.min(n,e.state.doc.length)),i=t.getBoundingClientRect().top,a=At(e,r);if(a)return{top:a.top-i+t.scrollTop,height:a.bottom-a.top};try{let n=e.lineBlockAt(r);return{top:e.documentTop-i+t.scrollTop+n.top,height:n.height}}catch{return null}}function Mt(e,t){if(e.isDestroyed)return null;try{let n=e.nodeDOM(t);if(n instanceof HTMLElement)return n;let{node:r}=e.domAtPos(t);return r instanceof HTMLElement?r:r.parentElement}catch{return null}}function Nt(e,t,n){if(e.isDestroyed)return null;let r=Mt(e,Math.max(0,Math.min(n,e.state.doc.content.size)));if(!r)return null;let i=r.getBoundingClientRect(),a=t.getBoundingClientRect().top;return{top:i.top-a+t.scrollTop,height:i.height}}function Pt(){return typeof document>`u`?null:f()}function Ft(e,t){let n=t.getBoundingClientRect(),r=n.left+n.width/2;for(let t of[Y+1,Y+12,Y+40]){let i=e.posAtCoords({left:r,top:n.top+t});if(i)return i.pos}return null}function It(e,t){let n=t.getBoundingClientRect(),r=n.left+n.width/2;for(let t of[Y+1,Y+12,Y+40]){let i=e.posAtCoords({x:r,y:n.top+t});if(i!==null)return i}return null}function Lt(e){let{from:t,to:n,docName:r,ytext:i}=e;t===`wysiwyg`&&n===`source`?Rt(r,i):t===`source`&&n===`wysiwyg`&&zt(r,i)}function Rt(e,t){let n=pt(e);if(n&&n.kind!==`selection-offset`)return;let i=r(e);if(!i)return;let a=A(i);if(!a)return;let o=Pt();if(!o)return;let s=Ft(a,o);if(s===null)return;let c=Tt(a.state.doc,s,t,wt());c&&ft(e,c)}function zt(e,t){let n=a(e);if(!n)return;let i=Pt();if(!i)return;let o=It(n,i);if(o===null)return;let s=r(e),c=s?A(s)?.state.doc:void 0,l=Dt(t.toString(),o,t,wt(),c);l&>(e,l)}function Bt(e){let{view:t,docName:n,navigation:i,ydoc:a,transition:o}=e,s=r(n),c=s?A(s)?.state.doc:void 0;if(!c)return null;let l=kt(i,{source:t.state.doc.toString(),pmDoc:c,ydoc:a,resolver:wt()});if(!l)return null;let d=Pt();if(!d)return null;let f=l,p=i.intent===`jump`,m=p?f.point:f.blockStart;t.dispatch({effects:be.scrollIntoView(m,{y:`start`})});let h=!1,g=null,_=u(n,{yieldsToNavigation:!p,supersede:()=>{h=!0,_.release()}}),v=e=>{if(!h){if(At(t,m)===null&&e<8){requestAnimationFrame(()=>v(e+1));return}try{p&&(t.dispatch({selection:he.cursor(m)}),t.focus())}finally{_.release()}g=ze({docName:n,container:d,contentColumn:t.contentDOM,measureTarget:()=>jt(t,d,m),placement:p?`center`:`top`,intent:p?`jump`:`toggle`,grade:f.confidence,landedMode:`source`,transition:o,toolbarOffset:Y,onOutcome:p?e=>{e.status===`landed`&&ot(t,f.blockStart,f.blockEnd,f.confidence)}:void 0,onDiscardQueuedTarget:()=>ht(n)})}};return v(0),{cancel:e=>{h=!0,_.release(),g?.cancel(e)}}}function Vt(e){let{editor:t,docName:n,navigation:r,ydoc:i,transition:a}=e,o=A(t);if(!o)return null;let s=Ot(r,{source:i.getText(`source`).toString(),pmDoc:o.state.doc,ydoc:i,resolver:wt()});if(!s)return null;let c=Pt();if(!c)return null;let l=s;return ze({docName:n,container:c,contentColumn:o.dom,measureTarget:()=>Nt(o,c,l.point),placement:`top`,intent:`toggle`,grade:l.confidence,landedMode:`wysiwyg`,transition:a,toolbarOffset:Y,onDiscardQueuedTarget:()=>yt(n)})}var X=e(h(),1),Z=b(),Q=t();function Ht(e){let t=(0,Z.c)(14),{scope:n,onScopeChange:r,projectLabel:i}=e,{_:a}=_(),o;t[0]===r?o=t[1]:(o=e=>{e&&r(e)},t[0]=r,t[1]=o);let s;t[2]===a?s=t[3]:(s=a({id:`aBgwis`}),t[2]=a,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(N,{value:`doc`,className:`flex-1`,"data-testid":`panel-scope-doc`,children:(0,Q.jsx)(g,{id:`UpCz01`})}),t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=i??(0,Q.jsx)(g,{id:`e0NrBM`}),t[5]=i,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,Q.jsx)(N,{value:`project`,className:`flex-1`,"data-testid":`panel-scope-project`,children:l}),t[7]=l,t[8]=u);let d;return t[9]!==n||t[10]!==o||t[11]!==s||t[12]!==u?(d=(0,Q.jsx)(`div`,{className:`shrink-0 px-4 pb-2`,children:(0,Q.jsxs)(P,{type:`single`,variant:`segmented`,size:`sm`,spacing:1,value:n,onValueChange:o,"aria-label":s,className:`w-full rounded-md bg-muted p-0.5 dark:bg-background`,children:[c,u]})}),t[9]=n,t[10]=o,t[11]=s,t[12]=u,t[13]=d):d=t[13],d}var Ut=null,Wt=[];function Gt(e){if(e===Ut)return Wt;let t=Kt(e);return Ut=e,Wt=t,t}function Kt(e){let t=[],n=new Map,r=I();for(let i=qt(e);i<=e.lines;i++){let a=e.line(i);if(r(a.text))continue;let o=V(a.text,n);o&&t.push({slug:o.slug,from:a.from})}return t}function qt(e){if(!Jt(e.line(1).text))return 1;for(let t=2;t<=e.lines;t++)if(Jt(e.line(t).text))return t+1;return 1}function Jt(e){return U.test(e.endsWith(`\r`)?e.slice(0,-1):e)}function Yt(e){let t=document.getElementById(e);return t?t.getBoundingClientRect().top:null}function Xt(e){let t=new Map;for(let n of Gt(e.state.doc))t.set(n.slug,n.from);let n=e.documentTop;return r=>{let i=t.get(r);return i===void 0?null:n+e.lineBlockAt(i).top}}function Zt(e,t){let n=(0,Z.c)(9),r;n[0]===t?r=n[1]:(r=t===void 0?{}:t,n[0]=t,n[1]=r);let{isSourceMode:o,docName:s}=r,c=o===void 0?!1:o,[l,u]=(0,X.useState)(void 0),d=(0,X.useRef)(null),f;n[2]===s?f=n[3]:(f=()=>s?a(s):null,n[2]=s,n[3]=f);let p=(0,X.useSyncExternalStore)(i,f,Qt),m,h;return n[4]!==c||n[5]!==e||n[6]!==p?(m=()=>{if(e.length===0||c&&!p){u(void 0);return}let t=function(){let t=c&&p?Xt(p):Yt,n=window.innerHeight/2,r,i;for(let a of e){let e=t(a);e!==null&&(e<0?r=a:i===void 0&&e<n&&(i=a))}u(i??r??e[0])},n=function(){d.current===null&&(d.current=requestAnimationFrame(()=>{d.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),d.current!==null&&(cancelAnimationFrame(d.current),d.current=null)}},h=[e,c,p],n[4]=c,n[5]=e,n[6]=p,n[7]=m,n[8]=h):(m=n[7],h=n[8]),(0,X.useEffect)(m,h),l}function Qt(){return null}var $t=300;async function en(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new j(K._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=G.safeParse(n);throw e.success?Error(e.data.title):new j(K._({id:`zlErBl`}),{status:t.status})}let r=W.safeParse(n);if(!r.success)throw new j(K._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var tn=32,nn=12,rn=6,an=`open-knowledge:outline-nav`;function on(e){let t=(0,Z.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(fe,{name:`outline-panel`,children:(0,Q.jsx)(sn,{...e})}),t[0]=e,t[1]=n),n}function sn(e){let t=(0,Z.c)(53),{docName:n,isSourceMode:r,className:i}=e,a=i===void 0?``:i,{_:o}=_(),{pages:s,loading:c}=ne(),l=v(),{activeProvider:u,activeDocName:f}=d(),p,m;t[0]===n?(p=t[1],m=t[2]):(p=[`page-headings`,n],m=()=>en(n),t[0]=n,t[1]=p,t[2]=m);let h;t[3]!==n||t[4]!==c||t[5]!==s?(h=!c&&(s.has(n)||L(n)),t[3]=n,t[4]=c,t[5]=s,t[6]=h):h=t[6];let b;t[7]!==p||t[8]!==m||t[9]!==h?(b={queryKey:p,queryFn:m,enabled:h,staleTime:1/0},t[7]=p,t[8]=m,t[9]=h,t[10]=b):b=t[10];let{data:S,isLoading:C,error:w}=y(b),T;t[11]===S?T=t[12]:(T=S===void 0?[]:S,t[11]=S,t[12]=T);let E=T,D,O;t[13]!==f||t[14]!==u||t[15]!==n||t[16]!==l?(D=()=>{if(!u||f!==n)return;let e=u.document,t=null,r=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,l.invalidateQueries({queryKey:[`page-headings`,n]})},$t)};return e.on(`update`,r),()=>{e.off(`update`,r),t!==null&&clearTimeout(t)}},O=[u,f,n,l],t[13]=f,t[14]=u,t[15]=n,t[16]=l,t[17]=D,t[18]=O):(D=t[17],O=t[18]),(0,X.useEffect)(D,O);let k;t[19]===E?k=t[20]:(k=E.map(cn),t[19]=E,t[20]=k);let A=k,j;t[21]!==n||t[22]!==r?(j={isSourceMode:r,docName:n},t[21]=n,t[22]=r,t[23]=j):j=t[23];let M=Zt(A,j),N;t[24]!==M||t[25]!==E?(N=M?E.findIndex(e=>e.slug===M):-1,t[24]=M,t[25]=E,t[26]=N):N=t[26];let P=N,F;t[27]!==n||t[28]!==r?(F=function(e,t){let i={index:e,slug:t,mode:r?`source`:`wysiwyg`};i.mode===`source`&&ft(n,{kind:`outline`,detail:i}),window.dispatchEvent(new CustomEvent(an,{detail:i}))},t[27]=n,t[28]=r,t[29]=F):F=t[29];let I=F,R=((P>=0?E[P].level:1)-1)*nn+(nn-rn)/2,z=P*tn+(tn-rn)/2,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(Se,{children:(0,Q.jsx)(g,{id:`dD7NPy`})}),t[30]=B):B=t[30];let V;t[31]!==E.length||t[32]!==C?(V=!C&&(0,Q.jsx)(Te,{children:E.length}),t[31]=E.length,t[32]=C,t[33]=V):V=t[33];let H;t[34]===V?H=t[35]:(H=(0,Q.jsxs)(Ee,{children:[B,V]}),t[34]=V,t[35]=H);let U;t[36]!==o||t[37]!==P||t[38]!==M||t[39]!==w||t[40]!==I||t[41]!==E||t[42]!==C||t[43]!==R||t[44]!==z?(U=w?(0,Q.jsx)(xe,{className:`px-2`,children:w instanceof Error?w.message:o({id:`GuqOb1`})}):E.length===0&&!C?(0,Q.jsx)(Ce,{className:`px-2`,children:(0,Q.jsx)(g,{id:`0BB9ID`})}):(0,Q.jsxs)(`nav`,{"aria-label":o({id:`BymzO4`}),className:`relative`,children:[P>=0&&(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-0 top-0 rounded-full bg-primary motion-safe:[transition:transform_0.25s_var(--ease-out-strong)]`,style:{width:rn,height:rn,transform:`translate(${R}px, ${z}px)`}}),E.map((e,t)=>{let n=e.slug===M;return(0,Q.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>I(t,e.slug),className:x(`w-full cursor-pointer truncate py-1.5 pe-2 text-left text-sm transition-colors`,n?`font-medium text-primary`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${(e.level-1)*nn+20}px`},title:e.text,children:e.text},t)})]}),t[36]=o,t[37]=P,t[38]=M,t[39]=w,t[40]=I,t[41]=E,t[42]=C,t[43]=R,t[44]=z,t[45]=U):U=t[45];let W;t[46]!==C||t[47]!==U?(W=(0,Q.jsx)(we,{className:`px-3 py-2`,"aria-busy":C,children:U}),t[46]=C,t[47]=U,t[48]=W):W=t[48];let G;return t[49]!==a||t[50]!==H||t[51]!==W?(G=(0,Q.jsxs)(De,{className:a,children:[H,W]}),t[49]=a,t[50]=H,t[51]=W,t[52]=G):G=t[52],G}function cn(e){return e.slug}var ln=`audit-superseded`;async function un(e={kind:`project`}){return fn(e,H,!1)}async function dn(e={kind:`project`},t){return fn(e,F,!0,t)}async function fn(e,t,n,r){try{let i=new URLSearchParams;e.kind===`path`?i.set(`path`,e.path):e.kind===`doc`&&i.set(`doc`,e.docName),n&&i.set(`counts`,`1`);let a=i.size===0?``:`?${i}`,o=await fetch(`/api/audit${a}`,r===void 0?void 0:{signal:r});if(!o.ok)return o.status===409?ln:(console.warn(`[audit] request failed`,o.status,o.statusText),null);let s;try{s=await o.json()}catch{return r?.aborted===!0||console.warn(`[audit] response body is not valid JSON`),null}let c=t.safeParse(s);return c.success?c.data:(console.warn(`[audit] response failed schema validation`,c.error.issues),null)}catch(e){return r?.aborted===!0||console.warn(`[audit] fetch threw`,e),null}}function pn(e){let t=(0,Z.c)(4),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,i]=(0,X.useState)(n),a,o;return t[1]===e?(a=t[2],o=t[3]):(a=()=>{if(i(gn),e===null)return;let t=!1,n=()=>{un({kind:`doc`,docName:e}).then(e=>{if(t||e===null||e===`audit-superseded`)return;let n=e.files.flatMap(hn).filter(mn);i(e=>e.length===0&&n.length===0?e:n)})};n();let r=de(e=>{e.includes(`backlinks`)&&n()});return()=>{t=!0,r()}},o=[e],t[1]=e,t[2]=a,t[3]=o),(0,X.useEffect)(a,o),r}function mn(e){return e.source===`links`}function hn(e){return e.diagnostics}function gn(e){return e.length===0?e:[]}var _n={errorCount:0,warningCount:0},$=new Map,vn=new Set,yn=new Map;function bn(){let e=new Map;for(let[t,n]of $){let r=n.lint.errorCount+n.links.errorCount,i=n.lint.warningCount+n.links.warningCount;r===0&&i===0||e.set(t,{errorCount:r,warningCount:i})}yn=e;for(let e of vn)e()}var xn=z;function Sn(e){return vn.add(e),()=>{vn.delete(e)}}function Cn(){return yn}function wn(e){$.clear();for(let t of e)$.set(le(t.file),xn(t.diagnostics));bn()}function Tn(e){$.clear();for(let t of e)$.set(le(t.file),{lint:t.lint,links:t.links});bn()}function En(e,t){$.set(e,xn(t)),bn()}function Dn(e,t,n){let r=$.get(e)??{lint:_n,links:_n},i=r[t];i.errorCount===n.errorCount&&i.warningCount===n.warningCount||($.set(e,{...r,[t]:n}),bn())}var On=`open-knowledge:lint-nav`;function kn(e,t){return e.range.start.line-t.range.start.line||e.range.start.character-t.range.start.character}function An(e){return{line:e.range.start.line+1,column:e.range.start.character+1}}function jn(e){let t=(0,Z.c)(35),{diagnostic:n,instanceCount:r}=e,{_:i}=_(),a=n.severity===`error`?te:ae,s=n.range.start.line+1,c=n.source===`links`,l=r!==void 0&&r>1,u=n.severity===`error`?`text-destructive`:`text-amber-500`,d;t[0]===u?d=t[1]:(d=x(`mt-0.5 size-3.5 shrink-0`,u),t[0]=u,t[1]=d);let f;t[2]!==a||t[3]!==d?(f=(0,Q.jsx)(a,{"aria-hidden":`true`,className:d}),t[2]=a,t[3]=d,t[4]=f):f=t[4];let p;t[5]===n.message?p=t[6]:(p=(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 text-foreground`,children:n.message}),t[5]=n.message,t[6]=p);let m;t[7]!==l||t[8]!==r?(m=l?(0,Q.jsxs)(`span`,{className:`mt-0.5 flex shrink-0 items-center gap-1`,children:[(0,Q.jsx)(J,{variant:`gray`,"data-testid":`problems-instance-count`,className:`h-4 px-1 font-sans text-[10px] leading-none`,children:(0,Q.jsx)(g,{id:`iZCZmF`,values:{instanceCount:r}})}),(0,Q.jsx)(ee,{"aria-hidden":`true`,className:`size-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`})]}):null,t[7]=l,t[8]=r,t[9]=m):m=t[9];let h;t[10]!==f||t[11]!==p||t[12]!==m?(h=(0,Q.jsxs)(`span`,{className:`flex items-start gap-1.5 text-sm`,children:[f,p,m]}),t[10]=f,t[11]=p,t[12]=m,t[13]=h):h=t[13];let v=c&&`gap-0.5`,y;t[14]===v?y=t[15]:(y=x(`h-4 shrink-0 px-1 font-sans text-[10px] uppercase leading-none`,v),t[14]=v,t[15]=y);let b;t[16]===c?b=t[17]:(b=c?(0,Q.jsx)(o,{"aria-hidden":`true`,className:`size-2.5`}):null,t[16]=c,t[17]=b);let S;t[18]!==n.source||t[19]!==y||t[20]!==b?(S=(0,Q.jsxs)(J,{variant:`gray`,"data-testid":`problems-source-tag`,className:y,children:[b,n.source]}),t[18]=n.source,t[19]=y,t[20]=b,t[21]=S):S=t[21];let C;t[22]!==i||t[23]!==n.code||t[24]!==s||t[25]!==l?(C=l?n.code:`${n.code} · ${i({id:`enPTnx`,values:{displayLine:s}})}`,t[22]=i,t[23]=n.code,t[24]=s,t[25]=l,t[26]=C):C=t[26];let w;t[27]===C?w=t[28]:(w=(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:C}),t[27]=C,t[28]=w);let T;t[29]!==S||t[30]!==w?(T=(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 ps-5 font-mono text-xs text-muted-foreground`,children:[S,w]}),t[29]=S,t[30]=w,t[31]=T):T=t[31];let E;return t[32]!==T||t[33]!==h?(E=(0,Q.jsxs)(Q.Fragment,{children:[h,T]}),t[32]=T,t[33]=h,t[34]=E):E=t[34],E}function Mn(e){let t=new Map;for(let n of e){let e=`${n.source}/${n.code}\u0000${n.linkTarget??``}\u0000${n.message}`,r=t.get(e);r===void 0?t.set(e,{key:e,instances:[n]}):r.instances.push(n)}return[...t.values()]}function Nn(e){let t=(0,Z.c)(43),{group:n,onNavigate:r,navTitle:i,renderActions:a}=e,{_:o}=_(),s=n.instances[0];if(n.instances.length===1){let e;t[0]!==s||t[1]!==a?(e=a(s),t[0]=s,t[1]=a,t[2]=e):e=t[2];let n=e,o;t[3]!==s||t[4]!==r?(o=()=>r(s),t[3]=s,t[4]=r,t[5]=o):o=t[5];let c;t[6]!==s||t[7]!==i?(c=i(s),t[6]=s,t[7]=i,t[8]=c):c=t[8];let l;t[9]===s?l=t[10]:(l=(0,Q.jsx)(jn,{diagnostic:s}),t[9]=s,t[10]=l);let u;t[11]!==o||t[12]!==c||t[13]!==l?(u=(0,Q.jsx)(`button`,{type:`button`,onClick:o,className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left`,title:c,children:l}),t[11]=o,t[12]=c,t[13]=l,t[14]=u):u=t[14];let d;t[15]===n?d=t[16]:(d=n===null?null:(0,Q.jsx)(`div`,{className:`absolute bottom-1 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:n}),t[15]=n,t[16]=d);let f;return t[17]!==u||t[18]!==d?(f=(0,Q.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[u,d]}),t[17]=u,t[18]=d,t[19]=f):f=t[19],f}let c;t[20]!==s||t[21]!==n.instances.length?(c=(0,Q.jsx)(D,{className:`group flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:(0,Q.jsx)(jn,{diagnostic:s,instanceCount:n.instances.length})}),t[20]=s,t[21]=n.instances.length,t[22]=c):c=t[22];let l;t[23]!==o||t[24]!==s.message?(l=o({id:`EUiJEM`,values:{0:s.message}}),t[23]=o,t[24]=s.message,t[25]=l):l=t[25];let u;if(t[26]!==o||t[27]!==n.instances||t[28]!==i||t[29]!==r||t[30]!==a){let e;t[32]!==o||t[33]!==i||t[34]!==r||t[35]!==a?(e=e=>{let t=a(e),n=e.range.start.line+1;return(0,Q.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`flex w-full cursor-pointer rounded px-2 py-1 text-left font-mono text-xs text-muted-foreground`,title:i(e),"aria-label":o({id:`uCe4AX`,values:{0:e.message,displayLine:n}}),children:o({id:`enPTnx`,values:{displayLine:n}})}),t===null?null:(0,Q.jsx)(`div`,{className:`absolute bottom-0.5 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:t})]},Pn(e))},t[32]=o,t[33]=i,t[34]=r,t[35]=a,t[36]=e):e=t[36],u=n.instances.map(e),t[26]=o,t[27]=n.instances,t[28]=i,t[29]=r,t[30]=a,t[31]=u}else u=t[31];let d;t[37]!==l||t[38]!==u?(d=(0,Q.jsx)(E,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,children:(0,Q.jsx)(`ul`,{"aria-label":l,className:`flex flex-col gap-0.5 pb-1 ps-5`,"data-testid":`problems-duplicate-instances`,children:u})}),t[37]=l,t[38]=u,t[39]=d):d=t[39];let f;return t[40]!==c||t[41]!==d?(f=(0,Q.jsx)(`li`,{className:`rounded`,"data-testid":`problems-duplicate-group`,children:(0,Q.jsxs)(O,{children:[c,d]})}),t[40]=c,t[41]=d,t[42]=f):f=t[42],f}function Pn(e){return`${e.source}/${e.code}-${e.range.start.line}-${e.range.start.character}-${e.message}`}function Fn(e){return e.reduce((e,t)=>e+ +((t.fixes?.length??0)>0),0)}function In(e){let t=(0,Z.c)(11),{target:n,creating:r,disabled:i,onCreate:a}=e,{_:o}=_(),s;t[0]!==o||t[1]!==n?(s=o({id:`oWsZk8`,values:{target:n}}),t[0]=o,t[1]=n,t[2]=s):s=t[2];let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(M,{"aria-hidden":`true`,className:`size-3`}),t[3]=c):c=t[3];let l;t[4]===r?l=t[5]:(l=r?(0,Q.jsx)(g,{id:`E9bKSA`}):(0,Q.jsx)(g,{id:`XRuL0i`}),t[4]=r,t[5]=l);let u;return t[6]!==i||t[7]!==a||t[8]!==s||t[9]!==l?(u=(0,Q.jsxs)(S,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:i,onClick:a,"aria-label":s,"data-testid":`problems-create-page`,children:[c,l]}),t[6]=i,t[7]=a,t[8]=s,t[9]=l,t[10]=u):u=t[10],u}function Ln(e){let t=(0,Z.c)(8),{tip:n,testId:r,children:i}=e,a;t[0]===i?a=t[1]:(a=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(`span`,{className:`inline-flex shrink-0`,children:i})}),t[0]=i,t[1]=a);let o;t[2]!==r||t[3]!==n?(o=(0,Q.jsx)(w,{"data-testid":r,children:n}),t[2]=r,t[3]=n,t[4]=o):o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,Q.jsxs)(T,{children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Rn(e){let t=(0,Z.c)(21),{count:n,problemCount:r,aiAvailable:i,disabled:a,onClick:o,children:s}=e,{_:c}=_(),l;t[0]!==i||t[1]!==n||t[2]!==r?(l=n>0?(0,Q.jsx)(g,{id:`vjwsDi`,values:{count:n}}):r===0?(0,Q.jsx)(g,{id:`gAhHu7`}):i?(0,Q.jsx)(g,{id:`zA9zRL`}):(0,Q.jsx)(g,{id:`X3MMeA`}),t[0]=i,t[1]=n,t[2]=r,t[3]=l):l=t[3];let u;t[4]!==c||t[5]!==s||t[6]!==n||t[7]!==r?(u=s===void 0?r===0?c({id:`4m-xuX`}):n===0?c({id:`SqIoy_`}):void 0:void 0,t[4]=c,t[5]=s,t[6]=n,t[7]=r,t[8]=u):u=t[8];let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),t[9]=d):d=t[9];let f;t[10]!==s||t[11]!==n?(f=s??(0,Q.jsx)(g,{id:`RZXTlY`,values:{count:n}}),t[10]=s,t[11]=n,t[12]=f):f=t[12];let p;t[13]!==a||t[14]!==o||t[15]!==u||t[16]!==f?(p=(0,Q.jsxs)(S,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:a,onClick:o,"aria-label":u,"data-testid":`problems-auto-fix`,children:[d,f]}),t[13]=a,t[14]=o,t[15]=u,t[16]=f,t[17]=p):p=t[17];let m;return t[18]!==l||t[19]!==p?(m=(0,Q.jsx)(Ln,{testId:`problems-auto-fix-tip`,tip:l,children:p}),t[18]=l,t[19]=p,t[20]=m):m=t[20],m}function zn(e){let t=(0,Z.c)(12),{count:n,disabled:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(g,{id:`mgDKWS`,values:{count:n}}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(l,{"aria-hidden":`true`,className:`size-3`}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Q.jsx)(g,{id:`gyHDWC`,values:{count:n}}),t[3]=n,t[4]=s);let c;t[5]!==r||t[6]!==i||t[7]!==s?(c=(0,Q.jsxs)(S,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:r,onClick:i,"data-testid":`problems-fix-with-ai`,children:[o,s]}),t[5]=r,t[6]=i,t[7]=s,t[8]=c):c=t[8];let u;return t[9]!==a||t[10]!==c?(u=(0,Q.jsx)(Ln,{testId:`problems-fix-with-ai-tip`,tip:a,children:c}),t[9]=a,t[10]=c,t[11]=u):u=t[11],u}function Bn(e){let t=(0,Z.c)(18),{docName:n,diagnostics:r,onFix:i,onAutoFix:a,onAskAi:o,onFixWithAi:s}=e,{_:c}=_(),[u,d]=(0,X.useState)(`doc`),{data:f}=Me(),m=f===null?null:f.effective.enabled?Oe.filter(e=>f.effective.plugins[e.id].enabled):[],h=m!==null&&m.length===0,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={status:`idle`},t[0]=v):v=t[0];let[y,b]=(0,X.useState)(v),[x,E]=(0,X.useState)(null),D=re(),[O,k]=(0,X.useState)(null),A=(0,X.useRef)(!0),j,M;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>(A.current=!0,()=>{A.current=!1}),M=[],t[1]=j,t[2]=M):(j=t[1],M=t[2]),(0,X.useEffect)(j,M);let N=(0,X.useRef)(qn),P;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(P={status:`idle`},t[3]=P):P=t[3];let F=(0,X.useRef)(P),I;t[4]===y?I=t[5]:(I=()=>{y.status!==`loading`&&(F.current=y)},t[4]=y,t[5]=I),(0,X.useEffect)(I);let L=(0,X.useRef)(0),R=[...r].sort(kn),z=Fn(R),B=async function(e){let t=e.linkTarget;if(!(t===void 0||O!==null||D===null)){k(t);try{await p({initialDir:``,suggestedName:t},{addPage:D.addPage})}catch(e){let t=e;se.error(t instanceof Error?t.message:c({id:`tfi40B`})),A.current&&k(null);return}se.success(c({id:`EWCJFu`,values:{target:t}})),A.current&&k(null),A.current&&y.status===`loaded`&&await V()}};async function V(){L.current+=1;let e=L.current,t=F.current;b({status:`loading`});let n=await un();if(n===`audit-superseded`){L.current===e&&A.current&&b(t.status===`idle`?{status:`failed`}:t);return}n!==null&&wn(n.files),A.current&&b(n===null?{status:`failed`}:{status:`loaded`,result:n})}let H=y.status===`loaded`?y.result.files.filter(Gn):[],U=async function(){if(x!==null||H.length===0)return;E({done:0,total:H.length});let e=[];for(let t of H){let n=await Ae(le(t.file));if(!A.current)return;n.ok||e.push({file:t.file,detail:n.errorDetail}),E(Wn)}if(E(null),e.length>0){let t=e[0];se.error(c({id:`fru3T7`,values:{0:e.length,1:H.length}}),{description:t===void 0?void 0:`${t.file}${t.detail===null?``:` — ${t.detail}`}`})}try{await V()}catch{A.current&&b({status:`failed`})}},W=function(e){d(e),e===`project`&&y.status===`idle`&&V()};(0,X.useEffect)(()=>{N.current=()=>{y.status===`idle`||y.status===`failed`||V()}});let G;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(G=[],t[6]=G):G=t[6],(0,X.useEffect)(()=>je(()=>N.current()),G);let ee;t[7]===n?ee=t[8]:(ee=function(e){let t=An(e);ft(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(On,{detail:t}))},t[7]=n,t[8]=ee);let te=ee,ne;t[9]!==n||t[10]!==te?(ne=function(e,t){let r=le(e);if(r===n){te(t);return}ft(r,{kind:`lint`,detail:An(t)}),window.location.hash=ce(r)},t[9]=n,t[10]=te,t[11]=ne):ne=t[11];let ie=ne,ae=function(e){let t=i!==void 0&&(e.fixes?.length??0)>0,n=e.linkTarget!==void 0&&D!==null;if(!t&&!n&&o===void 0)return null;let r=`${e.source}/${e.code}`;return(0,Q.jsxs)(Q.Fragment,{children:[n?(0,Q.jsx)(In,{target:e.linkTarget??``,creating:O===e.linkTarget,disabled:O!==null,onCreate:()=>void B(e)}):null,t?(0,Q.jsxs)(S,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>i?.(e),"aria-label":c({id:`fZj9em`,values:{flatId:r}}),"data-testid":`problems-fix`,children:[(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),(0,Q.jsx)(g,{id:`c4fVUV`})]}):null,o===void 0?null:(0,Q.jsxs)(S,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>o(e),"aria-label":c({id:`hh4mVC`,values:{flatId:r}}),"data-testid":`problems-ask-ai`,children:[(0,Q.jsx)(l,{"aria-hidden":`true`,className:`size-3`}),(0,Q.jsx)(g,{id:`xWEvuo`})]})]})},K;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(Se,{children:(0,Q.jsx)(g,{id:`OXdGnd`})}),t[12]=K):K=t[12];let de=m!==null&&m.length>0&&(0,Q.jsxs)(T,{children:[(0,Q.jsx)(C,{className:`shrink-0 cursor-default rounded-md bg-muted-foreground/5 px-2 py-1 font-mono text-xs text-muted-foreground`,"data-testid":`problems-active-plugins`,children:(0,Q.jsx)(g,{id:`yxF19Y`,values:{0:m.length}})}),(0,Q.jsx)(w,{"data-testid":`problems-active-plugins-tooltip`,children:(0,Q.jsx)(g,{id:`ws5o1F`,values:{0:m.map(Un).join(`, `)}})})]}),q;t[13]===de?q=t[14]:(q=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[K,de]}),t[13]=de,t[14]=q);let fe=u===`doc`&&R.length>0&&(0,Q.jsx)(Te,{children:R.length}),J;return t[15]!==q||t[16]!==fe?(J=(0,Q.jsxs)(Ee,{children:[q,fe]}),t[15]=q,t[16]=fe,t[17]=J):J=t[17],(0,Q.jsxs)(De,{children:[J,(0,Q.jsx)(Ht,{scope:u,onScopeChange:W}),u===`doc`?(0,Q.jsx)(we,{className:`px-2 py-2`,children:R.length===0?h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ce,{className:`px-2`,"data-testid":`problems-no-plugins`,children:(0,Q.jsx)(g,{id:`Hngy37`})}),(0,Q.jsx)(`div`,{className:`px-2 pt-2`,children:(0,Q.jsx)(S,{variant:`outline`,size:`sm`,onClick:ue,"data-testid":`problems-enable-plugins`,children:(0,Q.jsx)(g,{id:`rnX-1S`})})})]}):(0,Q.jsx)(Ce,{className:`px-2`,children:(0,Q.jsx)(g,{id:`ZI8uvA`})}):(0,Q.jsxs)(Q.Fragment,{children:[a!==void 0||s!==void 0?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1 px-2 pb-1`,children:[a!==void 0&&(0,Q.jsx)(Rn,{count:z,problemCount:R.length,aiAvailable:s!==void 0,disabled:z===0,onClick:a}),s!==void 0&&(0,Q.jsx)(zn,{count:R.length,disabled:!1,onClick:()=>s(`doc`)})]}):null,(0,Q.jsx)(`ul`,{"aria-label":c({id:`OXdGnd`}),className:`flex flex-col gap-0.5`,children:Mn(R).map(e=>(0,Q.jsx)(Nn,{group:e,onNavigate:te,navTitle:e=>c({id:`vbMHjo`,values:{0:e.range.start.line+1}}),renderActions:ae},e.key))})]})}):(0,Q.jsx)(Jn,{audit:y,onRefresh:()=>void V(),onNavigate:ie,fixableCount:H.reduce(Hn,0),problemCount:y.status===`loaded`?y.result.files.reduce(Vn,0):0,fixing:x,onAutoFix:()=>void U(),onFixWithAi:s===void 0||y.status!==`loaded`?void 0:()=>s(`project`),onCreateTarget:D===null?void 0:e=>void B(e),creatingTarget:O})]})}function Vn(e,t){return e+t.diagnostics.length}function Hn(e,t){return e+Fn(t.diagnostics)}function Un(e){return e.label}function Wn(e){return e===null?e:{...e,done:e.done+1}}function Gn(e){return e.diagnostics.some(Kn)}function Kn(e){return(e.fixes?.length??0)>0}function qn(){}function Jn(e){let t=(0,Z.c)(57),{audit:n,onRefresh:r,onNavigate:i,fixableCount:a,problemCount:o,fixing:s,onAutoFix:c,onFixWithAi:l,onCreateTarget:u,creatingTarget:d}=e,{_:f}=_(),p=n.status===`loading`||n.status===`idle`,m;t[0]!==n.result||t[1]!==n.status?(m=n.status===`loaded`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(g,{id:`DsDwR-`,values:{0:n.result.errorCount}}),` · `,(0,Q.jsx)(g,{id:`W1SI2K`,values:{0:n.result.warningCount}})]}),t[0]=n.result,t[1]=n.status,t[2]=m):m=t[2];let h;t[3]===m?h=t[4]:(h=(0,Q.jsx)(`p`,{className:`min-w-0 truncate text-xs text-muted-foreground`,"data-testid":`problems-audit-summary`,children:m}),t[3]=m,t[4]=h);let v;t[5]===f?v=t[6]:(v=f({id:`I7y_vn`}),t[5]=f,t[6]=v);let y=p||s!==null,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`}),t[7]=b):b=t[7];let x;t[8]!==r||t[9]!==v||t[10]!==y?(x=(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(S,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":v,"data-testid":`problems-audit-refresh`,disabled:y,onClick:r,children:b})}),t[8]=r,t[9]=v,t[10]=y,t[11]=x):x=t[11];let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(w,{"data-testid":`problems-audit-refresh-tooltip`,children:(0,Q.jsx)(g,{id:`I7y_vn`})}),t[12]=E):E=t[12];let D;t[13]===x?D=t[14]:(D=(0,Q.jsxs)(T,{children:[x,E]}),t[13]=x,t[14]=D);let O;t[15]!==h||t[16]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[h,D]}),t[15]=h,t[16]=D,t[17]=O):O=t[17];let k;t[18]!==f||t[19]!==s?(k=s===null?null:(0,Q.jsx)(`span`,{className:`sr-only`,role:`status`,children:f({id:`gZElfU`,values:{0:s.done,1:s.total}})}),t[18]=f,t[19]=s,t[20]=k):k=t[20];let A=l!==void 0,j=p||s!==null||a===0,M;t[21]===s?M=t[22]:(M=s===null?void 0:(0,Q.jsx)(g,{id:`S9t1PI`,values:{0:s.done,1:s.total}}),t[21]=s,t[22]=M);let N;t[23]!==a||t[24]!==c||t[25]!==o||t[26]!==A||t[27]!==j||t[28]!==M?(N=(0,Q.jsx)(Rn,{count:a,problemCount:o,aiAvailable:A,disabled:j,onClick:c,children:M}),t[23]=a,t[24]=c,t[25]=o,t[26]=A,t[27]=j,t[28]=M,t[29]=N):N=t[29];let P;t[30]!==s||t[31]!==l||t[32]!==o?(P=l!==void 0&&o>0?(0,Q.jsx)(zn,{count:o,disabled:s!==null,onClick:l}):null,t[30]=s,t[31]=l,t[32]=o,t[33]=P):P=t[33];let F;t[34]!==k||t[35]!==N||t[36]!==P?(F=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1`,children:[k,N,P]}),t[34]=k,t[35]=N,t[36]=P,t[37]=F):F=t[37];let I;t[38]!==F||t[39]!==O?(I=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 px-2 pb-1`,children:[O,F]}),t[38]=F,t[39]=O,t[40]=I):I=t[40];let L;t[41]!==f||t[42]!==p?(L=p&&(0,Q.jsx)(`div`,{className:`flex flex-col gap-1`,role:`status`,"aria-busy":`true`,"aria-label":f({id:`dx-TwN`}),children:[1,2,3].map(Yn)}),t[41]=f,t[42]=p,t[43]=L):L=t[43];let R;t[44]===n.status?R=t[45]:(R=n.status===`failed`&&(0,Q.jsx)(xe,{className:`px-2 text-xs`,children:(0,Q.jsx)(g,{id:`IFezUv`})}),t[44]=n.status,t[45]=R);let z;t[46]!==n.result||t[47]!==n.status||t[48]!==d||t[49]!==u||t[50]!==i?(z=n.status===`loaded`&&(0,Q.jsx)(Xn,{result:n.result,onNavigate:i,onCreateTarget:u,creatingTarget:d}),t[46]=n.result,t[47]=n.status,t[48]=d,t[49]=u,t[50]=i,t[51]=z):z=t[51];let B;return t[52]!==I||t[53]!==L||t[54]!==R||t[55]!==z?(B=(0,Q.jsxs)(we,{className:`px-2 py-2`,"data-testid":`problems-project-scope`,children:[I,L,R,z]}),t[52]=I,t[53]=L,t[54]=R,t[55]=z,t[56]=B):B=t[56],B}function Yn(e){return(0,Q.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded px-2 py-1.5`,children:[(0,Q.jsx)(ke,{className:`mt-0.5 size-3.5 shrink-0 rounded`}),(0,Q.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Q.jsx)(ke,{className:`h-3 w-28`}),(0,Q.jsx)(ke,{className:`h-3 w-40`})]})]},e)}function Xn(e){let t=(0,Z.c)(12),{result:n,onNavigate:r,onCreateTarget:i,creatingTarget:a}=e,{_:o}=_(),s;t[0]!==o||t[1]!==n.warnings?(s=n.warnings.length>0&&(0,Q.jsx)(`ul`,{"aria-label":o({id:`Rsdhj9`}),className:`flex flex-col gap-0.5 pb-1`,children:n.warnings.map(Zn)}),t[0]=o,t[1]=n.warnings,t[2]=s):s=t[2];let c;t[3]!==a||t[4]!==i||t[5]!==r||t[6]!==n.fileCount||t[7]!==n.files?(c=n.files.length===0?(0,Q.jsx)(Ce,{className:`px-2`,children:(0,Q.jsx)(g,{id:`k_Dqw1`,values:{0:n.fileCount}})}):n.files.map(e=>(0,Q.jsx)(Qn,{file:e,onNavigate:r,onCreateTarget:i,creatingTarget:a},e.file)),t[3]=a,t[4]=i,t[5]=r,t[6]=n.fileCount,t[7]=n.files,t[8]=c):c=t[8];let l;return t[9]!==s||t[10]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Zn(e,t){return(0,Q.jsxs)(`li`,{className:`flex items-start gap-1.5 px-2 text-xs`,children:[(0,Q.jsx)(ae,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-500`}),(0,Q.jsx)(`span`,{className:`min-w-0 text-foreground`,children:e})]},`${t}-${e}`)}function Qn(e){let t=(0,Z.c)(41),{file:n,onNavigate:r,onCreateTarget:i,creatingTarget:a}=e,{_:o}=_(),s,c,l,u,d,f,p,m,h;if(t[0]!==o||t[1]!==a||t[2]!==n.diagnostics||t[3]!==n.file||t[4]!==i||t[5]!==r){let e=[...n.diagnostics].sort(kn);c=O,p=!0,m=`problems-audit-group`;let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),t[15]=g):g=t[15];let _;t[16]===n.file?_=t[17]:(_=(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,title:n.file,children:n.file}),t[16]=n.file,t[17]=_),h=(0,Q.jsxs)(D,{className:`group flex w-full cursor-pointer items-center gap-1.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:[g,_,(0,Q.jsx)(J,{variant:`gray`,"data-testid":`problems-audit-file-count`,className:`shrink-0`,children:e.length})]}),s=E,f=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,t[18]!==o||t[19]!==n.file?(l=o({id:`zAJzIg`,values:{0:n.file}}),t[18]=o,t[19]=n.file,t[20]=l):l=t[20],u=`flex flex-col gap-0.5 pb-1 ps-3`;let v;t[21]!==o||t[22]!==a||t[23]!==n.file||t[24]!==i||t[25]!==r?(v=e=>(0,Q.jsx)(Nn,{group:e,onNavigate:e=>r(n.file,e),navTitle:e=>o({id:`xKDsGS`,values:{0:e.range.start.line+1,1:n.file}}),renderActions:e=>e.linkTarget===void 0||i===void 0?null:(0,Q.jsx)(In,{target:e.linkTarget,creating:a===e.linkTarget,disabled:a!==null,onCreate:()=>i(e)})},e.key),t[21]=o,t[22]=a,t[23]=n.file,t[24]=i,t[25]=r,t[26]=v):v=t[26],d=Mn(e).map(v),t[0]=o,t[1]=a,t[2]=n.diagnostics,t[3]=n.file,t[4]=i,t[5]=r,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=h}else s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13],h=t[14];let g;t[27]!==l||t[28]!==u||t[29]!==d?(g=(0,Q.jsx)(`ul`,{"aria-label":l,className:u,children:d}),t[27]=l,t[28]=u,t[29]=d,t[30]=g):g=t[30];let v;t[31]!==s||t[32]!==f||t[33]!==g?(v=(0,Q.jsx)(s,{className:f,children:g}),t[31]=s,t[32]=f,t[33]=g,t[34]=v):v=t[34];let y;return t[35]!==c||t[36]!==p||t[37]!==m||t[38]!==h||t[39]!==v?(y=(0,Q.jsxs)(c,{defaultOpen:p,"data-testid":m,children:[h,v]}),t[35]=c,t[36]=p,t[37]=m,t[38]=h,t[39]=v,t[40]=y):y=t[40],y}var $n={words:0,chars:0,tokens:0},er=/[ -〿-ゟ゠-ヿ㐀-䶿一-鿿豈---ក-]/,tr=/[\p{L}\p{N}]/u,nr=new Set([`text`,`inlineCode`,`code`,`tag`]),rr=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),ir=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function ar(e,t){if(!e)return;let n=e.type;if(!rr.has(n)){if(nr.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
|
|
4
4
|
`));return}if(n===`wikiLink`||n===`wikiLinkEmbed`){let n=e.data?.alias??e.value??``;n&&t.push(n);return}if(Array.isArray(e.children)){for(let n of e.children)ar(n,t);if(ir.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
|
package/dist/public/assets/{use-activity-panel-D9D0qVT-.js → use-activity-panel-CwELvNbY.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{i as t}from"./DocumentContext-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{i as t}from"./DocumentContext-DQRTQdaE.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{j as i}from"./CodeMirrorPropInput-yJZmvoN3.js";import{ft as a,i as o,r as s}from"./dist-lf4nG52q2.js";import{d as c}from"./documents-events-Bz6CFw_P.js";import{n as l}from"./agent-presence-DspgbUIJ.js";import{t as u}from"./lru-string-cache-DXyh0UqD.js";var d=r(),f=e(n(),1),p=500,m=64;async function h(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new i(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=a.safeParse(r);throw e.success?Error(e.data.title):new i(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let o=s.safeParse(r);if(!o.success)throw new i(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:o.error,status:n.status});return o.data}async function g(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&keptCount=${n}`,s=await fetch(r),c;try{c=await s.json()}catch(e){throw new i(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:s.status})}if(!s.ok){let e=a.safeParse(c);throw e.success?Error(e.data.title):new i(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:s.status})}let l=o.safeParse(c);if(!l.success)throw new i(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:l.error,status:s.status});let{diff:u,before:d,after:f}=l.data;return{diff:u,before:d,after:f}}function _(e){let n=(0,d.c)(23),{systemProvider:r}=t(),[i,a]=(0,f.useState)(null),[o,s]=(0,f.useState)(`idle`),[l,_]=(0,f.useState)(null),b;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=new u(m),n[0]=b):b=n[0];let x=(0,f.useRef)(b),S=(0,f.useRef)(0),C;n[1]===r?C=n[2]:(C=e=>{let t=S.current+=1;s(`loading`),_(null),h(e).then(n=>{if(S.current!==t)return;let i=y(r,e);a({...n,writingDocs:i}),s(`ready`)}).catch(e=>{S.current===t&&(_(e instanceof Error?e.message:String(e)),s(`error`))})},n[1]=r,n[2]=C);let w=C,T;n[3]!==e||n[4]!==w?(T=()=>{if(!e){S.current+=1,a(null),s(`idle`),_(null),x.current.clear();return}x.current.clear(),w(e);let t=null,n=c(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,w(e)},p))});return()=>{t&&clearTimeout(t),n()}},n[3]=e,n[4]=w,n[5]=T):T=n[5];let E;n[6]===e?E=n[7]:(E=[e],n[6]=e,n[7]=E),(0,f.useEffect)(T,E);let D,O;n[8]!==e||n[9]!==r?(D=()=>{if(!e||!r)return;let t=()=>{if(!r.awareness)return;let t=y(r,e);a(e=>!e||v(e.writingDocs,t)?e:{...e,writingDocs:t})},n=r.awareness;if(!n||typeof n.on!=`function`){t();return}n.on(`update`,t),t();let i=setInterval(t,1e3);return()=>{clearInterval(i),typeof n.off==`function`&&n.off(`update`,t)}},O=[e,r],n[8]=e,n[9]=r,n[10]=D,n[11]=O):(D=n[10],O=n[11]),(0,f.useEffect)(D,O);let k;n[12]===e?k=n[13]:(k=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=x.current.get(r);if(i!==void 0)return i;let{diff:a}=await g(e,t,n);return x.current.set(r,a),a},n[12]=e,n[13]=k);let A=k,j;n[14]!==e||n[15]!==w?(j=()=>{e&&w(e)},n[14]=e,n[15]=w,n[16]=j):j=n[16];let M=j,N;return n[17]!==i||n[18]!==l||n[19]!==A||n[20]!==M||n[21]!==o?(N={data:i,status:o,error:l,reload:M,fetchBurstDiff:A},n[17]=i,n[18]=l,n[19]=A,n[20]=M,n[21]=o,n[22]=N):N=n[22],N}function v(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function y(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!l(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}export{_ as n,g as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./DocumentContext-
|
|
1
|
+
import{i as e}from"./DocumentContext-DQRTQdaE.js";import{t}from"./compiler-runtime-BfE3aGVn.js";import{Va as n}from"./dist-lf4nG52q2.js";import{n as r}from"./dist-Dr52ya0i.js";import{t as i}from"./dist-D1YpGD7x.js";import{f as a,x as o}from"./doc-paths-D9TaK83y.js";import{G as s}from"./navigation-targets-CIvGC6UT.js";import{m as c}from"./skills-api-DF632dit.js";import{t as l}from"./use-skills-CjgBfNqJ.js";var u=t();function d(){let t=(0,u.c)(4),{openTarget:d}=e(),f=l(),p;return t[0]!==d||t[1]!==f.data||t[2]!==f.status?(p=(e,t,l)=>{let u=e=>{d({kind:`doc`,target:e,docName:e},l?.replaceActive?{tabBehavior:`replace-active`}:void 0),o(a(e))},p=f.status===`ready`?f.data.find(n=>n.scope===e&&n.name===t):void 0;if(p)return u(s(p));if(e===`project`&&l?.path)return u(l.path.replace(/\.mdx?$/i,``));if(e===`global`)return u(n(e,t));(async()=>{try{let n=await c(`project`);if(!n.ok){r.error(i._({id:`IO8REi`,values:{0:n.error,name:t}}));return}let a=n.skills.find(n=>n.scope===e&&n.name===t);if(!a){r.error(i._({id:`9uRLEH`,values:{name:t}}));return}u(s(a))}catch(e){let n=e;r.error(i._({id:`IO8REi`,values:{0:n instanceof Error?n.message:String(n),name:t}}))}})()},t[0]=d,t[1]=f.data,t[2]=f.status,t[3]=p):p=t[3],p}export{d as t};
|
package/dist/public/assets/{use-skill-directory-ByVFCtzx.js → use-skill-directory-B03ue0No.js}
RENAMED
|
@@ -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"./useQuery-ZeEDLtxh.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-D3xSRfT4.js";import{t as c}from"./createLucideIcon-wbFLvDA-.js";import{t as l}from"./check-D1JmbeH0.js";import{t as u}from"./badge-BTPyRUGW.js";import{o as d}from"./skills-api-DF632dit.js";import{t as f}from"./use-skills-CjgBfNqJ.js";import{t as p}from"./use-open-skill-
|
|
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"./useQuery-ZeEDLtxh.js";import{t as o}from"./compiler-runtime-BfE3aGVn.js";import{t as s}from"./button-D3xSRfT4.js";import{t as c}from"./createLucideIcon-wbFLvDA-.js";import{t as l}from"./check-D1JmbeH0.js";import{t as u}from"./badge-BTPyRUGW.js";import{o as d}from"./skills-api-DF632dit.js";import{t as f}from"./use-skills-CjgBfNqJ.js";import{t as p}from"./use-open-skill-BSfRSbaQ.js";import{n as m}from"./open-managed-artifact-tab-DvNiFkHO.js";var h=[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]],g=c(`package`,h),_=e(n(),1),v=o(),y=t();function b(e){let t=(0,v.c)(27),{name:n,description:r,onOpen:a,action:o,meta:c,leading:l}=e,{_:u}=i(),d;t[0]===n?d=t[1]:(d=(0,y.jsx)(`div`,{className:`truncate font-medium text-sm`,children:n}),t[0]=n,t[1]=d);let f=d,p;t[2]!==u||t[3]!==n?(p=u({id:`9_euHO`,values:{name:n}}),t[2]=u,t[3]=n,t[4]=p):p=t[4];let m;t[5]!==a||t[6]!==p?(m=(0,y.jsx)(s,{variant:`ghost`,"aria-label":p,onClick:a,className:`absolute inset-0 h-auto w-full rounded-xl p-0 opacity-0`}),t[5]=a,t[6]=p,t[7]=m):m=t[7];let h;t[8]===l?h=t[9]:(h=l?(0,y.jsx)(`div`,{className:`shrink-0`,children:l}):null,t[8]=l,t[9]=h);let g;t[10]!==c||t[11]!==f?(g=(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,c]}),t[10]=c,t[11]=f,t[12]=g):g=t[12];let _;t[13]===o?_=t[14]:(_=(0,y.jsx)(`div`,{className:`relative z-10 shrink-0`,children:o}),t[13]=o,t[14]=_);let b;t[15]!==h||t[16]!==g||t[17]!==_?(b=(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[h,g,_]}),t[15]=h,t[16]=g,t[17]=_,t[18]=b):b=t[18];let x;t[19]===r?x=t[20]:(x=r?(0,y.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground text-xs leading-relaxed`,children:r}):null,t[19]=r,t[20]=x);let S;t[21]!==b||t[22]!==x?(S=(0,y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[b,x]}),t[21]=b,t[22]=x,t[23]=S):S=t[23];let C;return t[24]!==m||t[25]!==S?(C=(0,y.jsxs)(`li`,{className:`relative rounded-xl border border-border bg-card p-4 transition-colors hover:border-border/60 hover:bg-accent/40 focus-within:ring-2 focus-within:ring-ring`,children:[m,S]}),t[24]=m,t[25]=S,t[26]=C):C=t[26],C}function x(e,t){return new Intl.NumberFormat(t||void 0,{notation:`compact`,compactDisplay:`short`}).format(e)}function S(e){let t=(0,v.c)(4),{login:n}=e,[r,i]=(0,_.useState)(!0);if(n&&r){let e=`https://github.com/${encodeURIComponent(n)}.png?size=96`,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>i(!1),t[0]=r):r=t[0];let a;return t[1]===e?a=t[2]:(a=(0,y.jsx)(`img`,{src:e,alt:``,loading:`lazy`,className:`size-10 rounded border border-border bg-background object-cover`,onError:r}),t[1]=e,t[2]=a),a}let a;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,y.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded border border-border bg-muted text-muted-foreground`,children:(0,y.jsx)(g,{className:`size-5`,"aria-hidden":!0})}),t[3]=a):a=t[3],a}function C(e){let t=(0,v.c)(22),{result:n,imported:a,onOpen:o}=e,{i18n:s}=i(),c;t[0]===n.publisher?c=t[1]:(c=(0,y.jsx)(S,{login:n.publisher}),t[0]=n.publisher,t[1]=c);let d;t[2]===a?d=t[3]:(d=a?(0,y.jsxs)(u,{variant:`primary`,className:`gap-1`,children:[(0,y.jsx)(l,{"aria-hidden":!0}),(0,y.jsx)(r,{id:`hp8OtS`})]}):null,t[2]=a,t[3]=d);let f=n.publisher??n.source,p;t[4]===f?p=t[5]:(p=(0,y.jsx)(`span`,{className:`truncate`,children:f}),t[4]=f,t[5]=p);let m;t[6]===n.publisher?m=t[7]:(m=n.publisher===`openknowledge`||n.publisher===`inkeep`?(0,y.jsx)(u,{variant:`secondary`,className:`h-4 px-1 text-[10px] uppercase tracking-wide`,children:(0,y.jsx)(r,{id:`o0bHtA`})}):null,t[6]=n.publisher,t[7]=m);let h;t[8]!==s||t[9]!==n.installs?(h=n.installs==null?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,y.jsxs)(`span`,{className:`shrink-0`,children:[(0,y.jsx)(`span`,{"aria-hidden":`true`,children:`↓ `}),(0,y.jsxs)(`span`,{className:`sr-only`,children:[(0,y.jsx)(r,{id:`7m3Ade`}),` `]}),x(n.installs,s.locale)]})]}),t[8]=s,t[9]=n.installs,t[10]=h):h=t[10];let g;t[11]!==p||t[12]!==m||t[13]!==h?(g=(0,y.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5 text-muted-foreground text-xs`,children:[p,m,h]}),t[11]=p,t[12]=m,t[13]=h,t[14]=g):g=t[14];let _;return t[15]!==o||t[16]!==n.description||t[17]!==n.name||t[18]!==c||t[19]!==d||t[20]!==g?(_=(0,y.jsx)(b,{name:n.name,description:n.description,onOpen:o,leading:c,action:d,meta:g}),t[15]=o,t[16]=n.description,t[17]=n.name,t[18]=c,t[19]=d,t[20]=g,t[21]=_):_=t[21],_}function w(){let e=(0,v.c)(7),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:[`skills`,`popular`],queryFn:T,staleTime:3e5},e[0]=t):t=e[0];let{data:n,isPending:r,isError:i}=a(t),o;e[1]===n?o=e[2]:(o=n??[],e[1]=n,e[2]=o);let s;return e[3]!==i||e[4]!==r||e[5]!==o?(s={skills:o,isPending:r,failed:i},e[3]=i,e[4]=r,e[5]=o,e[6]=s):s=e[6],s}async function T(){let e=await d();if(!e.ok)throw Error(e.error);return e.results}function E(e,t){return e.find(e=>e.origin?.source===t.source&&(e.name===t.name||e.name===`${t.name}-imported`||e.name.startsWith(`${t.name}-imported-`)))??null}function D(e){let t=(0,v.c)(15),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{scope:r,onNavigate:i}=n,a=p(),o=f(),s;t[2]!==o.data||t[3]!==o.status?(s=o.status===`ready`?o.data.filter(O):[],t[2]=o.data,t[3]=o.status,t[4]=s):s=t[4];let c=s,l;t[5]===c?l=t[6]:(l=e=>E(c,e),t[5]=c,t[6]=l);let u=l,d;t[7]!==u||t[8]!==i||t[9]!==a||t[10]!==r?(d=function(e){i?.();let t=u(e);if(t){a(t.scope,t.name);return}m({flavor:`explore`,source:e.source,name:e.name,subtitle:e.source,level:r})},t[7]=u,t[8]=i,t[9]=a,t[10]=r,t[11]=d):d=t[11];let h=d,g;return t[12]!==u||t[13]!==h?(g={importedEntry:u,openResult:h},t[12]=u,t[13]=h,t[14]=g):g=t[14],g}function O(e){return e.origin}export{h as a,g as i,w as n,C as r,D as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{h as r,i}from"./DocumentContext-BYAIHlLG.js";import{t as a}from"./react-f2sANaYj.js";import{t as o}from"./react-dom-DPxgxlDT.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{A as c,et as l,q as u}from"./CodeMirrorPropInput-yJZmvoN3.js";import{$i as d,Hi as f,Ki as p,Ua as m,Vi as h,W as g,Zi as _,gi as v,ki as y,na as b,qi as x,ra as S,ta as C}from"./dist-lf4nG52q2.js";import{t as ee}from"./libesm-COuF-Ycc.js";var w=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.unescapeToken=t,e.escapeToken=n;function t(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function n(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.Pointer=function(){function e(e){e===void 0&&(e=[``]),this.tokens=e}return e.fromJSON=function(n){var r=n.split(`/`).map(t);if(r[0]!==``)throw Error(`Invalid JSON Pointer: ${n}`);return new e(r)},e.prototype.toString=function(){return this.tokens.map(n).join(`/`)},e.prototype.evaluate=function(e){for(var t=null,n=``,r=e,i=1,a=this.tokens.length;i<a;i++)t=r,n=this.tokens[i],!(n==`__proto__`||n==`constructor`||n==`prototype`)&&(r=(t||{})[n]);return{parent:t,key:n,value:r}},e.prototype.get=function(e){return this.evaluate(e).value},e.prototype.set=function(e,t){var n=this.evaluate(e);n.parent&&(n.parent[n.key]=t)},e.prototype.push=function(e){this.tokens.push(e)},e.prototype.add=function(t){return new e(this.tokens.concat(String(t)))},e.prototype.parent=function(){return new e(this.tokens.length>1?this.tokens.slice(0,-1):[``])},e}()})),T=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hasOwnProperty=void 0,e.objectType=t,e.clone=r,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(e){return e===void 0?`undefined`:e===null?`null`:Array.isArray(e)?`array`:typeof e}function n(e){return typeof e==`object`&&!!e}function r(t){if(!n(t))return t;if(t.constructor==Array){for(var i=t.length,a=Array(i),o=0;o<i;o++)a[o]=r(t[o]);return a}if(t.constructor==Date)return new Date(+t);var s={};for(var c in t)e.hasOwnProperty.call(t,c)&&(s[c]=r(t[c]));return s}})),E=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isDestructive=n,e.subtract=r,e.intersection=i,e.diffArrays=l,e.diffObjects=u,e.diffAny=d;var t=T();function n(e){var t=e.op;return t===`remove`||t===`replace`||t===`copy`||t===`move`}function r(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&!(t.hasOwnProperty.call(n,i)&&n[i]!==void 0)&&r.push(i);return r}function i(e){for(var n=e.length,r={},i=0;i<n;i++){var a=e[i];for(var o in a)t.hasOwnProperty.call(a,o)&&a[o]!==void 0&&(r[o]=(r[o]||0)+1)}for(var o in r)r[o]<n&&delete r[o];return Object.keys(r)}function a(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&t.hasOwnProperty.call(n,i)&&n[i]!==void 0&&r.push(i);return r}function o(e){return e.op===`add`}function s(e){return e.op===`remove`}function c(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function l(e,t,n,r){r===void 0&&(r=d);var i=Math.max(e.length,t.length),a=new Map([[0,{operations:[],cost:0}]]);function l(o,s){var u=o*i+s,d=a.get(u);if(d===void 0){if(o>0&&s>0&&!r(e[o-1],t[s-1],n.add(String(o-1))).length)d=l(o-1,s-1);else{var f=[];if(o>0){var p=l(o-1,s),m={op:`remove`,index:o-1};f.push(c(p,m))}if(s>0){var h=l(o,s-1),g={op:`add`,index:o-1,value:t[s-1]};f.push(c(h,g))}if(o>0&&s>0){var _=l(o-1,s-1),v={op:`replace`,index:o-1,original:e[o-1],value:t[s-1]};f.push(c(_,v))}d=f.sort(function(e,t){return e.cost-t.cost})[0]}a.set(u,d)}return d}var u=isNaN(e.length)||e.length<=0?0:e.length;return l(u,isNaN(t.length)||t.length<=0?0:t.length).operations.reduce(function(e,t){var i=e[0],a=e[1];if(o(t)){var c=t.index+1+a,l=c<u+a?String(c):`-`,d={op:t.op,path:n.add(l).toString(),value:t.value};return[i.concat(d),a+1]}else if(s(t)){var d={op:t.op,path:n.add(String(t.index+a)).toString()};return[i.concat(d),a-1]}else{var f=n.add(String(t.index+a)),p=r(t.original,t.value,f);return[i.concat.apply(i,p),a]}},[[],0])[0]}function u(e,t,n,i){i===void 0&&(i=d);var o=[];return r(e,t).forEach(function(e){o.push({op:`remove`,path:n.add(e).toString()})}),r(t,e).forEach(function(e){o.push({op:`add`,path:n.add(e).toString(),value:t[e]})}),a(e,t).forEach(function(r){o.push.apply(o,i(e[r],t[r],n.add(r)))}),o}function d(e,n,r,i){if(i===void 0&&(i=d),e===n)return[];var a=(0,t.objectType)(e),o=(0,t.objectType)(n);return a==`array`&&o==`array`?l(e,n,r,i):a==`object`&&o==`object`?u(e,n,r,i):[{op:`replace`,path:r.toString(),value:n}]}})),te=t((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.InvalidOperationError=e.TestError=e.MissingError=void 0,e.add=l,e.remove=u,e.replace=d,e.move=f,e.copy=p,e.test=m,e.apply=g;var n=w(),r=T(),i=E(),a=function(e){t(n,e);function n(t){var n=e.call(this,`Value required at path: ${t}`)||this;return n.path=t,n.name=`MissingError`,n}return n}(Error);e.MissingError=a;var o=function(e){t(n,e);function n(t,n){var r=e.call(this,`Test failed: ${t} != ${n}`)||this;return r.actual=t,r.expected=n,r.name=`TestError`,r}return n}(Error);e.TestError=o;function s(e,t,n){if(Array.isArray(e))if(t==`-`)e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function c(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function l(e,t,i){var o=n.Pointer.fromJSON(t.path);if(i?.implicitArrayCreation&&o.tokens[o.tokens.length-1]===`-`){var c=o.parent().evaluate(e);c.value===void 0&&(0,r.objectType)(c.parent)===`object`&&(c.parent[c.key]=[])}var l=o.evaluate(e);return l.parent===void 0||i?.implicitArrayCreation&&l.key===`-`&&!Array.isArray(l.parent)?new a(t.path):(s(l.parent,l.key,(0,r.clone)(t.value)),null)}function u(e,t,r){var i=n.Pointer.fromJSON(t.path).evaluate(e);return i.value===void 0?new a(t.path):(c(i.parent,i.key),null)}function d(e,t,i){var o=n.Pointer.fromJSON(t.path).evaluate(e);if(o.parent===null)return new a(t.path);if(Array.isArray(o.parent)){if(parseInt(o.key,10)>=o.parent.length)return new a(t.path)}else if(o.value===void 0)return new a(t.path);return o.parent[o.key]=(0,r.clone)(t.value),null}function f(e,t,r){var i=n.Pointer.fromJSON(t.from).evaluate(e);if(i.value===void 0)return new a(t.from);var o=n.Pointer.fromJSON(t.path).evaluate(e);return o.parent===void 0?new a(t.path):(c(i.parent,i.key),s(o.parent,o.key,i.value),null)}function p(e,t,i){var o=n.Pointer.fromJSON(t.from).evaluate(e);if(o.value===void 0)return new a(t.from);var c=n.Pointer.fromJSON(t.path).evaluate(e);return c.parent===void 0?new a(t.path):(s(c.parent,c.key,(0,r.clone)(o.value)),null)}function m(e,t,r){var a=n.Pointer.fromJSON(t.path).evaluate(e);return(0,i.diffAny)(a.value,t.value,new n.Pointer).length?new o(a.value,t.value):null}var h=function(e){t(n,e);function n(t){var n=e.call(this,`Invalid operation: ${t.op}`)||this;return n.operation=t,n.name=`InvalidOperationError`,n}return n}(Error);e.InvalidOperationError=h;function g(e,t,n){switch(t.op){case`add`:return l(e,t,n);case`remove`:return u(e,t,n);case`replace`:return d(e,t,n);case`move`:return f(e,t,n);case`copy`:return p(e,t,n);case`test`:return m(e,t,n)}return new h(t)}})),ne=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=w();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=te(),r=E();function i(e,t,r){return t.map(function(t){return(0,n.apply)(e,t,r)})}function a(e){function t(n,i,a){var o=e(n,i,a);return Array.isArray(o)?o:(0,r.diffAny)(n,i,a,t)}return t}function o(e,n,i){var o=new t.Pointer;return(i?a(i):r.diffAny)(e,n,o)}})),D=e(a(),1),re=e(o(),1),O=s(),k=ne();function A(){}A.prototype={diff:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.callback;typeof n==`function`&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout(function(){r(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var o=t.length,s=e.length,c=1,l=o+s;n.maxEditLength&&(l=Math.min(l,n.maxEditLength));var u=n.timeout??1/0,d=Date.now()+u,f=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(f[0],t,e,0);if(f[0].oldPos+1>=s&&p+1>=o)return a([{value:this.join(t),count:t.length}]);var m=-1/0,h=1/0;function g(){for(var n=Math.max(m,-c);n<=Math.min(h,c);n+=2){var r=void 0,l=f[n-1],u=f[n+1];l&&(f[n-1]=void 0);var d=!1;if(u){var g=u.oldPos-n;d=u&&0<=g&&g<o}var _=l&&l.oldPos+1<s;if(!d&&!_){f[n]=void 0;continue}if(r=!_||d&&l.oldPos+1<u.oldPos?i.addToPath(u,!0,void 0,0):i.addToPath(l,void 0,!0,1),p=i.extractCommon(r,t,e,n),r.oldPos+1>=s&&p+1>=o)return a(ie(i,r.lastComponent,t,e,i.useLongestToken));f[n]=r,r.oldPos+1>=s&&(h=Math.min(h,n-1)),p+1>=o&&(m=Math.max(m,n+1))}c++}if(r)(function e(){setTimeout(function(){if(c>l||Date.now()>d)return r();g()||e()},0)})();else for(;c<=l&&Date.now()<=d;){var _=g();if(_)return _}},addToPath:function(e,t,n,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}},extractCommon:function(e,t,n,r){for(var i=t.length,a=n.length,o=e.oldPos,s=o-r,c=0;s+1<i&&o+1<a&&this.equals(t[s+1],n[o+1]);)s++,o++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=o,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split(``)},join:function(e){return e.join(``)}};function ie(e,t,n,r,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,c=a.length,l=0,u=0;s<c;s++){var d=a[s];if(!d.removed){if(!d.added&&i){var f=n.slice(l,l+d.count);f=f.map(function(e,t){var n=r[u+t];return n.length>e.length?n:e}),d.value=e.join(f)}else d.value=e.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}else if(d.value=e.join(r.slice(u,u+d.count)),u+=d.count,s&&a[s-1].added){var p=a[s-1];a[s-1]=a[s],a[s]=p}}var m=a[c-1];return c>1&&typeof m.value==`string`&&(m.added||m.removed)&&e.equals(``,m.value)&&(a[c-2].value+=m.value,a.pop()),a}var j=new A;function ae(e,t,n){return j.diff(e,t,n)}var M=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,N=/\S/,P=new A;P.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!N.test(e)&&!N.test(t)},P.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&M.test(t[n])&&M.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function oe(e,t,n){return P.diff(e,t,n)}var F=new A;F.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
1
|
+
import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{h as r,i}from"./DocumentContext-DQRTQdaE.js";import{t as a}from"./react-f2sANaYj.js";import{t as o}from"./react-dom-DPxgxlDT.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{A as c,et as l,q as u}from"./CodeMirrorPropInput-yJZmvoN3.js";import{$i as d,Hi as f,Ki as p,Ua as m,Vi as h,W as g,Zi as _,gi as v,ki as y,na as b,qi as x,ra as S,ta as C}from"./dist-lf4nG52q2.js";import{t as ee}from"./libesm-COuF-Ycc.js";var w=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.unescapeToken=t,e.escapeToken=n;function t(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function n(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.Pointer=function(){function e(e){e===void 0&&(e=[``]),this.tokens=e}return e.fromJSON=function(n){var r=n.split(`/`).map(t);if(r[0]!==``)throw Error(`Invalid JSON Pointer: ${n}`);return new e(r)},e.prototype.toString=function(){return this.tokens.map(n).join(`/`)},e.prototype.evaluate=function(e){for(var t=null,n=``,r=e,i=1,a=this.tokens.length;i<a;i++)t=r,n=this.tokens[i],!(n==`__proto__`||n==`constructor`||n==`prototype`)&&(r=(t||{})[n]);return{parent:t,key:n,value:r}},e.prototype.get=function(e){return this.evaluate(e).value},e.prototype.set=function(e,t){var n=this.evaluate(e);n.parent&&(n.parent[n.key]=t)},e.prototype.push=function(e){this.tokens.push(e)},e.prototype.add=function(t){return new e(this.tokens.concat(String(t)))},e.prototype.parent=function(){return new e(this.tokens.length>1?this.tokens.slice(0,-1):[``])},e}()})),T=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hasOwnProperty=void 0,e.objectType=t,e.clone=r,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(e){return e===void 0?`undefined`:e===null?`null`:Array.isArray(e)?`array`:typeof e}function n(e){return typeof e==`object`&&!!e}function r(t){if(!n(t))return t;if(t.constructor==Array){for(var i=t.length,a=Array(i),o=0;o<i;o++)a[o]=r(t[o]);return a}if(t.constructor==Date)return new Date(+t);var s={};for(var c in t)e.hasOwnProperty.call(t,c)&&(s[c]=r(t[c]));return s}})),E=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isDestructive=n,e.subtract=r,e.intersection=i,e.diffArrays=l,e.diffObjects=u,e.diffAny=d;var t=T();function n(e){var t=e.op;return t===`remove`||t===`replace`||t===`copy`||t===`move`}function r(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&!(t.hasOwnProperty.call(n,i)&&n[i]!==void 0)&&r.push(i);return r}function i(e){for(var n=e.length,r={},i=0;i<n;i++){var a=e[i];for(var o in a)t.hasOwnProperty.call(a,o)&&a[o]!==void 0&&(r[o]=(r[o]||0)+1)}for(var o in r)r[o]<n&&delete r[o];return Object.keys(r)}function a(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&t.hasOwnProperty.call(n,i)&&n[i]!==void 0&&r.push(i);return r}function o(e){return e.op===`add`}function s(e){return e.op===`remove`}function c(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function l(e,t,n,r){r===void 0&&(r=d);var i=Math.max(e.length,t.length),a=new Map([[0,{operations:[],cost:0}]]);function l(o,s){var u=o*i+s,d=a.get(u);if(d===void 0){if(o>0&&s>0&&!r(e[o-1],t[s-1],n.add(String(o-1))).length)d=l(o-1,s-1);else{var f=[];if(o>0){var p=l(o-1,s),m={op:`remove`,index:o-1};f.push(c(p,m))}if(s>0){var h=l(o,s-1),g={op:`add`,index:o-1,value:t[s-1]};f.push(c(h,g))}if(o>0&&s>0){var _=l(o-1,s-1),v={op:`replace`,index:o-1,original:e[o-1],value:t[s-1]};f.push(c(_,v))}d=f.sort(function(e,t){return e.cost-t.cost})[0]}a.set(u,d)}return d}var u=isNaN(e.length)||e.length<=0?0:e.length;return l(u,isNaN(t.length)||t.length<=0?0:t.length).operations.reduce(function(e,t){var i=e[0],a=e[1];if(o(t)){var c=t.index+1+a,l=c<u+a?String(c):`-`,d={op:t.op,path:n.add(l).toString(),value:t.value};return[i.concat(d),a+1]}else if(s(t)){var d={op:t.op,path:n.add(String(t.index+a)).toString()};return[i.concat(d),a-1]}else{var f=n.add(String(t.index+a)),p=r(t.original,t.value,f);return[i.concat.apply(i,p),a]}},[[],0])[0]}function u(e,t,n,i){i===void 0&&(i=d);var o=[];return r(e,t).forEach(function(e){o.push({op:`remove`,path:n.add(e).toString()})}),r(t,e).forEach(function(e){o.push({op:`add`,path:n.add(e).toString(),value:t[e]})}),a(e,t).forEach(function(r){o.push.apply(o,i(e[r],t[r],n.add(r)))}),o}function d(e,n,r,i){if(i===void 0&&(i=d),e===n)return[];var a=(0,t.objectType)(e),o=(0,t.objectType)(n);return a==`array`&&o==`array`?l(e,n,r,i):a==`object`&&o==`object`?u(e,n,r,i):[{op:`replace`,path:r.toString(),value:n}]}})),te=t((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.InvalidOperationError=e.TestError=e.MissingError=void 0,e.add=l,e.remove=u,e.replace=d,e.move=f,e.copy=p,e.test=m,e.apply=g;var n=w(),r=T(),i=E(),a=function(e){t(n,e);function n(t){var n=e.call(this,`Value required at path: ${t}`)||this;return n.path=t,n.name=`MissingError`,n}return n}(Error);e.MissingError=a;var o=function(e){t(n,e);function n(t,n){var r=e.call(this,`Test failed: ${t} != ${n}`)||this;return r.actual=t,r.expected=n,r.name=`TestError`,r}return n}(Error);e.TestError=o;function s(e,t,n){if(Array.isArray(e))if(t==`-`)e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function c(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function l(e,t,i){var o=n.Pointer.fromJSON(t.path);if(i?.implicitArrayCreation&&o.tokens[o.tokens.length-1]===`-`){var c=o.parent().evaluate(e);c.value===void 0&&(0,r.objectType)(c.parent)===`object`&&(c.parent[c.key]=[])}var l=o.evaluate(e);return l.parent===void 0||i?.implicitArrayCreation&&l.key===`-`&&!Array.isArray(l.parent)?new a(t.path):(s(l.parent,l.key,(0,r.clone)(t.value)),null)}function u(e,t,r){var i=n.Pointer.fromJSON(t.path).evaluate(e);return i.value===void 0?new a(t.path):(c(i.parent,i.key),null)}function d(e,t,i){var o=n.Pointer.fromJSON(t.path).evaluate(e);if(o.parent===null)return new a(t.path);if(Array.isArray(o.parent)){if(parseInt(o.key,10)>=o.parent.length)return new a(t.path)}else if(o.value===void 0)return new a(t.path);return o.parent[o.key]=(0,r.clone)(t.value),null}function f(e,t,r){var i=n.Pointer.fromJSON(t.from).evaluate(e);if(i.value===void 0)return new a(t.from);var o=n.Pointer.fromJSON(t.path).evaluate(e);return o.parent===void 0?new a(t.path):(c(i.parent,i.key),s(o.parent,o.key,i.value),null)}function p(e,t,i){var o=n.Pointer.fromJSON(t.from).evaluate(e);if(o.value===void 0)return new a(t.from);var c=n.Pointer.fromJSON(t.path).evaluate(e);return c.parent===void 0?new a(t.path):(s(c.parent,c.key,(0,r.clone)(o.value)),null)}function m(e,t,r){var a=n.Pointer.fromJSON(t.path).evaluate(e);return(0,i.diffAny)(a.value,t.value,new n.Pointer).length?new o(a.value,t.value):null}var h=function(e){t(n,e);function n(t){var n=e.call(this,`Invalid operation: ${t.op}`)||this;return n.operation=t,n.name=`InvalidOperationError`,n}return n}(Error);e.InvalidOperationError=h;function g(e,t,n){switch(t.op){case`add`:return l(e,t,n);case`remove`:return u(e,t,n);case`replace`:return d(e,t,n);case`move`:return f(e,t,n);case`copy`:return p(e,t,n);case`test`:return m(e,t,n)}return new h(t)}})),ne=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=w();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=te(),r=E();function i(e,t,r){return t.map(function(t){return(0,n.apply)(e,t,r)})}function a(e){function t(n,i,a){var o=e(n,i,a);return Array.isArray(o)?o:(0,r.diffAny)(n,i,a,t)}return t}function o(e,n,i){var o=new t.Pointer;return(i?a(i):r.diffAny)(e,n,o)}})),D=e(a(),1),re=e(o(),1),O=s(),k=ne();function A(){}A.prototype={diff:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.callback;typeof n==`function`&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout(function(){r(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var o=t.length,s=e.length,c=1,l=o+s;n.maxEditLength&&(l=Math.min(l,n.maxEditLength));var u=n.timeout??1/0,d=Date.now()+u,f=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(f[0],t,e,0);if(f[0].oldPos+1>=s&&p+1>=o)return a([{value:this.join(t),count:t.length}]);var m=-1/0,h=1/0;function g(){for(var n=Math.max(m,-c);n<=Math.min(h,c);n+=2){var r=void 0,l=f[n-1],u=f[n+1];l&&(f[n-1]=void 0);var d=!1;if(u){var g=u.oldPos-n;d=u&&0<=g&&g<o}var _=l&&l.oldPos+1<s;if(!d&&!_){f[n]=void 0;continue}if(r=!_||d&&l.oldPos+1<u.oldPos?i.addToPath(u,!0,void 0,0):i.addToPath(l,void 0,!0,1),p=i.extractCommon(r,t,e,n),r.oldPos+1>=s&&p+1>=o)return a(ie(i,r.lastComponent,t,e,i.useLongestToken));f[n]=r,r.oldPos+1>=s&&(h=Math.min(h,n-1)),p+1>=o&&(m=Math.max(m,n+1))}c++}if(r)(function e(){setTimeout(function(){if(c>l||Date.now()>d)return r();g()||e()},0)})();else for(;c<=l&&Date.now()<=d;){var _=g();if(_)return _}},addToPath:function(e,t,n,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}},extractCommon:function(e,t,n,r){for(var i=t.length,a=n.length,o=e.oldPos,s=o-r,c=0;s+1<i&&o+1<a&&this.equals(t[s+1],n[o+1]);)s++,o++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=o,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split(``)},join:function(e){return e.join(``)}};function ie(e,t,n,r,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,c=a.length,l=0,u=0;s<c;s++){var d=a[s];if(!d.removed){if(!d.added&&i){var f=n.slice(l,l+d.count);f=f.map(function(e,t){var n=r[u+t];return n.length>e.length?n:e}),d.value=e.join(f)}else d.value=e.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}else if(d.value=e.join(r.slice(u,u+d.count)),u+=d.count,s&&a[s-1].added){var p=a[s-1];a[s-1]=a[s],a[s]=p}}var m=a[c-1];return c>1&&typeof m.value==`string`&&(m.added||m.removed)&&e.equals(``,m.value)&&(a[c-2].value+=m.value,a.pop()),a}var j=new A;function ae(e,t,n){return j.diff(e,t,n)}var M=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,N=/\S/,P=new A;P.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!N.test(e)&&!N.test(t)},P.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&M.test(t[n])&&M.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function oe(e,t,n){return P.diff(e,t,n)}var F=new A;F.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
2
2
|
`));var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var r=0;r<n.length;r++){var i=n[r];r%2&&!this.options.newlineIsToken?t[t.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),t.push(i))}return t};var I=new A;I.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var se=new A;se.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function L(e){"@babel/helpers - typeof";return L=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},L(e)}var ce=Object.prototype.toString,R=new A;R.useLongestToken=!0,R.tokenize=F.tokenize,R.castInput=function(e){var t=this.options,n=t.undefinedReplacement,r=t.stringifyReplacer,i=r===void 0?function(e,t){return t===void 0?n:t}:r;return typeof e==`string`?e:JSON.stringify(z(e,null,null,i),i,` `)},R.equals=function(e,t){return A.prototype.equals.call(R,e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`))};function z(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i,e));var a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];var o;if(ce.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=z(e[a],t,n,r,i);return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),L(e)===`object`&&e!==null){t.push(e),o={},n.push(o);var s=[],c;for(c in e)e.hasOwnProperty(c)&&s.push(c);for(s.sort(),a=0;a<s.length;a+=1)c=s[a],o[c]=z(e[c],t,n,r,c);t.pop(),n.pop()}else o=e;return o}var B=new A;B.tokenize=function(e){return e.slice()},B.join=B.removeEmpty=function(e){return e};function V(e,t){let n=t.content.findDiffStart(e.content);if(n===null)return!1;let{a:r,b:i}=t.content.findDiffEnd(e.content),a=n-Math.min(r,i);return a>0&&(e.resolve(n-a).depth<t.resolve(r+a).depth?n-=a:(r+=a,i+=a)),new C(n,i,t.slice(n,r))}function le(e){if(!e.steps.length)return;let t=new b(e.docs[0]),n=e.steps.slice();for(;n.length;){let e=n.shift();for(;n.length&&e.merge(n[0]);){let r=n.shift();e=e instanceof C&&r instanceof C?V(t.doc,r.apply(e.apply(t.doc).doc).doc):e.merge(r)}t.step(e)}return t}function H(e){let t=new b(e);return t.removeMark(0,e.nodeSize-2),t.doc}function U(e,t){let n=t.split(`/`);for(n.shift();n.length;){if(typeof e!=`object`)throw Error();let t=n.shift();e=e[t]}return e}function W(e){return JSON.parse(JSON.stringify(e))}var ue=class{fromDoc;toDoc;complexSteps;wordDiffs;simplifyDiff;schema;tr;currentJSON;finalJSON;ops;constructor(e,t,n={}){let r={complexSteps:!0,wordDiffs:!1,simplifyDiff:!0,...n};this.fromDoc=e,this.toDoc=t,this.complexSteps=r.complexSteps,this.wordDiffs=r.wordDiffs,this.simplifyDiff=r.simplifyDiff,this.schema=e.type.schema,this.tr=new b(e),this.currentJSON={},this.finalJSON={},this.ops=[]}init(){return this.complexSteps?(this.currentJSON=H(this.fromDoc).toJSON(),this.finalJSON=H(this.toDoc).toJSON(),this.ops=(0,k.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps(),this.recreateChangeMarkSteps()):(this.currentJSON=this.fromDoc.toJSON(),this.finalJSON=this.toDoc.toJSON(),this.ops=(0,k.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps()),this.simplifyDiff&&(this.tr=le(this.tr)||this.tr),this.tr}recreateChangeContentSteps(){let e=[];for(;this.ops.length;){let t=this.ops.shift();e.push(t);let n,r=W(this.currentJSON),i=t.path.split(`/`);for(;n==null;){(0,k.applyPatch)(r,[t]);try{n=this.schema.nodeFromJSON(r),n.check()}catch{if(n=null,this.ops.length>0)t=this.ops.shift(),e.push(t);else throw Error(`No valid diff possible applying ${t.path}`)}}this.complexSteps&&e.length===1&&(i.includes(`attrs`)||i.includes(`type`))?(this.addSetNodeMarkup(),e=[]):e.length===1&&t.op===`replace`&&i[i.length-1]===`text`?(this.addReplaceTextSteps(t,r),e=[]):this.addReplaceStep(n,r)&&(e=[])}}addSetNodeMarkup(){let e=this.schema.nodeFromJSON(this.currentJSON),t=this.schema.nodeFromJSON(this.finalJSON),n=t.content.findDiffStart(e.content),r=e.nodeAt(n),i=t.nodeAt(n);if(n!=null){let e=r.type===i.type?null:i.type;try{this.tr.setNodeMarkup(n,e,i.attrs,i.marks)}catch(t){if(e&&t.message.includes(`Invalid content`))this.tr.replaceWith(n,n+r.nodeSize,i);else throw t}return this.currentJSON=H(this.tr.doc).toJSON(),this.ops=(0,k.createPatch)(this.currentJSON,this.finalJSON),!0}return!1}recreateChangeMarkSteps(){this.toDoc.descendants((e,t)=>{if(!e.isInline)return!0;this.tr.doc.nodesBetween(t,t+e.nodeSize,(n,r)=>{if(!n.isInline)return!0;let i=Math.max(t,r),a=Math.min(t+e.nodeSize,r+n.nodeSize);n.marks.forEach(t=>{t.isInSet(e.marks)||this.tr.removeMark(i,a,t)}),e.marks.forEach(e=>{e.isInSet(n.marks)||this.tr.addMark(i,a,e)})})})}addReplaceStep(e,t){let n=V(this.schema.nodeFromJSON(this.currentJSON),e);if(!n)return!1;if(!this.tr.maybeStep(n).failed)return this.currentJSON=t,!0;throw Error(`No valid step found.`)}addReplaceTextSteps(e,t){let n={...e,value:`xx`},r={...e,value:`yy`},i=W(this.currentJSON),a=W(this.currentJSON);(0,k.applyPatch)(i,[n]),(0,k.applyPatch)(a,[r]);let o=this.schema.nodeFromJSON(i),s=this.schema.nodeFromJSON(a),c=e.value,l=U(this.currentJSON,e.path),u=this.wordDiffs?oe(l,c):ae(l,c),d=o.content.findDiffStart(s.content),f=o.resolve(d+1).marks();for(;u.length;){let e=u.shift();if(e.added){let t=this.schema.nodeFromJSON({type:`text`,text:e.value}).mark(f);if(u.length&&u[0].removed){let e=u.shift();this.tr.replaceWith(d,d+e.value.length,t)}else this.tr.insert(d,t);d+=e.value.length}else if(e.removed)if(u.length&&u[0].added){let t=u.shift(),n=this.schema.nodeFromJSON({type:`text`,text:t.value}).mark(f);this.tr.replaceWith(d,d+e.value.length,n),d+=t.value.length}else this.tr.delete(d,d+e.value.length);else d+=e.value.length}this.currentJSON=t}};function de(e,t,n={}){return new ue(e,t,n).init()}var G=new Set([`list`,`bulletList`,`orderedList`,`taskList`]);function K(e){let t=[];return e.forEach((e,n)=>{if(G.has(e.type.name)){let r=n+1,i=0;e.forEach(e=>{let n=r+i;t.push({from:n,to:n+e.nodeSize,key:`${e.type.name}:${e.textContent}`}),i+=e.nodeSize})}else t.push({from:n,to:n+e.nodeSize,key:`${e.type.name}:${e.textContent}`})}),t}function fe(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=n-1;a>=0;a--)for(let n=r-1;n>=0;n--)i[a][n]=e[a].key===t[n].key?i[a+1][n+1]+1:Math.max(i[a+1][n],i[a][n+1]);let a=[],o=0,s=0;for(;o<n&&s<r;)e[o].key===t[s].key?(a.push({type:`same`,b:t[s]}),o++,s++):i[o+1][s]>=i[o][s+1]?(a.push({type:`del`,a:e[o]}),o++):(a.push({type:`ins`,b:t[s]}),s++);for(;o<n;)a.push({type:`del`,a:e[o++]});for(;s<r;)a.push({type:`ins`,b:t[s++]});return a}function pe(e,t){let n=fe(K(e),K(t)),r=[],i=0;for(let e of n)e.type===`same`?i=e.b.to:e.type===`ins`?(r.push({fromA:0,toA:0,fromB:e.b.from,toB:e.b.to}),i=e.b.to):r.push({fromA:e.a.from,toA:e.a.to,fromB:i,toB:i});return r}var me=400;function q(e,t,n){return t.nodeFromJSON(e.parseWithFallback(n))}function he(e,t){let n=t.filter(e=>e.toB>e.fromB),r=[];return e.steps.forEach((t,i)=>{let a=t instanceof _?`add`:t instanceof d?`remove`:null;if(a===null)return;let o=t,s=e.mapping.slice(i+1),c=s.map(o.from,-1),l=s.map(o.to,1);if(l<=c||n.some(e=>e.fromB<=c&&l<=e.toB))return;let u=e.mapping.slice(0,i).invert(),f=u.map(o.from),p=u.map(o.to);p<=f||r.push({fromA:f,toA:p,fromB:c,toB:l,markName:o.mark.type.name,kind:a})}),r}function ge(e,t,n,r){if(e.length>2e5||t.length>2e5)return{ok:!1,reason:`ceiling`};let i,a;try{i=q(r,n,e),a=q(r,n,t)}catch{return{ok:!1,reason:`parse`}}let o=a,s=null;try{s=de(i,a,{complexSteps:!0,wordDiffs:!0,simplifyDiff:!0}),o=s.doc}catch{}let c=pe(i,o),l=s?he(s,c):[];return c.length+l.length>me?{ok:!1,reason:`ceiling`}:{ok:!0,afterDoc:o,beforeDoc:i,changes:c,markChanges:l}}var _e=`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`;function ve(e){return e.changes.length+2*e.markChanges.length}function J(e){let t=!1;return e.forEach(e=>{e.isBlock&&(t=!0)}),t}function ye(e){if(e.childCount===0)return!1;let t=!0;return e.forEach(e=>{e.type.name!==`listItem`&&e.type.name!==`taskItem`&&(t=!1)}),t}function Y(e,t,n){let r=document.createElement(n?`div`:`span`);r.className=n?`ok-diff-del ok-diff-del-block`:`ok-diff-del`,r.setAttribute(`data-diff-deleted`,``);let i=e.serializeFragment(t);if(n&&ye(t)){let e=document.createElement(`ul`);e.appendChild(i),r.appendChild(e)}else r.appendChild(i);return r}function be(e,t,n,r,i){let a=S.fromSchema(i),o=[];for(let e of r){let n=t.slice(e.fromA,e.toA),r=J(n.content);o.push(h.widget(e.fromB,()=>Y(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]})),o.push(h.inline(e.fromB,e.toB,{class:`ok-diff-ins`},{inclusiveEnd:!0}))}for(let e of n)if(e.toB>e.fromB&&o.push(h.node(e.fromB,e.toB,{class:`ok-diff-ins-block`})),e.toA>e.fromA){let n=t.slice(e.fromA,e.toA),r=J(n.content);o.push(h.widget(e.fromB,()=>Y(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]}))}return f.create(e,o)}var xe=new Set([`slashCommand`,`blockDragHandle`,`blockMover`,`tableInsertControls`,`fileHandler`,`gfmAutolink`,`inlineLinkInputRule`,`keyboardNav`,`tiptapFindReplace`,`selectionState`,`sourceDirtyObserver`,`tabFocusTrap`]),X=r.filter(e=>!xe.has(e.name)).map(e=>e.name===`jsxComponent`?g:e),Z=n(),Q=y(X);function Se(e,t){return ge(e,t,Q,c())}var Ce=v.create({name:`renderedDiffDecorations`,addOptions(){return{decorations:f.empty}},addProseMirrorPlugins(){let e=this.options.decorations;return[new p({key:new x(`renderedDiffDecorations`),props:{decorations:()=>e}})]}});function we(e){let t=(0,O.c)(31),{diff:n}=e,r,i,a,o;if(t[0]!==n.afterDoc||t[1]!==n.beforeDoc||t[2]!==n.changes||t[3]!==n.markChanges){let e=be(n.afterDoc,n.beforeDoc,n.changes,n.markChanges,Q);o=l,a=!1,r=X,i=Ce.configure({decorations:e}),t[0]=n.afterDoc,t[1]=n.beforeDoc,t[2]=n.changes,t[3]=n.markChanges,t[4]=r,t[5]=i,t[6]=a,t[7]=o}else r=t[4],i=t[5],a=t[6],o=t[7];let s;t[8]!==r||t[9]!==i?(s=[...r,i],t[8]=r,t[9]=i,t[10]=s):s=t[10];let c;t[11]===n.afterDoc?c=t[12]:(c=n.afterDoc.toJSON(),t[11]=n.afterDoc,t[12]=c);let d;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(d={attributes:{class:`pt-4`}},t[13]=d):d=t[13];let f;t[14]!==a||t[15]!==s||t[16]!==c?(f={editable:a,extensions:s,content:c,editorProps:d},t[14]=a,t[15]=s,t[16]=c,t[17]=f):f=t[17];let p;t[18]===n?p=t[19]:(p=[n],t[18]=n,t[19]=p);let m=o(f,p),[h]=(0,D.useState)(Te),g=(0,D.useRef)(null),_,v;t[20]===h?(_=t[21],v=t[22]):(_=()=>{let e=g.current;if(e)return e.appendChild(h),()=>{h.parentNode===e&&e.removeChild(h)}},v=[h],t[20]=h,t[21]=_,t[22]=v),(0,D.useLayoutEffect)(_,v);let y;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:g,style:{display:`contents`}})}),t[23]=y):y=t[23];let b;t[24]===m?b=t[25]:(b=(0,Z.jsx)(u,{editor:m,className:`tiptap-editor-portal-content`}),t[24]=m,t[25]=b);let x;t[26]!==h||t[27]!==b?(x=(0,re.createPortal)(b,h),t[26]=h,t[27]=b,t[28]=x):x=t[28];let S;return t[29]===x?S=t[30]:(S=(0,Z.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1`,"data-testid":`rendered-diff-view`,children:[y,x]}),t[29]=x,t[30]=S),S}function Te(){let e=document.createElement(`div`);return e.style.display=`contents`,e}function Ee(e){let t=0,n=!1;for(let r of e.split(`
|
|
3
3
|
`)){let e=r.startsWith(`+`)&&!r.startsWith(`+++`)||r.startsWith(`-`)&&!r.startsWith(`---`);e&&!n&&(t+=1),n=e}return t}function De(e){let t=Array.from(e.querySelectorAll(`.diff-code-insert, .diff-code-delete`)),n=[],r=null;for(let e of t){let t=e.closest(`tr`);t&&((r===null||t.previousElementSibling!==r)&&n.push(e),r=t)}return n}function $(e){let t=0,n=0;for(let r of e.split(`
|
|
4
4
|
`))r.startsWith(`+`)&&!r.startsWith(`+++`)?t++:r.startsWith(`-`)&&!r.startsWith(`---`)&&n++;return{additions:t,deletions:n}}function Oe(e,t){return`${e}\u0000${t}`}function ke(e,t,n){let r=m(e).body,i=m(t).body;return r===i?``:ee(n,r,i,``,``,{context:Math.max(r.split(`
|