@inkeep/open-knowledge 0.25.0-beta.1 → 0.25.0-beta.2
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/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +6 -6
- package/dist/constants-ucUYJZ1d.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/{init-BFySg4cK.mjs → init-BIZmMISx.mjs} +3 -3
- package/dist/init-xOChjex1.mjs +1 -0
- package/dist/{loader-kYfLQbUq.mjs → loader-DV6UKiTv.mjs} +2 -2
- package/dist/loader-VmDsYETh.mjs +1 -0
- package/dist/{preview-DcLHmjqA.mjs → preview-CE-TkybR.mjs} +2 -2
- package/dist/preview-CvKvNwdB.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-BXwyo0tV.js → ActivityModeContent-CNxdYTCc.js} +1 -1
- package/dist/public/assets/{ConsentDialogBody-DPw1rTwW.js → ConsentDialogBody-CPX75E6Q.js} +1 -1
- package/dist/public/assets/{DocumentContext-BiJ-_xlQ.js → DocumentContext-bNGvFuJS.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-DrATYt0M.js → ManagedArtifactProperties-CRYWYGK4.js} +1 -1
- package/dist/public/assets/{McpConsentDialogBody-DnW93Hlu.js → McpConsentDialogBody-Dr_AIi2H.js} +1 -1
- package/dist/public/assets/{PropertyPanel-DDb_pPhO.js → PropertyPanel-DgbQo3wG.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-Cq52gaLH.js → SettingsDialogBody-CU-nEwde.js} +1 -1
- package/dist/public/assets/{SkillEditorActions-BEyFie-g.js → SkillEditorActions-Bfh-iuK_.js} +1 -1
- package/dist/public/assets/{SourceEditor-Ca3EOrpG.js → SourceEditor-CAUoNOTU.js} +1 -1
- package/dist/public/assets/{checkbox-DwE0ySFI.js → checkbox-EGJP9xna.js} +1 -1
- package/dist/public/assets/{config-validation-events-xzRhWOFG.js → config-validation-events-DiOTHiAz.js} +1 -1
- package/dist/public/assets/{dialog-CvKVTeQa.js → dialog-CIq9aQLf.js} +1 -1
- package/dist/public/assets/{index-DqAFQhRc.js → index-BeB8EEj0.js} +6 -6
- package/dist/public/assets/{index-HjoM0Lai.css → index-hY8weMMg.css} +1 -1
- package/dist/public/assets/{selection-context-DBzjobL4.js → selection-context-B6kAEK37.js} +1 -1
- package/dist/public/assets/{skill-actions-5seH6nEr.js → skill-actions-CPoGr_7b.js} +1 -1
- package/dist/public/assets/{skills-api-CAh7BbdG.js → skills-api-mcV6MiPo.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-DerDTg2m.js → typing-burst-detector-DEl5qeGr.js} +1 -1
- package/dist/public/index.html +11 -11
- package/dist/{repair-launch-json-DJ72dZ5s.mjs → repair-launch-json-sjB6vbft.mjs} +2 -2
- package/dist/{repair-mcp-configs-CehYsaY5.mjs → repair-mcp-configs-uo7Kpg-f.mjs} +2 -2
- package/dist/{src-BGnLjdLF.mjs → src-CYYkqMBK.mjs} +2 -2
- package/dist/{start-DOnYbt5T.mjs → start-C9zxsQBV.mjs} +2 -2
- package/dist/start-dIUzLkmt.mjs +1 -0
- package/package.json +1 -1
- package/dist/constants-C5Kh99hH.mjs +0 -2
- package/dist/init-ByAw3X7-.mjs +0 -1
- package/dist/loader-p811lc-J.mjs +0 -1
- package/dist/preview-BcZ2y0Ew.mjs +0 -1
- package/dist/start-BBxjM94q.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{nt as e,st as t}from"./DocumentContext-
|
|
1
|
+
import{nt as e,st as t}from"./DocumentContext-bNGvFuJS.js";function n(n){let r=e(n.state.selection.content(),n.state.schema);return t().serialize(r).trim()}function r(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 i(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 a(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 o=new Map,s=new Set,c=(e,t)=>`${t}:${e}`;function l(){for(let e of s)e()}function u(e,t){return e.markdown===t.markdown&&e.sourceLineStart===t.sourceLineStart&&e.sourceLineEnd===t.sourceLineEnd}function d(e,t,n){let r=c(e,t);if(n===null){o.delete(r)&&l();return}let i=o.get(r);i&&u(i,n)||(o.set(r,n),l())}function f(e,t){return e===null?null:o.get(c(e,t))??null}function p(e){return s.add(e),()=>{s.delete(e)}}function m(e,t){if(e.state.selection.empty)return null;let r=n(e);return r.trim()?{surface:`wysiwyg`,docName:t,markdown:r,charLen:r.trim().length,lineCount:(r.match(/\n/g)?.length??0)+1}:null}function h(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 g(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{h as a,r as c,i,p as l,a as n,g as o,d as r,m as s,f as t,n as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i,r as a}from"./dist-CQw2y-s3.js";import{$t as o,Bt as s,Ct as c,J as l,Ki as u,Lt as d,Mt as f,Or as p,Qt as m,Zt as h,dn as g,en as _,ft as v,in as y,jt as b,k as x,n as S,nn as C,rn as w,t as T,tn as E,wt as D,xt as O,zt as k}from"./dist-GmorMgHF.js";import{l as A,t as j,u as M}from"./button-DGf25ccp.js";import{a as N,c as P,i as F,n as I,o as L,r as R,s as z,t as B}from"./dialog-CvKVTeQa.js";import{d as V,f as ee,i as te,l as H,m as ne,n as re,p as ie,u as ae}from"./config-context-DhhN0rlf.js";import{a as U,i as W,n as oe,t as G}from"./cursor-CpjEfgnv.js";import{n as K}from"./dist-KBKQayVB.js";import{l as q,o as J,s as Y,u as se}from"./documents-events-CSQluyCM.js";import{C as ce,S as le,_ as X,a as ue,d as de,f as fe,g as pe,n as me,s as he,t as ge,v as _e,w as ve,x as ye}from"./skills-api-CAh7BbdG.js";import{t as be}from"./label-DyT4OD9H.js";import{t as xe}from"./input-DkQ8Zmzd.js";var Se=M(`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`}]]),Ce=M(`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`}]]),we=M(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Te=M(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Z=r(),Q=e(t(),1);function Ee(){let[e]=(0,Q.useState)(De);return e}function De(){return g()!=null}var Oe=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,tagline:`Conversational pairing in Claude Desktop's Cowork tab.`},{id:`claude-code`,displayName:`Claude`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,tagline:`Agentic coding in Claude Desktop's Code tab.`},{id:`codex`,displayName:`Codex`,appBrandName:`Codex Desktop`,schemes:[`codex:`],installUrl:`https://openai.com/codex`,tagline:`OpenAI's coding agent, terminal-native.`},{id:`cursor`,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`,tagline:`AI-first VS Code fork with multi-file edits.`},{id:`opencode`,displayName:`OpenCode`,schemes:[],installUrl:`https://opencode.ai`,tagline:`Open-source terminal coding agent; bring any local model.`}],ke=Oe.filter(e=>e.id!==`claude-cowork`&&e.id!==`opencode`),$=n();function Ae(){let e=(0,Z.c)(3),[t,n]=(0,Q.useState)(Ne),r,i;return e[0]===t?(r=e[1],i=e[2]):(r=()=>{if(t!==null||window.okDesktop)return;let e=!0;return fetch(`/api/workspace`).then(async t=>{let r=await t.json().catch(Me);if(!e||!t.ok)return;let i=b.safeParse(r);i.success&&n({contentDir:i.data.contentDir,pathSeparator:i.data.pathSeparator})}).catch(je),()=>{e=!1}},i=[t],e[0]=t,e[1]=r,e[2]=i),(0,Q.useEffect)(r,i),t}function je(e){console.warn(`[useWorkspace] /api/workspace fetch failed:`,e)}function Me(){return null}function Ne(){return Pe()}function Pe(e=typeof window>`u`?void 0:window){if(!e)return null;let t=e.okDesktop;return t?{contentDir:t.config.projectPath,pathSeparator:t.platform===`win32`?`\\`:`/`}:null}function Fe(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 Ie(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=q(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 Le(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?Fe(e):Ie()}var Re=`ok:skill:cowork:installed`,ze=`1`,Be=250,Ve=`/api/skill/install-state`;function He(e){return`${Re}:v${e}`}var Ue=new Map;async function We(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Ue.get(n);if(r)return r;let i=Ge(e,t);return Ue.set(n,i),i.finally(()=>{Ue.get(n)===i&&Ue.delete(n)}),i}async function Ge(e,t){let n=e.installer===void 0?Le():e.installer,r=Ke(e.storage),i=e.fetchSnapshot??Je,a=e.serverTimeoutMs??Be,o=null;if(!t.force){try{o=await Ye(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=He(o?.currentVersion??e.fallbackSkillVersion??qe());if(!t.force&&r?.getItem(s)===ze)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,ze)}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 Ke(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function qe(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Je(){let e;try{e=await fetch(Ve,{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 Ye(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Xe(e){return We({},e)}function Ze(){return We({},{force:!0})}async function Qe(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 $e(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Qe({target:`claude-cowork`,url:d({mode:`cowork`},e)},n);case`claude-code`:return Qe({target:`claude-code`,url:d({mode:`code`},e)},n);case`codex`:return Qe({target:`codex`,url:k(e)},n);case`cursor`:return Qe({target:`cursor`,url:s(e),workspacePath:e.projectDir},n);case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function et(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.openExternal)try{return await n.shell.openExternal(e),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:tt(e)}}let r=t.doc??(typeof document<`u`?document:void 0);if(!r)return{ok:!1,reason:`dispatch-error`,detail:`no DOM available`};try{let t=r.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,/^https?:/i.test(e)&&(t.target=`_blank`),r.body.appendChild(t),t.click(),t.remove(),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:tt(e)}}}function tt(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}async function nt(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)}`)}}function rt(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function it(e){return`${e}.md`}function at(e){if(!e.docName||!e.workspace)return null;let t=it(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:rt(n,t,r)}}function ot(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function st(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function ct(e){return et(e.installUrl).then(()=>void 0)}function lt(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function ut(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function dt(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace;if(e.docName){let r=it(e.docName),i={scope:`doc`,docRelativePath:r,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?i:{...i,selection:e.selection},projectDir:t,docPath:rt(t,r,n)}}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 ft(e){return`Opened in ${e}.`}function pt(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 mt(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function ht(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 gt(e,t,n){if(e.scope===`doc`){let r={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n};return e.selection===void 0?r:{...r,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n}}function _t(e,t,n){return e.compose?f(gt(e.compose,t,n)):e.selection?C({...e.selection,target:t}):e.skill?w(e.skill.name,e.skill.scope,n):e.ask?h(e.ask.relativePath,e.ask.instruction,n,t):p(e.docContext===null?e.folderRelativePath?E(e.folderRelativePath,n,e.instruction):e.createDescription===void 0?o(n,e.instruction):m(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[]):_(e.docContext.relativePath,n,e.instruction))}function vt(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${l} ${_t(e,c[t].handoffTarget,!1)}`:y(e.docContext?.relativePath??null)}async function yt(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)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=ht(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(ft(u));else{let i=mt(r),a=pt(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{yt(e,t,n,r+1)}}})}return a}function bt(e){return Oe.find(t=>t.id===e)?.displayName??e}function xt(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function St(){return{dispatchHandoff:$e,recordHandoff:nt,toast:{success:e=>{K.success(e)},error:(e,t)=>{K.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>xt(),getDisplayName:bt,ensureCoworkSkillInstalled:Xe,autoOpen:!0}}function Ct(){let e=(0,Z.c)(2),{merged:t}=re(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>yt(e,t,{...St(),autoOpen:n}),reinstallCoworkSkill:Ze},e[0]=n,e[1]=r),r}var wt=[...new Set(Oe.flatMap(e=>e.schemes))];function Tt(e,t){let n=t.now?.()??Date.now(),r={};for(let t of Oe){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function Et(e){return Tt({},e)}async function Dt(e){let t=e.schemes??wt,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var Ot=Object.fromEntries(wt.map(e=>[e,{installed:!1}]));async function kt(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return Ot}if(!t.ok)return Ot;let n;try{n=await t.json()}catch{return Ot}if(typeof n!=`object`||!n||Array.isArray(n))return Ot;let r=n,i={};for(let e of wt)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function At(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function jt(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Et({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Tt(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!At(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function Mt(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Nt(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Dt({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>kt({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Pt(){let e=(0,Z.c)(5),[t,n]=(0,Q.useState)(Ft),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=jt(Nt());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function Ft(){return Et({isElectronHost:Mt(),now:Date.now})}function It(e){return!(e instanceof Error)||e.name!==`NotAllowedError`?!1:/permission denied|permissions policy/i.test(e.message)}function Lt(e){let t=globalThis.document;if(!t?.body||typeof t.createElement!=`function`||typeof t.execCommand!=`function`)return!1;let n=t.createElement(`textarea`);n.value=e,n.style.position=`fixed`,n.style.opacity=`0`,n.style.pointerEvents=`none`,n.setAttribute(`readonly`,``),t.body.appendChild(n);try{return n.focus(),n.select(),t.execCommand(`copy`)}catch{return!1}finally{n.remove()}}async function Rt(e){let t=globalThis.okDesktop?.clipboard;if(t&&typeof t.writeText==`function`){await t.writeText(e);return}let n=globalThis.navigator?.clipboard;if(n&&typeof n.writeText==`function`)try{await n.writeText(e);return}catch(t){if(Lt(e))return;throw t}if(!Lt(e))throw Error(`clipboard API unavailable`)}function zt(e){let t=(0,Z.c)(5),n,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`title`,{children:`OpenCode icon`}),r=(0,$.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M384 416H128V96H384V416ZM320 160H192V352H320V160Z`}),i=(0,$.jsx)(`path`,{fill:`currentColor`,fillOpacity:.55,d:`M320 224V352H192V224H320Z`}),t[0]=n,t[1]=r,t[2]=i):(n=t[0],r=t[1],i=t[2]);let a;return t[3]===e?a=t[4]:(a=(0,$.jsxs)(`svg`,{role:`img`,"aria-label":`OpenCode icon`,xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,fill:`none`,viewBox:`0 0 512 512`,...e,children:[n,r,i]}),t[3]=e,t[4]=a),a}var Bt={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`,opencode:`opencode`};function Vt(e){let t=(0,Z.c)(27),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({id:r,style:a,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{resolvedTheme:o}=u(),s=Bt[r],c=s?(o===`dark`?S[s]:void 0)??T[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let d=l,f=c&&`[&_*]:![color:var(--ok-brand-color)]`,p;t[8]!==n||t[9]!==f?(p=A(f,n),t[8]=n,t[9]=f,t[10]=p):p=t[10];let m=p;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==m||t[12]!==d||t[13]!==i?(e=(0,$.jsx)(W,{style:d,className:m,...i}),t[11]=m,t[12]=d,t[13]=i,t[14]=e):e=t[14],e}if(r===`codex`){let e;return t[15]!==m||t[16]!==d||t[17]!==i?(e=(0,$.jsx)(oe,{style:d,className:m,...i}),t[15]=m,t[16]=d,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==m||t[20]!==d||t[21]!==i?(e=(0,$.jsx)(G,{style:d,className:m,...i}),t[19]=m,t[20]=d,t[21]=i,t[22]=e):e=t[22],e}if(r===`opencode`){let e;return t[23]!==m||t[24]!==d||t[25]!==i?(e=(0,$.jsx)(zt,{style:d,className:m,...i}),t[23]=m,t[24]=d,t[25]=i,t[26]=e):e=t[26],e}return null}var Ht=(0,Q.createContext)(null);function Ut(e){let t=(0,Z.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,$.jsx)(Ht,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Wt(){return(0,Q.use)(Ht)}var Gt=D;function Kt(e){return c[e].handoffTarget}function qt(e){let t=(0,Z.c)(48),{itemName:n,isSubmitting:r,onDelete:o,customTitle:s,customDescription:c,customDetail:l,customConfirmLabel:u,customConfirmLabelBusy:d,children:f}=e,{_:p}=a(),m;t[0]!==p||t[1]!==n?(m=n??p({id:`L3CEC1`}),t[0]=p,t[1]=n,t[2]=m):m=t[2];let h=m,g;t[3]!==p||t[4]!==u?(g=u??p({id:`cnGeoo`}),t[3]=p,t[4]=u,t[5]=g):g=t[5];let _=g,v;t[6]!==p||t[7]!==u||t[8]!==d?(v=d??u??p({id:`s3caR3`}),t[6]=p,t[7]=u,t[8]=d,t[9]=v):v=t[9];let y=v,b;t[10]!==p||t[11]!==s||t[12]!==h?(b=s??p({id:`77SdEP`,values:{itemName:h}}),t[10]=p,t[11]=s,t[12]=h,t[13]=b):b=t[13];let x;t[14]===b?x=t[15]:(x=(0,$.jsx)(P,{children:b}),t[14]=b,t[15]=x);let S;t[16]!==p||t[17]!==c||t[18]!==h?(S=c??p({id:`16D5Zj`,values:{itemName:h}}),t[16]=p,t[17]=c,t[18]=h,t[19]=S):S=t[19];let C;t[20]===S?C=t[21]:(C=(0,$.jsx)(N,{className:`whitespace-pre-wrap`,children:S}),t[20]=S,t[21]=C);let w;t[22]===l?w=t[23]:(w=l?(0,$.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`delete-confirmation-detail`,children:l}):null,t[22]=l,t[23]=w);let T;t[24]!==x||t[25]!==C||t[26]!==w?(T=(0,$.jsxs)(z,{children:[x,C,w]}),t[24]=x,t[25]=C,t[26]=w,t[27]=T):T=t[27];let E;t[28]===f?E=t[29]:(E=f?(0,$.jsx)(I,{children:f}):null,t[28]=f,t[29]=E);let D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(i,{id:`dEgA5A`}),t[30]=D):D=t[30];let O;t[31]===r?O=t[32]:(O=(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(j,{variant:`outline`,disabled:r,children:D})}),t[31]=r,t[32]=O);let k;t[33]!==_||t[34]!==y||t[35]!==r?(k=r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V,{className:`size-4 animate-spin`}),` `,y]}):_,t[33]=_,t[34]=y,t[35]=r,t[36]=k):k=t[36];let A;t[37]!==r||t[38]!==o||t[39]!==k?(A=(0,$.jsx)(j,{variant:`destructive`,onClick:o,disabled:r,children:k}),t[37]=r,t[38]=o,t[39]=k,t[40]=A):A=t[40];let M;t[41]!==O||t[42]!==A?(M=(0,$.jsxs)(L,{children:[O,A]}),t[41]=O,t[42]=A,t[43]=M):M=t[43];let B;return t[44]!==E||t[45]!==M||t[46]!==T?(B=(0,$.jsxs)(F,{children:[T,E,M]}),t[44]=E,t[45]=M,t[46]=T,t[47]=B):B=t[47],B}function Jt(e){return e?se._({id:`wTcjov`}):null}function Yt(e){let t=(0,Z.c)(30),{_:n}=a(),r=Ee(),o=Wt();if(r)return null;let{input:s,installStates:l,dispatch:u}=e,d=s===null,f,p,m,h,g,_,v;if(t[0]!==n||t[1]!==u||t[2]!==s||t[3]!==d||t[4]!==l||t[5]!==o){let e=Jt(d),r;t[13]===l?r=t[14]:(r=e=>l[e.id]?.installed===!0,t[13]=l,t[14]=r);let a=ke.filter(r),y;t[15]===l?y=t[16]:(y=ke.some(e=>l[e.id]?.installed==null),t[15]=l,t[16]=y),m=y;let b=a.length>0,x=o!==null;h=!b&&!x,p=le,t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsxs)(ve,{children:[(0,$.jsx)(U,{"aria-hidden":`true`}),(0,$.jsx)(i,{id:`O7_W_a`})]}),t[17]=v):v=t[17],f=ce,g=x?(0,$.jsxs)(pe,{"aria-label":n({id:`ALhMYW`}),children:[(0,$.jsx)(_e,{children:(0,$.jsx)(i,{id:`ALhMYW`})}),Gt.map(t=>{let{displayName:r}=c[t];return(0,$.jsxs)(X,{onSelect:()=>{s!==null&&o.launchInTerminal(s,t)},disabled:d,"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,$.jsx)(Vt,{id:Kt(t),"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,_=b?(0,$.jsxs)($.Fragment,{children:[x?(0,$.jsx)(ye,{}):null,(0,$.jsxs)(pe,{"aria-label":n({id:`BBqGS9`}),children:[(0,$.jsx)(_e,{children:(0,$.jsx)(i,{id:`BBqGS9`})}),a.map(t=>{let r=!d,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,$.jsxs)(X,{disabled:!r,onSelect:()=>{s&&u(t.id,s)},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,$.jsx)(Vt,{id:t.id,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=u,t[2]=s,t[3]=d,t[4]=l,t[5]=o,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=_,t[12]=v}else f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12];let y;t[18]!==m||t[19]!==h?(y=h?(0,$.jsx)(X,{disabled:!0,"data-testid":`file-tree-open-in-empty`,children:m?(0,$.jsx)(i,{id:`EcR0fl`}):(0,$.jsx)(i,{id:`l6OXqI`})}):null,t[18]=m,t[19]=h,t[20]=y):y=t[20];let b;t[21]!==f||t[22]!==g||t[23]!==_||t[24]!==y?(b=(0,$.jsxs)(f,{children:[g,_,y]}),t[21]=f,t[22]=g,t[23]=_,t[24]=y,t[25]=b):b=t[25];let x;return t[26]!==p||t[27]!==v||t[28]!==b?(x=(0,$.jsxs)(p,{children:[v,b]}),t[26]=p,t[27]=v,t[28]=b,t[29]=x):x=t[29],x}function Xt(e){let t=(0,Z.c)(8),n=e?.enabled??!0,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`idle`},t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(0),c,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=()=>s(en),t=Y(e),n=J(t=>{t.includes(`files`)&&e()});return()=>{t(),n()}},l=[],t[1]=c,t[2]=l):(c=t[1],l=t[2]),(0,Q.useEffect)(c,l);let u;t[3]===n?u=t[4]:(u=()=>{if(!n)return;let e=!1;return a($t),fetch(`/api/skills`).then(Zt).then(t=>{if(e)return;let n=O.safeParse(t);if(!n.success){console.error(`[ok-skills] /api/skills response failed schema validation:`,n.error.issues),a({status:`error`,message:`Server returned an incomplete skills response.`});return}a({status:`ready`,data:n.data.skills})}).catch(t=>{e||a({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},t[3]=n,t[4]=u);let d;return t[5]!==n||t[6]!==o?(d=[o,n],t[5]=n,t[6]=o,t[7]=d):d=t[7],(0,Q.useEffect)(u,d),i}async function Zt(e){if(!e.ok){let t=await e.json().catch(Qt);throw Error(q(t)??`HTTP ${e.status}`)}return e.json()}function Qt(){return null}function $t(e){return e.status===`ready`?e:{status:`loading`}}function en(e){return e+1}function tn(e){let t=(0,Z.c)(16),{skill:n,onOpenChange:r,onDeleted:i}=e,{_:o}=a(),[s,c]=(0,Q.useState)(!1),l;t[0]!==o||t[1]!==i||t[2]!==r?(l=async function(e){c(!0);let t=await ge(e.scope,e.name);if(c(!1),!t.ok){let{error:e}=t;K.error(o({id:`AtBdnD`,values:{error:e}}));return}K.success(o({id:`h9QFb9`,values:{0:e.name}})),i(),r(!1)},t[0]=o,t[1]=i,t[2]=r,t[3]=l):l=t[3];let u=l,d=n!==null,f;t[4]!==s||t[5]!==r?(f=e=>{!e&&!s&&r(!1)},t[4]=s,t[5]=r,t[6]=f):f=t[6];let p;t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==n?(p=n?(0,$.jsx)(qt,{itemName:o({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:s,onDelete:()=>u(n),customDescription:o({id:`E1Da_b`,values:{0:n.path}})}):null,t[7]=o,t[8]=s,t[9]=u,t[10]=n,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,$.jsx)(B,{open:d,onOpenChange:f,children:p}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function nn(e){let t=(0,Z.c)(68),{skill:n,existingNames:r,onOpenChange:o,onRenamed:s}=e,{_:c}=a(),l=n!==null,u=(0,Q.useId)(),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),h;t[0]===n?h=t[1]:(h=()=>{n&&f(n.name)},t[0]=n,t[1]=h);let g=n?.scope,_=n?.name,y;if(t[2]!==g||t[3]!==_?(y=[g,_],t[2]=g,t[3]=_,t[4]=y):y=t[4],(0,Q.useEffect)(h,y),!n)return null;let b,x,S,C;t[5]!==r||t[6]!==d||t[7]!==n.name?(S=d.trim(),C=S===n.name,b=S===``||!v.test(S),x=!b&&!C&&r.has(S),t[5]=r,t[6]=d,t[7]=n.name,t[8]=b,t[9]=x,t[10]=S,t[11]=C):(b=t[8],x=t[9],S=t[10],C=t[11]);let w=x,T=!b&&!w&&!C&&!p,E;t[12]!==c||t[13]!==T||t[14]!==o||t[15]!==s||t[16]!==n||t[17]!==S?(E=async function(){if(!n||!T)return;m(!0);let e=await he({scope:n.scope,fromName:n.name,toName:S});if(m(!1),!e.ok){K.error(c({id:`zKxoPm`,values:{0:n.name,1:e.error}}));return}K.success(c({id:`dUCQo4`,values:{trimmed:S}})),s?.(S),o(!1)},t[12]=c,t[13]=T,t[14]=o,t[15]=s,t[16]=n,t[17]=S,t[18]=E):E=t[18];let D=E,O;t[19]===o?O=t[20]:(O=e=>e?null:o(!1),t[19]=o,t[20]=O);let k;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(P,{children:(0,$.jsx)(i,{id:`dw_3cv`})}),t[21]=k):k=t[21];let A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsxs)(z,{children:[k,(0,$.jsx)(N,{children:(0,$.jsx)(i,{id:`R9IDFz`})})]}),t[22]=A):A=t[22];let M;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(i,{id:`6YtxFj`}),t[23]=M):M=t[23];let I;t[24]===u?I=t[25]:(I=(0,$.jsx)(be,{htmlFor:u,children:M}),t[24]=u,t[25]=I);let R;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>f(e.target.value),t[26]=R):R=t[26];let V;t[27]===D?V=t[28]:(V=e=>{e.key===`Enter`&&D()},t[27]=D,t[28]=V);let ee=b||w,te=b&&S!==``||w?`${u}-error`:void 0,H;t[29]!==u||t[30]!==d||t[31]!==V||t[32]!==ee||t[33]!==te?(H=(0,$.jsx)(xe,{id:u,value:d,onChange:R,onKeyDown:V,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":ee,"aria-describedby":te,className:`font-mono`}),t[29]=u,t[30]=d,t[31]=V,t[32]=ee,t[33]=te,t[34]=H):H=t[34];let ne;t[35]!==w||t[36]!==u||t[37]!==b||t[38]!==S?(ne=b&&S!==``?(0,$.jsx)(`p`,{id:`${u}-error`,className:`text-xs text-destructive`,children:(0,$.jsx)(i,{id:`A50vr3`,components:{0:(0,$.jsx)(`code`,{className:`font-mono`})}})}):w?(0,$.jsx)(`p`,{id:`${u}-error`,className:`text-xs text-destructive`,children:(0,$.jsx)(i,{id:`YJ1BTp`})}):null,t[35]=w,t[36]=u,t[37]=b,t[38]=S,t[39]=ne):ne=t[39];let re;t[40]!==I||t[41]!==H||t[42]!==ne?(re=(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[I,H,ne]}),t[40]=I,t[41]=H,t[42]=ne,t[43]=re):re=t[43];let ie;t[44]===o?ie=t[45]:(ie=()=>o(!1),t[44]=o,t[45]=ie);let ae;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(i,{id:`dEgA5A`}),t[46]=ae):ae=t[46];let U;t[47]!==p||t[48]!==ie?(U=(0,$.jsx)(j,{variant:`ghost`,onClick:ie,disabled:p,children:ae}),t[47]=p,t[48]=ie,t[49]=U):U=t[49];let W;t[50]===D?W=t[51]:(W=()=>void D(),t[50]=D,t[51]=W);let oe=!T,G;t[52]===p?G=t[53]:(G=p?(0,$.jsx)(i,{id:`tHKQ6j`}):(0,$.jsx)(i,{id:`2wxgft`}),t[52]=p,t[53]=G);let q;t[54]!==W||t[55]!==oe||t[56]!==G?(q=(0,$.jsx)(j,{onClick:W,disabled:oe,children:G}),t[54]=W,t[55]=oe,t[56]=G,t[57]=q):q=t[57];let J;t[58]!==U||t[59]!==q?(J=(0,$.jsxs)(L,{children:[U,q]}),t[58]=U,t[59]=q,t[60]=J):J=t[60];let Y;t[61]!==re||t[62]!==J?(Y=(0,$.jsxs)(F,{children:[A,re,J]}),t[61]=re,t[62]=J,t[63]=Y):Y=t[63];let se;return t[64]!==l||t[65]!==Y||t[66]!==O?(se=(0,$.jsx)(B,{open:l,onOpenChange:O,children:Y}),t[64]=l,t[65]=Y,t[66]=O,t[67]=se):se=t[67],se}function rn(e){let t=(0,Z.c)(15),{skill:n,onOpenChange:r,onUpdated:o}=e,{_:s}=a(),[c,l]=(0,Q.useState)(!1),u;t[0]!==s||t[1]!==r||t[2]!==o?(u=async function(e){l(!0);let t=await fe({scope:e.scope,name:e.name});l(!1);let n=te(e.name);if(!t.ok){K.error(s({id:`FRqZ9v`,values:{0:t.error}}));return}K.success(t.checkpointRef?s({id:`My9uXI`,values:{0:t.version,display:n}}):s({id:`mPneVR`,values:{0:t.version,display:n}})),o(),r(!1)},t[0]=s,t[1]=r,t[2]=o,t[3]=u):u=t[3];let d=u,f=n!==null,p;t[4]!==r||t[5]!==c?(p=e=>{!e&&!c&&r(!1)},t[4]=r,t[5]=c,t[6]=p):p=t[6];let m;t[7]!==d||t[8]!==n||t[9]!==c?(m=n?(0,$.jsxs)(F,{className:`sm:max-w-lg`,children:[(0,$.jsxs)(z,{children:[(0,$.jsx)(P,{children:(0,$.jsx)(i,{id:`iAoh55`,values:{0:te(n.name)}})}),(0,$.jsx)(N,{children:n.installedVersion?(0,$.jsx)(i,{id:`47EXvY`,values:{0:n.bundledVersion??``,1:n.installedVersion}}):(0,$.jsx)(i,{id:`nD7Fx9`,values:{0:n.bundledVersion??``}})})]}),(0,$.jsx)(I,{}),(0,$.jsxs)(L,{children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(j,{variant:`outline`,disabled:c,children:(0,$.jsx)(i,{id:`dEgA5A`})})}),(0,$.jsx)(j,{onClick:()=>void d(n),disabled:c,children:c?(0,$.jsx)(i,{id:`JL3si7`}):(0,$.jsx)(i,{id:`EkH9pt`})})]})]}):null,t[7]=d,t[8]=n,t[9]=c,t[10]=m):m=t[10];let h;return t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,$.jsx)(B,{open:f,onOpenChange:p,children:m}),t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14],h}function an(){let e=(0,Z.c)(30),{_:t}=a(),[n,r]=(0,Q.useState)(null),[i,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),d;e[0]===t?d=e[1]:(d=async function(e,n){u(e.name);let r=await ue({scope:e.scope,name:e.name,...n?{targets:[...n]}:{}});if(u(null),!r.ok)return K.error(t({id:`Mj8R8K`,values:{0:r.error}})),r;let i=on,a=new Set(r.hosts),o=r.hosts.filter(t=>!e.hosts.includes(t)),s=e.hosts.filter(e=>!a.has(e)),c=e=>{let t=r.warningCodes.indexOf(e);return t>=0?r.warnings[t]:void 0},l=c(`no-targets`);if(l)return K.warning(l),r;if(o.length>0){let e=c(`scripts-present`);e&&K.warning(e)}return r.hosts.length===0?K.success(t({id:`0LBDjY`,values:{0:e.name}})):o.length>0&&s.length===0?K.success(t({id:`PPFQ3o`,values:{0:e.name,1:i(o)}})):s.length>0&&o.length===0?K.success(t({id:`OOIVJo`,values:{0:e.name,1:i(s)}})):o.length>0&&s.length>0?K.success(t({id:`OxplNM`,values:{0:e.name,1:i(o),2:i(s)}})):K.success(t({id:`wDgmsr`,values:{0:e.name,1:i(r.hosts)}})),r},e[0]=t,e[1]=d);let f=d,p;e[2]===t?p=e[3]:(p=async function(e){u(e.name);let n=await de({scope:e.scope,name:e.name});return u(null),n.ok?K.success(t({id:`0LBDjY`,values:{0:e.name}})):K.error(t({id:`nJq7et`,values:{0:n.error}})),n},e[2]=t,e[3]=p);let m=p,h;e[4]===t?h=e[5]:(h=async function(e,n){let r=await me({scope:e.scope,name:e.name,existingNames:n});if(!r.ok){K.error(t({id:`UPjaXD`,values:{0:e.name,1:r.error}}));return}K.success(t({id:`0g7rCZ`,values:{0:r.name}}))},e[4]=t,e[5]=h);let g=h,_,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{e||r(null)},v=()=>r(null),e[6]=_,e[7]=v):(_=e[6],v=e[7]);let y;e[8]===n?y=e[9]:(y=(0,$.jsx)(tn,{skill:n,onOpenChange:_,onDeleted:v}),e[8]=n,e[9]=y);let b=i?.skill??null,x=i?.existingNames??cn,S,C;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{e||o(null)},C=()=>o(null),e[10]=S,e[11]=C):(S=e[10],C=e[11]);let w;e[12]!==b||e[13]!==x?(w=(0,$.jsx)(nn,{skill:b,existingNames:x,onOpenChange:S,onRenamed:C}),e[12]=b,e[13]=x,e[14]=w):w=e[14];let T,E;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||c(null)},E=()=>c(null),e[15]=T,e[16]=E):(T=e[15],E=e[16]);let D;e[17]===s?D=e[18]:(D=(0,$.jsx)(rn,{skill:s,onOpenChange:T,onUpdated:E}),e[17]=s,e[18]=D);let O;e[19]!==w||e[20]!==D||e[21]!==y?(O=(0,$.jsxs)($.Fragment,{children:[y,w,D]}),e[19]=w,e[20]=D,e[21]=y,e[22]=O):O=e[22];let k=O,A;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=(e,t)=>o({skill:e,existingNames:t}),e[23]=A):A=e[23];let j;return e[24]!==k||e[25]!==g||e[26]!==f||e[27]!==l||e[28]!==m?(j={installingName:l,install:f,uninstall:m,duplicate:g,requestDelete:r,requestRename:A,requestUpdate:c,dialogs:k},e[24]=k,e[25]=g,e[26]=f,e[27]=l,e[28]=m,e[29]=j):j=e[29],j}function on(e){return e.map(sn).join(`, `)}function sn(e){return x[e]??e}var cn=new Set;function ln(e){let t=(0,Z.c)(19),{skill:n,onEdit:r,onInstall:a,onUninstall:o,onDelete:s}=e,c,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(ae,{"aria-hidden":!0}),l=(0,$.jsx)(i,{id:`ePK91l`}),t[0]=c,t[1]=l):(c=t[0],l=t[1]);let u;t[2]===r?u=t[3]:(u=(0,$.jsxs)(X,{onSelect:r,children:[c,l]}),t[2]=r,t[3]=u);let d;t[4]!==a||t[5]!==n.installed?(d=a&&!n.installed?(0,$.jsxs)(X,{onSelect:a,children:[(0,$.jsx)(Se,{"aria-hidden":!0}),(0,$.jsx)(i,{id:`TKQ7K-`})]}):null,t[4]=a,t[5]=n.installed,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.installed?(f=n.installed?(0,$.jsxs)(X,{onSelect:o,children:[(0,$.jsx)(we,{"aria-hidden":!0}),(0,$.jsx)(i,{id:`fo0VXg`})]}):null,t[7]=o,t[8]=n.installed,t[9]=f):f=t[9];let p,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(H,{"aria-hidden":!0}),m=(0,$.jsx)(i,{id:`cnGeoo`}),t[10]=p,t[11]=m):(p=t[10],m=t[11]);let h;t[12]===s?h=t[13]:(h=(0,$.jsxs)(X,{variant:`destructive`,onSelect:s,children:[p,m]}),t[12]=s,t[13]=h);let g;return t[14]!==u||t[15]!==d||t[16]!==f||t[17]!==h?(g=(0,$.jsxs)($.Fragment,{children:[u,d,f,h]}),t[14]=u,t[15]=d,t[16]=f,t[17]=h,t[18]=g):g=t[18],g}function un(e){let t=(0,Z.c)(65),{skill:n,actions:r,existingNames:o}=e,{_:s}=a(),c=Ae(),l=Pt().states,{dispatch:u}=Ct(),d=typeof window<`u`?window.okDesktop:void 0,f=n.absolutePath,p;t[0]===s?p=t[1]:(p=async function(e){try{await Rt(e),K.success(s({id:`SXCSQd`}))}catch{K.error(s({id:`cRHuuI`}))}},t[0]=s,t[1]=p);let m=p,h;t[2]===f?h=t[3]:(h=d&&f?(0,$.jsxs)(X,{onSelect:()=>void d.shell.showItemInFolder(f),children:[(0,$.jsx)(ee,{"aria-hidden":!0}),(0,$.jsx)(i,{id:`LtSYdi`})]}):null,t[2]=f,t[3]=h);let g;t[4]!==n.name||t[5]!==n.scope||t[6]!==c?(g=ut({skillName:n.name,scope:n.scope,workspace:c}),t[4]=n.name,t[5]=n.scope,t[6]=c,t[7]=g):g=t[7];let _;t[8]!==u||t[9]!==l||t[10]!==g?(_=(0,$.jsx)(Yt,{input:g,installStates:l,isElectronHost:d!=null,dispatch:u}),t[8]=u,t[9]=l,t[10]=g,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsxs)(ve,{children:[(0,$.jsx)(ie,{"aria-hidden":!0}),(0,$.jsx)(i,{id:`zd00pH`})]}),t[12]=v):v=t[12];let y;t[13]!==f||t[14]!==m?(y=f?(0,$.jsx)(X,{onSelect:()=>void m(f),children:(0,$.jsx)(i,{id:`z2funE`})}):null,t[13]=f,t[14]=m,t[15]=y):y=t[15];let b;t[16]!==m||t[17]!==n.path?(b=()=>void m(n.path),t[16]=m,t[17]=n.path,t[18]=b):b=t[18];let x;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(i,{id:`xloBjn`}),t[19]=x):x=t[19];let S;t[20]===b?S=t[21]:(S=(0,$.jsx)(X,{onSelect:b,children:x}),t[20]=b,t[21]=S);let C;t[22]!==y||t[23]!==S?(C=(0,$.jsxs)(le,{children:[v,(0,$.jsxs)(ce,{children:[y,S]})]}),t[22]=y,t[23]=S,t[24]=C):C=t[24];let w;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(ye,{}),t[25]=w):w=t[25];let T;t[26]!==r||t[27]!==o||t[28]!==n?(T=()=>void r.duplicate(n,o),t[26]=r,t[27]=o,t[28]=n,t[29]=T):T=t[29];let E,D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(ne,{"aria-hidden":!0}),D=(0,$.jsx)(i,{id:`euc6Ns`}),t[30]=E,t[31]=D):(E=t[30],D=t[31]);let O;t[32]===T?O=t[33]:(O=(0,$.jsxs)(X,{onSelect:T,children:[E,D]}),t[32]=T,t[33]=O);let k;t[34]!==r||t[35]!==o||t[36]!==n?(k=()=>r.requestRename(n,o),t[34]=r,t[35]=o,t[36]=n,t[37]=k):k=t[37];let A,j;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(Ce,{"aria-hidden":!0}),j=(0,$.jsx)(i,{id:`2wxgft`}),t[38]=A,t[39]=j):(A=t[38],j=t[39]);let M;t[40]===k?M=t[41]:(M=(0,$.jsxs)(X,{onSelect:k,children:[A,j]}),t[40]=k,t[41]=M);let N;t[42]!==r||t[43]!==n?(N=n.updateAvailable?(0,$.jsxs)(X,{onSelect:()=>r.requestUpdate(n),children:[(0,$.jsx)(Te,{"aria-hidden":!0}),(0,$.jsx)(i,{id:`6g2jsp`})]}):null,t[42]=r,t[43]=n,t[44]=N):N=t[44];let P;t[45]!==r||t[46]!==n?(P=n.installed?(0,$.jsxs)(X,{onSelect:()=>void r.uninstall(n),children:[(0,$.jsx)(we,{"aria-hidden":!0}),(0,$.jsx)(i,{id:`fo0VXg`})]}):(0,$.jsxs)(X,{onSelect:()=>void r.install(n),children:[(0,$.jsx)(Se,{"aria-hidden":!0}),(0,$.jsx)(i,{id:`TKQ7K-`})]}),t[45]=r,t[46]=n,t[47]=P):P=t[47];let F;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(ye,{}),t[48]=F):F=t[48];let I;t[49]!==r||t[50]!==n?(I=()=>r.requestDelete(n),t[49]=r,t[50]=n,t[51]=I):I=t[51];let L,R;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(H,{"aria-hidden":!0}),R=(0,$.jsx)(i,{id:`cnGeoo`}),t[52]=L,t[53]=R):(L=t[52],R=t[53]);let z;t[54]===I?z=t[55]:(z=(0,$.jsxs)(X,{variant:`destructive`,onSelect:I,children:[L,R]}),t[54]=I,t[55]=z);let B;return t[56]!==C||t[57]!==O||t[58]!==M||t[59]!==h||t[60]!==N||t[61]!==P||t[62]!==z||t[63]!==_?(B=(0,$.jsxs)($.Fragment,{children:[h,_,C,w,O,M,N,P,F,z]}),t[56]=C,t[57]=O,t[58]=M,t[59]=h,t[60]=N,t[61]=P,t[62]=z,t[63]=_,t[64]=B):B=t[64],B}export{Te as A,ct as C,Ae as D,rt as E,ke as O,bt as S,it as T,lt as _,Yt as a,ut as b,Kt as c,Vt as d,It as f,st as g,dt as h,Xt as i,Se as j,Ee as k,Ut as l,Pt as m,un as n,qt as o,Rt as p,an as r,Gt as s,ln as t,Wt as u,at as v,Ct as w,vt as x,ot as y};
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{n as i,r as a}from"./dist-CQw2y-s3.js";import{$t as o,Bt as s,Ct as c,J as l,Ki as u,Lt as d,Mt as f,Or as p,Qt as m,Zt as h,dn as g,en as _,ft as v,in as y,jt as b,k as x,n as S,nn as C,rn as w,t as T,tn as E,wt as D,xt as O,zt as k}from"./dist-GmorMgHF.js";import{l as A,t as j,u as M}from"./button-DGf25ccp.js";import{a as N,c as P,i as F,n as I,o as L,r as R,s as z,t as B}from"./dialog-CIq9aQLf.js";import{d as V,f as ee,i as te,l as H,m as ne,n as re,p as ie,u as ae}from"./config-context-DhhN0rlf.js";import{a as U,i as W,n as oe,t as G}from"./cursor-CpjEfgnv.js";import{n as K}from"./dist-KBKQayVB.js";import{l as q,o as J,s as Y,u as se}from"./documents-events-CSQluyCM.js";import{C as ce,S as le,_ as X,a as ue,d as de,f as fe,g as pe,n as me,s as he,t as ge,v as _e,w as ve,x as ye}from"./skills-api-mcV6MiPo.js";import{t as be}from"./label-DyT4OD9H.js";import{t as xe}from"./input-DkQ8Zmzd.js";var Se=M(`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`}]]),Ce=M(`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`}]]),we=M(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Te=M(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Z=r(),Q=e(t(),1);function Ee(){let[e]=(0,Q.useState)(De);return e}function De(){return g()!=null}var Oe=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,tagline:`Conversational pairing in Claude Desktop's Cowork tab.`},{id:`claude-code`,displayName:`Claude`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,tagline:`Agentic coding in Claude Desktop's Code tab.`},{id:`codex`,displayName:`Codex`,appBrandName:`Codex Desktop`,schemes:[`codex:`],installUrl:`https://openai.com/codex`,tagline:`OpenAI's coding agent, terminal-native.`},{id:`cursor`,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`,tagline:`AI-first VS Code fork with multi-file edits.`},{id:`opencode`,displayName:`OpenCode`,schemes:[],installUrl:`https://opencode.ai`,tagline:`Open-source terminal coding agent; bring any local model.`}],ke=Oe.filter(e=>e.id!==`claude-cowork`&&e.id!==`opencode`),$=n();function Ae(){let e=(0,Z.c)(3),[t,n]=(0,Q.useState)(Ne),r,i;return e[0]===t?(r=e[1],i=e[2]):(r=()=>{if(t!==null||window.okDesktop)return;let e=!0;return fetch(`/api/workspace`).then(async t=>{let r=await t.json().catch(Me);if(!e||!t.ok)return;let i=b.safeParse(r);i.success&&n({contentDir:i.data.contentDir,pathSeparator:i.data.pathSeparator})}).catch(je),()=>{e=!1}},i=[t],e[0]=t,e[1]=r,e[2]=i),(0,Q.useEffect)(r,i),t}function je(e){console.warn(`[useWorkspace] /api/workspace fetch failed:`,e)}function Me(){return null}function Ne(){return Pe()}function Pe(e=typeof window>`u`?void 0:window){if(!e)return null;let t=e.okDesktop;return t?{contentDir:t.config.projectPath,pathSeparator:t.platform===`win32`?`\\`:`/`}:null}function Fe(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 Ie(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=q(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 Le(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?Fe(e):Ie()}var Re=`ok:skill:cowork:installed`,ze=`1`,Be=250,Ve=`/api/skill/install-state`;function He(e){return`${Re}:v${e}`}var Ue=new Map;async function We(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Ue.get(n);if(r)return r;let i=Ge(e,t);return Ue.set(n,i),i.finally(()=>{Ue.get(n)===i&&Ue.delete(n)}),i}async function Ge(e,t){let n=e.installer===void 0?Le():e.installer,r=Ke(e.storage),i=e.fetchSnapshot??Je,a=e.serverTimeoutMs??Be,o=null;if(!t.force){try{o=await Ye(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=He(o?.currentVersion??e.fallbackSkillVersion??qe());if(!t.force&&r?.getItem(s)===ze)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,ze)}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 Ke(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function qe(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Je(){let e;try{e=await fetch(Ve,{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 Ye(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Xe(e){return We({},e)}function Ze(){return We({},{force:!0})}async function Qe(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 $e(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Qe({target:`claude-cowork`,url:d({mode:`cowork`},e)},n);case`claude-code`:return Qe({target:`claude-code`,url:d({mode:`code`},e)},n);case`codex`:return Qe({target:`codex`,url:k(e)},n);case`cursor`:return Qe({target:`cursor`,url:s(e),workspacePath:e.projectDir},n);case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function et(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.openExternal)try{return await n.shell.openExternal(e),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:tt(e)}}let r=t.doc??(typeof document<`u`?document:void 0);if(!r)return{ok:!1,reason:`dispatch-error`,detail:`no DOM available`};try{let t=r.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,/^https?:/i.test(e)&&(t.target=`_blank`),r.body.appendChild(t),t.click(),t.remove(),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:tt(e)}}}function tt(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}async function nt(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)}`)}}function rt(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function it(e){return`${e}.md`}function at(e){if(!e.docName||!e.workspace)return null;let t=it(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:rt(n,t,r)}}function ot(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function st(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function ct(e){return et(e.installUrl).then(()=>void 0)}function lt(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function ut(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function dt(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace;if(e.docName){let r=it(e.docName),i={scope:`doc`,docRelativePath:r,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?i:{...i,selection:e.selection},projectDir:t,docPath:rt(t,r,n)}}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 ft(e){return`Opened in ${e}.`}function pt(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 mt(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function ht(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 gt(e,t,n){if(e.scope===`doc`){let r={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n};return e.selection===void 0?r:{...r,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n}}function _t(e,t,n){return e.compose?f(gt(e.compose,t,n)):e.selection?C({...e.selection,target:t}):e.skill?w(e.skill.name,e.skill.scope,n):e.ask?h(e.ask.relativePath,e.ask.instruction,n,t):p(e.docContext===null?e.folderRelativePath?E(e.folderRelativePath,n,e.instruction):e.createDescription===void 0?o(n,e.instruction):m(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[]):_(e.docContext.relativePath,n,e.instruction))}function vt(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${l} ${_t(e,c[t].handoffTarget,!1)}`:y(e.docContext?.relativePath??null)}async function yt(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)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=ht(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(ft(u));else{let i=mt(r),a=pt(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{yt(e,t,n,r+1)}}})}return a}function bt(e){return Oe.find(t=>t.id===e)?.displayName??e}function xt(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function St(){return{dispatchHandoff:$e,recordHandoff:nt,toast:{success:e=>{K.success(e)},error:(e,t)=>{K.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>xt(),getDisplayName:bt,ensureCoworkSkillInstalled:Xe,autoOpen:!0}}function Ct(){let e=(0,Z.c)(2),{merged:t}=re(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>yt(e,t,{...St(),autoOpen:n}),reinstallCoworkSkill:Ze},e[0]=n,e[1]=r),r}var wt=[...new Set(Oe.flatMap(e=>e.schemes))];function Tt(e,t){let n=t.now?.()??Date.now(),r={};for(let t of Oe){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function Et(e){return Tt({},e)}async function Dt(e){let t=e.schemes??wt,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var Ot=Object.fromEntries(wt.map(e=>[e,{installed:!1}]));async function kt(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return Ot}if(!t.ok)return Ot;let n;try{n=await t.json()}catch{return Ot}if(typeof n!=`object`||!n||Array.isArray(n))return Ot;let r=n,i={};for(let e of wt)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function At(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function jt(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Et({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Tt(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!At(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function Mt(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Nt(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Dt({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>kt({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Pt(){let e=(0,Z.c)(5),[t,n]=(0,Q.useState)(Ft),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=jt(Nt());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function Ft(){return Et({isElectronHost:Mt(),now:Date.now})}function It(e){return!(e instanceof Error)||e.name!==`NotAllowedError`?!1:/permission denied|permissions policy/i.test(e.message)}function Lt(e){let t=globalThis.document;if(!t?.body||typeof t.createElement!=`function`||typeof t.execCommand!=`function`)return!1;let n=t.createElement(`textarea`);n.value=e,n.style.position=`fixed`,n.style.opacity=`0`,n.style.pointerEvents=`none`,n.setAttribute(`readonly`,``),t.body.appendChild(n);try{return n.focus(),n.select(),t.execCommand(`copy`)}catch{return!1}finally{n.remove()}}async function Rt(e){let t=globalThis.okDesktop?.clipboard;if(t&&typeof t.writeText==`function`){await t.writeText(e);return}let n=globalThis.navigator?.clipboard;if(n&&typeof n.writeText==`function`)try{await n.writeText(e);return}catch(t){if(Lt(e))return;throw t}if(!Lt(e))throw Error(`clipboard API unavailable`)}function zt(e){let t=(0,Z.c)(5),n,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`title`,{children:`OpenCode icon`}),r=(0,$.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M384 416H128V96H384V416ZM320 160H192V352H320V160Z`}),i=(0,$.jsx)(`path`,{fill:`currentColor`,fillOpacity:.55,d:`M320 224V352H192V224H320Z`}),t[0]=n,t[1]=r,t[2]=i):(n=t[0],r=t[1],i=t[2]);let a;return t[3]===e?a=t[4]:(a=(0,$.jsxs)(`svg`,{role:`img`,"aria-label":`OpenCode icon`,xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,fill:`none`,viewBox:`0 0 512 512`,...e,children:[n,r,i]}),t[3]=e,t[4]=a),a}var Bt={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`,opencode:`opencode`};function Vt(e){let t=(0,Z.c)(27),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({id:r,style:a,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{resolvedTheme:o}=u(),s=Bt[r],c=s?(o===`dark`?S[s]:void 0)??T[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let d=l,f=c&&`[&_*]:![color:var(--ok-brand-color)]`,p;t[8]!==n||t[9]!==f?(p=A(f,n),t[8]=n,t[9]=f,t[10]=p):p=t[10];let m=p;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==m||t[12]!==d||t[13]!==i?(e=(0,$.jsx)(W,{style:d,className:m,...i}),t[11]=m,t[12]=d,t[13]=i,t[14]=e):e=t[14],e}if(r===`codex`){let e;return t[15]!==m||t[16]!==d||t[17]!==i?(e=(0,$.jsx)(oe,{style:d,className:m,...i}),t[15]=m,t[16]=d,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==m||t[20]!==d||t[21]!==i?(e=(0,$.jsx)(G,{style:d,className:m,...i}),t[19]=m,t[20]=d,t[21]=i,t[22]=e):e=t[22],e}if(r===`opencode`){let e;return t[23]!==m||t[24]!==d||t[25]!==i?(e=(0,$.jsx)(zt,{style:d,className:m,...i}),t[23]=m,t[24]=d,t[25]=i,t[26]=e):e=t[26],e}return null}var Ht=(0,Q.createContext)(null);function Ut(e){let t=(0,Z.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,$.jsx)(Ht,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Wt(){return(0,Q.use)(Ht)}var Gt=D;function Kt(e){return c[e].handoffTarget}function qt(e){let t=(0,Z.c)(48),{itemName:n,isSubmitting:r,onDelete:o,customTitle:s,customDescription:c,customDetail:l,customConfirmLabel:u,customConfirmLabelBusy:d,children:f}=e,{_:p}=a(),m;t[0]!==p||t[1]!==n?(m=n??p({id:`L3CEC1`}),t[0]=p,t[1]=n,t[2]=m):m=t[2];let h=m,g;t[3]!==p||t[4]!==u?(g=u??p({id:`cnGeoo`}),t[3]=p,t[4]=u,t[5]=g):g=t[5];let _=g,v;t[6]!==p||t[7]!==u||t[8]!==d?(v=d??u??p({id:`s3caR3`}),t[6]=p,t[7]=u,t[8]=d,t[9]=v):v=t[9];let y=v,b;t[10]!==p||t[11]!==s||t[12]!==h?(b=s??p({id:`77SdEP`,values:{itemName:h}}),t[10]=p,t[11]=s,t[12]=h,t[13]=b):b=t[13];let x;t[14]===b?x=t[15]:(x=(0,$.jsx)(P,{children:b}),t[14]=b,t[15]=x);let S;t[16]!==p||t[17]!==c||t[18]!==h?(S=c??p({id:`16D5Zj`,values:{itemName:h}}),t[16]=p,t[17]=c,t[18]=h,t[19]=S):S=t[19];let C;t[20]===S?C=t[21]:(C=(0,$.jsx)(N,{className:`whitespace-pre-wrap`,children:S}),t[20]=S,t[21]=C);let w;t[22]===l?w=t[23]:(w=l?(0,$.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`delete-confirmation-detail`,children:l}):null,t[22]=l,t[23]=w);let T;t[24]!==x||t[25]!==C||t[26]!==w?(T=(0,$.jsxs)(z,{children:[x,C,w]}),t[24]=x,t[25]=C,t[26]=w,t[27]=T):T=t[27];let E;t[28]===f?E=t[29]:(E=f?(0,$.jsx)(I,{children:f}):null,t[28]=f,t[29]=E);let D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(i,{id:`dEgA5A`}),t[30]=D):D=t[30];let O;t[31]===r?O=t[32]:(O=(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(j,{variant:`outline`,disabled:r,children:D})}),t[31]=r,t[32]=O);let k;t[33]!==_||t[34]!==y||t[35]!==r?(k=r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V,{className:`size-4 animate-spin`}),` `,y]}):_,t[33]=_,t[34]=y,t[35]=r,t[36]=k):k=t[36];let A;t[37]!==r||t[38]!==o||t[39]!==k?(A=(0,$.jsx)(j,{variant:`destructive`,onClick:o,disabled:r,children:k}),t[37]=r,t[38]=o,t[39]=k,t[40]=A):A=t[40];let M;t[41]!==O||t[42]!==A?(M=(0,$.jsxs)(L,{children:[O,A]}),t[41]=O,t[42]=A,t[43]=M):M=t[43];let B;return t[44]!==E||t[45]!==M||t[46]!==T?(B=(0,$.jsxs)(F,{children:[T,E,M]}),t[44]=E,t[45]=M,t[46]=T,t[47]=B):B=t[47],B}function Jt(e){return e?se._({id:`wTcjov`}):null}function Yt(e){let t=(0,Z.c)(30),{_:n}=a(),r=Ee(),o=Wt();if(r)return null;let{input:s,installStates:l,dispatch:u}=e,d=s===null,f,p,m,h,g,_,v;if(t[0]!==n||t[1]!==u||t[2]!==s||t[3]!==d||t[4]!==l||t[5]!==o){let e=Jt(d),r;t[13]===l?r=t[14]:(r=e=>l[e.id]?.installed===!0,t[13]=l,t[14]=r);let a=ke.filter(r),y;t[15]===l?y=t[16]:(y=ke.some(e=>l[e.id]?.installed==null),t[15]=l,t[16]=y),m=y;let b=a.length>0,x=o!==null;h=!b&&!x,p=le,t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsxs)(ve,{children:[(0,$.jsx)(U,{"aria-hidden":`true`}),(0,$.jsx)(i,{id:`O7_W_a`})]}),t[17]=v):v=t[17],f=ce,g=x?(0,$.jsxs)(pe,{"aria-label":n({id:`ALhMYW`}),children:[(0,$.jsx)(_e,{children:(0,$.jsx)(i,{id:`ALhMYW`})}),Gt.map(t=>{let{displayName:r}=c[t];return(0,$.jsxs)(X,{onSelect:()=>{s!==null&&o.launchInTerminal(s,t)},disabled:d,"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,$.jsx)(Vt,{id:Kt(t),"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,_=b?(0,$.jsxs)($.Fragment,{children:[x?(0,$.jsx)(ye,{}):null,(0,$.jsxs)(pe,{"aria-label":n({id:`BBqGS9`}),children:[(0,$.jsx)(_e,{children:(0,$.jsx)(i,{id:`BBqGS9`})}),a.map(t=>{let r=!d,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,$.jsxs)(X,{disabled:!r,onSelect:()=>{s&&u(t.id,s)},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,$.jsx)(Vt,{id:t.id,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=u,t[2]=s,t[3]=d,t[4]=l,t[5]=o,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=_,t[12]=v}else f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12];let y;t[18]!==m||t[19]!==h?(y=h?(0,$.jsx)(X,{disabled:!0,"data-testid":`file-tree-open-in-empty`,children:m?(0,$.jsx)(i,{id:`EcR0fl`}):(0,$.jsx)(i,{id:`l6OXqI`})}):null,t[18]=m,t[19]=h,t[20]=y):y=t[20];let b;t[21]!==f||t[22]!==g||t[23]!==_||t[24]!==y?(b=(0,$.jsxs)(f,{children:[g,_,y]}),t[21]=f,t[22]=g,t[23]=_,t[24]=y,t[25]=b):b=t[25];let x;return t[26]!==p||t[27]!==v||t[28]!==b?(x=(0,$.jsxs)(p,{children:[v,b]}),t[26]=p,t[27]=v,t[28]=b,t[29]=x):x=t[29],x}function Xt(e){let t=(0,Z.c)(8),n=e?.enabled??!0,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`idle`},t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(0),c,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=()=>s(en),t=Y(e),n=J(t=>{t.includes(`files`)&&e()});return()=>{t(),n()}},l=[],t[1]=c,t[2]=l):(c=t[1],l=t[2]),(0,Q.useEffect)(c,l);let u;t[3]===n?u=t[4]:(u=()=>{if(!n)return;let e=!1;return a($t),fetch(`/api/skills`).then(Zt).then(t=>{if(e)return;let n=O.safeParse(t);if(!n.success){console.error(`[ok-skills] /api/skills response failed schema validation:`,n.error.issues),a({status:`error`,message:`Server returned an incomplete skills response.`});return}a({status:`ready`,data:n.data.skills})}).catch(t=>{e||a({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},t[3]=n,t[4]=u);let d;return t[5]!==n||t[6]!==o?(d=[o,n],t[5]=n,t[6]=o,t[7]=d):d=t[7],(0,Q.useEffect)(u,d),i}async function Zt(e){if(!e.ok){let t=await e.json().catch(Qt);throw Error(q(t)??`HTTP ${e.status}`)}return e.json()}function Qt(){return null}function $t(e){return e.status===`ready`?e:{status:`loading`}}function en(e){return e+1}function tn(e){let t=(0,Z.c)(16),{skill:n,onOpenChange:r,onDeleted:i}=e,{_:o}=a(),[s,c]=(0,Q.useState)(!1),l;t[0]!==o||t[1]!==i||t[2]!==r?(l=async function(e){c(!0);let t=await ge(e.scope,e.name);if(c(!1),!t.ok){let{error:e}=t;K.error(o({id:`AtBdnD`,values:{error:e}}));return}K.success(o({id:`h9QFb9`,values:{0:e.name}})),i(),r(!1)},t[0]=o,t[1]=i,t[2]=r,t[3]=l):l=t[3];let u=l,d=n!==null,f;t[4]!==s||t[5]!==r?(f=e=>{!e&&!s&&r(!1)},t[4]=s,t[5]=r,t[6]=f):f=t[6];let p;t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==n?(p=n?(0,$.jsx)(qt,{itemName:o({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:s,onDelete:()=>u(n),customDescription:o({id:`E1Da_b`,values:{0:n.path}})}):null,t[7]=o,t[8]=s,t[9]=u,t[10]=n,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==f||t[14]!==p?(m=(0,$.jsx)(B,{open:d,onOpenChange:f,children:p}),t[12]=d,t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function nn(e){let t=(0,Z.c)(68),{skill:n,existingNames:r,onOpenChange:o,onRenamed:s}=e,{_:c}=a(),l=n!==null,u=(0,Q.useId)(),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),h;t[0]===n?h=t[1]:(h=()=>{n&&f(n.name)},t[0]=n,t[1]=h);let g=n?.scope,_=n?.name,y;if(t[2]!==g||t[3]!==_?(y=[g,_],t[2]=g,t[3]=_,t[4]=y):y=t[4],(0,Q.useEffect)(h,y),!n)return null;let b,x,S,C;t[5]!==r||t[6]!==d||t[7]!==n.name?(S=d.trim(),C=S===n.name,b=S===``||!v.test(S),x=!b&&!C&&r.has(S),t[5]=r,t[6]=d,t[7]=n.name,t[8]=b,t[9]=x,t[10]=S,t[11]=C):(b=t[8],x=t[9],S=t[10],C=t[11]);let w=x,T=!b&&!w&&!C&&!p,E;t[12]!==c||t[13]!==T||t[14]!==o||t[15]!==s||t[16]!==n||t[17]!==S?(E=async function(){if(!n||!T)return;m(!0);let e=await he({scope:n.scope,fromName:n.name,toName:S});if(m(!1),!e.ok){K.error(c({id:`zKxoPm`,values:{0:n.name,1:e.error}}));return}K.success(c({id:`dUCQo4`,values:{trimmed:S}})),s?.(S),o(!1)},t[12]=c,t[13]=T,t[14]=o,t[15]=s,t[16]=n,t[17]=S,t[18]=E):E=t[18];let D=E,O;t[19]===o?O=t[20]:(O=e=>e?null:o(!1),t[19]=o,t[20]=O);let k;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(P,{children:(0,$.jsx)(i,{id:`dw_3cv`})}),t[21]=k):k=t[21];let A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsxs)(z,{children:[k,(0,$.jsx)(N,{children:(0,$.jsx)(i,{id:`R9IDFz`})})]}),t[22]=A):A=t[22];let M;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(i,{id:`6YtxFj`}),t[23]=M):M=t[23];let I;t[24]===u?I=t[25]:(I=(0,$.jsx)(be,{htmlFor:u,children:M}),t[24]=u,t[25]=I);let R;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>f(e.target.value),t[26]=R):R=t[26];let V;t[27]===D?V=t[28]:(V=e=>{e.key===`Enter`&&D()},t[27]=D,t[28]=V);let ee=b||w,te=b&&S!==``||w?`${u}-error`:void 0,H;t[29]!==u||t[30]!==d||t[31]!==V||t[32]!==ee||t[33]!==te?(H=(0,$.jsx)(xe,{id:u,value:d,onChange:R,onKeyDown:V,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":ee,"aria-describedby":te,className:`font-mono`}),t[29]=u,t[30]=d,t[31]=V,t[32]=ee,t[33]=te,t[34]=H):H=t[34];let ne;t[35]!==w||t[36]!==u||t[37]!==b||t[38]!==S?(ne=b&&S!==``?(0,$.jsx)(`p`,{id:`${u}-error`,className:`text-xs text-destructive`,children:(0,$.jsx)(i,{id:`A50vr3`,components:{0:(0,$.jsx)(`code`,{className:`font-mono`})}})}):w?(0,$.jsx)(`p`,{id:`${u}-error`,className:`text-xs text-destructive`,children:(0,$.jsx)(i,{id:`YJ1BTp`})}):null,t[35]=w,t[36]=u,t[37]=b,t[38]=S,t[39]=ne):ne=t[39];let re;t[40]!==I||t[41]!==H||t[42]!==ne?(re=(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[I,H,ne]}),t[40]=I,t[41]=H,t[42]=ne,t[43]=re):re=t[43];let ie;t[44]===o?ie=t[45]:(ie=()=>o(!1),t[44]=o,t[45]=ie);let ae;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(i,{id:`dEgA5A`}),t[46]=ae):ae=t[46];let U;t[47]!==p||t[48]!==ie?(U=(0,$.jsx)(j,{variant:`ghost`,onClick:ie,disabled:p,children:ae}),t[47]=p,t[48]=ie,t[49]=U):U=t[49];let W;t[50]===D?W=t[51]:(W=()=>void D(),t[50]=D,t[51]=W);let oe=!T,G;t[52]===p?G=t[53]:(G=p?(0,$.jsx)(i,{id:`tHKQ6j`}):(0,$.jsx)(i,{id:`2wxgft`}),t[52]=p,t[53]=G);let q;t[54]!==W||t[55]!==oe||t[56]!==G?(q=(0,$.jsx)(j,{onClick:W,disabled:oe,children:G}),t[54]=W,t[55]=oe,t[56]=G,t[57]=q):q=t[57];let J;t[58]!==U||t[59]!==q?(J=(0,$.jsxs)(L,{children:[U,q]}),t[58]=U,t[59]=q,t[60]=J):J=t[60];let Y;t[61]!==re||t[62]!==J?(Y=(0,$.jsxs)(F,{children:[A,re,J]}),t[61]=re,t[62]=J,t[63]=Y):Y=t[63];let se;return t[64]!==l||t[65]!==Y||t[66]!==O?(se=(0,$.jsx)(B,{open:l,onOpenChange:O,children:Y}),t[64]=l,t[65]=Y,t[66]=O,t[67]=se):se=t[67],se}function rn(e){let t=(0,Z.c)(15),{skill:n,onOpenChange:r,onUpdated:o}=e,{_:s}=a(),[c,l]=(0,Q.useState)(!1),u;t[0]!==s||t[1]!==r||t[2]!==o?(u=async function(e){l(!0);let t=await fe({scope:e.scope,name:e.name});l(!1);let n=te(e.name);if(!t.ok){K.error(s({id:`FRqZ9v`,values:{0:t.error}}));return}K.success(t.checkpointRef?s({id:`My9uXI`,values:{0:t.version,display:n}}):s({id:`mPneVR`,values:{0:t.version,display:n}})),o(),r(!1)},t[0]=s,t[1]=r,t[2]=o,t[3]=u):u=t[3];let d=u,f=n!==null,p;t[4]!==r||t[5]!==c?(p=e=>{!e&&!c&&r(!1)},t[4]=r,t[5]=c,t[6]=p):p=t[6];let m;t[7]!==d||t[8]!==n||t[9]!==c?(m=n?(0,$.jsxs)(F,{className:`sm:max-w-lg`,children:[(0,$.jsxs)(z,{children:[(0,$.jsx)(P,{children:(0,$.jsx)(i,{id:`iAoh55`,values:{0:te(n.name)}})}),(0,$.jsx)(N,{children:n.installedVersion?(0,$.jsx)(i,{id:`47EXvY`,values:{0:n.bundledVersion??``,1:n.installedVersion}}):(0,$.jsx)(i,{id:`nD7Fx9`,values:{0:n.bundledVersion??``}})})]}),(0,$.jsx)(I,{}),(0,$.jsxs)(L,{children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(j,{variant:`outline`,disabled:c,children:(0,$.jsx)(i,{id:`dEgA5A`})})}),(0,$.jsx)(j,{onClick:()=>void d(n),disabled:c,children:c?(0,$.jsx)(i,{id:`JL3si7`}):(0,$.jsx)(i,{id:`EkH9pt`})})]})]}):null,t[7]=d,t[8]=n,t[9]=c,t[10]=m):m=t[10];let h;return t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,$.jsx)(B,{open:f,onOpenChange:p,children:m}),t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14],h}function an(){let e=(0,Z.c)(30),{_:t}=a(),[n,r]=(0,Q.useState)(null),[i,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),d;e[0]===t?d=e[1]:(d=async function(e,n){u(e.name);let r=await ue({scope:e.scope,name:e.name,...n?{targets:[...n]}:{}});if(u(null),!r.ok)return K.error(t({id:`Mj8R8K`,values:{0:r.error}})),r;let i=on,a=new Set(r.hosts),o=r.hosts.filter(t=>!e.hosts.includes(t)),s=e.hosts.filter(e=>!a.has(e)),c=e=>{let t=r.warningCodes.indexOf(e);return t>=0?r.warnings[t]:void 0},l=c(`no-targets`);if(l)return K.warning(l),r;if(o.length>0){let e=c(`scripts-present`);e&&K.warning(e)}return r.hosts.length===0?K.success(t({id:`0LBDjY`,values:{0:e.name}})):o.length>0&&s.length===0?K.success(t({id:`PPFQ3o`,values:{0:e.name,1:i(o)}})):s.length>0&&o.length===0?K.success(t({id:`OOIVJo`,values:{0:e.name,1:i(s)}})):o.length>0&&s.length>0?K.success(t({id:`OxplNM`,values:{0:e.name,1:i(o),2:i(s)}})):K.success(t({id:`wDgmsr`,values:{0:e.name,1:i(r.hosts)}})),r},e[0]=t,e[1]=d);let f=d,p;e[2]===t?p=e[3]:(p=async function(e){u(e.name);let n=await de({scope:e.scope,name:e.name});return u(null),n.ok?K.success(t({id:`0LBDjY`,values:{0:e.name}})):K.error(t({id:`nJq7et`,values:{0:n.error}})),n},e[2]=t,e[3]=p);let m=p,h;e[4]===t?h=e[5]:(h=async function(e,n){let r=await me({scope:e.scope,name:e.name,existingNames:n});if(!r.ok){K.error(t({id:`UPjaXD`,values:{0:e.name,1:r.error}}));return}K.success(t({id:`0g7rCZ`,values:{0:r.name}}))},e[4]=t,e[5]=h);let g=h,_,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{e||r(null)},v=()=>r(null),e[6]=_,e[7]=v):(_=e[6],v=e[7]);let y;e[8]===n?y=e[9]:(y=(0,$.jsx)(tn,{skill:n,onOpenChange:_,onDeleted:v}),e[8]=n,e[9]=y);let b=i?.skill??null,x=i?.existingNames??cn,S,C;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{e||o(null)},C=()=>o(null),e[10]=S,e[11]=C):(S=e[10],C=e[11]);let w;e[12]!==b||e[13]!==x?(w=(0,$.jsx)(nn,{skill:b,existingNames:x,onOpenChange:S,onRenamed:C}),e[12]=b,e[13]=x,e[14]=w):w=e[14];let T,E;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||c(null)},E=()=>c(null),e[15]=T,e[16]=E):(T=e[15],E=e[16]);let D;e[17]===s?D=e[18]:(D=(0,$.jsx)(rn,{skill:s,onOpenChange:T,onUpdated:E}),e[17]=s,e[18]=D);let O;e[19]!==w||e[20]!==D||e[21]!==y?(O=(0,$.jsxs)($.Fragment,{children:[y,w,D]}),e[19]=w,e[20]=D,e[21]=y,e[22]=O):O=e[22];let k=O,A;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=(e,t)=>o({skill:e,existingNames:t}),e[23]=A):A=e[23];let j;return e[24]!==k||e[25]!==g||e[26]!==f||e[27]!==l||e[28]!==m?(j={installingName:l,install:f,uninstall:m,duplicate:g,requestDelete:r,requestRename:A,requestUpdate:c,dialogs:k},e[24]=k,e[25]=g,e[26]=f,e[27]=l,e[28]=m,e[29]=j):j=e[29],j}function on(e){return e.map(sn).join(`, `)}function sn(e){return x[e]??e}var cn=new Set;function ln(e){let t=(0,Z.c)(19),{skill:n,onEdit:r,onInstall:a,onUninstall:o,onDelete:s}=e,c,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(ae,{"aria-hidden":!0}),l=(0,$.jsx)(i,{id:`ePK91l`}),t[0]=c,t[1]=l):(c=t[0],l=t[1]);let u;t[2]===r?u=t[3]:(u=(0,$.jsxs)(X,{onSelect:r,children:[c,l]}),t[2]=r,t[3]=u);let d;t[4]!==a||t[5]!==n.installed?(d=a&&!n.installed?(0,$.jsxs)(X,{onSelect:a,children:[(0,$.jsx)(Se,{"aria-hidden":!0}),(0,$.jsx)(i,{id:`TKQ7K-`})]}):null,t[4]=a,t[5]=n.installed,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.installed?(f=n.installed?(0,$.jsxs)(X,{onSelect:o,children:[(0,$.jsx)(we,{"aria-hidden":!0}),(0,$.jsx)(i,{id:`fo0VXg`})]}):null,t[7]=o,t[8]=n.installed,t[9]=f):f=t[9];let p,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(H,{"aria-hidden":!0}),m=(0,$.jsx)(i,{id:`cnGeoo`}),t[10]=p,t[11]=m):(p=t[10],m=t[11]);let h;t[12]===s?h=t[13]:(h=(0,$.jsxs)(X,{variant:`destructive`,onSelect:s,children:[p,m]}),t[12]=s,t[13]=h);let g;return t[14]!==u||t[15]!==d||t[16]!==f||t[17]!==h?(g=(0,$.jsxs)($.Fragment,{children:[u,d,f,h]}),t[14]=u,t[15]=d,t[16]=f,t[17]=h,t[18]=g):g=t[18],g}function un(e){let t=(0,Z.c)(65),{skill:n,actions:r,existingNames:o}=e,{_:s}=a(),c=Ae(),l=Pt().states,{dispatch:u}=Ct(),d=typeof window<`u`?window.okDesktop:void 0,f=n.absolutePath,p;t[0]===s?p=t[1]:(p=async function(e){try{await Rt(e),K.success(s({id:`SXCSQd`}))}catch{K.error(s({id:`cRHuuI`}))}},t[0]=s,t[1]=p);let m=p,h;t[2]===f?h=t[3]:(h=d&&f?(0,$.jsxs)(X,{onSelect:()=>void d.shell.showItemInFolder(f),children:[(0,$.jsx)(ee,{"aria-hidden":!0}),(0,$.jsx)(i,{id:`LtSYdi`})]}):null,t[2]=f,t[3]=h);let g;t[4]!==n.name||t[5]!==n.scope||t[6]!==c?(g=ut({skillName:n.name,scope:n.scope,workspace:c}),t[4]=n.name,t[5]=n.scope,t[6]=c,t[7]=g):g=t[7];let _;t[8]!==u||t[9]!==l||t[10]!==g?(_=(0,$.jsx)(Yt,{input:g,installStates:l,isElectronHost:d!=null,dispatch:u}),t[8]=u,t[9]=l,t[10]=g,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsxs)(ve,{children:[(0,$.jsx)(ie,{"aria-hidden":!0}),(0,$.jsx)(i,{id:`zd00pH`})]}),t[12]=v):v=t[12];let y;t[13]!==f||t[14]!==m?(y=f?(0,$.jsx)(X,{onSelect:()=>void m(f),children:(0,$.jsx)(i,{id:`z2funE`})}):null,t[13]=f,t[14]=m,t[15]=y):y=t[15];let b;t[16]!==m||t[17]!==n.path?(b=()=>void m(n.path),t[16]=m,t[17]=n.path,t[18]=b):b=t[18];let x;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(i,{id:`xloBjn`}),t[19]=x):x=t[19];let S;t[20]===b?S=t[21]:(S=(0,$.jsx)(X,{onSelect:b,children:x}),t[20]=b,t[21]=S);let C;t[22]!==y||t[23]!==S?(C=(0,$.jsxs)(le,{children:[v,(0,$.jsxs)(ce,{children:[y,S]})]}),t[22]=y,t[23]=S,t[24]=C):C=t[24];let w;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(ye,{}),t[25]=w):w=t[25];let T;t[26]!==r||t[27]!==o||t[28]!==n?(T=()=>void r.duplicate(n,o),t[26]=r,t[27]=o,t[28]=n,t[29]=T):T=t[29];let E,D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(ne,{"aria-hidden":!0}),D=(0,$.jsx)(i,{id:`euc6Ns`}),t[30]=E,t[31]=D):(E=t[30],D=t[31]);let O;t[32]===T?O=t[33]:(O=(0,$.jsxs)(X,{onSelect:T,children:[E,D]}),t[32]=T,t[33]=O);let k;t[34]!==r||t[35]!==o||t[36]!==n?(k=()=>r.requestRename(n,o),t[34]=r,t[35]=o,t[36]=n,t[37]=k):k=t[37];let A,j;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(Ce,{"aria-hidden":!0}),j=(0,$.jsx)(i,{id:`2wxgft`}),t[38]=A,t[39]=j):(A=t[38],j=t[39]);let M;t[40]===k?M=t[41]:(M=(0,$.jsxs)(X,{onSelect:k,children:[A,j]}),t[40]=k,t[41]=M);let N;t[42]!==r||t[43]!==n?(N=n.updateAvailable?(0,$.jsxs)(X,{onSelect:()=>r.requestUpdate(n),children:[(0,$.jsx)(Te,{"aria-hidden":!0}),(0,$.jsx)(i,{id:`6g2jsp`})]}):null,t[42]=r,t[43]=n,t[44]=N):N=t[44];let P;t[45]!==r||t[46]!==n?(P=n.installed?(0,$.jsxs)(X,{onSelect:()=>void r.uninstall(n),children:[(0,$.jsx)(we,{"aria-hidden":!0}),(0,$.jsx)(i,{id:`fo0VXg`})]}):(0,$.jsxs)(X,{onSelect:()=>void r.install(n),children:[(0,$.jsx)(Se,{"aria-hidden":!0}),(0,$.jsx)(i,{id:`TKQ7K-`})]}),t[45]=r,t[46]=n,t[47]=P):P=t[47];let F;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(ye,{}),t[48]=F):F=t[48];let I;t[49]!==r||t[50]!==n?(I=()=>r.requestDelete(n),t[49]=r,t[50]=n,t[51]=I):I=t[51];let L,R;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(H,{"aria-hidden":!0}),R=(0,$.jsx)(i,{id:`cnGeoo`}),t[52]=L,t[53]=R):(L=t[52],R=t[53]);let z;t[54]===I?z=t[55]:(z=(0,$.jsxs)(X,{variant:`destructive`,onSelect:I,children:[L,R]}),t[54]=I,t[55]=z);let B;return t[56]!==C||t[57]!==O||t[58]!==M||t[59]!==h||t[60]!==N||t[61]!==P||t[62]!==z||t[63]!==_?(B=(0,$.jsxs)($.Fragment,{children:[h,_,C,w,O,M,N,P,F,z]}),t[56]=C,t[57]=O,t[58]=M,t[59]=h,t[60]=N,t[61]=P,t[62]=z,t[63]=_,t[64]=B):B=t[64],B}export{Te as A,ct as C,Ae as D,rt as E,ke as O,bt as S,it as T,lt as _,Yt as a,ut as b,Kt as c,Vt as d,It as f,st as g,dt as h,Xt as i,Se as j,Ee as k,Ut as l,Pt as m,un as n,qt as o,Rt as p,an as r,Gt as s,ln as t,Wt as u,at as v,Ct as w,vt as x,ot as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{i,l as a,o,s}from"./button-DGf25ccp.js";import{_ as c,g as l,h as u,m as d,p as f}from"./dialog-CvKVTeQa.js";import{t as p}from"./chevron-right-jyIhGBkw.js";import{l as m,r as h}from"./documents-events-CSQluyCM.js";import{a as g,d as _,f as v,i as y,l as b,n as x,o as S,p as ee,r as te,s as ne}from"./dist-BXd_K33i.js";import{_ as re,a as ie,g as ae,i as C,n as oe,r as se,t as w}from"./dist-ICp_3rWY.js";import{n as ce,r as T,t as le}from"./dist-AQSp7Qij.js";var E=e(t(),1),D=n(),O=[`Enter`,` `],ue=[`ArrowDown`,`PageUp`,`Home`],de=[`ArrowUp`,`PageDown`,`End`],fe=[...ue,...de],k={ltr:[...O,`ArrowRight`],rtl:[...O,`ArrowLeft`]},pe={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},A=`Menu`,[j,me,M]=re(A),[N,P]=_(A,[M,ie,T]),F=ie(),he=T(),[ge,I]=N(A),[_e,L]=N(A),ve=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=F(t),[c,l]=E.useState(null),u=E.useRef(!1),d=y(a),f=ae(i);return E.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,D.jsx)(C,{...s,children:(0,D.jsx)(ge,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,D.jsx)(_e,{scope:t,onClose:E.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};ve.displayName=A;var ye=`MenuAnchor`,be=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=F(n);return(0,D.jsx)(w,{...i,...r,ref:t})});be.displayName=ye;var xe=`MenuPortal`,[Se,Ce]=N(xe,{forceMount:void 0}),we=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=I(xe,t);return(0,D.jsx)(Se,{scope:t,forceMount:n,children:(0,D.jsx)(S,{present:n||a.open,children:(0,D.jsx)(x,{asChild:!0,container:i,children:r})})})};we.displayName=xe;var R=`MenuContent`,[Te,z]=N(R),Ee=E.forwardRef((e,t)=>{let n=Ce(R,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=I(R,e.__scopeMenu),o=L(R,e.__scopeMenu);return(0,D.jsx)(j.Provider,{scope:e.__scopeMenu,children:(0,D.jsx)(S,{present:r||a.open,children:(0,D.jsx)(j.Slot,{scope:e.__scopeMenu,children:o.modal?(0,D.jsx)(De,{...i,ref:t}):(0,D.jsx)(Oe,{...i,ref:t})})})})}),De=E.forwardRef((e,t)=>{let n=I(R,e.__scopeMenu),r=E.useRef(null),i=s(t,r);return E.useEffect(()=>{let e=r.current;if(e)return f(e)},[]),(0,D.jsx)(B,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:b(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Oe=E.forwardRef((e,t)=>{let n=I(R,e.__scopeMenu);return(0,D.jsx)(B,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ke=i(`MenuContent.ScrollLock`),B=E.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:c,onEntryFocus:f,onEscapeKeyDown:p,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:_,disableOutsideScroll:v,...y}=e,x=I(R,n),S=L(R,n),ee=F(n),ne=he(n),re=me(n),[ie,ae]=E.useState(null),C=E.useRef(null),oe=s(t,C,x.onContentChange),w=E.useRef(0),T=E.useRef(``),le=E.useRef(0),O=E.useRef(null),ue=E.useRef(`right`),k=E.useRef(0),pe=v?d:E.Fragment,A=v?{as:ke,allowPinchZoom:!0}:void 0,j=e=>{let t=T.current+e,n=re().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=at(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){T.current=t,window.clearTimeout(w.current),t!==``&&(w.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};E.useEffect(()=>()=>window.clearTimeout(w.current),[]),u();let M=E.useCallback(e=>ue.current===O.current?.side&&st(e,O.current?.area),[]);return(0,D.jsx)(Te,{scope:n,searchRef:T,onItemEnter:E.useCallback(e=>{M(e)&&e.preventDefault()},[M]),onItemLeave:E.useCallback(e=>{M(e)||(C.current?.focus(),ae(null))},[M]),onTriggerLeave:E.useCallback(e=>{M(e)&&e.preventDefault()},[M]),pointerGraceTimerRef:le,onPointerGraceIntentChange:E.useCallback(e=>{O.current=e},[]),children:(0,D.jsx)(pe,{...A,children:(0,D.jsx)(l,{asChild:!0,trapped:i,onMountAutoFocus:b(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,D.jsx)(te,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:p,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:_,children:(0,D.jsx)(ce,{asChild:!0,...ne,dir:S.dir,orientation:`vertical`,loop:r,currentTabStopId:ie,onCurrentTabStopIdChange:ae,onEntryFocus:b(f,e=>{S.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,D.jsx)(se,{role:`menu`,"aria-orientation":`vertical`,"data-state":nt(x.open),"data-radix-menu-content":``,dir:S.dir,...ee,...y,ref:oe,style:{outline:`none`,...y.style},onKeyDown:b(y.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&j(e.key));let i=C.current;if(e.target!==i||!fe.includes(e.key))return;e.preventDefault();let a=re().filter(e=>!e.disabled).map(e=>e.ref.current);de.includes(e.key)&&a.reverse(),rt(a)}),onBlur:b(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(w.current),T.current=``)}),onPointerMove:b(e.onPointerMove,Y(e=>{let t=e.target,n=k.current!==e.clientX;e.currentTarget.contains(t)&&n&&(ue.current=e.clientX>k.current?`right`:`left`,k.current=e.clientX)}))})})})})})})});Ee.displayName=R;var Ae=`MenuGroup`,V=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(v.div,{role:`group`,...r,ref:t})});V.displayName=Ae;var je=`MenuLabel`,Me=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(v.div,{...r,ref:t})});Me.displayName=je;var H=`MenuItem`,Ne=`menu.itemSelect`,U=E.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=E.useRef(null),o=L(H,e.__scopeMenu),c=z(H,e.__scopeMenu),l=s(t,a),u=E.useRef(!1),d=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Ne,{bubbles:!0,cancelable:!0});e.addEventListener(Ne,e=>r?.(e),{once:!0}),ee(e,t),t.defaultPrevented?u.current=!1:o.onClose()}};return(0,D.jsx)(Pe,{...i,ref:l,disabled:n,onClick:b(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:b(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:b(e.onKeyDown,e=>{let t=c.searchRef.current!==``;n||t&&e.key===` `||O.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});U.displayName=H;var Pe=E.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=z(H,n),c=he(n),l=E.useRef(null),u=s(t,l),[d,f]=E.useState(!1),[p,m]=E.useState(``);return E.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[a.children]),(0,D.jsx)(j.ItemSlot,{scope:n,disabled:r,textValue:i??p,children:(0,D.jsx)(le,{asChild:!0,...c,focusable:!r,children:(0,D.jsx)(v.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:u,onPointerMove:b(e.onPointerMove,Y(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:b(e.onPointerLeave,Y(e=>o.onItemLeave(e))),onFocus:b(e.onFocus,()=>f(!0)),onBlur:b(e.onBlur,()=>f(!1))})})})}),Fe=`MenuCheckboxItem`,Ie=E.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,D.jsx)(Ue,{scope:e.__scopeMenu,checked:n,children:(0,D.jsx)(U,{role:`menuitemcheckbox`,"aria-checked":q(n)?`mixed`:n,...i,ref:t,"data-state":J(n),onSelect:b(i.onSelect,()=>r?.(q(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ie.displayName=Fe;var Le=`MenuRadioGroup`,[Re,ze]=N(Le,{value:void 0,onValueChange:()=>{}}),Be=E.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=y(r);return(0,D.jsx)(Re,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,D.jsx)(V,{...i,ref:t})})});Be.displayName=Le;var Ve=`MenuRadioItem`,He=E.forwardRef((e,t)=>{let{value:n,...r}=e,i=ze(Ve,e.__scopeMenu),a=n===i.value;return(0,D.jsx)(Ue,{scope:e.__scopeMenu,checked:a,children:(0,D.jsx)(U,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":J(a),onSelect:b(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});He.displayName=Ve;var W=`MenuItemIndicator`,[Ue,We]=N(W,{checked:!1}),Ge=E.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=We(W,n);return(0,D.jsx)(S,{present:r||q(a.checked)||a.checked===!0,children:(0,D.jsx)(v.span,{...i,ref:t,"data-state":J(a.checked)})})});Ge.displayName=W;var Ke=`MenuSeparator`,qe=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(v.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});qe.displayName=Ke;var Je=`MenuArrow`,Ye=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=F(n);return(0,D.jsx)(oe,{...i,...r,ref:t})});Ye.displayName=Je;var G=`MenuSub`,[Xe,Ze]=N(G),Qe=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=I(G,t),o=F(t),[s,c]=E.useState(null),[l,u]=E.useState(null),d=y(i);return E.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,D.jsx)(C,{...o,children:(0,D.jsx)(ge,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,D.jsx)(Xe,{scope:t,contentId:g(),triggerId:g(),trigger:s,onTriggerChange:c,children:n})})})};Qe.displayName=G;var K=`MenuSubTrigger`,$e=E.forwardRef((e,t)=>{let n=I(K,e.__scopeMenu),r=L(K,e.__scopeMenu),i=Ze(K,e.__scopeMenu),a=z(K,e.__scopeMenu),s=E.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=a,u={__scopeMenu:e.__scopeMenu},d=E.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return E.useEffect(()=>d,[d]),E.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]),(0,D.jsx)(be,{asChild:!0,...u,children:(0,D.jsx)(Pe,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":nt(n.open),...e,ref:o(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:b(e.onPointerMove,Y(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(a.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:b(e.onPointerLeave,Y(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,s=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:b(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||k[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});$e.displayName=K;var et=`MenuSubContent`,tt=E.forwardRef((e,t)=>{let n=Ce(R,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=I(R,e.__scopeMenu),o=L(R,e.__scopeMenu),c=Ze(et,e.__scopeMenu),l=E.useRef(null),u=s(t,l);return(0,D.jsx)(j.Provider,{scope:e.__scopeMenu,children:(0,D.jsx)(S,{present:r||a.open,children:(0,D.jsx)(j.Slot,{scope:e.__scopeMenu,children:(0,D.jsx)(B,{id:c.contentId,"aria-labelledby":c.triggerId,...i,ref:u,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:b(e.onFocusOutside,e=>{e.target!==c.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:b(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:b(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=pe[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});tt.displayName=et;function nt(e){return e?`open`:`closed`}function q(e){return e===`indeterminate`}function J(e){return q(e)?`indeterminate`:e?`checked`:`unchecked`}function rt(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function it(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function at(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=it(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function ot(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function st(e,t){return t?ot({x:e.clientX,y:e.clientY},t):!1}function Y(e){return t=>t.pointerType===`mouse`?e(t):void 0}var ct=ve,lt=be,ut=we,dt=Ee,ft=V,pt=Me,mt=U,ht=Ie,gt=Be,_t=He,vt=Ge,yt=qe,bt=Ye,xt=Qe,St=$e,Ct=tt,X=`DropdownMenu`,[wt,Tt]=_(X,[P]),Z=P(),[Et,Dt]=wt(X),Ot=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Z(t),l=E.useRef(null),[u,d]=ne({prop:i,defaultProp:a??!1,onChange:o,caller:X});return(0,D.jsx)(Et,{scope:t,triggerId:g(),triggerRef:l,contentId:g(),open:u,onOpenChange:d,onOpenToggle:E.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,D.jsx)(ct,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Ot.displayName=X;var kt=`DropdownMenuTrigger`,At=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Dt(kt,n),s=Z(n);return(0,D.jsx)(lt,{asChild:!0,...s,children:(0,D.jsx)(v.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:o(t,a.triggerRef),onPointerDown:b(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:b(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});At.displayName=kt;var jt=`DropdownMenuPortal`,Mt=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Z(t);return(0,D.jsx)(ut,{...r,...n})};Mt.displayName=jt;var Nt=`DropdownMenuContent`,Pt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Dt(Nt,n),a=Z(n),o=E.useRef(!1);return(0,D.jsx)(dt,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:b(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:b(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Pt.displayName=Nt;var Ft=`DropdownMenuGroup`,It=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(ft,{...i,...r,ref:t})});It.displayName=Ft;var Lt=`DropdownMenuLabel`,Rt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(pt,{...i,...r,ref:t})});Rt.displayName=Lt;var zt=`DropdownMenuItem`,Bt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(mt,{...i,...r,ref:t})});Bt.displayName=zt;var Vt=`DropdownMenuCheckboxItem`,Ht=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(ht,{...i,...r,ref:t})});Ht.displayName=Vt;var Ut=`DropdownMenuRadioGroup`,Wt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(gt,{...i,...r,ref:t})});Wt.displayName=Ut;var Gt=`DropdownMenuRadioItem`,Kt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(_t,{...i,...r,ref:t})});Kt.displayName=Gt;var qt=`DropdownMenuItemIndicator`,Jt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(vt,{...i,...r,ref:t})});Jt.displayName=qt;var Yt=`DropdownMenuSeparator`,Xt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(yt,{...i,...r,ref:t})});Xt.displayName=Yt;var Zt=`DropdownMenuArrow`,Qt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(bt,{...i,...r,ref:t})});Qt.displayName=Zt;var $t=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Z(t),[s,c]=ne({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,D.jsx)(xt,{...o,open:s,onOpenChange:c,children:n})},en=`DropdownMenuSubTrigger`,tn=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(St,{...i,...r,ref:t})});tn.displayName=en;var nn=`DropdownMenuSubContent`,rn=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(Ct,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});rn.displayName=nn;var an=Ot,on=At,sn=Mt,cn=Pt,ln=It,un=Rt,dn=Bt,fn=Ht,pn=Wt,mn=Kt,hn=Jt,gn=Xt,_n=$t,vn=tn,yn=rn,Q=r();function bn(e){let t=(0,Q.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,D.jsx)(an,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function xn(e){let t=(0,Q.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,D.jsx)(on,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function Sn(e){let t=(0,Q.c)(12),n,r,i,o;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4]):({className:n,align:i,sideOffset:o,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o);let s=i===void 0?`start`:i,c=o===void 0?4:o,l;t[5]===n?l=t[6]:(l=a(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[5]=n,t[6]=l);let u;return t[7]!==s||t[8]!==r||t[9]!==c||t[10]!==l?(u=(0,D.jsx)(sn,{children:(0,D.jsx)(cn,{"data-slot":`dropdown-menu-content`,sideOffset:c,align:s,className:l,...r})}),t[7]=s,t[8]=r,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function Cn(e){let t=(0,Q.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,D.jsx)(ln,{"data-slot":`dropdown-menu-group`,...n}),t[2]=n,t[3]=r),r}function wn(e){let t=(0,Q.c)(12),n,r,i,o;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4]):({className:n,inset:r,variant:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o);let s=o===void 0?`default`:o,c;t[5]===n?c=t[6]:(c=a(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=c);let l;return t[7]!==r||t[8]!==i||t[9]!==c||t[10]!==s?(l=(0,D.jsx)(dn,{"data-slot":`dropdown-menu-item`,"data-inset":r,"data-variant":s,className:c,...i}),t[7]=r,t[8]=i,t[9]=c,t[10]=s,t[11]=l):l=t[11],l}function Tn(e){let t=(0,Q.c)(15),n,r,i,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4],s=t[5]):({className:i,children:r,checked:n,inset:o,...s}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s);let l;t[6]===i?l=t[7]:(l=a(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=l);let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,D.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,D.jsx)(hn,{children:(0,D.jsx)(c,{})})}),t[8]=u):u=t[8];let d;return t[9]!==n||t[10]!==r||t[11]!==o||t[12]!==s||t[13]!==l?(d=(0,D.jsxs)(fn,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":o,className:l,checked:n,...s,children:[u,r]}),t[9]=n,t[10]=r,t[11]=o,t[12]=s,t[13]=l,t[14]=d):d=t[14],d}function En(e){let t=(0,Q.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,D.jsx)(pn,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function Dn(e){let t=(0,Q.c)(13),n,r,i,o;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4]):({className:r,children:n,inset:i,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o);let s;t[5]===r?s=t[6]:(s=a(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=s);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,D.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,D.jsx)(hn,{children:(0,D.jsx)(c,{})})}),t[7]=l):l=t[7];let u;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(u=(0,D.jsxs)(mn,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:s,...o,children:[l,n]}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=u):u=t[12],u}function On(e){let t=(0,Q.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let o;t[4]===n?o=t[5]:(o=a(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==i||t[8]!==o?(s=(0,D.jsx)(un,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:o,...i}),t[6]=r,t[7]=i,t[8]=o,t[9]=s):s=t[9],s}function kn(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=a(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,D.jsx)(gn,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o}function An(e){let t=(0,Q.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,D.jsx)(_n,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function jn(e){let t=(0,Q.c)(13),n,r,i,o;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4]):({className:r,inset:i,children:n,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o);let s;t[5]===r?s=t[6]:(s=a(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,D.jsx)(p,{className:`ml-auto`}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(l=(0,D.jsxs)(vn,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":i,className:s,...o,children:[n,c]}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function Mn(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=a(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,D.jsx)(yn,{"data-slot":`dropdown-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o}async function $(e){return m(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function Nn(e){try{let t=await fetch(`/api/skill`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await $(t)};let n=await t.json().catch(()=>null);return h(),{ok:!0,created:n?.created??!1,warnings:n?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Pn(e){try{let t=await fetch(`/api/skill-file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await $(t)};let n=await t.json().catch(()=>null);return h(),{ok:!0,created:n?.created??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Fn(){try{let e=await fetch(`/api/skills/management`);return e.ok?await e.json():null}catch{return null}}async function In(e){try{return(await fetch(`/api/skills/management`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({manageEditorSkills:e})})).ok?(h(),!0):!1}catch{return!1}}function Ln(e,t){let n=`${e}-copy`;if(!t.has(n))return n;for(let n=2;n<1e3;n+=1){let r=`${e}-copy-${n}`;if(!t.has(r))return r}return`${e}-copy-${t.size+1}`}async function Rn(e){try{let t=new URLSearchParams({name:e.name,scope:e.scope}),n=await fetch(`/api/skill?${t.toString()}`);if(!n.ok)return{ok:!1,error:await $(n)};let r=await n.json().catch(()=>null),i=typeof r?.skill?.frontmatter?.description==`string`?r.skill.frontmatter.description:``,a=typeof r?.skill?.body==`string`?r.skill.body:``,o=Ln(e.name,e.existingNames),s=await Nn({scope:e.scope,name:o,frontmatter:{name:o,description:i},body:a});return s.ok?{ok:!0,name:o}:{ok:!1,error:s.error}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function zn(e){let{name:t,fromScope:n,toScope:r}=e;if(n===r)return{ok:!0,scope:r};try{let e=await fetch(`/api/skill?name=${encodeURIComponent(t)}&scope=${n}`);if(!e.ok)return{ok:!1,error:await $(e)};let i=await e.json().catch(()=>null),a=typeof i?.skill?.frontmatter?.description==`string`?i.skill.frontmatter.description:``,o=typeof i?.skill?.body==`string`?i.skill.body:``,s=await fetch(`/api/skill?name=${encodeURIComponent(t)}&scope=${r}`);if(s.ok)return{ok:!1,error:`A ${r} skill named "${t}" already exists.`};if(s.status!==404)return{ok:!1,error:`Couldn't verify the ${r} destination "${t}" is free (HTTP ${s.status}); aborting before any write so an existing skill can't be overwritten. Retry in a moment.`};let c=await Nn({scope:r,name:t,frontmatter:{name:t,description:a},body:o});if(!c.ok)return c;let l=await Hn(n,t);if(!l.ok)return{ok:!1,error:`Copied "${t}" to ${r}, but reading its bundle files failed (${l.error}); the ${n} original is intact. Delete the partial ${r} copy and retry.`};let u=[];for(let e of l.files){if(e.text===null){u.push(e.path);continue}let i=await Pn({scope:r,name:t,path:e.path,content:e.text});if(!i.ok)return{ok:!1,error:`Copied "${t}" to ${r}, but copying its bundle file "${e.path}" failed (${i.error}); the ${n} original is intact. Delete the partial ${r} copy and retry.`}}let d=await Vn(n,t);return d.ok?(h(),{ok:!0,scope:r,...u.length>0?{skippedBinaryFiles:u}:{}}):{ok:!1,error:`Copied to ${r}, but couldn't remove the ${n} copy: ${d.error}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Bn(e){try{let t=await fetch(`/api/skill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await $(t)};let n=await t.json().catch(()=>null);return h(),{ok:!0,committed:n?.committed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Vn(e,t){try{let n=`?name=${encodeURIComponent(t)}&scope=${encodeURIComponent(e)}`,r=await fetch(`/api/skill${n}`,{method:`DELETE`});if(!r.ok)return{ok:!1,error:await $(r)};let i=await r.json().catch(()=>null);return h(),{ok:!0,existed:i?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Hn(e,t){try{let n=new URLSearchParams({name:t,scope:e}),r=await fetch(`/api/skill?${n.toString()}`);return r.ok?{ok:!0,files:(await r.json().catch(()=>null))?.skill?.files??[]}:{ok:!1,error:await $(r)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Un(e){try{let t=new URLSearchParams({name:e.name,scope:e.scope,path:e.path}),n=await fetch(`/api/skill-file?${t.toString()}`,{signal:e.signal});if(!n.ok)return{ok:!1,status:n.status,error:await $(n)};let r=await n.json().catch(()=>null);return typeof r?.text==`string`?{ok:!0,text:r.text}:{ok:!1,status:n.status,error:`HTTP ${n.status}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function Wn(e,t){return Un({...e,signal:t}).then(e=>e.ok?{ok:!0,text:e.text}:{ok:!1,status:e.status})}async function Gn(e){try{let t=await fetch(`/api/skill/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await $(t)};let n=await t.json().catch(()=>null);return h(),{ok:!0,hosts:n?.hosts??[],scripts:n?.scripts??!1,warnings:n?.warnings??[],warningCodes:n?.warningCodes??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Kn(e){try{let t=await fetch(`/api/skill/uninstall`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await $(t)};let n=await t.json().catch(()=>null);return h(),{ok:!0,uninstalled:n?.uninstalled??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function qn(e){try{let t=await fetch(`/api/skill/update`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await $(t)};let n=await t.json().catch(()=>null);return h(),{ok:!0,version:n?.version??``,previousVersion:n?.previousVersion,checkpointRef:n?.checkpointRef}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}export{ft as A,Ct as B,Mn as C,bt as D,lt as E,gt as F,P as H,_t as I,ct as L,vt as M,pt as N,ht as O,ut as P,yt as R,An as S,xn as T,St as V,wn as _,Gn as a,Dn as b,zn as c,Kn as d,qn as f,Cn as g,Sn as h,Fn as i,mt as j,dt as k,Nn as l,Tn as m,Rn as n,Wn as o,bn as p,Hn as r,Bn as s,Vn as t,In as u,On as v,jn as w,kn as x,En as y,xt as z};
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{i,l as a,o,s}from"./button-DGf25ccp.js";import{_ as c,g as l,h as u,m as d,p as f}from"./dialog-CIq9aQLf.js";import{t as p}from"./chevron-right-jyIhGBkw.js";import{l as m,r as h}from"./documents-events-CSQluyCM.js";import{a as g,d as _,f as v,i as y,l as b,n as x,o as S,p as ee,r as te,s as ne}from"./dist-BXd_K33i.js";import{_ as re,a as ie,g as ae,i as C,n as oe,r as se,t as w}from"./dist-ICp_3rWY.js";import{n as ce,r as T,t as le}from"./dist-AQSp7Qij.js";var E=e(t(),1),D=n(),O=[`Enter`,` `],ue=[`ArrowDown`,`PageUp`,`Home`],de=[`ArrowUp`,`PageDown`,`End`],fe=[...ue,...de],k={ltr:[...O,`ArrowRight`],rtl:[...O,`ArrowLeft`]},pe={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},A=`Menu`,[j,me,M]=re(A),[N,P]=_(A,[M,ie,T]),F=ie(),he=T(),[ge,I]=N(A),[_e,L]=N(A),ve=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=F(t),[c,l]=E.useState(null),u=E.useRef(!1),d=y(a),f=ae(i);return E.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,D.jsx)(C,{...s,children:(0,D.jsx)(ge,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,D.jsx)(_e,{scope:t,onClose:E.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};ve.displayName=A;var ye=`MenuAnchor`,be=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=F(n);return(0,D.jsx)(w,{...i,...r,ref:t})});be.displayName=ye;var xe=`MenuPortal`,[Se,Ce]=N(xe,{forceMount:void 0}),we=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=I(xe,t);return(0,D.jsx)(Se,{scope:t,forceMount:n,children:(0,D.jsx)(S,{present:n||a.open,children:(0,D.jsx)(x,{asChild:!0,container:i,children:r})})})};we.displayName=xe;var R=`MenuContent`,[Te,z]=N(R),Ee=E.forwardRef((e,t)=>{let n=Ce(R,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=I(R,e.__scopeMenu),o=L(R,e.__scopeMenu);return(0,D.jsx)(j.Provider,{scope:e.__scopeMenu,children:(0,D.jsx)(S,{present:r||a.open,children:(0,D.jsx)(j.Slot,{scope:e.__scopeMenu,children:o.modal?(0,D.jsx)(De,{...i,ref:t}):(0,D.jsx)(Oe,{...i,ref:t})})})})}),De=E.forwardRef((e,t)=>{let n=I(R,e.__scopeMenu),r=E.useRef(null),i=s(t,r);return E.useEffect(()=>{let e=r.current;if(e)return f(e)},[]),(0,D.jsx)(B,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:b(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Oe=E.forwardRef((e,t)=>{let n=I(R,e.__scopeMenu);return(0,D.jsx)(B,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ke=i(`MenuContent.ScrollLock`),B=E.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:c,onEntryFocus:f,onEscapeKeyDown:p,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:_,disableOutsideScroll:v,...y}=e,x=I(R,n),S=L(R,n),ee=F(n),ne=he(n),re=me(n),[ie,ae]=E.useState(null),C=E.useRef(null),oe=s(t,C,x.onContentChange),w=E.useRef(0),T=E.useRef(``),le=E.useRef(0),O=E.useRef(null),ue=E.useRef(`right`),k=E.useRef(0),pe=v?d:E.Fragment,A=v?{as:ke,allowPinchZoom:!0}:void 0,j=e=>{let t=T.current+e,n=re().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=at(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){T.current=t,window.clearTimeout(w.current),t!==``&&(w.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};E.useEffect(()=>()=>window.clearTimeout(w.current),[]),u();let M=E.useCallback(e=>ue.current===O.current?.side&&st(e,O.current?.area),[]);return(0,D.jsx)(Te,{scope:n,searchRef:T,onItemEnter:E.useCallback(e=>{M(e)&&e.preventDefault()},[M]),onItemLeave:E.useCallback(e=>{M(e)||(C.current?.focus(),ae(null))},[M]),onTriggerLeave:E.useCallback(e=>{M(e)&&e.preventDefault()},[M]),pointerGraceTimerRef:le,onPointerGraceIntentChange:E.useCallback(e=>{O.current=e},[]),children:(0,D.jsx)(pe,{...A,children:(0,D.jsx)(l,{asChild:!0,trapped:i,onMountAutoFocus:b(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,D.jsx)(te,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:p,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:g,onDismiss:_,children:(0,D.jsx)(ce,{asChild:!0,...ne,dir:S.dir,orientation:`vertical`,loop:r,currentTabStopId:ie,onCurrentTabStopIdChange:ae,onEntryFocus:b(f,e=>{S.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,D.jsx)(se,{role:`menu`,"aria-orientation":`vertical`,"data-state":nt(x.open),"data-radix-menu-content":``,dir:S.dir,...ee,...y,ref:oe,style:{outline:`none`,...y.style},onKeyDown:b(y.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&j(e.key));let i=C.current;if(e.target!==i||!fe.includes(e.key))return;e.preventDefault();let a=re().filter(e=>!e.disabled).map(e=>e.ref.current);de.includes(e.key)&&a.reverse(),rt(a)}),onBlur:b(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(w.current),T.current=``)}),onPointerMove:b(e.onPointerMove,Y(e=>{let t=e.target,n=k.current!==e.clientX;e.currentTarget.contains(t)&&n&&(ue.current=e.clientX>k.current?`right`:`left`,k.current=e.clientX)}))})})})})})})});Ee.displayName=R;var Ae=`MenuGroup`,V=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(v.div,{role:`group`,...r,ref:t})});V.displayName=Ae;var je=`MenuLabel`,Me=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(v.div,{...r,ref:t})});Me.displayName=je;var H=`MenuItem`,Ne=`menu.itemSelect`,U=E.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=E.useRef(null),o=L(H,e.__scopeMenu),c=z(H,e.__scopeMenu),l=s(t,a),u=E.useRef(!1),d=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Ne,{bubbles:!0,cancelable:!0});e.addEventListener(Ne,e=>r?.(e),{once:!0}),ee(e,t),t.defaultPrevented?u.current=!1:o.onClose()}};return(0,D.jsx)(Pe,{...i,ref:l,disabled:n,onClick:b(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:b(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:b(e.onKeyDown,e=>{let t=c.searchRef.current!==``;n||t&&e.key===` `||O.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});U.displayName=H;var Pe=E.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=z(H,n),c=he(n),l=E.useRef(null),u=s(t,l),[d,f]=E.useState(!1),[p,m]=E.useState(``);return E.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[a.children]),(0,D.jsx)(j.ItemSlot,{scope:n,disabled:r,textValue:i??p,children:(0,D.jsx)(le,{asChild:!0,...c,focusable:!r,children:(0,D.jsx)(v.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:u,onPointerMove:b(e.onPointerMove,Y(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:b(e.onPointerLeave,Y(e=>o.onItemLeave(e))),onFocus:b(e.onFocus,()=>f(!0)),onBlur:b(e.onBlur,()=>f(!1))})})})}),Fe=`MenuCheckboxItem`,Ie=E.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,D.jsx)(Ue,{scope:e.__scopeMenu,checked:n,children:(0,D.jsx)(U,{role:`menuitemcheckbox`,"aria-checked":q(n)?`mixed`:n,...i,ref:t,"data-state":J(n),onSelect:b(i.onSelect,()=>r?.(q(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ie.displayName=Fe;var Le=`MenuRadioGroup`,[Re,ze]=N(Le,{value:void 0,onValueChange:()=>{}}),Be=E.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=y(r);return(0,D.jsx)(Re,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,D.jsx)(V,{...i,ref:t})})});Be.displayName=Le;var Ve=`MenuRadioItem`,He=E.forwardRef((e,t)=>{let{value:n,...r}=e,i=ze(Ve,e.__scopeMenu),a=n===i.value;return(0,D.jsx)(Ue,{scope:e.__scopeMenu,checked:a,children:(0,D.jsx)(U,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":J(a),onSelect:b(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});He.displayName=Ve;var W=`MenuItemIndicator`,[Ue,We]=N(W,{checked:!1}),Ge=E.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=We(W,n);return(0,D.jsx)(S,{present:r||q(a.checked)||a.checked===!0,children:(0,D.jsx)(v.span,{...i,ref:t,"data-state":J(a.checked)})})});Ge.displayName=W;var Ke=`MenuSeparator`,qe=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(v.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});qe.displayName=Ke;var Je=`MenuArrow`,Ye=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=F(n);return(0,D.jsx)(oe,{...i,...r,ref:t})});Ye.displayName=Je;var G=`MenuSub`,[Xe,Ze]=N(G),Qe=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=I(G,t),o=F(t),[s,c]=E.useState(null),[l,u]=E.useState(null),d=y(i);return E.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,D.jsx)(C,{...o,children:(0,D.jsx)(ge,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,D.jsx)(Xe,{scope:t,contentId:g(),triggerId:g(),trigger:s,onTriggerChange:c,children:n})})})};Qe.displayName=G;var K=`MenuSubTrigger`,$e=E.forwardRef((e,t)=>{let n=I(K,e.__scopeMenu),r=L(K,e.__scopeMenu),i=Ze(K,e.__scopeMenu),a=z(K,e.__scopeMenu),s=E.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=a,u={__scopeMenu:e.__scopeMenu},d=E.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return E.useEffect(()=>d,[d]),E.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]),(0,D.jsx)(be,{asChild:!0,...u,children:(0,D.jsx)(Pe,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":nt(n.open),...e,ref:o(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:b(e.onPointerMove,Y(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(a.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:b(e.onPointerLeave,Y(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,s=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:b(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||k[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});$e.displayName=K;var et=`MenuSubContent`,tt=E.forwardRef((e,t)=>{let n=Ce(R,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=I(R,e.__scopeMenu),o=L(R,e.__scopeMenu),c=Ze(et,e.__scopeMenu),l=E.useRef(null),u=s(t,l);return(0,D.jsx)(j.Provider,{scope:e.__scopeMenu,children:(0,D.jsx)(S,{present:r||a.open,children:(0,D.jsx)(j.Slot,{scope:e.__scopeMenu,children:(0,D.jsx)(B,{id:c.contentId,"aria-labelledby":c.triggerId,...i,ref:u,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:b(e.onFocusOutside,e=>{e.target!==c.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:b(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:b(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=pe[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});tt.displayName=et;function nt(e){return e?`open`:`closed`}function q(e){return e===`indeterminate`}function J(e){return q(e)?`indeterminate`:e?`checked`:`unchecked`}function rt(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function it(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function at(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=it(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function ot(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function st(e,t){return t?ot({x:e.clientX,y:e.clientY},t):!1}function Y(e){return t=>t.pointerType===`mouse`?e(t):void 0}var ct=ve,lt=be,ut=we,dt=Ee,ft=V,pt=Me,mt=U,ht=Ie,gt=Be,_t=He,vt=Ge,yt=qe,bt=Ye,xt=Qe,St=$e,Ct=tt,X=`DropdownMenu`,[wt,Tt]=_(X,[P]),Z=P(),[Et,Dt]=wt(X),Ot=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Z(t),l=E.useRef(null),[u,d]=ne({prop:i,defaultProp:a??!1,onChange:o,caller:X});return(0,D.jsx)(Et,{scope:t,triggerId:g(),triggerRef:l,contentId:g(),open:u,onOpenChange:d,onOpenToggle:E.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,D.jsx)(ct,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Ot.displayName=X;var kt=`DropdownMenuTrigger`,At=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Dt(kt,n),s=Z(n);return(0,D.jsx)(lt,{asChild:!0,...s,children:(0,D.jsx)(v.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:o(t,a.triggerRef),onPointerDown:b(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:b(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});At.displayName=kt;var jt=`DropdownMenuPortal`,Mt=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Z(t);return(0,D.jsx)(ut,{...r,...n})};Mt.displayName=jt;var Nt=`DropdownMenuContent`,Pt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Dt(Nt,n),a=Z(n),o=E.useRef(!1);return(0,D.jsx)(dt,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:b(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:b(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Pt.displayName=Nt;var Ft=`DropdownMenuGroup`,It=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(ft,{...i,...r,ref:t})});It.displayName=Ft;var Lt=`DropdownMenuLabel`,Rt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(pt,{...i,...r,ref:t})});Rt.displayName=Lt;var zt=`DropdownMenuItem`,Bt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(mt,{...i,...r,ref:t})});Bt.displayName=zt;var Vt=`DropdownMenuCheckboxItem`,Ht=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(ht,{...i,...r,ref:t})});Ht.displayName=Vt;var Ut=`DropdownMenuRadioGroup`,Wt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(gt,{...i,...r,ref:t})});Wt.displayName=Ut;var Gt=`DropdownMenuRadioItem`,Kt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(_t,{...i,...r,ref:t})});Kt.displayName=Gt;var qt=`DropdownMenuItemIndicator`,Jt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(vt,{...i,...r,ref:t})});Jt.displayName=qt;var Yt=`DropdownMenuSeparator`,Xt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(yt,{...i,...r,ref:t})});Xt.displayName=Yt;var Zt=`DropdownMenuArrow`,Qt=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(bt,{...i,...r,ref:t})});Qt.displayName=Zt;var $t=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Z(t),[s,c]=ne({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,D.jsx)(xt,{...o,open:s,onOpenChange:c,children:n})},en=`DropdownMenuSubTrigger`,tn=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(St,{...i,...r,ref:t})});tn.displayName=en;var nn=`DropdownMenuSubContent`,rn=E.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Z(n);return(0,D.jsx)(Ct,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});rn.displayName=nn;var an=Ot,on=At,sn=Mt,cn=Pt,ln=It,un=Rt,dn=Bt,fn=Ht,pn=Wt,mn=Kt,hn=Jt,gn=Xt,_n=$t,vn=tn,yn=rn,Q=r();function bn(e){let t=(0,Q.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,D.jsx)(an,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function xn(e){let t=(0,Q.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,D.jsx)(on,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function Sn(e){let t=(0,Q.c)(12),n,r,i,o;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4]):({className:n,align:i,sideOffset:o,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o);let s=i===void 0?`start`:i,c=o===void 0?4:o,l;t[5]===n?l=t[6]:(l=a(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[5]=n,t[6]=l);let u;return t[7]!==s||t[8]!==r||t[9]!==c||t[10]!==l?(u=(0,D.jsx)(sn,{children:(0,D.jsx)(cn,{"data-slot":`dropdown-menu-content`,sideOffset:c,align:s,className:l,...r})}),t[7]=s,t[8]=r,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function Cn(e){let t=(0,Q.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,D.jsx)(ln,{"data-slot":`dropdown-menu-group`,...n}),t[2]=n,t[3]=r),r}function wn(e){let t=(0,Q.c)(12),n,r,i,o;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4]):({className:n,inset:r,variant:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o);let s=o===void 0?`default`:o,c;t[5]===n?c=t[6]:(c=a(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=c);let l;return t[7]!==r||t[8]!==i||t[9]!==c||t[10]!==s?(l=(0,D.jsx)(dn,{"data-slot":`dropdown-menu-item`,"data-inset":r,"data-variant":s,className:c,...i}),t[7]=r,t[8]=i,t[9]=c,t[10]=s,t[11]=l):l=t[11],l}function Tn(e){let t=(0,Q.c)(15),n,r,i,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4],s=t[5]):({className:i,children:r,checked:n,inset:o,...s}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s);let l;t[6]===i?l=t[7]:(l=a(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=l);let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,D.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,D.jsx)(hn,{children:(0,D.jsx)(c,{})})}),t[8]=u):u=t[8];let d;return t[9]!==n||t[10]!==r||t[11]!==o||t[12]!==s||t[13]!==l?(d=(0,D.jsxs)(fn,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":o,className:l,checked:n,...s,children:[u,r]}),t[9]=n,t[10]=r,t[11]=o,t[12]=s,t[13]=l,t[14]=d):d=t[14],d}function En(e){let t=(0,Q.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,D.jsx)(pn,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function Dn(e){let t=(0,Q.c)(13),n,r,i,o;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4]):({className:r,children:n,inset:i,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o);let s;t[5]===r?s=t[6]:(s=a(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=s);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,D.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,D.jsx)(hn,{children:(0,D.jsx)(c,{})})}),t[7]=l):l=t[7];let u;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(u=(0,D.jsxs)(mn,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:s,...o,children:[l,n]}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=u):u=t[12],u}function On(e){let t=(0,Q.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let o;t[4]===n?o=t[5]:(o=a(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==i||t[8]!==o?(s=(0,D.jsx)(un,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:o,...i}),t[6]=r,t[7]=i,t[8]=o,t[9]=s):s=t[9],s}function kn(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=a(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,D.jsx)(gn,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o}function An(e){let t=(0,Q.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,D.jsx)(_n,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function jn(e){let t=(0,Q.c)(13),n,r,i,o;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4]):({className:r,inset:i,children:n,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o);let s;t[5]===r?s=t[6]:(s=a(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,D.jsx)(p,{className:`ml-auto`}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(l=(0,D.jsxs)(vn,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":i,className:s,...o,children:[n,c]}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function Mn(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=a(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,D.jsx)(yn,{"data-slot":`dropdown-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o}async function $(e){return m(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function Nn(e){try{let t=await fetch(`/api/skill`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await $(t)};let n=await t.json().catch(()=>null);return h(),{ok:!0,created:n?.created??!1,warnings:n?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Pn(e){try{let t=await fetch(`/api/skill-file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await $(t)};let n=await t.json().catch(()=>null);return h(),{ok:!0,created:n?.created??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Fn(){try{let e=await fetch(`/api/skills/management`);return e.ok?await e.json():null}catch{return null}}async function In(e){try{return(await fetch(`/api/skills/management`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({manageEditorSkills:e})})).ok?(h(),!0):!1}catch{return!1}}function Ln(e,t){let n=`${e}-copy`;if(!t.has(n))return n;for(let n=2;n<1e3;n+=1){let r=`${e}-copy-${n}`;if(!t.has(r))return r}return`${e}-copy-${t.size+1}`}async function Rn(e){try{let t=new URLSearchParams({name:e.name,scope:e.scope}),n=await fetch(`/api/skill?${t.toString()}`);if(!n.ok)return{ok:!1,error:await $(n)};let r=await n.json().catch(()=>null),i=typeof r?.skill?.frontmatter?.description==`string`?r.skill.frontmatter.description:``,a=typeof r?.skill?.body==`string`?r.skill.body:``,o=Ln(e.name,e.existingNames),s=await Nn({scope:e.scope,name:o,frontmatter:{name:o,description:i},body:a});return s.ok?{ok:!0,name:o}:{ok:!1,error:s.error}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function zn(e){let{name:t,fromScope:n,toScope:r}=e;if(n===r)return{ok:!0,scope:r};try{let e=await fetch(`/api/skill?name=${encodeURIComponent(t)}&scope=${n}`);if(!e.ok)return{ok:!1,error:await $(e)};let i=await e.json().catch(()=>null),a=typeof i?.skill?.frontmatter?.description==`string`?i.skill.frontmatter.description:``,o=typeof i?.skill?.body==`string`?i.skill.body:``,s=await fetch(`/api/skill?name=${encodeURIComponent(t)}&scope=${r}`);if(s.ok)return{ok:!1,error:`A ${r} skill named "${t}" already exists.`};if(s.status!==404)return{ok:!1,error:`Couldn't verify the ${r} destination "${t}" is free (HTTP ${s.status}); aborting before any write so an existing skill can't be overwritten. Retry in a moment.`};let c=await Nn({scope:r,name:t,frontmatter:{name:t,description:a},body:o});if(!c.ok)return c;let l=await Hn(n,t);if(!l.ok)return{ok:!1,error:`Copied "${t}" to ${r}, but reading its bundle files failed (${l.error}); the ${n} original is intact. Delete the partial ${r} copy and retry.`};let u=[];for(let e of l.files){if(e.text===null){u.push(e.path);continue}let i=await Pn({scope:r,name:t,path:e.path,content:e.text});if(!i.ok)return{ok:!1,error:`Copied "${t}" to ${r}, but copying its bundle file "${e.path}" failed (${i.error}); the ${n} original is intact. Delete the partial ${r} copy and retry.`}}let d=await Vn(n,t);return d.ok?(h(),{ok:!0,scope:r,...u.length>0?{skippedBinaryFiles:u}:{}}):{ok:!1,error:`Copied to ${r}, but couldn't remove the ${n} copy: ${d.error}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Bn(e){try{let t=await fetch(`/api/skill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await $(t)};let n=await t.json().catch(()=>null);return h(),{ok:!0,committed:n?.committed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Vn(e,t){try{let n=`?name=${encodeURIComponent(t)}&scope=${encodeURIComponent(e)}`,r=await fetch(`/api/skill${n}`,{method:`DELETE`});if(!r.ok)return{ok:!1,error:await $(r)};let i=await r.json().catch(()=>null);return h(),{ok:!0,existed:i?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Hn(e,t){try{let n=new URLSearchParams({name:t,scope:e}),r=await fetch(`/api/skill?${n.toString()}`);return r.ok?{ok:!0,files:(await r.json().catch(()=>null))?.skill?.files??[]}:{ok:!1,error:await $(r)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Un(e){try{let t=new URLSearchParams({name:e.name,scope:e.scope,path:e.path}),n=await fetch(`/api/skill-file?${t.toString()}`,{signal:e.signal});if(!n.ok)return{ok:!1,status:n.status,error:await $(n)};let r=await n.json().catch(()=>null);return typeof r?.text==`string`?{ok:!0,text:r.text}:{ok:!1,status:n.status,error:`HTTP ${n.status}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function Wn(e,t){return Un({...e,signal:t}).then(e=>e.ok?{ok:!0,text:e.text}:{ok:!1,status:e.status})}async function Gn(e){try{let t=await fetch(`/api/skill/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await $(t)};let n=await t.json().catch(()=>null);return h(),{ok:!0,hosts:n?.hosts??[],scripts:n?.scripts??!1,warnings:n?.warnings??[],warningCodes:n?.warningCodes??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Kn(e){try{let t=await fetch(`/api/skill/uninstall`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await $(t)};let n=await t.json().catch(()=>null);return h(),{ok:!0,uninstalled:n?.uninstalled??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function qn(e){try{let t=await fetch(`/api/skill/update`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await $(t)};let n=await t.json().catch(()=>null);return h(),{ok:!0,version:n?.version??``,previousVersion:n?.previousVersion,checkpointRef:n?.checkpointRef}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}export{ft as A,Ct as B,Mn as C,bt as D,lt as E,gt as F,P as H,_t as I,ct as L,vt as M,pt as N,ht as O,ut as P,yt as R,An as S,xn as T,St as V,wn as _,Gn as a,Dn as b,zn as c,Kn as d,qn as f,Cn as g,Sn as h,Fn as i,mt as j,dt as k,Nn as l,Tn as m,Rn as n,Wn as o,bn as p,Hn as r,Bn as s,Vn as t,In as u,On as v,jn as w,kn as x,En as y,xt as z};
|
package/dist/public/assets/{typing-burst-detector-DerDTg2m.js → typing-burst-detector-DEl5qeGr.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{J as i,X as a,Y as o,n as s,pt as c,st as l}from"./DocumentContext-BiJ-_xlQ.js";import{n as u,r as d}from"./dist-CQw2y-s3.js";import{a as f,c as ee,i as te,n as ne,o as re,r as ie,s as ae,t as oe,u as se}from"./panel-BbrtnF__.js";import{Wn as ce,et as p,rt as m,xr as h}from"./dist-GmorMgHF.js";import{l as le}from"./button-DGf25ccp.js";import{i as ue}from"./prop-types-C_2IQGCC.js";import{u as g}from"./documents-events-CSQluyCM.js";import{i as _}from"./startup-marks-CWTDb1CP.js";import{$ as v,At as y,Bt as b,Dt as x,E as S,Et as C,Ft as w,Ht as T,J as E,Mt as D,N as O,Ot as k,Pt as A,Q as j,Rt as de,Ut as fe,X as M,_ as N,_t as P,ct as F,dt as I,et as L,f as R,gt as pe,ht as me,l as he,lt as ge,mt as _e,nt as ve,ot as ye,rt as be,st as xe,tt as Se,ut as Ce,wt as z,y as we,yt as B,zt as Te}from"./dist-DWaLpHcz.js";import{i as Ee,n as De,o as Oe,r as ke}from"./dist-Bqo1ZTng.js";var Ae=e(t(),1),je=r(),Me=new Map;function Ne(e,t){Me.set(e,t)}function Pe(e){let t=Me.get(e)??null;return Me.delete(e),t}function Fe(e){Me.delete(e)}function Ie(e,t){let n=(0,je.c)(4),r=t===void 0?!1:t,[i,a]=(0,Ae.useState)(void 0),o=(0,Ae.useRef)(null),s,c;return n[0]!==r||n[1]!==e?(s=()=>{if(r||e.length===0){a(void 0);return}let t=function(){let t=window.innerHeight/2,n,r;for(let i of e){let e=document.getElementById(i);if(!e)continue;let a=e.getBoundingClientRect().top;a<0?n=i:r===void 0&&a<t&&(r=i)}a(r??n??e[0])},n=function(){o.current===null&&(o.current=requestAnimationFrame(()=>{o.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),o.current!==null&&(cancelAnimationFrame(o.current),o.current=null)}},c=[e,r],n[0]=r,n[1]=e,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,Ae.useEffect)(s,c),i}var V=n(),Le=300;async function Re(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new c(g._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=m.safeParse(n);throw e.success?Error(e.data.title):new c(g._({id:`zlErBl`}),{status:t.status})}let r=p.safeParse(n);if(!r.success)throw new c(g._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var ze=32,Be=12,Ve=6,He=`open-knowledge:outline-nav`;function Ue(e){let t=(0,je.c)(2),n;return t[0]===e?n=t[1]:(n=(0,V.jsx)(_,{name:`outline-panel`,children:(0,V.jsx)(We,{...e})}),t[0]=e,t[1]=n),n}function We(e){let t=(0,je.c)(50),{docName:n,isSourceMode:r,className:i}=e,a=i===void 0?``:i,{_:o}=d(),{pages:c,loading:l}=ue(),p=se(),{activeProvider:m,activeDocName:h}=s(),g,_;t[0]===n?(g=t[1],_=t[2]):(g=[`page-headings`,n],_=()=>Re(n),t[0]=n,t[1]=g,t[2]=_);let v;t[3]!==n||t[4]!==l||t[5]!==c?(v=!l&&(c.has(n)||ce(n)),t[3]=n,t[4]=l,t[5]=c,t[6]=v):v=t[6];let y;t[7]!==g||t[8]!==_||t[9]!==v?(y={queryKey:g,queryFn:_,enabled:v,staleTime:1/0},t[7]=g,t[8]=_,t[9]=v,t[10]=y):y=t[10];let{data:b,isLoading:x,error:S}=ee(y),C;t[11]===b?C=t[12]:(C=b===void 0?[]:b,t[11]=b,t[12]=C);let w=C,T,E;t[13]!==h||t[14]!==m||t[15]!==n||t[16]!==p?(T=()=>{if(!m||h!==n)return;let e=m.document,t=null,r=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,p.invalidateQueries({queryKey:[`page-headings`,n]})},Le)};return e.on(`update`,r),()=>{e.off(`update`,r),t!==null&&clearTimeout(t)}},E=[m,h,n,p],t[13]=h,t[14]=m,t[15]=n,t[16]=p,t[17]=T,t[18]=E):(T=t[17],E=t[18]),(0,Ae.useEffect)(T,E);let D;t[19]===w?D=t[20]:(D=w.map(Ge),t[19]=w,t[20]=D);let O=Ie(D,r),k;t[21]!==O||t[22]!==w?(k=O?w.findIndex(e=>e.slug===O):-1,t[21]=O,t[22]=w,t[23]=k):k=t[23];let A=k,j;t[24]!==n||t[25]!==r?(j=function(e,t){let i={index:e,slug:t,mode:r?`source`:`wysiwyg`};i.mode===`source`&&Ne(n,{kind:`outline`,detail:i}),window.dispatchEvent(new CustomEvent(He,{detail:i}))},t[24]=n,t[25]=r,t[26]=j):j=t[26];let de=j,fe=((A>=0?w[A].level:1)-1)*Be+(Be-Ve)/2,M=A*ze+(ze-Ve)/2,N;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,V.jsx)(ae,{children:(0,V.jsx)(u,{id:`dD7NPy`})}),t[27]=N):N=t[27];let P;t[28]!==w.length||t[29]!==x?(P=!x&&(0,V.jsx)(ie,{children:w.length}),t[28]=w.length,t[29]=x,t[30]=P):P=t[30];let F;t[31]===P?F=t[32]:(F=(0,V.jsxs)(re,{children:[N,P]}),t[31]=P,t[32]=F);let I;t[33]!==o||t[34]!==A||t[35]!==O||t[36]!==S||t[37]!==de||t[38]!==w||t[39]!==x||t[40]!==fe||t[41]!==M?(I=S?(0,V.jsx)(f,{className:`px-2`,children:S instanceof Error?S.message:o({id:`GuqOb1`})}):w.length===0&&!x?(0,V.jsx)(te,{className:`px-2`,children:(0,V.jsx)(u,{id:`0BB9ID`})}):(0,V.jsxs)(`nav`,{"aria-label":o({id:`BymzO4`}),className:`relative`,children:[A>=0&&(0,V.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-0 top-0 rounded-full bg-primary motion-safe:[transition:transform_0.25s_var(--ease-out-strong)]`,style:{width:Ve,height:Ve,transform:`translate(${fe}px, ${M}px)`}}),w.map((e,t)=>{let n=e.slug===O;return(0,V.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>de(t,e.slug),className:le(`w-full cursor-pointer truncate py-1.5 pe-2 text-left text-sm transition-colors`,n?`font-medium text-primary`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${(e.level-1)*Be+20}px`},title:e.text,children:e.text},t)})]}),t[33]=o,t[34]=A,t[35]=O,t[36]=S,t[37]=de,t[38]=w,t[39]=x,t[40]=fe,t[41]=M,t[42]=I):I=t[42];let L;t[43]!==x||t[44]!==I?(L=(0,V.jsx)(ne,{className:`px-3 py-2`,"aria-busy":x,children:I}),t[43]=x,t[44]=I,t[45]=L):L=t[45];let R;return t[46]!==a||t[47]!==F||t[48]!==L?(R=(0,V.jsxs)(oe,{className:a,children:[F,L]}),t[46]=a,t[47]=F,t[48]=L,t[49]=R):R=t[49],R}function Ge(e){return e.slug}var Ke=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,H=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(Ke(e)):Ke,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return de(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=fe(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Te(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(H.prototype[Symbol.iterator]=function(){return this});var qe={from:-1,to:-1,match:/.*/.exec(``)},Je=`gm`+(/x/.unicode==null?``:`u`),Ye=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=qe,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Qe(e,t,n,r,i);this.re=new RegExp(t,Je+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=et(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=et(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},Xe=new WeakMap,Ze=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=Xe.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return Xe.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),Xe.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Qe=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=qe,this.matchPos=et(e,r),this.re=new RegExp(t,Je+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Ze.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=et(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ze.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Ye.prototype[Symbol.iterator]=Qe.prototype[Symbol.iterator]=function(){return this});function $e(e){try{return new RegExp(e,Je),!0}catch{return!1}}function et(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var tt=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=pe(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),d=Math.round(t.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=t.doc.line(Math.max(1,Math.min(t.doc.lines,d))),ee=C.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[r,M.scrollIntoView(ee.from,{y:`center`})],selection:ee})}),!0},nt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},rt=k.define({combine(e){return b(e,nt,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function it(e){let t=[ut,lt];return e&&t.push(rt.of(e)),t}var at=E.mark({class:`cm-selectionMatch`}),ot=E.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function st(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=z.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=z.Word)}function ct(e,t,n,r){return e(t.sliceDoc(n,n+1))==z.Word&&e(t.sliceDoc(r-1,r))==z.Word}var lt=j.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(rt),{state:n}=e,r=n.selection;if(r.ranges.length>1)return E.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return E.none;let e=n.wordAt(i.head);if(!e)return E.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return E.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(st(o,n,i.from,i.to)&&ct(o,n,i.from,i.to)))return E.none}else if(a=n.sliceDoc(i.from,i.to),!a)return E.none}let s=[];for(let r of e.visibleRanges){let e=new H(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||st(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(ot.range(r,a)):(r>=i.to||a<=i.from)&&s.push(at.range(r,a)),s.length>t.maxMatches))return E.none}}return E.set(s)}},{decorations:e=>e.decorations}),ut=M.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),dt=({state:e,dispatch:t})=>{let{selection:n}=e,r=C.create(n.ranges.map(t=>e.wordAt(t.head)||C.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function ft(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new H(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new H(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var pt=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return dt({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=ft(e,r);return i?(t(e.update({selection:e.selection.addRange(C.range(i.from,i.to),!1),effects:M.scrollIntoView(i.to)})),!0):!1},U=k.define({combine(e){return b(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ut(e),scrollToMatch:e=>M.scrollIntoView(e)})}});function mt(e){return e?[U.of(e),Jt]:Jt}var ht=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||$e(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{J as i,X as a,Y as o,n as s,pt as c,st as l}from"./DocumentContext-bNGvFuJS.js";import{n as u,r as d}from"./dist-CQw2y-s3.js";import{a as f,c as ee,i as te,n as ne,o as re,r as ie,s as ae,t as oe,u as se}from"./panel-BbrtnF__.js";import{Wn as ce,et as p,rt as m,xr as h}from"./dist-GmorMgHF.js";import{l as le}from"./button-DGf25ccp.js";import{i as ue}from"./prop-types-C_2IQGCC.js";import{u as g}from"./documents-events-CSQluyCM.js";import{i as _}from"./startup-marks-CWTDb1CP.js";import{$ as v,At as y,Bt as b,Dt as x,E as S,Et as C,Ft as w,Ht as T,J as E,Mt as D,N as O,Ot as k,Pt as A,Q as j,Rt as de,Ut as fe,X as M,_ as N,_t as P,ct as F,dt as I,et as L,f as R,gt as pe,ht as me,l as he,lt as ge,mt as _e,nt as ve,ot as ye,rt as be,st as xe,tt as Se,ut as Ce,wt as z,y as we,yt as B,zt as Te}from"./dist-DWaLpHcz.js";import{i as Ee,n as De,o as Oe,r as ke}from"./dist-Bqo1ZTng.js";var Ae=e(t(),1),je=r(),Me=new Map;function Ne(e,t){Me.set(e,t)}function Pe(e){let t=Me.get(e)??null;return Me.delete(e),t}function Fe(e){Me.delete(e)}function Ie(e,t){let n=(0,je.c)(4),r=t===void 0?!1:t,[i,a]=(0,Ae.useState)(void 0),o=(0,Ae.useRef)(null),s,c;return n[0]!==r||n[1]!==e?(s=()=>{if(r||e.length===0){a(void 0);return}let t=function(){let t=window.innerHeight/2,n,r;for(let i of e){let e=document.getElementById(i);if(!e)continue;let a=e.getBoundingClientRect().top;a<0?n=i:r===void 0&&a<t&&(r=i)}a(r??n??e[0])},n=function(){o.current===null&&(o.current=requestAnimationFrame(()=>{o.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),o.current!==null&&(cancelAnimationFrame(o.current),o.current=null)}},c=[e,r],n[0]=r,n[1]=e,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,Ae.useEffect)(s,c),i}var V=n(),Le=300;async function Re(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new c(g._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=m.safeParse(n);throw e.success?Error(e.data.title):new c(g._({id:`zlErBl`}),{status:t.status})}let r=p.safeParse(n);if(!r.success)throw new c(g._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var ze=32,Be=12,Ve=6,He=`open-knowledge:outline-nav`;function Ue(e){let t=(0,je.c)(2),n;return t[0]===e?n=t[1]:(n=(0,V.jsx)(_,{name:`outline-panel`,children:(0,V.jsx)(We,{...e})}),t[0]=e,t[1]=n),n}function We(e){let t=(0,je.c)(50),{docName:n,isSourceMode:r,className:i}=e,a=i===void 0?``:i,{_:o}=d(),{pages:c,loading:l}=ue(),p=se(),{activeProvider:m,activeDocName:h}=s(),g,_;t[0]===n?(g=t[1],_=t[2]):(g=[`page-headings`,n],_=()=>Re(n),t[0]=n,t[1]=g,t[2]=_);let v;t[3]!==n||t[4]!==l||t[5]!==c?(v=!l&&(c.has(n)||ce(n)),t[3]=n,t[4]=l,t[5]=c,t[6]=v):v=t[6];let y;t[7]!==g||t[8]!==_||t[9]!==v?(y={queryKey:g,queryFn:_,enabled:v,staleTime:1/0},t[7]=g,t[8]=_,t[9]=v,t[10]=y):y=t[10];let{data:b,isLoading:x,error:S}=ee(y),C;t[11]===b?C=t[12]:(C=b===void 0?[]:b,t[11]=b,t[12]=C);let w=C,T,E;t[13]!==h||t[14]!==m||t[15]!==n||t[16]!==p?(T=()=>{if(!m||h!==n)return;let e=m.document,t=null,r=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,p.invalidateQueries({queryKey:[`page-headings`,n]})},Le)};return e.on(`update`,r),()=>{e.off(`update`,r),t!==null&&clearTimeout(t)}},E=[m,h,n,p],t[13]=h,t[14]=m,t[15]=n,t[16]=p,t[17]=T,t[18]=E):(T=t[17],E=t[18]),(0,Ae.useEffect)(T,E);let D;t[19]===w?D=t[20]:(D=w.map(Ge),t[19]=w,t[20]=D);let O=Ie(D,r),k;t[21]!==O||t[22]!==w?(k=O?w.findIndex(e=>e.slug===O):-1,t[21]=O,t[22]=w,t[23]=k):k=t[23];let A=k,j;t[24]!==n||t[25]!==r?(j=function(e,t){let i={index:e,slug:t,mode:r?`source`:`wysiwyg`};i.mode===`source`&&Ne(n,{kind:`outline`,detail:i}),window.dispatchEvent(new CustomEvent(He,{detail:i}))},t[24]=n,t[25]=r,t[26]=j):j=t[26];let de=j,fe=((A>=0?w[A].level:1)-1)*Be+(Be-Ve)/2,M=A*ze+(ze-Ve)/2,N;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,V.jsx)(ae,{children:(0,V.jsx)(u,{id:`dD7NPy`})}),t[27]=N):N=t[27];let P;t[28]!==w.length||t[29]!==x?(P=!x&&(0,V.jsx)(ie,{children:w.length}),t[28]=w.length,t[29]=x,t[30]=P):P=t[30];let F;t[31]===P?F=t[32]:(F=(0,V.jsxs)(re,{children:[N,P]}),t[31]=P,t[32]=F);let I;t[33]!==o||t[34]!==A||t[35]!==O||t[36]!==S||t[37]!==de||t[38]!==w||t[39]!==x||t[40]!==fe||t[41]!==M?(I=S?(0,V.jsx)(f,{className:`px-2`,children:S instanceof Error?S.message:o({id:`GuqOb1`})}):w.length===0&&!x?(0,V.jsx)(te,{className:`px-2`,children:(0,V.jsx)(u,{id:`0BB9ID`})}):(0,V.jsxs)(`nav`,{"aria-label":o({id:`BymzO4`}),className:`relative`,children:[A>=0&&(0,V.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-0 top-0 rounded-full bg-primary motion-safe:[transition:transform_0.25s_var(--ease-out-strong)]`,style:{width:Ve,height:Ve,transform:`translate(${fe}px, ${M}px)`}}),w.map((e,t)=>{let n=e.slug===O;return(0,V.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>de(t,e.slug),className:le(`w-full cursor-pointer truncate py-1.5 pe-2 text-left text-sm transition-colors`,n?`font-medium text-primary`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${(e.level-1)*Be+20}px`},title:e.text,children:e.text},t)})]}),t[33]=o,t[34]=A,t[35]=O,t[36]=S,t[37]=de,t[38]=w,t[39]=x,t[40]=fe,t[41]=M,t[42]=I):I=t[42];let L;t[43]!==x||t[44]!==I?(L=(0,V.jsx)(ne,{className:`px-3 py-2`,"aria-busy":x,children:I}),t[43]=x,t[44]=I,t[45]=L):L=t[45];let R;return t[46]!==a||t[47]!==F||t[48]!==L?(R=(0,V.jsxs)(oe,{className:a,children:[F,L]}),t[46]=a,t[47]=F,t[48]=L,t[49]=R):R=t[49],R}function Ge(e){return e.slug}var Ke=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,H=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(Ke(e)):Ke,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return de(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=fe(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Te(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(H.prototype[Symbol.iterator]=function(){return this});var qe={from:-1,to:-1,match:/.*/.exec(``)},Je=`gm`+(/x/.unicode==null?``:`u`),Ye=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=qe,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Qe(e,t,n,r,i);this.re=new RegExp(t,Je+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=et(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=et(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},Xe=new WeakMap,Ze=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=Xe.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return Xe.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),Xe.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Qe=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=qe,this.matchPos=et(e,r),this.re=new RegExp(t,Je+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Ze.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=et(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ze.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Ye.prototype[Symbol.iterator]=Qe.prototype[Symbol.iterator]=function(){return this});function $e(e){try{return new RegExp(e,Je),!0}catch{return!1}}function et(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var tt=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=pe(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),d=Math.round(t.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=t.doc.line(Math.max(1,Math.min(t.doc.lines,d))),ee=C.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[r,M.scrollIntoView(ee.from,{y:`center`})],selection:ee})}),!0},nt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},rt=k.define({combine(e){return b(e,nt,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function it(e){let t=[ut,lt];return e&&t.push(rt.of(e)),t}var at=E.mark({class:`cm-selectionMatch`}),ot=E.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function st(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=z.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=z.Word)}function ct(e,t,n,r){return e(t.sliceDoc(n,n+1))==z.Word&&e(t.sliceDoc(r-1,r))==z.Word}var lt=j.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(rt),{state:n}=e,r=n.selection;if(r.ranges.length>1)return E.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return E.none;let e=n.wordAt(i.head);if(!e)return E.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return E.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(st(o,n,i.from,i.to)&&ct(o,n,i.from,i.to)))return E.none}else if(a=n.sliceDoc(i.from,i.to),!a)return E.none}let s=[];for(let r of e.visibleRanges){let e=new H(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||st(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(ot.range(r,a)):(r>=i.to||a<=i.from)&&s.push(at.range(r,a)),s.length>t.maxMatches))return E.none}}return E.set(s)}},{decorations:e=>e.decorations}),ut=M.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),dt=({state:e,dispatch:t})=>{let{selection:n}=e,r=C.create(n.ranges.map(t=>e.wordAt(t.head)||C.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function ft(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new H(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new H(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var pt=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return dt({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=ft(e,r);return i?(t(e.update({selection:e.selection.addRange(C.range(i.from,i.to),!1),effects:M.scrollIntoView(i.to)})),!0):!1},U=k.define({combine(e){return b(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ut(e),scrollToMatch:e=>M.scrollIntoView(e)})}});function mt(e){return e?[U.of(e),Jt]:Jt}var ht=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||$e(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
2
2
|
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new wt(this):new yt(this)}getCursor(e,t=0,n){let r=e.doc?e:x.create({doc:e});return n??=r.doc.length,this.regexp?G(this,r,t,n):W(this,r,t,n)}},gt=class{constructor(e){this.spec=e}};function _t(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function W(e,t,n,r){let i;return e.wholeWord&&(i=vt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=_t(e.test,t,i)),new H(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function vt(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(xt(i,n-a))!=z.Word||t(St(i,n-a))!=z.Word)&&(t(St(i,r-a))!=z.Word||t(xt(i,r-a))!=z.Word))}var yt=class extends gt{constructor(e){super(e)}nextMatch(e,t,n){let r=W(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=W(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=W(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=W(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=W(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function bt(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function G(e,t,n,r){let i;return e.wholeWord&&(i=Ct(t.charCategorizer(t.selection.main.head))),e.test&&(i=bt(e.test,t,i)),new Ye(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function xt(e,t){return e.slice(T(e,t,!1),t)}function St(e,t){return e.slice(t,T(e,t))}function Ct(e){return(t,n,r)=>!r[0].length||(e(xt(r.input,r.index))!=z.Word||e(St(r.input,r.index))!=z.Word)&&(e(St(r.input,r.index+r[0].length))!=z.Word||e(xt(r.input,r.index+r[0].length))!=z.Word)}var wt=class extends gt{nextMatch(e,t,n){let r=G(this.spec,e,n,e.doc.length).next();return r.done&&(r=G(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=G(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=G(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=G(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},K=A.define(),Tt=A.define(),q=w.define({create(e){return new Et(Lt(e).create(),null)},update(e,t){for(let n of t.effects)n.is(K)?e=new Et(n.value.create(),e.panel):n.is(Tt)&&(e=new Et(e.query,n.value?It:null));return e},provide:e=>P.from(e,e=>e.panel)}),Et=class{constructor(e,t){this.query=e,this.panel=t}},Dt=E.mark({class:`cm-searchMatch`}),Ot=E.mark({class:`cm-searchMatch cm-searchMatch-selected`}),kt=j.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(q))}update(e){let t=e.state.field(q);(t!=e.startState.field(q)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return E.none;let{view:n}=this,r=new D;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?Ot:Dt)})}return r.finish()}},{decorations:e=>e.decorations});function J(e){return t=>{let n=t.state.field(q,!1);return n&&n.query.spec.valid?e(t,n):Bt(t)}}var At=J((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=C.single(r.from,r.to),a=e.state.facet(U);return e.dispatch({selection:i,effects:[Kt(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),zt(e),!0}),jt=J((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=C.single(i.from,i.to),o=e.state.facet(U);return e.dispatch({selection:a,effects:[Kt(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),zt(e),!0}),Mt=J((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:C.create(n.map(e=>C.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Nt=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new H(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(C.range(t.value.from,t.value.to))}return t(e.update({selection:C.create(a,o),userEvent:`select.search.matches`})),!0},Pt=J((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(M.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`)));let d=e.state.changes(s);return o&&(c=C.single(o.from,o.to).map(d),u.push(Kt(e,o)),u.push(n.facet(U).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),Ft=J((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:M.announce.of(r),userEvent:`input.replace.all`}),!0});function It(e){return e.state.facet(U).createPanel(e)}function Lt(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(U);return new ht({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function Rt(e){let t=be(e,It);return t&&t.dom.querySelector(`[main-field]`)}function zt(e){let t=Rt(e);t&&t==e.root.activeElement&&t.select()}var Bt=e=>{let t=e.state.field(q,!1);if(t&&t.panel){let n=Rt(e);if(n&&n!=e.root.activeElement){let r=Lt(e.state,t.query.spec);r.valid&&e.dispatch({effects:K.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Tt.of(!0),t?K.of(Lt(e.state,t.query.spec)):A.appendConfig.of(Jt)]});return!0},Vt=e=>{let t=e.state.field(q,!1);if(!t||!t.panel)return!1;let n=be(e,It);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Tt.of(!1)}),!0},Ht=[{key:`Mod-f`,run:Bt,scope:`editor search-panel`},{key:`F3`,run:At,shift:jt,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:At,shift:jt,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Vt,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Nt},{key:`Mod-Alt-g`,run:tt},{key:`Mod-d`,run:pt,preventDefault:!0}],Ut=class{constructor(e){this.view=e;let t=this.query=e.state.field(q).query.spec;this.commit=this.commit.bind(this),this.searchField=B(`input`,{value:t.search,placeholder:Y(e,`Find`),"aria-label":Y(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=B(`input`,{value:t.replace,placeholder:Y(e,`Replace`),"aria-label":Y(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=B(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=B(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=B(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return B(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=B(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>At(e),[Y(e,`next`)]),n(`prev`,()=>jt(e),[Y(e,`previous`)]),n(`select`,()=>Mt(e),[Y(e,`all`)]),B(`label`,null,[this.caseField,Y(e,`match case`)]),B(`label`,null,[this.reField,Y(e,`regexp`)]),B(`label`,null,[this.wordField,Y(e,`by word`)]),...e.state.readOnly?[]:[B(`br`),this.replaceField,n(`replace`,()=>Pt(e),[Y(e,`replace`)]),n(`replaceAll`,()=>Ft(e),[Y(e,`replace all`)])],B(`button`,{name:`close`,onclick:()=>Vt(e),"aria-label":Y(e,`close`),type:`button`},[`×`])])}commit(){let e=new ht({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:K.of(e)}))}keydown(e){me(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?jt:At)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Pt(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(K)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(U).top}};function Y(e,t){return e.state.phrase(t)}var Wt=30,Gt=/[\s\.,:;?!]/;function Kt(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-Wt),o=Math.min(i,n+Wt),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<Wt;e++)if(!Gt.test(s[e+1])&&Gt.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-Wt;e--)if(!Gt.test(s[e-1])&&Gt.test(s[e])){s=s.slice(0,e);break}}return M.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var qt=M.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),Jt=[q,y.low(kt),qt],Yt=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},X=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet($).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new D,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=vn(s);if(i)o.add(n,n,E.widget({widget:new dn(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,E.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,Z(f))}};function Z(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new Yt(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new Yt(r.from,n,r.diagnostic)}),r}function Xt(e,t){let n=t.pos,r=t.end||n,i=e.state.facet($).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(Qt))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function Zt(e,t){return e.field(Q,!1)?t:t.concat(A.appendConfig.of(yn))}var Qt=A.define(),$t=A.define(),en=A.define(),Q=w.define({create(){return new X(E.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=Z(n,e.selected.diagnostic,i)||Z(n,null,i)}!n.size&&i&&t.state.facet($).autoPanel&&(i=null),e=new X(n,i,r)}for(let n of t.effects)if(n.is(Qt)){let r=t.state.facet($).autoPanel?n.value.length?pn.open:null:e.panel;e=X.init(n.value,r,t.state)}else n.is($t)?e=new X(e.diagnostics,n.value?pn.open:null,e.selected):n.is(en)&&(e=new X(e.diagnostics,e.panel,n.value));return e},provide:e=>[P.from(e,e=>e.panel),M.decorations.from(e,e=>e.diagnostics)]}),tn=E.mark({class:`cm-lintRange cm-lintRange-active`});function nn(e,t,n){let{diagnostics:r}=e.state.field(Q),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet($).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:rn(e,i)}}}:null}function rn(e,t){return B(`ul`,{class:`cm-tooltip-lint`},t.map(t=>un(e,t,!1)))}var an=e=>{let t=e.state.field(Q,!1);(!t||!t.panel)&&e.dispatch({effects:Zt(e.state,[$t.of(!0)])});let n=be(e,pn.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},on=e=>{let t=e.state.field(Q,!1);return!t||!t.panel?!1:(e.dispatch({effects:$t.of(!1)}),!0)},sn=[{key:`Mod-Shift-m`,run:an,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(Q,!1);if(!t)return!1;let n=e.state.selection.main,r=Z(t.diagnostics,null,n.to+1);return!r&&(r=Z(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],$=k.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...b(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:cn,tooltipFilter:cn,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function cn(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function ln(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function un(e,t,n){let r=n?ln(t.actions):[];return B(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},B(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=Z(e.state.field(Q).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),B(`u`,s.slice(c,c+1)),s.slice(c+1)];return B(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&B(`div`,{class:`cm-diagnosticSource`},t.source))}var dn=class extends v{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return B(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},fn=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=un(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},pn=class e{constructor(e){this.view=e,this.items=[],this.list=B(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)on(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=ln(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=Z(this.view.state.field(Q).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=B(`div`,{class:`cm-panel-lint`},this.list,B(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>on(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(Q).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Q),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new fn(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new fn(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Z(this.view.state.field(Q).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:en.of(t)})}static open(t){return new e(t)}};function mn(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function hn(e){return mn(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var gn=M.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:hn(`#d11`)},".cm-lintRange-warning":{backgroundImage:hn(`orange`)},".cm-lintRange-info":{backgroundImage:hn(`#999`)},".cm-lintRange-hint":{backgroundImage:hn(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function _n(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function vn(e){let t=`hint`,n=1;for(let r of e){let e=_n(r.severity);e>n&&(n=e,t=r.severity)}return t}var yn=[Q,M.decorations.compute([Q],e=>{let{selected:t,panel:n}=e.field(Q);return!t||!n||t.from==t.to?E.none:E.set([tn.range(t.from,t.to)])}),ge(nn,{hideOn:Xt}),gn],bn=[I(),xe(),F(),o(),N(),Se(),ve(),x.allowMultipleSelections.of(!0),S(),O(R,{fallback:!0}),he(),ke(),De(),_e(),L(),ye(),it(),Ce.of([...Ee,...i,...Ht,...a,...we,...Oe,...sn])];F(),o(),Se(),O(R,{fallback:!0}),Ce.of([...i,...a]);var xn={words:0,chars:0,tokens:0},Sn=/[ -〿-ゟ゠-ヿ㐀-䶿一-鿿豈---ក-]/,Cn=/[\p{L}\p{N}]/u,wn=new Set([`text`,`inlineCode`,`code`,`tag`]),Tn=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),En=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function Dn(e,t){if(!e)return;let n=e.type;if(!Tn.has(n)){if(wn.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
|
|
3
3
|
`));return}if(n===`wikiLink`||n===`wikiLinkEmbed`){let n=e.data?.alias??e.value??``;n&&t.push(n);return}if(Array.isArray(e.children)){for(let n of e.children)Dn(n,t);if(En.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
|
|
4
4
|
`)&&t.push(`
|
package/dist/public/index.html
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
-->
|
|
49
49
|
<script>(() => { let t = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (r === 'light' || r === 'dark' || r === 'system') t = r; } catch {} let dark = t === 'dark'; if (t === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } if (dark) document.documentElement.classList.add('dark'); if (window.okDesktop) document.documentElement.classList.add('electron-mode'); })();</script>
|
|
50
50
|
<style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
|
|
51
|
-
<script type="module" crossorigin src="./assets/index-
|
|
51
|
+
<script type="module" crossorigin src="./assets/index-BeB8EEj0.js"></script>
|
|
52
52
|
<link rel="modulepreload" crossorigin href="./assets/chunk-CFjPhJqf.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-2ej06EnG.js">
|
|
54
54
|
<link rel="modulepreload" crossorigin href="./assets/w3c-keyname-beU76Hfb.js">
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
<link rel="modulepreload" crossorigin href="./assets/propagation-api-CR2CQW4x.js">
|
|
75
75
|
<link rel="modulepreload" crossorigin href="./assets/collapsible-CjgfK1G5.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="./assets/dist-KBKQayVB.js">
|
|
77
|
-
<link rel="modulepreload" crossorigin href="./assets/dialog-
|
|
77
|
+
<link rel="modulepreload" crossorigin href="./assets/dialog-CIq9aQLf.js">
|
|
78
78
|
<link rel="modulepreload" crossorigin href="./assets/tooltip-DiL7DBhT.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="./assets/dist-ug68MPTZ.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="./assets/chevron-down-CzFz_0zd.js">
|
|
@@ -85,25 +85,25 @@
|
|
|
85
85
|
<link rel="modulepreload" crossorigin href="./assets/config-context-DhhN0rlf.js">
|
|
86
86
|
<link rel="modulepreload" crossorigin href="./assets/file-tree-rename-validation-BqGkSO9-.js">
|
|
87
87
|
<link rel="modulepreload" crossorigin href="./assets/input-DkQ8Zmzd.js">
|
|
88
|
-
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-
|
|
88
|
+
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-bNGvFuJS.js">
|
|
89
89
|
<link rel="modulepreload" crossorigin href="./assets/panel-BbrtnF__.js">
|
|
90
|
-
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-
|
|
90
|
+
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-DEl5qeGr.js">
|
|
91
91
|
<link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-CvsZjaW-.js">
|
|
92
|
-
<link rel="modulepreload" crossorigin href="./assets/checkbox-
|
|
92
|
+
<link rel="modulepreload" crossorigin href="./assets/checkbox-EGJP9xna.js">
|
|
93
93
|
<link rel="modulepreload" crossorigin href="./assets/dist-AQSp7Qij.js">
|
|
94
|
-
<link rel="modulepreload" crossorigin href="./assets/skills-api-
|
|
94
|
+
<link rel="modulepreload" crossorigin href="./assets/skills-api-mcV6MiPo.js">
|
|
95
95
|
<link rel="modulepreload" crossorigin href="./assets/label-DyT4OD9H.js">
|
|
96
96
|
<link rel="modulepreload" crossorigin href="./assets/radio-group-CFPLlVag.js">
|
|
97
97
|
<link rel="modulepreload" crossorigin href="./assets/toggle-group-Bc5FaFo3.js">
|
|
98
98
|
<link rel="modulepreload" crossorigin href="./assets/cursor-CpjEfgnv.js">
|
|
99
|
-
<link rel="modulepreload" crossorigin href="./assets/skill-actions-
|
|
99
|
+
<link rel="modulepreload" crossorigin href="./assets/skill-actions-CPoGr_7b.js">
|
|
100
100
|
<link rel="modulepreload" crossorigin href="./assets/textarea-BQFFQ9_l.js">
|
|
101
101
|
<link rel="modulepreload" crossorigin href="./assets/external-link-Bc6KvE1i.js">
|
|
102
102
|
<link rel="modulepreload" crossorigin href="./assets/keyboard-shortcuts-CZysvuV8.js">
|
|
103
|
-
<link rel="modulepreload" crossorigin href="./assets/config-validation-events-
|
|
103
|
+
<link rel="modulepreload" crossorigin href="./assets/config-validation-events-DiOTHiAz.js">
|
|
104
104
|
<link rel="modulepreload" crossorigin href="./assets/format-Fsxus_sZ.js">
|
|
105
|
-
<link rel="modulepreload" crossorigin href="./assets/selection-context-
|
|
106
|
-
<link rel="modulepreload" crossorigin href="./assets/PropertyPanel-
|
|
105
|
+
<link rel="modulepreload" crossorigin href="./assets/selection-context-B6kAEK37.js">
|
|
106
|
+
<link rel="modulepreload" crossorigin href="./assets/PropertyPanel-DgbQo3wG.js">
|
|
107
107
|
<link rel="modulepreload" crossorigin href="./assets/chevron-left-Bb3WBx0B.js">
|
|
108
108
|
<link rel="modulepreload" crossorigin href="./assets/agent-presence-BRmBPq78.js">
|
|
109
109
|
<link rel="modulepreload" crossorigin href="./assets/project-paths-CcPGtodV.js">
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-C4nLupIH.js">
|
|
112
112
|
<link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-Q_heVQ86.js">
|
|
113
113
|
<link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
|
|
114
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
114
|
+
<link rel="stylesheet" crossorigin href="./assets/index-hY8weMMg.css">
|
|
115
115
|
</head>
|
|
116
116
|
|
|
117
117
|
<body class="antialiased">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,v as t}from"./init-
|
|
2
|
-
//# sourceMappingURL=repair-launch-json-
|
|
1
|
+
import{r as e,v as t}from"./init-BIZmMISx.mjs";import{t as n}from"./is-object-Cg453afR.mjs";import{join as r}from"node:path";import{existsSync as i,readFileSync as a}from"node:fs";const o=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],e];function s(e){if(e.runtimeExecutable===`/bin/sh`&&Array.isArray(e.runtimeArgs)){let t=e.runtimeArgs[2];if(typeof t==`string`){if(t.includes(`# ok-ui-v1`))return`canonical`;if(/# ok-ui-v\d+/.test(t))return`legacy-bare`}return`preserved`}if(e.runtimeExecutable===`npx`&&Array.isArray(e.runtimeArgs)){for(let t of o)if(c(e.runtimeArgs,t))return`legacy-bare`}return`preserved`}function c(e,t){if(e.length!==t.length)return!1;for(let n=0;n<t.length;n++)if(e[n]!==t[n])return!1;return!0}function l(e){let o=e.logger??u,c=r(e.projectDir,`.claude`,`launch.json`);if(e.reclaimDisableEnv===`1`)return o({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:c,outcome:`skipped-reclaim-disabled`},repairedCount:0};if(!i(c))return{outcome:{configPath:c,outcome:`no-file`},repairedCount:0};let l;try{let e=a(c,`utf-8`).trim();l=e?JSON.parse(e):{}}catch(e){let t=e instanceof Error?e.message:String(e);return o({event:`launch-json-repair-read-failed`,configPath:c,error:t}),{outcome:{configPath:c,outcome:`read-failed`,error:t},repairedCount:0}}if(!n(l)){let e=`launch.json root is not an object`;return o({event:`launch-json-repair-read-failed`,configPath:c,error:e}),{outcome:{configPath:c,outcome:`read-failed`,error:e},repairedCount:0}}let d=l.configurations;if(!Array.isArray(d))return{outcome:{configPath:c,outcome:`no-entry`},repairedCount:0};let f=d.find(e=>n(e)&&e.name===`open-knowledge-ui`);if(!f)return{outcome:{configPath:c,outcome:`no-entry`},repairedCount:0};let p=s(f);if(p===`canonical`)return{outcome:{configPath:c,outcome:`canonical`},repairedCount:0};if(p===`preserved`)return{outcome:{configPath:c,outcome:`preserved`},repairedCount:0};let m=t(e.projectDir,{mode:`published`});if(m.action===`failed`){let e=m.error??`unknown write failure`;return o({event:`launch-json-repair-write-failed`,configPath:c,error:e}),{outcome:{configPath:c,outcome:`write-failed`,error:e},repairedCount:0}}return o({event:`launch-json-repair-applied`,configPath:c}),{outcome:{configPath:c,outcome:`repaired`},repairedCount:1}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{l as repairLaunchJson};
|
|
2
|
+
//# sourceMappingURL=repair-launch-json-sjB6vbft.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,y as t}from"./init-
|
|
2
|
-
//# sourceMappingURL=repair-mcp-configs-
|
|
1
|
+
import{p as e,y as t}from"./init-BIZmMISx.mjs";import{l as n,o as r,r as i}from"./write-project-skill-Ta2BaP1w.mjs";import{t as a}from"./mcp-migrate-event-D0NrGjvc.mjs";import{homedir as o}from"node:os";function s(e){let t=e.logger??u,n=e.home??o(),a=[];if(e.reclaimDisableEnv===`1`)return t({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of i){let i=r[o],s=c(()=>i.configPath(``,n));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:i,home:n,cwd:``,configPath:s,configPathOverride:void 0,logger:t})),i.projectConfigPath){let n=i.projectConfigPath,r=c(()=>n(e.projectDir));r!==null&&a.push(l({scope:`project`,editorId:o,target:i,home:void 0,cwd:e.projectDir,configPath:r,configPathOverride:r,logger:t}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(r){let i={scope:r.scope,editorId:r.editorId,configPath:r.configPath},o=e(r.target,r.cwd,r.home,r.configPathOverride);if(o===null)return{...i,outcome:`no-entry`};if(n(o))return{...i,outcome:`canonical`};r.logger(a({scope:r.scope,surface:`cli-repair`,editorId:r.editorId,configPath:r.configPath,priorEntry:o}));let s=t(r.target,r.cwd,{mode:`published`,skipAvailabilityCheck:!0},r.home,r.configPathOverride);if(s.action===`failed`){let e=s.error??`unknown write failure`;return r.logger({event:`mcp-config-repair-write-failed`,scope:r.scope,editorId:r.editorId,configPath:r.configPath,error:e}),{...i,outcome:`write-failed`,error:e}}return s.action===`declined`?(r.logger({event:`mcp-config-repair-declined`,scope:r.scope,editorId:r.editorId,configPath:r.configPath,reason:s.declineReason}),{...i,outcome:`declined`}):{...i,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
|
|
2
|
+
//# sourceMappingURL=repair-mcp-configs-uo7Kpg-f.mjs.map
|