@inkeep/open-knowledge 0.35.0-beta.0 → 0.35.0-beta.10
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 +60 -60
- package/dist/constants-Dz2qZ4xq.mjs +2 -0
- package/dist/{gh-detect-DRUIjmmd.mjs → gh-detect-93wtg_nV.mjs} +2 -2
- package/dist/git-handle-CeejIzW4.mjs +1 -0
- package/dist/{git-handle-BCwv1aYd.mjs → git-handle-DPCY4VMM.mjs} +2 -2
- package/dist/index.d.mts +31 -1
- package/dist/index.mjs +1 -1
- package/dist/init-BDDNvDb2.mjs +1 -0
- package/dist/init-BML9kFnm.mjs +643 -0
- package/dist/{launch-json-removal-CUWDqJP_.mjs → launch-json-removal-B1WIOuxC.mjs} +2 -2
- package/dist/loader-CVlmzfQz.mjs +1 -0
- package/dist/{loader-B1iUCvBP.mjs → loader-Ctd2y8kQ.mjs} +2 -2
- package/dist/{open-browser-BgoSoXxW.mjs → open-browser-CP3YN1jA.mjs} +2 -2
- package/dist/{preview-B0uDtWSM.mjs → preview-B0yncS2h.mjs} +2 -2
- package/dist/preview-BFe8JVVx.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-DR9f5yD2.js → ActivityModeContent-BzCteFud.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-FosFFMS2.js → CodeMirrorPropInput-BaaMh183.js} +2 -2
- package/dist/public/assets/DocumentContext-DVJ7yEqv.js +36 -0
- package/dist/public/assets/{EnableSyncConfirmDialog-DmwwBOqo.js → EnableSyncConfirmDialog-pUJ0-0Xd.js} +1 -1
- package/dist/public/assets/{GraphPanel-DXHTsrXS.js → GraphPanel-CLbL3_7S.js} +4 -4
- package/dist/public/assets/ManagedArtifactProperties-BbvAZvc9.js +1 -0
- package/dist/public/assets/{McpConsentDialogBody-CSFTjJ_1.js → McpConsentDialogBody-D_ALgiPf.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-fpCSGKJk.js → MermaidDocEditor-C4zrJQLq.js} +1 -1
- package/dist/public/assets/PropertyPanel-D2cHpPyn.js +2 -0
- package/dist/public/assets/{ReportBugDialogBody-BY3AL0yE.js → ReportBugDialogBody-Bqt1KnSD.js} +1 -1
- package/dist/public/assets/SettingsDialogBody-Ivdm3ToR.js +7 -0
- package/dist/public/assets/{ShareBranchSwitchDialog-B45Ur2hQ.js → ShareBranchSwitchDialog-COA225Wh.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-BqSpfMk9.js → ShareReceiveDialog-CGeUbVX5.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-CBp9VwKF.js → ShareReceiveMissDialog-BiFbvWX1.js} +1 -1
- package/dist/public/assets/{SkillEditorActions-Du4hCmH_.js → SkillEditorActions-HOX1vQzN.js} +1 -1
- package/dist/public/assets/{SourceEditor-B4kYPJBZ.js → SourceEditor-BbNBxNCg.js} +1 -1
- package/dist/public/assets/{TerminalPanel-Ba3Z23bi.js → TerminalPanel-CJcXd9VC.js} +3 -3
- package/dist/public/assets/{agent-presence-Br6X9ZdO.js → agent-presence-DWEqGNHh.js} +1 -1
- package/dist/public/assets/auth-state-cache-Di7tO3rZ.js +11 -0
- package/dist/public/assets/{config-provider-r_jEkHK-.js → config-provider-DGMqQCfP.js} +2 -2
- package/dist/public/assets/{dist-CLCs7mVU.js → dist-CN1nOe9M.js} +1 -1
- package/dist/public/assets/{dist-H6nXpN5y.js → dist-Cf-rDWvg.js} +137 -134
- package/dist/public/assets/doc-hash-vKFY-V-Y.js +1 -0
- package/dist/public/assets/{documents-events-Ce8maND0.js → documents-events-BzjmhSSx.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-DDfH4Jl4.js → file-tree-adapter-DNsVn4SH.js} +1 -1
- package/dist/public/assets/{index-BxeOg6H0.js → index-D0Ehy4r9.js} +103 -102
- package/dist/public/assets/index-Zwl7lo8a.css +1 -0
- package/dist/public/assets/lint-config-client-C1xGkxTP.js +1 -0
- package/dist/public/assets/{navigation-targets-eUQMk9uD.js → navigation-targets-nvGLJ1po.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-7RoXy4IS.js → open-managed-artifact-tab-CUhx9b-j.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-ByvpFZ2d.js → pending-receive-nav-store-HxClZpU_.js} +1 -1
- package/dist/public/assets/{prop-types-CL1xIIwL.js → prop-types-y7w6_eIH.js} +1 -1
- package/dist/public/assets/{receive-store-DYKCLsPp.js → receive-store-BBpK7Or2.js} +1 -1
- package/dist/public/assets/{selection-context-BIE5_MkH.js → selection-context-iozWEaD1.js} +1 -1
- package/dist/public/assets/{skill-actions-Dispz1uc.js → skill-actions-DL-yNOVR.js} +1 -1
- package/dist/public/assets/{skills-api-C_ShrZHV.js → skills-api-T6KNnXbb.js} +1 -1
- package/dist/public/assets/{src-DqYZW1sy.js → src-DL3Zlx5X.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-Ds095QOz.js → target-navigation-intent-JPOSvf1i.js} +1 -1
- package/dist/public/assets/{telemetry-startup-BtK87qj7.js → telemetry-startup-jMwHqIQ4.js} +1 -1
- package/dist/public/assets/typing-burst-detector-50DGt0NB.js +6 -0
- package/dist/public/assets/{use-apply-config-color-theme-x3LjnYOt.js → use-apply-config-color-theme-C4-L1m1x.js} +2 -2
- package/dist/public/assets/{workspace-paths-BY-2uufu.js → workspace-paths-BzYkZqjr.js} +1 -1
- package/dist/public/index.html +32 -32
- package/dist/{repair-launch-json-CgMAUaAY.mjs → repair-launch-json-QSRMby2t.mjs} +2 -2
- package/dist/{repair-mcp-configs-BKQlAFB9.mjs → repair-mcp-configs-BmV1j3BR.mjs} +2 -2
- package/dist/{repair-skills-CFabpG6D.mjs → repair-skills-CZbrTVch.mjs} +2 -2
- package/dist/repair-skills-CyhWReZX.mjs +1 -0
- package/dist/server-lock-DGqK-4av.mjs +1 -0
- package/dist/{server-lock-CRw6jjM3.mjs → server-lock-wMKEjgnN.mjs} +2 -2
- package/dist/{src-CFHcsBtV.mjs → src-BU7I7py6.mjs} +126 -122
- package/dist/{src-ddPUyd9u.mjs → src-C0CgVA8i.mjs} +273 -273
- package/dist/{src-CuYNuDEi.mjs → src-CrcH2zRs.mjs} +2 -2
- package/dist/{src-CsJd4hD1.mjs → src-FMIoftZv.mjs} +1 -1
- package/dist/start-CMGuisLc.mjs +1 -0
- package/dist/{start-OtsNv252.mjs → start-D8mMdCQz.mjs} +2 -2
- package/dist/{write-project-skill-D59YsAqA.mjs → write-project-skill-DkTM_Oeh.mjs} +2 -2
- package/package.json +4 -4
- package/dist/constants-CcwGXqRZ.mjs +0 -2
- package/dist/git-handle-DcVL5mrG.mjs +0 -1
- package/dist/init-D97Spx8d.mjs +0 -638
- package/dist/init-DQiXmAkQ.mjs +0 -1
- package/dist/loader-Bo77me0d.mjs +0 -1
- package/dist/preview-DgAWAvTf.mjs +0 -1
- package/dist/public/assets/DocumentContext-CZbRup3E.js +0 -36
- package/dist/public/assets/ManagedArtifactProperties-BfuADyBS.js +0 -1
- package/dist/public/assets/PropertyPanel-DUAGh6oO.js +0 -2
- package/dist/public/assets/SettingsDialogBody-Dvm6wIza.js +0 -7
- package/dist/public/assets/auth-state-cache-BriJQlFg.js +0 -11
- package/dist/public/assets/doc-hash-B3BQzSL7.js +0 -1
- package/dist/public/assets/index-F5i20SPk.css +0 -1
- package/dist/public/assets/lint-config-client-DcsqWOgs.js +0 -1
- package/dist/public/assets/typing-burst-detector-BcuHrVCs.js +0 -6
- package/dist/repair-skills-BuztBrD_.mjs +0 -1
- package/dist/server-lock-KfTPtASZ.mjs +0 -1
- package/dist/start-t9AhW8gS.mjs +0 -1
- /package/dist/public/assets/{dist-o9cVHl8Q.js → dist-C87Ou6G5.js} +0 -0
- /package/dist/public/assets/{documents-fetch-YrVYNlaU.js → documents-fetch-CD85Qoe6.js} +0 -0
- /package/dist/public/assets/{file-tree-rename-validation-DgUQ0I0S.js → file-tree-rename-validation-BBSv40Qz.js} +0 -0
- /package/dist/public/assets/{parse-api-error-BcfaIWfX.js → parse-api-error-Mgtc4OJu.js} +0 -0
- /package/dist/public/assets/{startup-marks-Dq0rZGD-.js → startup-marks-BJwpvHMe.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DseTPa7n.js";import{n as t,r as n,t as r}from"./compiler-runtime-DrcePeIl.js";import{a as i,c as a,s as o,u as s}from"./createLucideIcon-Wgamzz8_.js";import{a as c,c as l,d as u,f as d,i as f,n as p,o as m,r as h,t as ee,u as g}from"./dist-DivkR5AO.js";import{n as _,t as te}from"./dist-Bpw_gSUm.js";import{g as ne,h as re,m as ie,p as v}from"./dialog-D9fMUB3u.js";import{a as ae,i as oe,n as y,r as se,t as ce}from"./dist-DGkUVO6K.js";import{n as le,r as b,t as x}from"./dist-Ly1ZfY-Y.js";import{t as S}from"./check-BJRSVBAg.js";import{t as C}from"./chevron-right-B2thM4kG.js";import{t as w}from"./parse-api-error-BcfaIWfX.js";import{r as T}from"./documents-events-Ce8maND0.js";var E=e(t(),1),D=n(),O=[`Enter`,` `],k=[`ArrowDown`,`PageUp`,`Home`],ue=[`ArrowUp`,`PageDown`,`End`],de=[...k,...ue],A={ltr:[...O,`ArrowRight`],rtl:[...O,`ArrowLeft`]},fe={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},j=`Menu`,[M,pe,N]=_(j),[P,F]=g(j,[N,ae,b]),I=ae(),me=b(),[he,L]=P(j),[ge,R]=P(j),_e=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=I(t),[c,l]=E.useState(null),u=E.useRef(!1),d=h(a),f=te(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)(oe,{...s,children:(0,D.jsx)(he,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,D.jsx)(ge,{scope:t,onClose:E.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};_e.displayName=j;var ve=`MenuAnchor`,ye=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=I(n);return(0,D.jsx)(ce,{...i,...r,ref:t})});ye.displayName=ve;var z=`MenuPortal`,[be,xe]=P(z,{forceMount:void 0}),Se=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=L(z,t);return(0,D.jsx)(be,{scope:t,forceMount:n,children:(0,D.jsx)(c,{present:n||a.open,children:(0,D.jsx)(ee,{asChild:!0,container:i,children:r})})})};Se.displayName=z;var B=`MenuContent`,[Ce,we]=P(B),Te=E.forwardRef((e,t)=>{let n=xe(B,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=L(B,e.__scopeMenu),o=R(B,e.__scopeMenu);return(0,D.jsx)(M.Provider,{scope:e.__scopeMenu,children:(0,D.jsx)(c,{present:r||a.open,children:(0,D.jsx)(M.Slot,{scope:e.__scopeMenu,children:o.modal?(0,D.jsx)(Ee,{...i,ref:t}):(0,D.jsx)(De,{...i,ref:t})})})})}),Ee=E.forwardRef((e,t)=>{let n=L(B,e.__scopeMenu),r=E.useRef(null),i=a(t,r);return E.useEffect(()=>{let e=r.current;if(e)return v(e)},[]),(0,D.jsx)(V,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:l(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),De=E.forwardRef((e,t)=>{let n=L(B,e.__scopeMenu);return(0,D.jsx)(V,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Oe=i(`MenuContent.ScrollLock`),V=E.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:h,onDismiss:ee,disableOutsideScroll:g,..._}=e,te=L(B,n),v=R(B,n),ae=I(n),oe=me(n),y=pe(n),[ce,b]=E.useState(null),x=E.useRef(null),S=a(t,x,te.onContentChange),C=E.useRef(0),w=E.useRef(``),T=E.useRef(0),O=E.useRef(null),k=E.useRef(`right`),A=E.useRef(0),fe=g?ie:E.Fragment,j=g?{as:Oe,allowPinchZoom:!0}:void 0,M=e=>{let t=w.current+e,n=y().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){w.current=t,window.clearTimeout(C.current),t!==``&&(C.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};E.useEffect(()=>()=>window.clearTimeout(C.current),[]),re();let N=E.useCallback(e=>k.current===O.current?.side&&st(e,O.current?.area),[]);return(0,D.jsx)(Ce,{scope:n,searchRef:w,onItemEnter:E.useCallback(e=>{N(e)&&e.preventDefault()},[N]),onItemLeave:E.useCallback(e=>{N(e)||(x.current?.focus(),b(null))},[N]),onTriggerLeave:E.useCallback(e=>{N(e)&&e.preventDefault()},[N]),pointerGraceTimerRef:T,onPointerGraceIntentChange:E.useCallback(e=>{O.current=e},[]),children:(0,D.jsx)(fe,{...j,children:(0,D.jsx)(ne,{asChild:!0,trapped:i,onMountAutoFocus:l(o,e=>{e.preventDefault(),x.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,D.jsx)(p,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:h,onDismiss:ee,children:(0,D.jsx)(le,{asChild:!0,...oe,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:ce,onCurrentTabStopIdChange:b,onEntryFocus:l(u,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,D.jsx)(se,{role:`menu`,"aria-orientation":`vertical`,"data-state":tt(te.open),"data-radix-menu-content":``,dir:v.dir,...ae,..._,ref:S,style:{outline:`none`,..._.style},onKeyDown:l(_.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&&M(e.key));let i=x.current;if(e.target!==i||!de.includes(e.key))return;e.preventDefault();let a=y().filter(e=>!e.disabled).map(e=>e.ref.current);ue.includes(e.key)&&a.reverse(),rt(a)}),onBlur:l(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(C.current),w.current=``)}),onPointerMove:l(e.onPointerMove,Y(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})});Te.displayName=B;var ke=`MenuGroup`,H=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(u.div,{role:`group`,...r,ref:t})});H.displayName=ke;var Ae=`MenuLabel`,je=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(u.div,{...r,ref:t})});je.displayName=Ae;var U=`MenuItem`,Me=`menu.itemSelect`,W=E.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,o=E.useRef(null),s=R(U,e.__scopeMenu),c=we(U,e.__scopeMenu),u=a(t,o),f=E.useRef(!1),p=()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(Me,{bubbles:!0,cancelable:!0});e.addEventListener(Me,e=>r?.(e),{once:!0}),d(e,t),t.defaultPrevented?f.current=!1:s.onClose()}};return(0,D.jsx)(Ne,{...i,ref:u,disabled:n,onClick:l(e.onClick,p),onPointerDown:t=>{e.onPointerDown?.(t),f.current=!0},onPointerUp:l(e.onPointerUp,e=>{f.current||e.currentTarget?.click()}),onKeyDown:l(e.onKeyDown,e=>{let t=c.searchRef.current!==``;n||t&&e.key===` `||O.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});W.displayName=U;var Ne=E.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,s=we(U,n),c=me(n),d=E.useRef(null),f=a(t,d),[p,m]=E.useState(!1),[h,ee]=E.useState(``);return E.useEffect(()=>{let e=d.current;e&&ee((e.textContent??``).trim())},[o.children]),(0,D.jsx)(M.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:(0,D.jsx)(x,{asChild:!0,...c,focusable:!r,children:(0,D.jsx)(u.div,{role:`menuitem`,"data-highlighted":p?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...o,ref:f,onPointerMove:l(e.onPointerMove,Y(e=>{r?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:l(e.onPointerLeave,Y(e=>s.onItemLeave(e))),onFocus:l(e.onFocus,()=>m(!0)),onBlur:l(e.onBlur,()=>m(!1))})})})}),Pe=`MenuCheckboxItem`,Fe=E.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,D.jsx)(He,{scope:e.__scopeMenu,checked:n,children:(0,D.jsx)(W,{role:`menuitemcheckbox`,"aria-checked":J(n)?`mixed`:n,...i,ref:t,"data-state":nt(n),onSelect:l(i.onSelect,()=>r?.(J(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Fe.displayName=Pe;var Ie=`MenuRadioGroup`,[Le,Re]=P(Ie,{value:void 0,onValueChange:()=>{}}),ze=E.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=h(r);return(0,D.jsx)(Le,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,D.jsx)(H,{...i,ref:t})})});ze.displayName=Ie;var Be=`MenuRadioItem`,Ve=E.forwardRef((e,t)=>{let{value:n,...r}=e,i=Re(Be,e.__scopeMenu),a=n===i.value;return(0,D.jsx)(He,{scope:e.__scopeMenu,checked:a,children:(0,D.jsx)(W,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":nt(a),onSelect:l(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Ve.displayName=Be;var G=`MenuItemIndicator`,[He,Ue]=P(G,{checked:!1}),We=E.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Ue(G,n);return(0,D.jsx)(c,{present:r||J(a.checked)||a.checked===!0,children:(0,D.jsx)(u.span,{...i,ref:t,"data-state":nt(a.checked)})})});We.displayName=G;var Ge=`MenuSeparator`,Ke=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(u.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Ke.displayName=Ge;var qe=`MenuArrow`,Je=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=I(n);return(0,D.jsx)(y,{...i,...r,ref:t})});Je.displayName=qe;var K=`MenuSub`,[Ye,Xe]=P(K),Ze=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=L(K,t),o=I(t),[s,c]=E.useState(null),[l,u]=E.useState(null),d=h(i);return E.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,D.jsx)(oe,{...o,children:(0,D.jsx)(he,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,D.jsx)(Ye,{scope:t,contentId:f(),triggerId:f(),trigger:s,onTriggerChange:c,children:n})})})};Ze.displayName=K;var q=`MenuSubTrigger`,Qe=E.forwardRef((e,t)=>{let n=L(q,e.__scopeMenu),r=R(q,e.__scopeMenu),i=Xe(q,e.__scopeMenu),a=we(q,e.__scopeMenu),s=E.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=a,d={__scopeMenu:e.__scopeMenu},f=E.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return E.useEffect(()=>f,[f]),E.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),u(null)}},[c,u]),(0,D.jsx)(ye,{asChild:!0,...d,children:(0,D.jsx)(Ne,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":tt(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:l(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),f()},100))})),onPointerLeave:l(e.onPointerLeave,Y(e=>{f();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:l(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||A[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Qe.displayName=q;var $e=`MenuSubContent`,et=E.forwardRef((e,t)=>{let n=xe(B,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=L(B,e.__scopeMenu),s=R(B,e.__scopeMenu),u=Xe($e,e.__scopeMenu),d=E.useRef(null),f=a(t,d);return(0,D.jsx)(M.Provider,{scope:e.__scopeMenu,children:(0,D.jsx)(c,{present:r||o.open,children:(0,D.jsx)(M.Slot,{scope:e.__scopeMenu,children:(0,D.jsx)(V,{id:u.contentId,"aria-labelledby":u.triggerId,...i,ref:f,align:`start`,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&d.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:l(e.onFocusOutside,e=>{e.target!==u.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:l(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:l(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=fe[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),u.trigger?.focus(),e.preventDefault())})})})})})});et.displayName=$e;function tt(e){return e?`open`:`closed`}function J(e){return e===`indeterminate`}function nt(e){return J(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=_e,lt=ye,ut=Se,dt=Te,ft=H,pt=je,mt=W,ht=Fe,gt=ze,_t=Ve,vt=We,yt=Ke,bt=Je,xt=Ze,St=Qe,Ct=et,X=`DropdownMenu`,[wt,Tt]=g(X,[F]),Z=F(),[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]=m({prop:i,defaultProp:a??!1,onChange:o,caller:X});return(0,D.jsx)(Et,{scope:t,triggerId:f(),triggerRef:l,contentId:f(),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)(u.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:l(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:l(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:l(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:l(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]=m({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)(sn,{"data-slot":`dropdown-menu-portal`,...n}),t[2]=n,t[3]=r),r}function Sn(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 Cn(e){let t=(0,Q.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`start`:i,c=a===void 0?4:a,l;t[5]===n?l=t[6]:(l=s(`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]!==o||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:o,className:l,...r})}),t[7]=o,t[8]=r,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function wn(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 Tn(e){let t=(0,Q.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,c;t[5]===n?c=t[6]:(c=s(`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]!==o?(l=(0,D.jsx)(dn,{"data-slot":`dropdown-menu-item`,"data-inset":r,"data-variant":o,className:c,...i}),t[7]=r,t[8]=i,t[9]=c,t[10]=o,t[11]=l):l=t[11],l}function En(e){let t=(0,Q.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let c;t[6]===i?c=t[7]:(c=s(`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]=c);let l;t[8]===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-checkbox-item-indicator`,children:(0,D.jsx)(hn,{children:(0,D.jsx)(S,{})})}),t[8]=l):l=t[8];let u;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==c?(u=(0,D.jsxs)(fn,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":a,className:c,checked:n,...o,children:[l,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=c,t[14]=u):u=t[14],u}function Dn(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 On(e){let t=(0,Q.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,inset:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=s(`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]=o);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(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)(S,{})})}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(l=(0,D.jsxs)(mn,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:o,...a,children:[c,n]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=l):l=t[12],l}function kn(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 a;t[4]===n?a=t[5]:(a=s(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,D.jsx)(un,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function An(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=s(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,D.jsx)(gn,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jn(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 Mn(e){let t=(0,Q.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=s(`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]=o);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,D.jsx)(C,{className:`ml-auto`}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(l=(0,D.jsxs)(vn,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,c]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=l):l=t[12],l}function Nn(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=s(`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 a;return t[5]!==r||t[6]!==i?(a=(0,D.jsx)(yn,{"data-slot":`dropdown-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function $(e){return w(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function Pn(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 T(),{ok:!0,created:n?.created??!1,warnings:n?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Fn(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 T(),{ok:!0,created:n?.created??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function In(){try{let e=await fetch(`/api/skills/management`);return e.ok?await e.json():null}catch{return null}}async function Ln(e){try{return(await fetch(`/api/skills/management`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({manageEditorSkills:e})})).ok?(T(),!0):!1}catch{return!1}}function Rn(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 zn(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=Rn(e.name,e.existingNames),s=await Pn({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 Bn(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 Pn({scope:r,name:t,frontmatter:{name:t,description:a},body:o});if(!c.ok)return c;let l=await Un(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 Fn({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 Hn(n,t);return d.ok?(T(),{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 Vn(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 T(),{ok:!0,committed:n?.committed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Hn(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 T(),{ok:!0,existed:i?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Un(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 Wn(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 Gn(e,t){return Wn({...e,signal:t}).then(e=>e.ok?{ok:!0,text:e.text}:{ok:!1,status:e.status})}async function Kn(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 T(),{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 qn(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 T(),{ok:!0,uninstalled:n?.uninstalled??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Jn(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 T(),{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{dt as A,xt as B,jn as C,lt as D,Sn as E,ut as F,St as H,gt as I,_t as L,mt as M,vt as N,bt as O,pt as P,ct as R,An as S,Mn as T,F as U,Ct as V,Tn as _,Kn as a,Dn as b,Bn as c,qn as d,Jn as f,wn as g,Cn as h,In as i,ft as j,ht as k,Pn as l,En as m,zn as n,Gn as o,bn as p,Un as r,Vn as s,Hn as t,Ln as u,kn as v,Nn as w,On as x,xn as y,yt as z};
|
|
1
|
+
import{i as e}from"./chunk-DseTPa7n.js";import{n as t,r as n,t as r}from"./compiler-runtime-DrcePeIl.js";import{a as i,c as a,s as o,u as s}from"./createLucideIcon-Wgamzz8_.js";import{a as c,c as l,d as u,f as d,i as f,n as p,o as m,r as h,t as ee,u as g}from"./dist-DivkR5AO.js";import{n as _,t as te}from"./dist-Bpw_gSUm.js";import{g as ne,h as re,m as ie,p as v}from"./dialog-D9fMUB3u.js";import{a as ae,i as oe,n as y,r as se,t as ce}from"./dist-DGkUVO6K.js";import{n as le,r as b,t as x}from"./dist-Ly1ZfY-Y.js";import{t as S}from"./check-BJRSVBAg.js";import{t as C}from"./chevron-right-B2thM4kG.js";import{t as w}from"./parse-api-error-Mgtc4OJu.js";import{r as T}from"./documents-events-BzjmhSSx.js";var E=e(t(),1),D=n(),O=[`Enter`,` `],k=[`ArrowDown`,`PageUp`,`Home`],ue=[`ArrowUp`,`PageDown`,`End`],de=[...k,...ue],A={ltr:[...O,`ArrowRight`],rtl:[...O,`ArrowLeft`]},fe={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},j=`Menu`,[M,pe,N]=_(j),[P,F]=g(j,[N,ae,b]),I=ae(),me=b(),[he,L]=P(j),[ge,R]=P(j),_e=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=I(t),[c,l]=E.useState(null),u=E.useRef(!1),d=h(a),f=te(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)(oe,{...s,children:(0,D.jsx)(he,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,D.jsx)(ge,{scope:t,onClose:E.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};_e.displayName=j;var ve=`MenuAnchor`,ye=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=I(n);return(0,D.jsx)(ce,{...i,...r,ref:t})});ye.displayName=ve;var z=`MenuPortal`,[be,xe]=P(z,{forceMount:void 0}),Se=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=L(z,t);return(0,D.jsx)(be,{scope:t,forceMount:n,children:(0,D.jsx)(c,{present:n||a.open,children:(0,D.jsx)(ee,{asChild:!0,container:i,children:r})})})};Se.displayName=z;var B=`MenuContent`,[Ce,we]=P(B),Te=E.forwardRef((e,t)=>{let n=xe(B,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=L(B,e.__scopeMenu),o=R(B,e.__scopeMenu);return(0,D.jsx)(M.Provider,{scope:e.__scopeMenu,children:(0,D.jsx)(c,{present:r||a.open,children:(0,D.jsx)(M.Slot,{scope:e.__scopeMenu,children:o.modal?(0,D.jsx)(Ee,{...i,ref:t}):(0,D.jsx)(De,{...i,ref:t})})})})}),Ee=E.forwardRef((e,t)=>{let n=L(B,e.__scopeMenu),r=E.useRef(null),i=a(t,r);return E.useEffect(()=>{let e=r.current;if(e)return v(e)},[]),(0,D.jsx)(V,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:l(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),De=E.forwardRef((e,t)=>{let n=L(B,e.__scopeMenu);return(0,D.jsx)(V,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Oe=i(`MenuContent.ScrollLock`),V=E.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:h,onDismiss:ee,disableOutsideScroll:g,..._}=e,te=L(B,n),v=R(B,n),ae=I(n),oe=me(n),y=pe(n),[ce,b]=E.useState(null),x=E.useRef(null),S=a(t,x,te.onContentChange),C=E.useRef(0),w=E.useRef(``),T=E.useRef(0),O=E.useRef(null),k=E.useRef(`right`),A=E.useRef(0),fe=g?ie:E.Fragment,j=g?{as:Oe,allowPinchZoom:!0}:void 0,M=e=>{let t=w.current+e,n=y().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){w.current=t,window.clearTimeout(C.current),t!==``&&(C.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};E.useEffect(()=>()=>window.clearTimeout(C.current),[]),re();let N=E.useCallback(e=>k.current===O.current?.side&&st(e,O.current?.area),[]);return(0,D.jsx)(Ce,{scope:n,searchRef:w,onItemEnter:E.useCallback(e=>{N(e)&&e.preventDefault()},[N]),onItemLeave:E.useCallback(e=>{N(e)||(x.current?.focus(),b(null))},[N]),onTriggerLeave:E.useCallback(e=>{N(e)&&e.preventDefault()},[N]),pointerGraceTimerRef:T,onPointerGraceIntentChange:E.useCallback(e=>{O.current=e},[]),children:(0,D.jsx)(fe,{...j,children:(0,D.jsx)(ne,{asChild:!0,trapped:i,onMountAutoFocus:l(o,e=>{e.preventDefault(),x.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,D.jsx)(p,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:h,onDismiss:ee,children:(0,D.jsx)(le,{asChild:!0,...oe,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:ce,onCurrentTabStopIdChange:b,onEntryFocus:l(u,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,D.jsx)(se,{role:`menu`,"aria-orientation":`vertical`,"data-state":tt(te.open),"data-radix-menu-content":``,dir:v.dir,...ae,..._,ref:S,style:{outline:`none`,..._.style},onKeyDown:l(_.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&&M(e.key));let i=x.current;if(e.target!==i||!de.includes(e.key))return;e.preventDefault();let a=y().filter(e=>!e.disabled).map(e=>e.ref.current);ue.includes(e.key)&&a.reverse(),rt(a)}),onBlur:l(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(C.current),w.current=``)}),onPointerMove:l(e.onPointerMove,Y(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})});Te.displayName=B;var ke=`MenuGroup`,H=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(u.div,{role:`group`,...r,ref:t})});H.displayName=ke;var Ae=`MenuLabel`,je=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(u.div,{...r,ref:t})});je.displayName=Ae;var U=`MenuItem`,Me=`menu.itemSelect`,W=E.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,o=E.useRef(null),s=R(U,e.__scopeMenu),c=we(U,e.__scopeMenu),u=a(t,o),f=E.useRef(!1),p=()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(Me,{bubbles:!0,cancelable:!0});e.addEventListener(Me,e=>r?.(e),{once:!0}),d(e,t),t.defaultPrevented?f.current=!1:s.onClose()}};return(0,D.jsx)(Ne,{...i,ref:u,disabled:n,onClick:l(e.onClick,p),onPointerDown:t=>{e.onPointerDown?.(t),f.current=!0},onPointerUp:l(e.onPointerUp,e=>{f.current||e.currentTarget?.click()}),onKeyDown:l(e.onKeyDown,e=>{let t=c.searchRef.current!==``;n||t&&e.key===` `||O.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});W.displayName=U;var Ne=E.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,s=we(U,n),c=me(n),d=E.useRef(null),f=a(t,d),[p,m]=E.useState(!1),[h,ee]=E.useState(``);return E.useEffect(()=>{let e=d.current;e&&ee((e.textContent??``).trim())},[o.children]),(0,D.jsx)(M.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:(0,D.jsx)(x,{asChild:!0,...c,focusable:!r,children:(0,D.jsx)(u.div,{role:`menuitem`,"data-highlighted":p?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...o,ref:f,onPointerMove:l(e.onPointerMove,Y(e=>{r?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:l(e.onPointerLeave,Y(e=>s.onItemLeave(e))),onFocus:l(e.onFocus,()=>m(!0)),onBlur:l(e.onBlur,()=>m(!1))})})})}),Pe=`MenuCheckboxItem`,Fe=E.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,D.jsx)(He,{scope:e.__scopeMenu,checked:n,children:(0,D.jsx)(W,{role:`menuitemcheckbox`,"aria-checked":J(n)?`mixed`:n,...i,ref:t,"data-state":nt(n),onSelect:l(i.onSelect,()=>r?.(J(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Fe.displayName=Pe;var Ie=`MenuRadioGroup`,[Le,Re]=P(Ie,{value:void 0,onValueChange:()=>{}}),ze=E.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=h(r);return(0,D.jsx)(Le,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,D.jsx)(H,{...i,ref:t})})});ze.displayName=Ie;var Be=`MenuRadioItem`,Ve=E.forwardRef((e,t)=>{let{value:n,...r}=e,i=Re(Be,e.__scopeMenu),a=n===i.value;return(0,D.jsx)(He,{scope:e.__scopeMenu,checked:a,children:(0,D.jsx)(W,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":nt(a),onSelect:l(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Ve.displayName=Be;var G=`MenuItemIndicator`,[He,Ue]=P(G,{checked:!1}),We=E.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Ue(G,n);return(0,D.jsx)(c,{present:r||J(a.checked)||a.checked===!0,children:(0,D.jsx)(u.span,{...i,ref:t,"data-state":nt(a.checked)})})});We.displayName=G;var Ge=`MenuSeparator`,Ke=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,D.jsx)(u.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Ke.displayName=Ge;var qe=`MenuArrow`,Je=E.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=I(n);return(0,D.jsx)(y,{...i,...r,ref:t})});Je.displayName=qe;var K=`MenuSub`,[Ye,Xe]=P(K),Ze=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=L(K,t),o=I(t),[s,c]=E.useState(null),[l,u]=E.useState(null),d=h(i);return E.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,D.jsx)(oe,{...o,children:(0,D.jsx)(he,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,D.jsx)(Ye,{scope:t,contentId:f(),triggerId:f(),trigger:s,onTriggerChange:c,children:n})})})};Ze.displayName=K;var q=`MenuSubTrigger`,Qe=E.forwardRef((e,t)=>{let n=L(q,e.__scopeMenu),r=R(q,e.__scopeMenu),i=Xe(q,e.__scopeMenu),a=we(q,e.__scopeMenu),s=E.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=a,d={__scopeMenu:e.__scopeMenu},f=E.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return E.useEffect(()=>f,[f]),E.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),u(null)}},[c,u]),(0,D.jsx)(ye,{asChild:!0,...d,children:(0,D.jsx)(Ne,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":tt(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:l(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),f()},100))})),onPointerLeave:l(e.onPointerLeave,Y(e=>{f();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:l(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||A[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Qe.displayName=q;var $e=`MenuSubContent`,et=E.forwardRef((e,t)=>{let n=xe(B,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=L(B,e.__scopeMenu),s=R(B,e.__scopeMenu),u=Xe($e,e.__scopeMenu),d=E.useRef(null),f=a(t,d);return(0,D.jsx)(M.Provider,{scope:e.__scopeMenu,children:(0,D.jsx)(c,{present:r||o.open,children:(0,D.jsx)(M.Slot,{scope:e.__scopeMenu,children:(0,D.jsx)(V,{id:u.contentId,"aria-labelledby":u.triggerId,...i,ref:f,align:`start`,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&d.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:l(e.onFocusOutside,e=>{e.target!==u.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:l(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:l(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=fe[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),u.trigger?.focus(),e.preventDefault())})})})})})});et.displayName=$e;function tt(e){return e?`open`:`closed`}function J(e){return e===`indeterminate`}function nt(e){return J(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=_e,lt=ye,ut=Se,dt=Te,ft=H,pt=je,mt=W,ht=Fe,gt=ze,_t=Ve,vt=We,yt=Ke,bt=Je,xt=Ze,St=Qe,Ct=et,X=`DropdownMenu`,[wt,Tt]=g(X,[F]),Z=F(),[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]=m({prop:i,defaultProp:a??!1,onChange:o,caller:X});return(0,D.jsx)(Et,{scope:t,triggerId:f(),triggerRef:l,contentId:f(),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)(u.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:l(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:l(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:l(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:l(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]=m({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)(sn,{"data-slot":`dropdown-menu-portal`,...n}),t[2]=n,t[3]=r),r}function Sn(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 Cn(e){let t=(0,Q.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`start`:i,c=a===void 0?4:a,l;t[5]===n?l=t[6]:(l=s(`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]!==o||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:o,className:l,...r})}),t[7]=o,t[8]=r,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function wn(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 Tn(e){let t=(0,Q.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,c;t[5]===n?c=t[6]:(c=s(`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]!==o?(l=(0,D.jsx)(dn,{"data-slot":`dropdown-menu-item`,"data-inset":r,"data-variant":o,className:c,...i}),t[7]=r,t[8]=i,t[9]=c,t[10]=o,t[11]=l):l=t[11],l}function En(e){let t=(0,Q.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let c;t[6]===i?c=t[7]:(c=s(`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]=c);let l;t[8]===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-checkbox-item-indicator`,children:(0,D.jsx)(hn,{children:(0,D.jsx)(S,{})})}),t[8]=l):l=t[8];let u;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==c?(u=(0,D.jsxs)(fn,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":a,className:c,checked:n,...o,children:[l,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=c,t[14]=u):u=t[14],u}function Dn(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 On(e){let t=(0,Q.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,inset:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=s(`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]=o);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(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)(S,{})})}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(l=(0,D.jsxs)(mn,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:o,...a,children:[c,n]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=l):l=t[12],l}function kn(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 a;t[4]===n?a=t[5]:(a=s(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,D.jsx)(un,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function An(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=s(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,D.jsx)(gn,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jn(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 Mn(e){let t=(0,Q.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=s(`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]=o);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,D.jsx)(C,{className:`ml-auto`}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(l=(0,D.jsxs)(vn,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,c]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=l):l=t[12],l}function Nn(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=s(`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 a;return t[5]!==r||t[6]!==i?(a=(0,D.jsx)(yn,{"data-slot":`dropdown-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function $(e){return w(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function Pn(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 T(),{ok:!0,created:n?.created??!1,warnings:n?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Fn(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 T(),{ok:!0,created:n?.created??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function In(){try{let e=await fetch(`/api/skills/management`);return e.ok?await e.json():null}catch{return null}}async function Ln(e){try{return(await fetch(`/api/skills/management`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({manageEditorSkills:e})})).ok?(T(),!0):!1}catch{return!1}}function Rn(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 zn(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=Rn(e.name,e.existingNames),s=await Pn({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 Bn(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 Pn({scope:r,name:t,frontmatter:{name:t,description:a},body:o});if(!c.ok)return c;let l=await Un(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 Fn({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 Hn(n,t);return d.ok?(T(),{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 Vn(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 T(),{ok:!0,committed:n?.committed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Hn(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 T(),{ok:!0,existed:i?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Un(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 Wn(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 Gn(e,t){return Wn({...e,signal:t}).then(e=>e.ok?{ok:!0,text:e.text}:{ok:!1,status:e.status})}async function Kn(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 T(),{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 qn(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 T(),{ok:!0,uninstalled:n?.uninstalled??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function Jn(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 T(),{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{dt as A,xt as B,jn as C,lt as D,Sn as E,ut as F,St as H,gt as I,_t as L,mt as M,vt as N,bt as O,pt as P,ct as R,An as S,Mn as T,F as U,Ct as V,Tn as _,Kn as a,Dn as b,Bn as c,qn as d,Jn as f,wn as g,Cn as h,In as i,ft as j,ht as k,Pn as l,En as m,zn as n,Gn as o,bn as p,Un as r,Vn as s,Hn as t,Ln as u,kn as v,Nn as w,On as x,xn as y,yt as z};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{J as e}from"./CodeMirrorPropInput-
|
|
1
|
+
import{J as e}from"./CodeMirrorPropInput-BaaMh183.js";import{B as t,C as n,H as r,P as i,V as a,b as o,et as s,p as c,tt as l,w as u,y as d}from"./config-provider-DGMqQCfP.js";import{$ as f,Dt as p,J as m,Mt as h,Q as g,St as _,X as v,kt as y}from"./dist-DOee8t3p.js";var b=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:i(this.yanchor),yhead:i(this.yhead)}}static fromJSON(t){return new e(n(t.yanchor),n(t.yhead))}},x=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new c(e)}toYPos(e,t=0){return u(this.ytext,e,t)}fromYPos(e){let t=o(n(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new b(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?p.cursor(n.pos,n.assoc):p.range(t.pos,n.pos)}},S=y.define({combine(e){return e[e.length-1]}}),C=_.define(),w=class{constructor(e){this.view=e,this.conf=e.state.facet(S),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[C.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(C)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
|
|
2
2
|
`);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},T=g.fromClass(w),E=v.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),D=_.define(),O=class extends f{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return t(`span`,[r(`class`,`cm-ySelectionCaret`),r(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[a(``),t(`div`,[r(`class`,`cm-ySelectionCaretDot`)]),a(``),t(`div`,[r(`class`,`cm-ySelectionInfo`)],[a(this.name)]),a(``)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},k=class{constructor(e){this.conf=e.state.facet(S),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[D.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=h.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,r=t.doc,i=this.conf.awareness,a=[],c=this.conf.awareness.getLocalState();if(c!=null){let r=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),a=r?e.state.selection.main:null,o=c.cursor==null?null:n(c.cursor.anchor),s=c.cursor==null?null:n(c.cursor.head);if(a!=null){let e=u(t,a.anchor),n=u(t,a.head);(c.cursor==null||!d(o,e)||!d(s,n))&&i.setLocalStateField(`cursor`,{anchor:e,head:n})}else c.cursor!=null&&r&&i.setLocalStateField(`cursor`,null)}i.getStates().forEach((n,c)=>{if(c===i.doc.clientID)return;let u=n.cursor;if(u==null||u.anchor==null||u.head==null)return;let d=o(u.anchor,r),f=o(u.head,r);if(d==null||f==null||d.type!==t||f.type!==t)return;let{color:p=`#30bced`,name:h=`Anonymous`}=n.user||{},g=n.user&&n.user.colorLight||p+`33`,_=l(d.index,f.index),v=s(d.index,f.index),y=e.view.state.doc.lineAt(_),b=e.view.state.doc.lineAt(v);if(y.number===b.number)a.push({from:_,to:v,value:m.mark({attributes:{style:`background-color: ${g}`},class:`cm-ySelection`})});else{a.push({from:_,to:y.from+y.length,value:m.mark({attributes:{style:`background-color: ${g}`},class:`cm-ySelection`})}),a.push({from:b.from,to:v,value:m.mark({attributes:{style:`background-color: ${g}`},class:`cm-ySelection`})});for(let t=y.number+1;t<b.number;t++){let n=e.view.state.doc.line(t).from;a.push({from:n,to:n,value:m.line({attributes:{style:`background-color: ${g}`,class:`cm-yLineSelection`}})})}}a.push({from:f.index,to:f.index,value:m.widget({side:f.index-d.index>0?-1:1,block:!1,widget:new O(p,h)})})}),this.decorations=m.set(a,!0)}},A=g.fromClass(k,{decorations:e=>e.decorations}),j=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},M=y.define({combine(e){return e[e.length-1]}});_.define();var N=class{constructor(t){this.view=t,this.conf=t.state.facet(M),this._undoManager=this.conf.undoManager,this.syncConf=t.state.facet(S),this._beforeChangeSelection=null,this._mux=e(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:e})=>{let n=e.meta.get(this);if(n){let e=this.syncConf.fromYRange(n);t.dispatch(t.state.update({selection:e,effects:[v.scrollIntoView(e)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(C)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},P=g.fromClass(N),F=({state:e,dispatch:t})=>e.facet(M).undo()||!0,I=({state:e,dispatch:t})=>e.facet(M).redo()||!0,L=(e,t,{undoManager:n=new c(e)}={})=>{let r=new x(e,t),i=[S.of(r),T];return t&&i.push(E,A),n!==!1&&i.push(M.of(new j(n)),P,v.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?F(t):e.inputType===`historyRedo`?I(t):!1}})),i};export{L as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./navigation-targets-
|
|
1
|
+
import{o as e}from"./navigation-targets-nvGLJ1po.js";import{l as t}from"./doc-hash-vKFY-V-Y.js";function n(e){switch(e.kind){case`doc`:case`large-file`:return`doc`;case`skill-file`:return`doc`;case`folder`:case`folder-index`:return`folder`;case`missing`:case`asset`:return`missing`}}function r(r,i){let a=e(r,i);return{resolvedTarget:a,hashDocName:a.target,hash:a.kind===`skill-file`?t({scope:a.scope,name:a.name,path:a.path}):null,displayState:n(a)}}export{r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./propagation-api-M_AcuP6N.js";import{n}from"./startup-marks-
|
|
1
|
+
import{n as e,t}from"./propagation-api-M_AcuP6N.js";import{n}from"./startup-marks-BJwpvHMe.js";import{getAppTracer as r}from"./telemetry-impl-jUMr-Cv1.js";var i;function a(){if(!i)try{let a=typeof window<`u`?window.okDesktop?.config.startupTraceparent:void 0;if(!a)return;let o=t.extract(e.active(),{traceparent:a}),s=r().startSpan(`ok.app-startup`,void 0,o);i=s,n(e=>{try{s.end(e)}catch{}i=void 0})}catch{}}export{a as initStartupTrace};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{i as e}from"./chunk-DseTPa7n.js";import{n as t,r as n,t as r}from"./compiler-runtime-DrcePeIl.js";import{n as i}from"./DocumentContext-DVJ7yEqv.js";import{n as a,r as o}from"./dist-CSDjUb5q.js";import{a as s,c,i as l,n as u,o as d,r as f,s as p,t as m,u as h}from"./panel-BGYdvxEm.js";import{n as g,t as _,u as v}from"./createLucideIcon-Wgamzz8_.js";import{n as y,r as b,t as x}from"./collapsible-UIgt0pSO.js";import{B as S,I as C}from"./CodeMirrorPropInput-BaaMh183.js";import{n as w,t as T}from"./toggle-group-B30vKHKs.js";import{Vr as E,ft as D,ht as O,lr as k}from"./dist-Cf-rDWvg.js";import{t as A}from"./chevron-right-B2thM4kG.js";import{n as j,r as M}from"./CopyButton-B8lE78wK.js";import{i as ee}from"./prop-types-y7w6_eIH.js";import{l as N}from"./workspace-paths-BzYkZqjr.js";import{t as P}from"./refresh-cw-FMnveNBD.js";import{t as F}from"./triangle-alert-VZ_Cki-r.js";import{n as I}from"./dist-Qabe7wDM.js";import{t as L}from"./dist-C87Ou6G5.js";import{i as R,l as z,r as B}from"./lint-config-client-C1xGkxTP.js";import{i as V}from"./startup-marks-BJwpvHMe.js";import{a as H,s as U}from"./doc-hash-vKFY-V-Y.js";var W=_(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),G=e(t(),1),K=r(),q=3e4,J=new Map;function Y(e){return e?Date.now()-e.rememberedAt>q?null:e.navigation:null}function te(e,t){J.set(e,{navigation:t,rememberedAt:Date.now()})}function X(e){return Y(J.get(e))}function Z(e){let t=J.get(e);return J.delete(e),Y(t)}function Q(e){J.delete(e)}function ne(e,t){let n=(0,K.c)(4),r=t===void 0?!1:t,[i,a]=(0,G.useState)(void 0),o=(0,G.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,G.useEffect)(s,c),i}var $=n(),re=300;async function ie(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new S(L._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=O.safeParse(n);throw e.success?Error(e.data.title):new S(L._({id:`zlErBl`}),{status:t.status})}let r=D.safeParse(n);if(!r.success)throw new S(L._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var ae=32,oe=12,se=6,ce=`open-knowledge:outline-nav`;function le(e){let t=(0,K.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(V,{name:`outline-panel`,children:(0,$.jsx)(ue,{...e})}),t[0]=e,t[1]=n),n}function ue(e){let t=(0,K.c)(50),{docName:n,isSourceMode:r,className:g}=e,_=g===void 0?``:g,{_:y}=o(),{pages:b,loading:x}=ee(),S=h(),{activeProvider:C,activeDocName:w}=i(),T,E;t[0]===n?(T=t[1],E=t[2]):(T=[`page-headings`,n],E=()=>ie(n),t[0]=n,t[1]=T,t[2]=E);let D;t[3]!==n||t[4]!==x||t[5]!==b?(D=!x&&(b.has(n)||k(n)),t[3]=n,t[4]=x,t[5]=b,t[6]=D):D=t[6];let O;t[7]!==T||t[8]!==E||t[9]!==D?(O={queryKey:T,queryFn:E,enabled:D,staleTime:1/0},t[7]=T,t[8]=E,t[9]=D,t[10]=O):O=t[10];let{data:A,isLoading:j,error:M}=c(O),N;t[11]===A?N=t[12]:(N=A===void 0?[]:A,t[11]=A,t[12]=N);let P=N,F,I;t[13]!==w||t[14]!==C||t[15]!==n||t[16]!==S?(F=()=>{if(!C||w!==n)return;let e=C.document,t=null,r=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,S.invalidateQueries({queryKey:[`page-headings`,n]})},re)};return e.on(`update`,r),()=>{e.off(`update`,r),t!==null&&clearTimeout(t)}},I=[C,w,n,S],t[13]=w,t[14]=C,t[15]=n,t[16]=S,t[17]=F,t[18]=I):(F=t[17],I=t[18]),(0,G.useEffect)(F,I);let L;t[19]===P?L=t[20]:(L=P.map(de),t[19]=P,t[20]=L);let R=ne(L,r),z;t[21]!==R||t[22]!==P?(z=R?P.findIndex(e=>e.slug===R):-1,t[21]=R,t[22]=P,t[23]=z):z=t[23];let B=z,V;t[24]!==n||t[25]!==r?(V=function(e,t){let i={index:e,slug:t,mode:r?`source`:`wysiwyg`};i.mode===`source`&&te(n,{kind:`outline`,detail:i}),window.dispatchEvent(new CustomEvent(ce,{detail:i}))},t[24]=n,t[25]=r,t[26]=V):V=t[26];let H=V,U=((B>=0?P[B].level:1)-1)*oe+(oe-se)/2,W=B*ae+(ae-se)/2,q;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(p,{children:(0,$.jsx)(a,{id:`dD7NPy`})}),t[27]=q):q=t[27];let J;t[28]!==P.length||t[29]!==j?(J=!j&&(0,$.jsx)(f,{children:P.length}),t[28]=P.length,t[29]=j,t[30]=J):J=t[30];let Y;t[31]===J?Y=t[32]:(Y=(0,$.jsxs)(d,{children:[q,J]}),t[31]=J,t[32]=Y);let X;t[33]!==y||t[34]!==B||t[35]!==R||t[36]!==M||t[37]!==H||t[38]!==P||t[39]!==j||t[40]!==U||t[41]!==W?(X=M?(0,$.jsx)(s,{className:`px-2`,children:M instanceof Error?M.message:y({id:`GuqOb1`})}):P.length===0&&!j?(0,$.jsx)(l,{className:`px-2`,children:(0,$.jsx)(a,{id:`0BB9ID`})}):(0,$.jsxs)(`nav`,{"aria-label":y({id:`BymzO4`}),className:`relative`,children:[B>=0&&(0,$.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:se,height:se,transform:`translate(${U}px, ${W}px)`}}),P.map((e,t)=>{let n=e.slug===R;return(0,$.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>H(t,e.slug),className:v(`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)*oe+20}px`},title:e.text,children:e.text},t)})]}),t[33]=y,t[34]=B,t[35]=R,t[36]=M,t[37]=H,t[38]=P,t[39]=j,t[40]=U,t[41]=W,t[42]=X):X=t[42];let Z;t[43]!==j||t[44]!==X?(Z=(0,$.jsx)(u,{className:`px-3 py-2`,"aria-busy":j,children:X}),t[43]=j,t[44]=X,t[45]=Z):Z=t[45];let Q;return t[46]!==_||t[47]!==Y||t[48]!==Z?(Q=(0,$.jsxs)(m,{className:_,children:[Y,Z]}),t[46]=_,t[47]=Y,t[48]=Z,t[49]=Q):Q=t[49],Q}function de(e){return e.slug}function fe(e){let t=(0,K.c)(10),{scope:n,onScopeChange:r}=e,{_:i}=o(),s;t[0]===r?s=t[1]:(s=e=>{e&&r(e)},t[0]=r,t[1]=s);let c;t[2]===i?c=t[3]:(c=i({id:`aBgwis`}),t[2]=i,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(w,{value:`doc`,className:`flex-1`,"data-testid":`panel-scope-doc`,children:(0,$.jsx)(a,{id:`UpCz01`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(w,{value:`project`,className:`flex-1`,"data-testid":`panel-scope-project`,children:(0,$.jsx)(a,{id:`e0NrBM`})}),t[5]=u):u=t[5];let d;return t[6]!==n||t[7]!==s||t[8]!==c?(d=(0,$.jsx)(`div`,{className:`shrink-0 px-4 pb-2`,children:(0,$.jsxs)(T,{type:`single`,variant:`segmented`,size:`sm`,spacing:1,value:n,onValueChange:s,"aria-label":c,className:`w-full rounded-md bg-muted p-0.5 dark:bg-background`,children:[l,u]})}),t[6]=n,t[7]=s,t[8]=c,t[9]=d):d=t[9],d}var pe=`open-knowledge:lint-nav`;function me(e,t){return e.range.start.line-t.range.start.line||e.range.start.character-t.range.start.character}function he(e){return{line:e.range.start.line+1,column:e.range.start.character+1}}function ge(e){let t=(0,K.c)(19),{diagnostic:n}=e,{_:r}=o(),i=n.severity===`error`?M:F,a=`${n.source}/${n.code}`,s=n.range.start.line+1,c=n.severity===`error`?`text-destructive`:`text-amber-500`,l;t[0]===c?l=t[1]:(l=v(`mt-0.5 size-3.5 shrink-0`,c),t[0]=c,t[1]=l);let u;t[2]!==i||t[3]!==l?(u=(0,$.jsx)(i,{"aria-hidden":`true`,className:l}),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===n.message?d=t[6]:(d=(0,$.jsx)(`span`,{className:`text-foreground`,children:n.message}),t[5]=n.message,t[6]=d);let f;t[7]!==u||t[8]!==d?(f=(0,$.jsxs)(`span`,{className:`flex items-start gap-1.5 text-sm`,children:[u,d]}),t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;t[10]!==r||t[11]!==s?(p=r({id:`enPTnx`,values:{displayLine:s}}),t[10]=r,t[11]=s,t[12]=p):p=t[12];let m;t[13]!==a||t[14]!==p?(m=(0,$.jsxs)(`span`,{className:`ps-5 font-mono text-xs text-muted-foreground`,children:[a,` · `,p]}),t[13]=a,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,$.jsxs)($.Fragment,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}function _e(e){return`${e.source}/${e.code}-${e.range.start.line}-${e.range.start.character}-${e.message}`}function ve(e){return e.reduce((e,t)=>e+ +((t.fixes?.length??0)>0),0)}function ye(e){let t=(0,K.c)(13),{count:n,disabled:r,onClick:i,children:s}=e,{_:c}=o(),l;t[0]!==c||t[1]!==s||t[2]!==n?(l=s===void 0?c({id:`Izb10l`,values:{count:n}}):void 0,t[0]=c,t[1]=s,t[2]=n,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(W,{"aria-hidden":`true`,className:`size-3`}),t[4]=u):u=t[4];let d;t[5]!==s||t[6]!==n?(d=s??(0,$.jsx)(a,{id:`5_8TCr`,values:{count:n}}),t[5]=s,t[6]=n,t[7]=d):d=t[7];let f;return t[8]!==r||t[9]!==i||t[10]!==l||t[11]!==d?(f=(0,$.jsxs)(g,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:r,onClick:i,"aria-label":l,"data-testid":`problems-fix-all`,children:[u,d]}),t[8]=r,t[9]=i,t[10]=l,t[11]=d,t[12]=f):f=t[12],f}function be(e){let t=(0,K.c)(21),{docName:n,diagnostics:r,onFix:i,onFixAll:s,onAskAi:c}=e,{_:h}=o(),[_,v]=(0,G.useState)(`doc`),y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y={status:`idle`},t[0]=y):y=t[0];let[b,x]=(0,G.useState)(y),[S,C]=(0,G.useState)(null),w=(0,G.useRef)(!0),T,E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>(w.current=!0,()=>{w.current=!1}),E=[],t[1]=T,t[2]=E):(T=t[1],E=t[2]),(0,G.useEffect)(T,E);let D;if(t[3]!==h||t[4]!==b||t[5]!==r||t[6]!==n||t[7]!==c||t[8]!==i||t[9]!==s||t[10]!==S||t[11]!==_){let e=[...r].sort(me),o=async function(){x({status:`loading`});let e=await R();w.current&&x(e===null?{status:`failed`}:{status:`loaded`,result:e})},y=b.status===`loaded`?b.result.files.filter(Ce):[],T=async function(){if(S!==null||y.length===0)return;C({done:0,total:y.length});let e=[];for(let t of y){let n=await B(H(t.file));if(!w.current)return;n.ok||e.push({file:t.file,detail:n.errorDetail}),C(Se)}if(C(null),e.length>0){let t=e[0];I.error(h({id:`fru3T7`,values:{0:e.length,1:y.length}}),{description:t===void 0?void 0:`${t.file}${t.detail===null?``:` — ${t.detail}`}`})}try{await o()}catch{w.current&&x({status:`failed`})}},E=function(e){v(e),e===`project`&&b.status===`idle`&&o()},O;t[13]===n?O=t[14]:(O=function(e){let t=he(e);te(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(pe,{detail:t}))},t[13]=n,t[14]=O);let k=O,A;t[15]!==n||t[16]!==k?(A=function(e,t){let r=H(e);if(r===n){k(t);return}te(r,{kind:`lint`,detail:he(t)}),window.location.hash=U(r)},t[15]=n,t[16]=k,t[17]=A):A=t[17];let j=A,M;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(p,{children:(0,$.jsx)(a,{id:`OXdGnd`})}),t[18]=M):M=t[18];let ee=_===`doc`&&e.length>0&&(0,$.jsx)(f,{children:e.length}),P;t[19]===ee?P=t[20]:(P=(0,$.jsxs)(d,{children:[M,ee]}),t[19]=ee,t[20]=P),D=(0,$.jsxs)(m,{children:[P,(0,$.jsx)(fe,{scope:_,onScopeChange:E}),_===`doc`?(0,$.jsx)(u,{className:`px-2 py-2`,children:e.length===0?(0,$.jsx)(l,{className:`px-2`,children:(0,$.jsx)(a,{id:`ZI8uvA`})}):(0,$.jsxs)($.Fragment,{children:[s!==void 0&&(0,$.jsx)(`div`,{className:`flex items-center justify-end gap-2 px-2 pb-1`,children:(0,$.jsx)(ye,{count:ve(e),disabled:ve(e)===0,onClick:s})}),(0,$.jsx)(`ul`,{"aria-label":h({id:`OXdGnd`}),className:`flex flex-col gap-0.5`,children:e.map(e=>{let t=e.range.start.line+1,n=i!==void 0&&(e.fixes?.length??0)>0,r=`${e.source}/${e.code}`;return(0,$.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>k(e),className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left`,title:h({id:`aHPdYV`,values:{displayLine:t}}),children:(0,$.jsx)(ge,{diagnostic:e})}),n||c!==void 0?(0,$.jsxs)(`div`,{className:`absolute bottom-1 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:[n?(0,$.jsxs)(g,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>i?.(e),"aria-label":h({id:`fZj9em`,values:{flatId:r}}),"data-testid":`problems-fix`,children:[(0,$.jsx)(W,{"aria-hidden":`true`,className:`size-3`}),(0,$.jsx)(a,{id:`c4fVUV`})]}):null,c===void 0?null:(0,$.jsxs)(g,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>c(e),"aria-label":h({id:`hh4mVC`,values:{flatId:r}}),"data-testid":`problems-ask-ai`,children:[(0,$.jsx)(N,{"aria-hidden":`true`,className:`size-3`}),(0,$.jsx)(a,{id:`xWEvuo`})]})]}):null]},_e(e))})})]})}):(0,$.jsx)(Te,{audit:b,onRefresh:()=>void o(),onNavigate:j,fixableCount:y.reduce(xe,0),fixing:S,onFixAll:()=>void T()})]}),t[3]=h,t[4]=b,t[5]=r,t[6]=n,t[7]=c,t[8]=i,t[9]=s,t[10]=S,t[11]=_,t[12]=D}else D=t[12];return D}function xe(e,t){return e+ve(t.diagnostics)}function Se(e){return e===null?e:{...e,done:e.done+1}}function Ce(e){return e.diagnostics.some(we)}function we(e){return(e.fixes?.length??0)>0}function Te(e){let t=(0,K.c)(43),{audit:n,onRefresh:r,onNavigate:i,fixableCount:c,fixing:l,onFixAll:d}=e,{_:f}=o(),p=n.status===`loading`||n.status===`idle`,m;t[0]!==n.result||t[1]!==n.status?(m=n.status===`loaded`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(a,{id:`DsDwR-`,values:{0:n.result.errorCount}}),` · `,(0,$.jsx)(a,{id:`W1SI2K`,values:{0:n.result.warningCount}})]}),t[0]=n.result,t[1]=n.status,t[2]=m):m=t[2];let h;t[3]===m?h=t[4]:(h=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`problems-audit-summary`,children:m}),t[3]=m,t[4]=h);let _;t[5]!==f||t[6]!==l?(_=l===null?null:(0,$.jsx)(`span`,{className:`sr-only`,role:`status`,children:f({id:`gZElfU`,values:{0:l.done,1:l.total}})}),t[5]=f,t[6]=l,t[7]=_):_=t[7];let v=p||l!==null||c===0,y;t[8]===l?y=t[9]:(y=l===null?void 0:(0,$.jsx)(a,{id:`S9t1PI`,values:{0:l.done,1:l.total}}),t[8]=l,t[9]=y);let b;t[10]!==c||t[11]!==d||t[12]!==v||t[13]!==y?(b=(0,$.jsx)(ye,{count:c,disabled:v,onClick:d,children:y}),t[10]=c,t[11]=d,t[12]=v,t[13]=y,t[14]=b):b=t[14];let x;t[15]===f?x=t[16]:(x=f({id:`WRdYfS`}),t[15]=f,t[16]=x);let S=p||l!==null,C;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(P,{"aria-hidden":`true`,className:`size-3.5`}),t[17]=C):C=t[17];let w;t[18]!==r||t[19]!==x||t[20]!==S?(w=(0,$.jsx)(g,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":x,"data-testid":`problems-audit-refresh`,disabled:S,onClick:r,children:C}),t[18]=r,t[19]=x,t[20]=S,t[21]=w):w=t[21];let T;t[22]!==w||t[23]!==_||t[24]!==b?(T=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[_,b,w]}),t[22]=w,t[23]=_,t[24]=b,t[25]=T):T=t[25];let E;t[26]!==T||t[27]!==h?(E=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 pb-1`,children:[h,T]}),t[26]=T,t[27]=h,t[28]=E):E=t[28];let D;t[29]!==f||t[30]!==p?(D=p&&(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,role:`status`,"aria-busy":`true`,"aria-label":f({id:`dx-TwN`}),children:[1,2,3].map(Ee)}),t[29]=f,t[30]=p,t[31]=D):D=t[31];let O;t[32]===n.status?O=t[33]:(O=n.status===`failed`&&(0,$.jsx)(s,{className:`px-2 text-xs`,children:(0,$.jsx)(a,{id:`IFezUv`})}),t[32]=n.status,t[33]=O);let k;t[34]!==n.result||t[35]!==n.status||t[36]!==i?(k=n.status===`loaded`&&(0,$.jsx)(De,{result:n.result,onNavigate:i}),t[34]=n.result,t[35]=n.status,t[36]=i,t[37]=k):k=t[37];let A;return t[38]!==E||t[39]!==D||t[40]!==O||t[41]!==k?(A=(0,$.jsxs)(u,{className:`px-2 py-2`,"data-testid":`problems-project-scope`,children:[E,D,O,k]}),t[38]=E,t[39]=D,t[40]=O,t[41]=k,t[42]=A):A=t[42],A}function Ee(e){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded px-2 py-1.5`,children:[(0,$.jsx)(z,{className:`mt-0.5 size-3.5 shrink-0 rounded`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,$.jsx)(z,{className:`h-3 w-28`}),(0,$.jsx)(z,{className:`h-3 w-40`})]})]},e)}function De(e){let t=(0,K.c)(10),{result:n,onNavigate:r}=e,{_:i}=o(),s;t[0]!==i||t[1]!==n.warnings?(s=n.warnings.length>0&&(0,$.jsx)(`ul`,{"aria-label":i({id:`Rsdhj9`}),className:`flex flex-col gap-0.5 pb-1`,children:n.warnings.map(Oe)}),t[0]=i,t[1]=n.warnings,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n.fileCount||t[5]!==n.files?(c=n.files.length===0?(0,$.jsx)(l,{className:`px-2`,children:(0,$.jsx)(a,{id:`k_Dqw1`,values:{0:n.fileCount}})}):n.files.map(e=>(0,$.jsx)(ke,{file:e,onNavigate:r},e.file)),t[3]=r,t[4]=n.fileCount,t[5]=n.files,t[6]=c):c=t[6];let u;return t[7]!==s||t[8]!==c?(u=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=u):u=t[9],u}function Oe(e,t){return(0,$.jsxs)(`li`,{className:`flex items-start gap-1.5 px-2 text-xs`,children:[(0,$.jsx)(F,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-500`}),(0,$.jsx)(`span`,{className:`min-w-0 text-foreground`,children:e})]},`${t}-${e}`)}function ke(e){let t=(0,K.c)(37),{file:n,onNavigate:r}=e,{_:i}=o(),a,s,c,l,u,d,f,p,m;if(t[0]!==i||t[1]!==n.diagnostics||t[2]!==n.file||t[3]!==r){let e=[...n.diagnostics].sort(me);s=x,f=!0,p=`problems-audit-group`;let o;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(A,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),t[13]=o):o=t[13];let h;t[14]===n.file?h=t[15]:(h=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,title:n.file,children:n.file}),t[14]=n.file,t[15]=h),m=(0,$.jsxs)(b,{className:`group flex w-full cursor-pointer items-center gap-1.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:[o,h,(0,$.jsx)(j,{variant:`gray`,"data-testid":`problems-audit-file-count`,className:`shrink-0`,children:e.length})]}),a=y,d=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[16]!==i||t[17]!==n.file?(c=i({id:`zAJzIg`,values:{0:n.file}}),t[16]=i,t[17]=n.file,t[18]=c):c=t[18],l=`flex flex-col gap-0.5 pb-1 ps-3`;let g;t[19]!==i||t[20]!==n.file||t[21]!==r?(g=e=>{let t=e.range.start.line+1;return(0,$.jsx)(`li`,{children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(n.file,e),className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,title:i({id:`kDwcbW`,values:{0:n.file,displayLine:t}}),children:(0,$.jsx)(ge,{diagnostic:e})})},_e(e))},t[19]=i,t[20]=n.file,t[21]=r,t[22]=g):g=t[22],u=e.map(g),t[0]=i,t[1]=n.diagnostics,t[2]=n.file,t[3]=r,t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else a=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12];let h;t[23]!==c||t[24]!==l||t[25]!==u?(h=(0,$.jsx)(`ul`,{"aria-label":c,className:l,children:u}),t[23]=c,t[24]=l,t[25]=u,t[26]=h):h=t[26];let g;t[27]!==a||t[28]!==d||t[29]!==h?(g=(0,$.jsx)(a,{className:d,children:h}),t[27]=a,t[28]=d,t[29]=h,t[30]=g):g=t[30];let _;return t[31]!==s||t[32]!==f||t[33]!==p||t[34]!==m||t[35]!==g?(_=(0,$.jsxs)(s,{defaultOpen:f,"data-testid":p,children:[m,g]}),t[31]=s,t[32]=f,t[33]=p,t[34]=m,t[35]=g,t[36]=_):_=t[36],_}var Ae={words:0,chars:0,tokens:0},je=/[ -〿-ゟ゠-ヿ㐀-䶿一-鿿豈---ក-]/,Me=/[\p{L}\p{N}]/u,Ne=new Set([`text`,`inlineCode`,`code`,`tag`]),Pe=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),Fe=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function Ie(e,t){if(!e)return;let n=e.type;if(!Pe.has(n)){if(Ne.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
|
|
2
|
+
`));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)Ie(n,t);if(Fe.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
|
|
3
|
+
`)&&t.push(`
|
|
4
|
+
`)}}}}function Le(e){try{let t=C().parseToMdast(e),n=[];return Ie(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function Re(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))Me.test(n)&&t++;return t}function ze(e){let t=globalThis.Intl.Segmenter;if(!t)return Re(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function Be(e){let t=je.test(e)?1.5:4;return Math.ceil(e.length/t)}function Ve(e){return e?{words:je.test(e)?ze(e):Re(e),chars:e.length,tokens:Be(e)}:{words:0,chars:0,tokens:0}}function He(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=E(e);return t.trim()?Ve(Le(t)):{words:0,chars:0,tokens:0}}function Ue(e,{isMarkdown:t}){let n=e.trim();return n?Ve(t?Le(e):n):Ae}var We=new Map,Ge=new Set,Ke=(e,t)=>`${t}:${e}`;function qe(){for(let e of Ge)e()}function Je(e,t,n){let r=Ke(e,t);if(n===null){We.delete(r)&&qe();return}let i=We.get(r);i&&i.words===n.words&&i.chars===n.chars&&i.tokens===n.tokens||(We.set(r,n),qe())}function Ye(e,t){return e===null?null:We.get(Ke(e,t))??null}function Xe(e){return Ge.add(e),()=>{Ge.delete(e)}}function Ze(e){let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
|
|
5
|
+
`,` `);return i.trim()?Ue(i,{isMarkdown:!1}):null}function Qe(e){let t=[];for(let n of e.state.selection.ranges)n.empty||t.push(e.state.sliceDoc(n.from,n.to));if(t.length===0)return null;let n=t.join(`
|
|
6
|
+
`);return n.trim()?Ue(n,{isMarkdown:!0}):null}export{Xe as a,pe as c,le as d,Q as f,te as h,Ze as i,be as l,X as m,Je as n,Ae as o,Z as p,Qe as r,He as s,Ye as t,ce as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DseTPa7n.js";import{n as t,t as n}from"./compiler-runtime-DrcePeIl.js";import{
|
|
2
|
-
`)}\n}`}var g=`ok-color-theme-v1`,_=`ok-custom-theme-v1`,v=`data-color-theme`,y=`ok-custom-theme`;function b(e){let t=document.getElementById(y);t||(t=document.createElement(`style`),t.id=y,document.head.appendChild(t)),t.textContent!==e&&(t.textContent=e)}function x(){document.getElementById(y)?.remove()}function S(e,t,n=!0){if(typeof document>`u`)return;let i
|
|
1
|
+
import{i as e}from"./chunk-DseTPa7n.js";import{n as t,t as n}from"./compiler-runtime-DrcePeIl.js";import{ua as r,va as i}from"./dist-Cf-rDWvg.js";var a=e(t(),1),o=n(),s=/^#[0-9a-fA-F]{6}$/,c={background:`#0f172a`,surface:`#1e293b`,foreground:`#e2e8f0`,primary:`#6366f1`,accent:`#22d3ee`,border:`#334155`};function l(e){return typeof e==`string`&&s.test(e)}function u(e){let t={...c};if(e)for(let n of Object.keys(c)){let r=e[n];l(r)&&(t[n]=r)}return t}function d(e){let t=l(e)?e:`#000000`,n=e=>{let n=Number.parseInt(t.slice(1+e*2,3+e*2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*n(0)+.7152*n(1)+.0722*n(2)}function f(e){return d(e.background)<.5?`dark`:`light`}function p(e){return d(e)<.5?`#ffffff`:`#0a0a0a`}function m(e){return{bg:e.background,bgElevated:e.surface,bgSubtle:e.surface,fg:e.foreground,fgMuted:`color-mix(in oklab, ${e.foreground} 55%, ${e.background})`,border:e.border,primary:e.primary,primaryFg:p(e.primary),red:`#e5534b`,green:`#3fb950`,yellow:`#d29922`,blue:e.accent,cyan:e.accent,orange:`#db8d3f`,purple:e.accent}}function h(e){let t=r(m(e)),n=Object.entries(t).map(([e,t])=>` --${e}: ${t};`);return`html[data-color-theme="custom"] {\n color-scheme: ${f(e)};\n${n.join(`
|
|
2
|
+
`)}\n}`}var g=`ok-color-theme-v1`,_=`ok-custom-theme-v1`,v=`data-color-theme`,y=`ok-custom-theme`;function b(e){let t=document.getElementById(y);t||(t=document.createElement(`style`),t.id=y,document.head.appendChild(t)),t.textContent!==e&&(t.textContent=e)}function x(){document.getElementById(y)?.remove()}function S(e,t,n=!0){if(typeof document>`u`)return;let r=i(n?e:`default`),a=document.documentElement;r.id===`default`?a.removeAttribute(v):a.setAttribute(v,r.id);let o=null;if(r.id===`custom`){let e=u(t),n=h(e);b(n),o=JSON.stringify({css:n,dark:f(e)===`dark`})}else x();try{r.id===`default`?localStorage.removeItem(g):localStorage.setItem(g,r.id),o?localStorage.setItem(_,o):localStorage.removeItem(_)}catch{}}function C(e,t,n){let r=(0,o.c)(12),i=n===void 0?!0:n,s;r[0]!==e||r[1]!==t||r[2]!==i?(s=i&&e===`custom`?JSON.stringify(t??null):``,r[0]=e,r[1]=t,r[2]=i,r[3]=s):s=r[3];let c=s,l;r[4]!==e||r[5]!==t||r[6]!==i?(l=()=>{S(e,t,i)},r[4]=e,r[5]=t,r[6]=i,r[7]=l):l=r[7];let u;r[8]!==e||r[9]!==i||r[10]!==c?(u=[e,c,i],r[8]=e,r[9]=i,r[10]=c,r[11]=u):u=r[11],(0,a.useEffect)(l,u)}export{f as a,u as c,c as i,S as n,m as o,C as r,l as s,v as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DseTPa7n.js";import{n as t}from"./compiler-runtime-DrcePeIl.js";import{r as n}from"./dist-CSDjUb5q.js";import{t as r}from"./createLucideIcon-Wgamzz8_.js";import{
|
|
1
|
+
import{i as e}from"./chunk-DseTPa7n.js";import{n as t}from"./compiler-runtime-DrcePeIl.js";import{r as n}from"./dist-CSDjUb5q.js";import{t as r}from"./createLucideIcon-Wgamzz8_.js";import{Tn as i}from"./dist-Cf-rDWvg.js";var a=r(`copy-plus`,[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),o=r(`pencil`,[[`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`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),s=r(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),c=[`global`,`project`];function l(e){return{project:new Set(e.filter(e=>e.scope===`project`).map(e=>e.name)),global:new Set(e.filter(e=>e.scope===`global`).map(e=>e.name))}}var u=`open-knowledge-pack-`;function d(e){return e.startsWith(u)?e.slice(20):e}function f(){let{_:e}=n();return{project:e({id:`e0NrBM`}),global:e({id:`2GT3Hf`})}}function p(){let{_:e}=n();return{project:e({id:`HyvSqq`}),global:e({id:`C7XjNB`})}}var m=e(t(),1);function h(){let[e]=(0,m.useState)(g);return e}function g(){return i()!=null}function _(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}var v=/\.(md|mdx)$/i;function y(e){return v.test(e)?e:`${e}.md`}export{d as a,p as c,a as d,c as i,s as l,_ as n,l as o,h as r,f as s,y as t,o as u};
|
package/dist/public/index.html
CHANGED
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
-->
|
|
59
59
|
<script>(() => { let t = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (r === 'light' || r === 'dark' || r === 'system') t = r; } catch {} let ct = null; try { const c = localStorage.getItem('ok-color-theme-v1'); if (c && ['dracula', 'catppuccin-frappe', 'catppuccin-latte', 'monokai', 'gruvbox', 'solarized', 'custom'].includes(c)) ct = c; } catch {} let dark = t === 'dark'; if (t === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } let customCss = null; if (ct === 'custom') { try { const raw = localStorage.getItem('ok-custom-theme-v1'); if (raw) { const o = JSON.parse(raw); if (o?.css) { customCss = o.css; dark = !!o.dark; } } } catch {} if (!customCss) ct = null; } else if (ct) { dark = !['catppuccin-latte'].includes(ct); } if (dark) document.documentElement.classList.add('dark'); if (ct) document.documentElement.setAttribute('data-color-theme', ct); if (customCss) { const s = document.createElement('style'); s.id = 'ok-custom-theme'; s.textContent = customCss; document.head.appendChild(s); } if (window.okDesktop) document.documentElement.classList.add('electron-mode'); })();</script>
|
|
60
60
|
<style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
|
|
61
|
-
<script type="module" crossorigin src="./assets/index-
|
|
61
|
+
<script type="module" crossorigin src="./assets/index-D0Ehy4r9.js"></script>
|
|
62
62
|
<link rel="modulepreload" crossorigin href="./assets/chunk-DseTPa7n.js">
|
|
63
63
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-2ej06EnG.js">
|
|
64
64
|
<link rel="modulepreload" crossorigin href="./assets/w3c-keyname-CRPBoZED.js">
|
|
@@ -75,28 +75,28 @@
|
|
|
75
75
|
<link rel="modulepreload" crossorigin href="./assets/floating-ui.dom-B3TJy2Tg.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="./assets/trace-api-BIWqyPc9.js">
|
|
77
77
|
<link rel="modulepreload" crossorigin href="./assets/markdownit-DyWy6cMj.js">
|
|
78
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
78
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-Cf-rDWvg.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="./assets/compiler-runtime-DrcePeIl.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="./assets/dist-DGbq0bSp.js">
|
|
81
|
-
<link rel="modulepreload" crossorigin href="./assets/use-apply-config-color-theme-
|
|
81
|
+
<link rel="modulepreload" crossorigin href="./assets/use-apply-config-color-theme-C4-L1m1x.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="./assets/config-context-BbS_JaHs.js">
|
|
83
|
-
<link rel="modulepreload" crossorigin href="./assets/config-provider-
|
|
84
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
83
|
+
<link rel="modulepreload" crossorigin href="./assets/config-provider-DGMqQCfP.js">
|
|
84
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-C87Ou6G5.js">
|
|
85
85
|
<link rel="modulepreload" crossorigin href="./assets/dist-CSDjUb5q.js">
|
|
86
86
|
<link rel="modulepreload" crossorigin href="./assets/createLucideIcon-Wgamzz8_.js">
|
|
87
87
|
<link rel="modulepreload" crossorigin href="./assets/folder-open-ygPcz1xa.js">
|
|
88
88
|
<link rel="modulepreload" crossorigin href="./assets/trash-2-Cgf308yS.js">
|
|
89
89
|
<link rel="modulepreload" crossorigin href="./assets/triangle-alert-VZ_Cki-r.js">
|
|
90
90
|
<link rel="modulepreload" crossorigin href="./assets/react-dom-CMNLH3L-.js">
|
|
91
|
-
<link rel="modulepreload" crossorigin href="./assets/doc-hash-
|
|
92
|
-
<link rel="modulepreload" crossorigin href="./assets/navigation-targets-
|
|
91
|
+
<link rel="modulepreload" crossorigin href="./assets/doc-hash-vKFY-V-Y.js">
|
|
92
|
+
<link rel="modulepreload" crossorigin href="./assets/navigation-targets-nvGLJ1po.js">
|
|
93
93
|
<link rel="modulepreload" crossorigin href="./assets/external-link-BfiFPJEx.js">
|
|
94
|
-
<link rel="modulepreload" crossorigin href="./assets/documents-fetch-
|
|
95
|
-
<link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-
|
|
96
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
97
|
-
<link rel="modulepreload" crossorigin href="./assets/documents-events-
|
|
98
|
-
<link rel="modulepreload" crossorigin href="./assets/parse-api-error-
|
|
99
|
-
<link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-
|
|
94
|
+
<link rel="modulepreload" crossorigin href="./assets/documents-fetch-CD85Qoe6.js">
|
|
95
|
+
<link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-BaaMh183.js">
|
|
96
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-CN1nOe9M.js">
|
|
97
|
+
<link rel="modulepreload" crossorigin href="./assets/documents-events-BzjmhSSx.js">
|
|
98
|
+
<link rel="modulepreload" crossorigin href="./assets/parse-api-error-Mgtc4OJu.js">
|
|
99
|
+
<link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-CUhx9b-j.js">
|
|
100
100
|
<link rel="modulepreload" crossorigin href="./assets/dist-DivkR5AO.js">
|
|
101
101
|
<link rel="modulepreload" crossorigin href="./assets/dist-DGkUVO6K.js">
|
|
102
102
|
<link rel="modulepreload" crossorigin href="./assets/propagation-api-M_AcuP6N.js">
|
|
@@ -112,48 +112,48 @@
|
|
|
112
112
|
<link rel="modulepreload" crossorigin href="./assets/chevron-right-B2thM4kG.js">
|
|
113
113
|
<link rel="modulepreload" crossorigin href="./assets/copy-CfDOH9N1.js">
|
|
114
114
|
<link rel="modulepreload" crossorigin href="./assets/CopyButton-B8lE78wK.js">
|
|
115
|
-
<link rel="modulepreload" crossorigin href="./assets/startup-marks-
|
|
116
|
-
<link rel="modulepreload" crossorigin href="./assets/prop-types-
|
|
117
|
-
<link rel="modulepreload" crossorigin href="./assets/workspace-paths-
|
|
115
|
+
<link rel="modulepreload" crossorigin href="./assets/startup-marks-BJwpvHMe.js">
|
|
116
|
+
<link rel="modulepreload" crossorigin href="./assets/prop-types-y7w6_eIH.js">
|
|
117
|
+
<link rel="modulepreload" crossorigin href="./assets/workspace-paths-BzYkZqjr.js">
|
|
118
118
|
<link rel="modulepreload" crossorigin href="./assets/eye-Cq1_8-Tk.js">
|
|
119
119
|
<link rel="modulepreload" crossorigin href="./assets/info-CVuSDi5Y.js">
|
|
120
120
|
<link rel="modulepreload" crossorigin href="./assets/loader-circle-BrJhrTc7.js">
|
|
121
121
|
<link rel="modulepreload" crossorigin href="./assets/dist-Qabe7wDM.js">
|
|
122
|
-
<link rel="modulepreload" crossorigin href="./assets/file-tree-rename-validation-
|
|
122
|
+
<link rel="modulepreload" crossorigin href="./assets/file-tree-rename-validation-BBSv40Qz.js">
|
|
123
123
|
<link rel="modulepreload" crossorigin href="./assets/input-BX4UDDMJ.js">
|
|
124
|
-
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-
|
|
124
|
+
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-DVJ7yEqv.js">
|
|
125
125
|
<link rel="modulepreload" crossorigin href="./assets/checkbox-Ds7GA0j4.js">
|
|
126
126
|
<link rel="modulepreload" crossorigin href="./assets/dist-Ly1ZfY-Y.js">
|
|
127
|
-
<link rel="modulepreload" crossorigin href="./assets/skills-api-
|
|
127
|
+
<link rel="modulepreload" crossorigin href="./assets/skills-api-T6KNnXbb.js">
|
|
128
128
|
<link rel="modulepreload" crossorigin href="./assets/label-CveCqKNR.js">
|
|
129
129
|
<link rel="modulepreload" crossorigin href="./assets/radio-group-D9Wp487Q.js">
|
|
130
|
-
<link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-
|
|
130
|
+
<link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-pUJ0-0Xd.js">
|
|
131
131
|
<link rel="modulepreload" crossorigin href="./assets/arrow-up-right-BnJZWj8r.js">
|
|
132
132
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-FMnveNBD.js">
|
|
133
133
|
<link rel="modulepreload" crossorigin href="./assets/cursor-Rw-XIAht.js">
|
|
134
134
|
<link rel="modulepreload" crossorigin href="./assets/clipboard-adapter-BHfhAZ-n.js">
|
|
135
|
-
<link rel="modulepreload" crossorigin href="./assets/skill-actions-
|
|
136
|
-
<link rel="modulepreload" crossorigin href="./assets/lint-config-client-
|
|
135
|
+
<link rel="modulepreload" crossorigin href="./assets/skill-actions-DL-yNOVR.js">
|
|
136
|
+
<link rel="modulepreload" crossorigin href="./assets/lint-config-client-C1xGkxTP.js">
|
|
137
137
|
<link rel="modulepreload" crossorigin href="./assets/textarea--26Ac0EI.js">
|
|
138
|
-
<link rel="modulepreload" crossorigin href="./assets/auth-state-cache-
|
|
138
|
+
<link rel="modulepreload" crossorigin href="./assets/auth-state-cache-Di7tO3rZ.js">
|
|
139
139
|
<link rel="modulepreload" crossorigin href="./assets/toggle-group-B30vKHKs.js">
|
|
140
140
|
<link rel="modulepreload" crossorigin href="./assets/panel-BGYdvxEm.js">
|
|
141
141
|
<link rel="modulepreload" crossorigin href="./assets/format-DJS8_tfZ.js">
|
|
142
|
-
<link rel="modulepreload" crossorigin href="./assets/selection-context-
|
|
143
|
-
<link rel="modulepreload" crossorigin href="./assets/PropertyPanel-
|
|
142
|
+
<link rel="modulepreload" crossorigin href="./assets/selection-context-iozWEaD1.js">
|
|
143
|
+
<link rel="modulepreload" crossorigin href="./assets/PropertyPanel-D2cHpPyn.js">
|
|
144
144
|
<link rel="modulepreload" crossorigin href="./assets/miss-dialog-store-b0Uwu1ZT.js">
|
|
145
|
-
<link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-
|
|
145
|
+
<link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-HxClZpU_.js">
|
|
146
146
|
<link rel="modulepreload" crossorigin href="./assets/chevron-left-rxhGFFOu.js">
|
|
147
|
-
<link rel="modulepreload" crossorigin href="./assets/agent-presence-
|
|
148
|
-
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-
|
|
147
|
+
<link rel="modulepreload" crossorigin href="./assets/agent-presence-DWEqGNHh.js">
|
|
148
|
+
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-50DGt0NB.js">
|
|
149
149
|
<link rel="modulepreload" crossorigin href="./assets/project-paths-DJDWBB-8.js">
|
|
150
|
-
<link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-
|
|
151
|
-
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-
|
|
150
|
+
<link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-DNsVn4SH.js">
|
|
151
|
+
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-JPOSvf1i.js">
|
|
152
152
|
<link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-O7e02Mi1.js">
|
|
153
|
-
<link rel="modulepreload" crossorigin href="./assets/receive-store-
|
|
153
|
+
<link rel="modulepreload" crossorigin href="./assets/receive-store-BBpK7Or2.js">
|
|
154
154
|
<link rel="modulepreload" crossorigin href="./assets/worktree-store-DFmh2OE1.js">
|
|
155
155
|
<link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
|
|
156
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
156
|
+
<link rel="stylesheet" crossorigin href="./assets/index-Zwl7lo8a.css">
|
|
157
157
|
</head>
|
|
158
158
|
|
|
159
159
|
<body class="antialiased">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./launch-json-removal-
|
|
2
|
-
//# sourceMappingURL=repair-launch-json-
|
|
1
|
+
import{t as e}from"./launch-json-removal-B1WIOuxC.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`||o.kind===`removed-file`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
|
|
2
|
+
//# sourceMappingURL=repair-launch-json-QSRMby2t.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as e,v as t}from"./init-
|
|
2
|
-
//# sourceMappingURL=repair-mcp-configs-
|
|
1
|
+
import{d as e,v as t}from"./init-BML9kFnm.mjs";import{_ as n,d as r,s as i}from"./write-project-skill-DkTM_Oeh.mjs";import{t as a}from"./mcp-migrate-event-C35ikoh2.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-BmV1j3BR.mjs.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{S as e}from"./src-
|
|
1
|
+
import{S as e}from"./src-BU7I7py6.mjs";import{An as t,Bn as n,Dn as r,En as i,In as a,Mn as o,Pn as s,Vn as c,jn as l}from"./src-C0CgVA8i.mjs";import{t as u}from"./esm-EvSEzE_V.mjs";import{a as d,d as f,f as p,t as m}from"./write-project-skill-DkTM_Oeh.mjs";import{dirname as h,join as g,resolve as _}from"node:path";import{existsSync as v,mkdirSync as y,readFileSync as b,readdirSync as x,rmSync as S,statSync as C,writeFileSync as w}from"node:fs";import{homedir as T}from"node:os";const E={existsSync:e=>v(e),isDirectory:e=>{try{return C(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>x(e),readFileSync:e=>b(e),writeFileSync:(e,t)=>{w(e,t)},mkdirSync:(e,t)=>{y(e,t)},rmSync:(e,t)=>{S(e,t)}},D={resolveProjectBundledSkillDir:()=>a(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>a(e,{checkDesktop:!1}),readBundledVersion:()=>r(),readRecordedVersion:e=>t(e,`cli-hosts`),writeRecordedVersion:(e,t)=>o(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>s(e),readBundleDecision:(e,t)=>i(e,t),writeBundleDecision:(e,t,n)=>l(e,t,n),removeBundleFromDisk:(e,t)=>d(e,t)};function O(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function k(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(h(t),{recursive:!0}),A(e,t,n)}function A(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=g(e,r),a=g(t,r);n.isDirectory(i)?A(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function j(e,t,n,r,i,a){let o=[],s=g(e,`.agents`,`skills`,t),c=r.existsSync(s),l=!1;try{k(n,s,r),l=!0,o.push({kind:`central`,path:s,outcome:c?`overwritten`:`written`}),i({event:`user-skill-reclaim-central-written`,scope:`user`,path:s,preexisting:c,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`central`,path:s,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-central-failed`,scope:`user`,path:s,error:t})}for(let c of p){let l=g(e,c.hostDir),u=g(l,`skills`,t);if(u===s){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!r.existsSync(l)){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-host-absent`});continue}let d=r.existsSync(u);try{k(n,u,r),o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:d?`overwritten`:`written`}),i({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,preexisting:d,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,error:t})}}return{entries:o,centralWritten:l}}function M(e,t){if(!e)return!1;try{if(!t.existsSync(e))return!1;let n=t.readFileSync(e).toString(`utf8`);return n.includes(`# ok-mcp-v1`)||n.includes(`# ok-mcp-win-v1`)}catch{return!1}}function N(e,t,n,r){let i;try{i=t.resolveProjectBundledSkillDir()}catch(e){return r({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let a=[];for(let t of p){let o=g(e,t.hostDir,`skills`,`open-knowledge`),s=g(o,`SKILL.md`),c=n.existsSync(s),l=f[t.editorId]?.projectConfigPath?.(e),u=!c&&M(l,n);if(!c&&!u){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:o});continue}try{m(o,e),k(i,o,n);let s=c?`reclaimed`:`created`;a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:s}),r({event:c?`project-skill-reclaim-reclaimed`:`project-skill-reclaim-created`,scope:`project`,editorId:t.editorId,path:o})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:o,error:n})}}return{outcome:`done`,entries:a}}async function P(t,r,i,a){let o=e=>{r.recordEvent(e).catch(()=>{})},s=()=>new Date().toISOString(),l;try{l=await r.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return a({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),o({ts:s(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let u;try{u=await r.readRecordedVersion(t)}catch(e){a({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),u=null}let d=[],f=null;for(let e of c)try{d.push({id:e,sourceDir:r.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(d.length===0)return a({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:f??`no user-global bundles`}),o({ts:s(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let o of d){let s=n[o.id],c=i.existsSync(g(t,`.agents`,`skills`,s)),l=await r.readBundleDecision(t,s).catch(()=>null);if(!e(l,{installedOnDisk:c})){if(c)try{r.removeBundleFromDisk(t,o.id),a({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:o.id})}catch(e){a({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:o.id,error:e instanceof Error?e.message:String(e)})}continue}if(l===null&&c)try{await r.writeBundleDecision(t,s,!0)}catch(e){a({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:o.id,error:e instanceof Error?e.message:String(e)})}p.push(o)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(e=>i.existsSync(g(t,`.agents`,`skills`,n[e.id])));if(u!==null&&u===l&&m)return a({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:l}),{outcome:`skipped`,reason:`version-current`};let h=[],_=d.length===c.length,v=!0;for(let{id:e,sourceDir:r}of p){let o=j(t,n[e],r,i,a,l);h.push(...o.entries),o.centralWritten||(v=!1)}let y=h.some(e=>e.kind===`central`&&(e.outcome===`written`||e.outcome===`overwritten`));if(_&&v&&y){let e=null;try{await r.writeRecordedVersion(t,l),a({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:l})}catch(t){e=t instanceof Error?t.message:String(t),a({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:l,error:e})}for(let{id:t}of p)o({ts:s(),surface:`cli-start`,target:`cli-hosts`,bundle:t,outcome:e===null?`installed`:`failed`,version:l,...e===null?{}:{reason:`state-write-failed:${e}`}})}else{let e=h.some(e=>e.kind===`host`&&e.outcome===`failed`);o({ts:s(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:l,reason:e?`all-writes-failed`:`no-hosts-installed`})}return{outcome:`done`,version:l,entries:h}}async function F(e){let t=e.logger??O,n=e.fs??E,r=e.home??T(),i={...D,...e.deps};return e.reclaimDisableEnv===`1`?(t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`}):{status:`done`,project:N(e.projectDir,i,n,t),user:await P(r,i,n,t)}}function I(e){return e.status===`skipped`?e.reason===`reclaim-disabled`?0:1:e.project.outcome===`skipped`||e.user.outcome===`skipped`&&e.user.reason!==`version-current`&&e.user.reason!==`all-bundles-declined`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function L(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`reclaimed`).length,r=e.project.entries.filter(e=>e.outcome===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length;t.push(` Project: ${n} reclaimed, ${r} created, ${i} no-token, ${a} failed.`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`||e.outcome===`overwritten`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,i=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} skipped, ${i} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return t.join(`
|
|
2
2
|
`)}function R(){return new u(`repair-skills`).description("Refresh bundled SKILL.md files for installed AI editors (project-local + user-global). Runs automatically during `ok start`; this command forces an explicit sweep.").action(async()=>{let e=await F({projectDir:_(process.cwd()),reclaimDisableEnv:process.env.OK_RECLAIM_DISABLE??null});process.stdout.write(`${L(e)}\n`),process.exitCode=I(e)})}export{R as n,F as t};
|
|
3
|
-
//# sourceMappingURL=repair-skills-
|
|
3
|
+
//# sourceMappingURL=repair-skills-CZbrTVch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./repair-skills-CZbrTVch.mjs";export{e as repairSkills};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,o as t,r as n}from"./server-lock-wMKEjgnN.mjs";export{n as markServerLockDraining,e as releaseServerLock,t as updateServerLockPort};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./src-
|
|
2
|
-
//# sourceMappingURL=server-lock-
|
|
1
|
+
import"./src-BU7I7py6.mjs";import{dirname as e,join as t,resolve as n}from"node:path";import{closeSync as r,existsSync as i,mkdirSync as a,openSync as o,readFileSync as s,unlinkSync as c,writeFileSync as l,writeSync as u}from"node:fs";import{homedir as d,hostname as f}from"node:os";import{fileURLToPath as p}from"node:url";import{randomUUID as m}from"node:crypto";function h(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function g(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}const _=/^[A-Za-z0-9-]{8,64}$/;let v=null;function y(e){return t(e??d(),`.ok`,`machine-id`)}function b(t){if(t===void 0&&v!==null)return v;let n=y(t),r=null;try{let e=s(n,`utf-8`).trim();_.test(e)&&(r=e)}catch{}if(r===null){r=m();try{a(e(n),{recursive:!0}),l(n,`${r}\n`,{encoding:`utf-8`,mode:384})}catch(e){console.warn(`[machine-id] Failed to persist ${n} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${e instanceof Error?e.message:String(e)}`)}}return t===void 0&&(v=r),r}function x(){try{let t=n(e(p(import.meta.url)),`..`,`package.json`),r=JSON.parse(s(t,`utf-8`));if(typeof r.version==`string`&&r.version.length>0)return r.version}catch{}return`0.0.0-unknown`}const S=x(),C=1;var w=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function T(e,t){return n(e,`${t}.lock`)}const E=new Map;function D(e){E.set(e,(E.get(e)??0)+1)}function O(e){let t=E.get(e);return t===void 0||t<=1?(E.delete(e),!0):(E.set(e,t-1),!1)}function k(e){return typeof e.machineId==`string`?e.machineId===b():e.hostname===f()}const A=new Set;let j=!1;function M(e){A.add(e),!j&&(j=!0,process.on(`exit`,()=>{for(let e of A)try{let t=JSON.parse(s(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==b()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==f())continue;c(e)}catch{}}))}function N(e,t){try{let n=JSON.parse(s(e,`utf-8`));return n&&typeof n==`object`&&g(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function P(e){let{lockName:t,lockDir:n,metadata:s}=e,d=`[${t}-lock]`;a(n,{recursive:!0});let p=T(n,t),m={pid:process.pid,hostname:f(),port:s.port,startedAt:new Date().toISOString(),worktreeRoot:s.worktreeRoot,machineId:b(),...s.kind!==void 0&&{kind:s.kind},...s.parentPid!==void 0&&{parentPid:s.parentPid},...s.capabilities!==void 0&&{capabilities:s.capabilities},protocolVersion:s.protocolVersion??1,runtimeVersion:s.runtimeVersion??S},g=JSON.stringify(m,null,2);for(let e=0;e<3;e++){if(!i(p))try{let e=o(p,`wx`,384);try{u(e,g)}finally{r(e)}return D(p),M(p),F({lockName:t,lockDir:n,lockPath:p})}catch(e){if(e.code!==`EEXIST`)throw e}let e=N(p,d);if(e){if(k(e)&&e.pid===process.pid)return l(p,g,{encoding:`utf-8`,mode:384}),D(p),M(p),F({lockName:t,lockDir:n,lockPath:p});if(h(e.pid))throw new w(e,p,t);console.warn(`${d} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{c(p)}catch{}}throw Error(`${d} Failed to acquire ${p} after 3 attempts (concurrent acquire contention).`)}function F(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>V({lockName:t,lockDir:n}),updatePort:e=>I({lockName:t,lockDir:n,port:e})}}function I(e){let{lockName:t,lockDir:n,port:r}=e,a=`[${t}-lock]`,o=T(n,t);if(!i(o)){console.warn(`${a} Lock file missing at ${o} during port update — skipping`);return}let c;try{let e=JSON.parse(s(o,`utf-8`));if(!e||typeof e!=`object`||!g(e.pid)){console.warn(`${a} Corrupt lock at ${o} during port update — skipping`);return}c=e}catch{console.warn(`${a} Unreadable lock at ${o} during port update — skipping`);return}if(c.pid===process.pid&&k(c)){c.port=r;try{l(o,JSON.stringify(c,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${a} Failed to update port in ${o}: ${e instanceof Error?e.message:String(e)}`)}}}function L(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=T(n,t);if((E.get(i)??0)>1)return;let a;try{let e=JSON.parse(s(i,`utf-8`));if(!e||typeof e!=`object`||!g(e.pid)){console.warn(`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){e.code!==`ENOENT`&&console.warn(`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&k(a)&&a.draining!==!0){a.draining=!0;try{l(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function R(e){let{lockName:t,lockDir:n}=e,r=T(n,t);if(!i(r))return null;let a;try{let e=JSON.parse(s(r,`utf-8`));if(!e||typeof e!=`object`||!g(e.pid))return null;a=e}catch{return null}if(!k(a))return null;if(!h(a.pid)){try{c(r)}catch{}return null}return a}function z(e){let{lockName:t,lockDir:n}=e,r=T(n,t);if(!i(r))return{status:`absent`};let a;try{a=JSON.parse(s(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!a||typeof a!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:a};let o=a;if(!g(o.pid)||typeof o.hostname!=`string`||typeof o.port!=`number`||typeof o.startedAt!=`string`||typeof o.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:a};let l={pid:o.pid,hostname:o.hostname,port:o.port,startedAt:o.startedAt,worktreeRoot:o.worktreeRoot,machineId:typeof o.machineId==`string`?o.machineId:void 0,draining:o.draining===!0?!0:void 0,protocolVersion:typeof o.protocolVersion==`number`?o.protocolVersion:void 0,runtimeVersion:typeof o.runtimeVersion==`string`?o.runtimeVersion:void 0};if(!k(l))return{status:`stale`,lock:l};if(!h(l.pid)){try{c(r)}catch{}return{status:`stale`,lock:l}}return l.protocolVersion===void 0||l.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:a}:{status:`live`,lock:l}}async function B(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>R({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function V(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,a=`[${t}-lock]`,o=T(n,t);if(O(o)){if(r){L({lockName:t,lockDir:n});return}if(i(o))try{let e=JSON.parse(s(o,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!k(e))return;c(o),A.delete(o)}catch(e){console.warn(`${a} Failed to release ${o}: ${e instanceof Error?e.message:String(e)}`)}}}var H=class extends w{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function U(e,t){try{return P({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof w&&e.lockName===`server`?new H(e.existing,e.lockPath):e}}function W(e,t){I({lockName:`server`,lockDir:e,port:t})}function G(e){return R({lockName:`server`,lockDir:e})}function K(e,t){V({lockName:`server`,lockDir:e,...t})}function q(e){L({lockName:`server`,lockDir:e})}function J(e,t){return B({lockName:`server`,lockDir:e,...t})}export{C as _,K as a,g as b,w as c,L as d,R as f,S as g,I as h,G as i,P as l,V as m,U as n,W as o,z as p,q as r,J as s,H as t,T as u,b as v,h as y};
|
|
2
|
+
//# sourceMappingURL=server-lock-wMKEjgnN.mjs.map
|