@inkeep/open-knowledge 0.50.0 → 0.50.1
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/{acp-harness-probe-CAyb1VG_.mjs → acp-harness-probe-DEQXdsjT.mjs} +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/constants-CaKELAh9.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/{init-xm3S7ePq.mjs → init-D5NDes00.mjs} +3 -3
- package/dist/init-D8Avhxo1.mjs +1 -0
- package/dist/{launch-json-removal-DRG4rr-O.mjs → launch-json-removal-Dl7uCpuY.mjs} +2 -2
- package/dist/loader-BjuhzcUO.mjs +1 -0
- package/dist/{loader-DDNYDIz4.mjs → loader-DWGxP7ZW.mjs} +2 -2
- package/dist/{open-browser-Bb773NFh.mjs → open-browser-iA8nPdIv.mjs} +2 -2
- package/dist/preview-BMmryl_A.mjs +1 -0
- package/dist/{preview-BJuJ4KQh.mjs → preview-NUFfTNAF.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-C3XczVNM.js → ActivityModeContent-CYdn5I4Y.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-CCvn5wQ3.js → AgentDiffPane-DpKorIT_.js} +1 -1
- package/dist/public/assets/{ChangedOutsideBadge-BTzPOikC.js → ChangedOutsideBadge-B0as4qVr.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-CJOa9rBB.js → CodeMirrorPropInput-CfyM9jmf.js} +1 -1
- package/dist/public/assets/{DocumentContext-q72mQT_t.js → DocumentContext-DQeqcbba.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-CYQ3YFwJ.js → EditorModeToggle-DYe6ugjz.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-D3pGpgBV.js → EnableSyncConfirmDialog-CZhoCX06.js} +1 -1
- package/dist/public/assets/FeedbackForm-1SPYA54M.js +1 -0
- package/dist/public/assets/{ImportSkillDialog-CXQr-FGP.js → ImportSkillDialog-DgaLRDa2.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-DbAjr4jH.js → LintConfigEditor-m8s0kHpU.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-B4gUE4uy.js → ManagedArtifactProperties-CNkIjYyD.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-DYFSQG10.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-BKY1PMJY.js → MermaidDocEditor-CpEV_vjl.js} +1 -1
- package/dist/public/assets/ReportBugDialogBody-9QPpMvae.js +3 -0
- package/dist/public/assets/{SchemaConfigEditor-SePva8he.js → SchemaConfigEditor-DGC-Ifl7.js} +1 -1
- package/dist/public/assets/{SessionsHost-gsjDemop.js → SessionsHost-CfMAKMV0.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-B0aiIMgi.js → SettingsDialogBody-COkVan2W.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-5admpSFE.js → ShareReceiveMissDialog-C01SdPiI.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-26O0onQs.js → SkillToolbarControls-CPO0igHl.js} +1 -1
- package/dist/public/assets/{SourceEditor-DCC6j8cH.js → SourceEditor-DPQOUOr0.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-CFcodtB9.js → TerminalWindowApp-Cwcma4mH.js} +1 -1
- package/dist/public/assets/{TextDocEditor-Ba292y2S.js → TextDocEditor-DEx6Kq9N.js} +1 -1
- package/dist/public/assets/{ThreadView-Bxz-QRgZ.js → ThreadView-BA1CLPVi.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-FY54Yfye.js → TimelineDiffPane-BICt_08r.js} +1 -1
- package/dist/public/assets/{agent-diff-store-DTrbnQbK.js → agent-diff-store-DEzJgiR6.js} +1 -1
- package/dist/public/assets/{auth-state-cache-CAQ4A-He.js → auth-state-cache-Bsh1HmX2.js} +1 -1
- package/dist/public/assets/{client-version-DZzYmEAI.js → client-version-B_vQj5m0.js} +1 -1
- package/dist/public/assets/{comment-chips-El0Mtul3.js → comment-chips-BfGPrQWn.js} +1 -1
- package/dist/public/assets/{config-provider-Cp4CY5__.js → config-provider-CCU8qlmR.js} +1 -1
- package/dist/public/assets/{follow-file-D8sBwhbX.js → follow-file-CjaFA8Bl.js} +1 -1
- package/dist/public/assets/{index-DYmWXWr6.js → index-Cg1k8Ayr.js} +108 -108
- package/dist/public/assets/{pending-receive-nav-store-CitdQa34.js → pending-receive-nav-store-MbkxejK0.js} +1 -1
- package/dist/public/assets/{selection-context-tW7mNL04.js → selection-context-DYJs4iye.js} +1 -1
- package/dist/public/assets/{skill-actions-B-rAAmok.js → skill-actions-Dvp72hct.js} +1 -1
- package/dist/public/assets/{src-DJwM4wxS.js → src-BgeX0ooS.js} +1 -1
- package/dist/public/assets/{telemetry-impl-LPWb9DJh.js → telemetry-impl-Bbdtn9J6.js} +1 -1
- package/dist/public/assets/{telemetry-startup-B-jACYNe.js → telemetry-startup-CqGbFCKQ.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-i5YC5a51.js → typing-burst-detector-DJTF6TYE.js} +1 -1
- package/dist/public/assets/{use-activity-panel-B_OxshWx.js → use-activity-panel-CoU7WjCv.js} +1 -1
- package/dist/public/assets/{use-open-skill-BZcJfbB3.js → use-open-skill-DN4VQ0HP.js} +1 -1
- package/dist/public/assets/{use-popular-skills-BI639F_L.js → use-popular-skills-CETv50qW.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-C1FCQb8g.js → use-terminal-enabled-Rnwv8rq4.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-C5UrKke2.js → use-timeline-entry-diff-fL6Q6imU.js} +1 -1
- package/dist/public/index.html +19 -19
- package/dist/{repair-launch-json-DQqY1ddo.mjs → repair-launch-json-Dj813bOM.mjs} +2 -2
- package/dist/{repair-mcp-configs-BlVWRe_X.mjs → repair-mcp-configs-CL14xUMJ.mjs} +2 -2
- package/dist/{repair-skills-C_mOgSqu.mjs → repair-skills-B_ZAQaXn.mjs} +2 -2
- package/dist/repair-skills-cJ6ASlsh.mjs +1 -0
- package/dist/{skill-teardown-DT0sY6o-.mjs → skill-teardown-mTNzEFkM.mjs} +2 -2
- package/dist/{src-DsnCRAh5.mjs → src-BDSe-YIB.mjs} +2 -2
- package/dist/src-CjvpBVI9.mjs +1 -0
- package/dist/{src-YVZCV4Ux.mjs → src-_krIFkyE.mjs} +1 -1
- package/dist/src-d4u8XMdW.mjs +2032 -0
- package/dist/{start-DrycEKLh.mjs → start-BiW9hFuV.mjs} +4 -4
- package/dist/start-D4pnGfoA.mjs +1 -0
- package/dist/ui-B1pZuo-s.mjs +1 -0
- package/dist/{ui-BBDdhHyy.mjs → ui-BC8TqXI0.mjs} +3 -3
- package/dist/{write-project-skill-__SzqfoP.mjs → write-project-skill-CyyI2a52.mjs} +2 -2
- package/package.json +4 -4
- package/dist/constants-B9zWb_fv.mjs +0 -2
- package/dist/init-UAHtpsrM.mjs +0 -1
- package/dist/loader-DGm-wuvO.mjs +0 -1
- package/dist/preview-_fm88K-5.mjs +0 -1
- package/dist/public/assets/FeedbackForm-CPJzntj4.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-ga621KKB.js +0 -1
- package/dist/public/assets/ReportBugDialogBody-C3RLSmI4.js +0 -3
- package/dist/repair-skills-qAm1agyb.mjs +0 -1
- package/dist/src-DJhexTh5.mjs +0 -2032
- package/dist/src-DKD0dtSw.mjs +0 -1
- package/dist/start-Y_cm7QYJ.mjs +0 -1
- package/dist/ui-BEwSKtfp.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-RQ5o7P7w.js";import{n as s}from"./dist-Bkx5dDHT2.js";import{t as c}from"./createLucideIcon-6iYxif1u.js";import{c as l,d as u,i as d,n as f,o as p,p as m,s as h,t as g}from"./EnableSyncConfirmDialog-D3pGpgBV.js";import{t as _}from"./arrow-up-right-D_WN0VGP.js";import{t as v}from"./check-xiKupoJh.js";import{t as y}from"./folder-open-CB-trByC.js";import{t as b}from"./info-CsTy513y.js";import{t as x}from"./spinner-D7fgqgRw.js";import{n as S}from"./miss-dialog-store-DKfFwAsF.js";import{t as C}from"./refresh-cw-CAV3aG7d.js";import{t as w}from"./triangle-alert-xKPljhlK.js";import{_ as T,r as E,s as D}from"./doc-paths-DCnBNou3.js";import{t as O}from"./external-link-CHCx4FXC.js";var k=c(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),A=c(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),j=c(`file-x-corner`,[[`path`,{d:`M11 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5`,key:`1jo35a`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m15 17 5 5`,key:`36xl1x`}],[`path`,{d:`m20 17-5 5`,key:`vdz27y`}]]),M=a(),N=e(n(),1),P=t(),F=`https://git-scm.com/docs/git-push`;function I(e,t){return e===`empty`?!0:!(e!==`stale`&&e!==`absent`||e===`stale`&&t?.syncEnabled===!0)}function ee(e){return e?e.state!==`dormant`&&e.state!==`disabled`&&e.state!==`auth-error`&&e.state!==`conflict`:!1}function L(e){let t=(0,M.c)(52),{freshness:n,status:a,kind:s}=e,{_:c}=i(),{confirmOpen:l,setConfirmOpen:u,onToggleRequest:m,onConfirm:h}=d(p()),[y,S]=(0,N.useState)(`idle`),T=(0,N.useRef)(null),E,D;if(t[0]!==a||t[1]!==y?(E=()=>{if(!(y!==`pending`||!a)){if(a.pushError||a.pushErrorCode){S(`idle`);return}(a.lastSyncUtc??null)!==T.current&&S(`synced`)}},D=[y,a],t[0]=a,t[1]=y,t[2]=E,t[3]=D):(E=t[2],D=t[3]),(0,N.useEffect)(E,D),!I(n,a))return null;if(n===`empty`){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(w,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),t[4]=e):e=t[4];let n;t[5]===c?n=t[6]:(n=c({id:`eazHgv`}),t[5]=c,t[6]=n);let r;return t[7]===n?r=t[8]:(r=(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[e,(0,P.jsx)(`span`,{children:n})]}),t[7]=n,t[8]=r),r}if(y===`synced`){let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[(0,P.jsx)(v,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:(0,P.jsx)(r,{id:`fxbCNQ`})})]}),t[9]=e):e=t[9],e}let O=a?.syncEnabled===!0,k=a?.pushPermission?.checkStatus===`denied`,A=!!(a?.pushError||a?.pushErrorCode),j=k||A,L=n===`absent`&&!O,B;if(n===`absent`&&!O){let e;t[10]!==c||t[11]!==s?(e=c(s===`folder`?{id:`PrJYSN`}:{id:`3BnyYc`}),t[10]=c,t[11]=s,t[12]=e):e=t[12],B=e}else if(n===`stale`){let e;t[13]!==c||t[14]!==s?(e=c(s===`folder`?{id:`Gt4gOO`}:{id:`2IYGkU`}),t[13]=c,t[14]=s,t[15]=e):e=t[15],B=e}else{let e;t[16]!==c||t[17]!==s?(e=c(s===`folder`?{id:`nqV0Kk`}:{id:`gwykHF`}),t[16]=c,t[17]=s,t[18]=e):e=t[18],B=e}let V;t[19]!==c||t[20]!==A||t[21]!==k?(V=k?c({id:`9OIqw4`}):A?c({id:`K6MQQk`}):null,t[19]=c,t[20]=A,t[21]=k,t[22]=V):V=t[22];let H=V,U;t[23]===a?.lastSyncUtc?U=t[24]:(U=()=>{T.current=a?.lastSyncUtc??null,S(`pending`),f(`sync`).catch(e=>{console.warn(`[share-freshness] sync trigger failed`,e instanceof Error?e.message:e),S(`idle`)})},t[23]=a?.lastSyncUtc,t[24]=U);let W=U,G=L?w:b,K;t[25]===G?K=t[26]:(K=(0,P.jsx)(G,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),t[25]=G,t[26]=K);let q;t[27]===B?q=t[28]:(q=(0,P.jsx)(`span`,{children:B}),t[27]=B,t[28]=q);let J;t[29]===H?J=t[30]:(J=H?(0,P.jsx)(`span`,{children:H}):null,t[29]=H,t[30]=J);let Y;t[31]!==j||t[32]!==W||t[33]!==m||t[34]!==a||t[35]!==O||t[36]!==y?(Y=j?null:O?ee(a)?(0,P.jsx)(`div`,{children:y===`pending`?(0,P.jsxs)(o,{variant:`outline`,size:`xs`,disabled:!0,children:[(0,P.jsx)(x,{icon:C,className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`EHu0x2`})]}):(0,P.jsx)(o,{variant:`outline`,size:`xs`,onClick:W,children:(0,P.jsx)(r,{id:`lb_UU4`})})}):null:(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,P.jsx)(o,{variant:`outline`,size:`xs`,onClick:()=>m(!0),children:(0,P.jsx)(r,{id:`XU0OXn`})}),(0,P.jsxs)(`a`,{href:F,target:`_blank`,rel:`noopener noreferrer`,onClick:z,onAuxClick:R,className:`inline-flex items-center gap-1 transition-colors hover:text-primary`,children:[(0,P.jsx)(r,{id:`GLxIKR`}),(0,P.jsx)(_,{className:`size-3 shrink-0`,"aria-hidden":`true`})]})]}),t[31]=j,t[32]=W,t[33]=m,t[34]=a,t[35]=O,t[36]=y,t[37]=Y):Y=t[37];let X;t[38]!==q||t[39]!==J||t[40]!==Y?(X=(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[q,J,Y]}),t[38]=q,t[39]=J,t[40]=Y,t[41]=X):X=t[41];let Z;t[42]!==K||t[43]!==X?(Z=(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[K,X]}),t[42]=K,t[43]=X,t[44]=Z):Z=t[44];let Q;t[45]!==l||t[46]!==h||t[47]!==u?(Q=(0,P.jsx)(g,{open:l,onOpenChange:u,onConfirm:h}),t[45]=l,t[46]=h,t[47]=u,t[48]=Q):Q=t[48];let $;return t[49]!==Z||t[50]!==Q?($=(0,P.jsxs)(P.Fragment,{children:[Z,Q]}),t[49]=Z,t[50]=Q,t[51]=$):$=t[51],$}function R(e){return O(e,F)}function z(e){return O(e,F)}function B(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function V(e){let t=(0,M.c)(13),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={phase:`pending`},t[0]=n):n=t[0];let[r,i]=(0,N.useState)(n),[a,o]=(0,N.useState)(0),s=e.branch,c;t[1]!==s||t[2]!==e.kind||t[3]!==e.path?(c=()=>{let t=window.okDesktop??null;if(!t||s===null){i({phase:`resolved`,resolution:{verdict:`unknown`}});return}let n=!1;return t.project.fetchTargetStatus({projectPath:t.config.projectPath,branch:s,path:e.path,kind:e.kind}).then(e=>{n||i({phase:`resolved`,resolution:e??{verdict:`unknown`}})}).catch(e=>{n||(console.warn(`[receive] miss target-status fetch failed`,e instanceof Error?e.message:e),i({phase:`resolved`,resolution:{verdict:`unknown`}}))}),()=>{n=!0}},t[1]=s,t[2]=e.kind,t[3]=e.path,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==a||t[7]!==e.kind||t[8]!==e.path?(l=[s,e.kind,e.path,a],t[5]=s,t[6]=a,t[7]=e.kind,t[8]=e.path,t[9]=l):l=t[9],(0,N.useEffect)(c,l);let u;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{i({phase:`pending`}),o(H)},t[10]=u):u=t[10];let d;return t[11]===r?d=t[12]:(d={state:r,refetch:u},t[11]=r,t[12]=d),d}function H(e){return e+1}function U(e){let t=(0,M.c)(15),{onEnabled:n}=e,i=p(),a;t[0]===n?a=t[1]:(a={onEnabled:n},t[0]=n,t[1]=a);let{confirmOpen:s,setConfirmOpen:c,onToggleRequest:l,onConfirm:u}=d(i,a),f;t[2]===l?f=t[3]:(f=()=>l(!0),t[2]=l,t[3]=f);let m,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,P.jsx)(C,{className:`size-4`,"aria-hidden":`true`}),h=(0,P.jsx)(r,{id:`XU0OXn`}),t[4]=m,t[5]=h):(m=t[4],h=t[5]);let _;t[6]===f?_=t[7]:(_=(0,P.jsxs)(o,{onClick:f,"data-testid":`share-receive-miss-enable-sync`,children:[m,h]}),t[6]=f,t[7]=_);let v;t[8]!==s||t[9]!==u||t[10]!==c?(v=(0,P.jsx)(g,{open:s,onOpenChange:c,onConfirm:u}),t[8]=s,t[9]=u,t[10]=c,t[11]=v):v=t[11];let y;return t[12]!==_||t[13]!==v?(y=(0,P.jsxs)(P.Fragment,{children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14],y}function W(e){let t=(0,M.c)(23),{status:n,onSyncCompleted:a}=e,{_:c}=i(),[l,u]=(0,N.useState)(!1),d=(0,N.useRef)(null),p;t[0]!==a||t[1]!==l||t[2]!==n.lastSyncUtc||t[3]!==n.pushError||t[4]!==n.pushErrorCode?(p=()=>{if(l){if(n.pushError||n.pushErrorCode){u(!1);return}(n.lastSyncUtc??null)!==d.current&&(u(!1),a?.())}},t[0]=a,t[1]=l,t[2]=n.lastSyncUtc,t[3]=n.pushError,t[4]=n.pushErrorCode,t[5]=p):p=t[5];let m;t[6]!==a||t[7]!==l||t[8]!==n?(m=[l,n,a],t[6]=a,t[7]=l,t[8]=n,t[9]=m):m=t[9],(0,N.useEffect)(p,m);let h;t[10]!==c||t[11]!==n.lastSyncUtc?(h=()=>{d.current=n.lastSyncUtc??null,u(!0),f(`sync`).catch(e=>{console.warn(`[receive] miss sync trigger failed`,e instanceof Error?e.message:e),u(!1),s.error(c({id:`1u-mAI`}))})},t[10]=c,t[11]=n.lastSyncUtc,t[12]=h):h=t[12];let g=h,_;t[13]!==g||t[14]!==l?(_=l?(0,P.jsxs)(o,{disabled:!0,"aria-busy":`true`,"data-testid":`share-receive-miss-sync-now`,children:[(0,P.jsx)(x,{icon:C,className:`size-4`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`EHu0x2`})]}):(0,P.jsxs)(o,{onClick:g,"data-testid":`share-receive-miss-sync-now`,children:[(0,P.jsx)(C,{className:`size-4`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`lb_UU4`})]}),t[13]=g,t[14]=l,t[15]=_):_=t[15];let v;t[16]===l?v=t[17]:(v=l?(0,P.jsx)(r,{id:`dXOolp`}):null,t[16]=l,t[17]=v);let y;t[18]===v?y=t[19]:(y=(0,P.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,"data-testid":`share-receive-miss-sync-status`,children:v}),t[18]=v,t[19]=y);let b;return t[20]!==_||t[21]!==y?(b=(0,P.jsxs)(P.Fragment,{children:[_,y]}),t[20]=_,t[21]=y,t[22]=b):b=t[22],b}var G=!1;function K(e){return!G&&e!==null&&e.syncEnabled!==!0}function q(e){return e===null?!1:e.hasRemote&&e.lastPullUtc!==void 0&&e.state!==`conflict`}function J(e,t){let n=(0,M.c)(15),[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(!1),l=(0,N.useRef)(null),u,d;n[0]!==t||n[1]!==r||n[2]!==e?(u=()=>{if(!r||(e?.lastPullUtc??null)===l.current)return;i(!1);let n=e?.lastPullOutcome??null;if(n===null){t?.();return}switch(n){case`refused`:case`error`:o(n);return;case`succeeded`:case`up-to-date`:if(K(e)){G=!0,c(!0);return}t?.();return;case`conflict`:t?.();return;default:t?.();return}},d=[r,e,t],n[0]=t,n[1]=r,n[2]=e,n[3]=u,n[4]=d):(u=n[3],d=n[4]),(0,N.useEffect)(u,d);let p;n[5]===t?p=n[6]:(p=()=>{c(!1),t?.()},n[5]=t,n[6]=p);let m;n[7]===e?.lastPullUtc?m=n[8]:(m=()=>{l.current=e?.lastPullUtc??null,o(null),i(!0),f(`pull`).catch(e=>{console.warn(`[receive] miss pull trigger failed`,e instanceof Error?e.message:e),i(!1),o(`error`)})},n[7]=e?.lastPullUtc,n[8]=m);let h;return n[9]!==a||n[10]!==s||n[11]!==r||n[12]!==p||n[13]!==m?(h={pending:r,failure:a,offering:s,resolveOffer:p,start:m},n[9]=a,n[10]=s,n[11]=r,n[12]=p,n[13]=m,n[14]=h):h=n[14],h}function Y(e){let t=(0,M.c)(10),{pending:n,onPull:i}=e,a;t[0]!==i||t[1]!==n?(a=n?(0,P.jsxs)(o,{disabled:!0,"aria-busy":`true`,"data-testid":`share-receive-miss-pull-now`,children:[(0,P.jsx)(x,{icon:C,className:`size-4`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`4uNLmk`})]}):(0,P.jsxs)(o,{onClick:i,"data-testid":`share-receive-miss-pull-now`,children:[(0,P.jsx)(m,{className:`size-4`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`fevEu0`})]}),t[0]=i,t[1]=n,t[2]=a):a=t[2];let s;t[3]===n?s=t[4]:(s=n?(0,P.jsx)(r,{id:`glG1TR`}):null,t[3]=n,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,P.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,"data-testid":`share-receive-miss-pull-status`,children:s}),t[5]=s,t[6]=c);let l;return t[7]!==a||t[8]!==c?(l=(0,P.jsxs)(P.Fragment,{children:[a,c]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function X(e){let t=(0,M.c)(18),{onResolve:n,strandedCommitCount:r}=e,i=l(),a=(0,N.useRef)(!1),o;t[0]===n?o=t[1]:(o=function(){a.current||(a.current=!0,n())},t[0]=n,t[1]=o);let s=o,c;t[2]===s?c=t[3]:(c={onApplied:s},t[2]=s,t[3]=c);let{confirmOpen:u,setConfirmOpen:d,onModeSelect:f,onConfirm:p}=h(i,`off`,c),m=(0,N.useRef)(!1),_,v;t[4]===f?(_=t[5],v=t[6]):(_=()=>{m.current||(m.current=!0,f(`follow`))},v=[f],t[4]=f,t[5]=_,t[6]=v),(0,N.useEffect)(_,v);let y;t[7]!==s||t[8]!==d?(y=e=>{d(e),e||s()},t[7]=s,t[8]=d,t[9]=y):y=t[9];let b;t[10]!==p||t[11]!==s?(b=()=>{p(),s()},t[10]=p,t[11]=s,t[12]=b):b=t[12];let x;return t[13]!==u||t[14]!==r||t[15]!==y||t[16]!==b?(x=(0,P.jsx)(g,{open:u,onOpenChange:y,onConfirm:b,variant:`follow`,strandedCommitCount:r}),t[13]=u,t[14]=r,t[15]=y,t[16]=b,t[17]=x):x=t[17],x}function Z(e){let t=(0,M.c)(89),{nav:n,state:a,onBrowseFolder:s,onOpenRenamed:c,onEnableAutoSync:l,onSyncCompleted:d,onPullApplied:f}=e,{_:p}=i(),h=u(),g=J(h,f),_=n.branch,v;t[0]!==p||t[1]!==n.kind?(v=n.kind===`folder`?p({id:`ugoTXs`}):p({id:`XH30C4`}),t[0]=p,t[1]=n.kind,t[2]=v):v=t[2];let b=v;if(a.phase===`pending`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(x,{className:`size-5`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`c8jBgX`})]}),t[3]=e):e=t[3],e}let{resolution:C}=a,w,T;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,P.jsx)(y,{className:`size-4`,"aria-hidden":`true`}),T=(0,P.jsx)(r,{id:`hItdtk`}),t[4]=w,t[5]=T):(w=t[4],T=t[5]);let E;t[6]===s?E=t[7]:(E=(0,P.jsxs)(o,{variant:`outline`,onClick:s,"data-testid":`share-receive-miss-browse`,children:[w,T]}),t[6]=s,t[7]=E);let D=E,O,N,F,I=null;if(C.verdict===`renamed`){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(S,{className:`size-9`,"aria-hidden":`true`}),t[8]=e):e=t[8],O=e;let n;t[9]!==C.renamedTo||t[10]!==b?(n={0:C.renamedTo,targetNoun:b},t[9]=C.renamedTo,t[10]=b,t[11]=n):n=t[11];let i;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[12]=i):i=t[12];let a;t[13]===n?a=t[14]:(a=(0,P.jsx)(r,{id:`P0HC30`,values:n,components:i}),t[13]=n,t[14]=a),N=a;let s;t[15]!==c||t[16]!==C.renamedTo?(s=()=>c(C.renamedTo),t[15]=c,t[16]=C.renamedTo,t[17]=s):s=t[17];let l,u;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,P.jsx)(S,{className:`size-4`,"aria-hidden":`true`}),u=(0,P.jsx)(r,{id:`AItsE5`}),t[18]=l,t[19]=u):(l=t[18],u=t[19]);let d;t[20]===s?d=t[21]:(d=(0,P.jsxs)(o,{onClick:s,"data-testid":`share-receive-miss-open-renamed`,children:[l,u]}),t[20]=s,t[21]=d);let f;t[22]!==D||t[23]!==d?(f=(0,P.jsxs)(P.Fragment,{children:[d,D]}),t[22]=D,t[23]=d,t[24]=f):f=t[24],F=f}else if(C.verdict===`deleted`){let e;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(j,{className:`size-9`,"aria-hidden":`true`}),t[25]=e):e=t[25],O=e;let n;t[26]!==_||t[27]!==b?(n={targetNoun:b,branch:_},t[26]=_,t[27]=b,t[28]=n):n=t[28];let i;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[29]=i):i=t[29];let a;t[30]===n?a=t[31]:(a=(0,P.jsx)(r,{id:`kpqWwG`,values:n,components:i}),t[30]=n,t[31]=a),N=a,F=D}else if(C.verdict===`never-on-branch`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(A,{className:`size-9`,"aria-hidden":`true`}),t[32]=e):e=t[32],O=e;let n;t[33]!==_||t[34]!==b?(n={targetNoun:b,branch:_},t[33]=_,t[34]=b,t[35]=n):n=t[35];let i;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[36]=i):i=t[36];let a;t[37]===n?a=t[38]:(a=(0,P.jsx)(r,{id:`i9TPUi`,values:n,components:i}),t[37]=n,t[38]=a),N=a,F=D}else if(C.verdict===`changed-locally`){let e;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(k,{className:`size-9`,"aria-hidden":`true`}),t[39]=e):e=t[39],O=e;let n=h?.syncEnabled===!0,i=h?.pushPermission?.checkStatus===`denied`||!!(h?.pushError||h?.pushErrorCode);if(n){let e;t[40]!==_||t[41]!==b?(e=_===null?(0,P.jsx)(r,{id:`RyIKxy`,values:{targetNoun:b}}):(0,P.jsx)(r,{id:`l6kpzR`,values:{targetNoun:b,branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[40]=_,t[41]=b,t[42]=e):e=t[42],N=e}else{let e;t[43]!==_||t[44]!==b?(e=_===null?(0,P.jsx)(r,{id:`UuYo7g`,values:{targetNoun:b}}):(0,P.jsx)(r,{id:`HoWElC`,values:{targetNoun:b,branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[43]=_,t[44]=b,t[45]=e):e=t[45],N=e}let a=null;if(h?.syncEnabled){if(ee(h)&&!i){let e;t[46]!==d||t[47]!==h?(e=(0,P.jsx)(W,{status:h,onSyncCompleted:d}),t[46]=d,t[47]=h,t[48]=e):e=t[48],a=e}}else if(h!==null){let e;t[49]===l?e=t[50]:(e=(0,P.jsx)(U,{onEnabled:l}),t[49]=l,t[50]=e),a=e}let o;t[51]!==D||t[52]!==a?(o=(0,P.jsxs)(P.Fragment,{children:[a,D]}),t[51]=D,t[52]=a,t[53]=o):o=t[53],F=o}else{let e;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(m,{className:`size-9`,"aria-hidden":`true`}),t[54]=e):e=t[54],O=e;let n;t[55]===h?n=t[56]:(n=q(h),t[55]=h,t[56]=n);let i=n;if(i){let e;t[57]===_?e=t[58]:(e=_===null?(0,P.jsx)(r,{id:`gwEcOD`}):(0,P.jsx)(r,{id:`wvK7Ay`,values:{branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[57]=_,t[58]=e),N=e}else{let e;t[59]===_?e=t[60]:(e=_===null?(0,P.jsx)(r,{id:`Xewl6B`}):(0,P.jsx)(r,{id:`d1JjXo`,values:{branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[59]=_,t[60]=e),N=e}let a=g.failure===null?`sr-only`:`max-w-md text-balance text-1sm text-destructive`,o;t[61]===g.failure?o=t[62]:(o=g.failure===`refused`?(0,P.jsx)(r,{id:`Xp7Kq4`}):g.failure===`error`?(0,P.jsx)(r,{id:`JG_8KT`}):null,t[61]=g.failure,t[62]=o);let s;t[63]!==a||t[64]!==o?(s=(0,P.jsx)(`p`,{role:`alert`,className:a,"data-testid":`share-receive-miss-pull-error`,children:o}),t[63]=a,t[64]=o,t[65]=s):s=t[65],I=s;let c;t[66]!==i||t[67]!==g.pending||t[68]!==g.start?(c=i?(0,P.jsx)(Y,{pending:g.pending,onPull:g.start}):null,t[66]=i,t[67]=g.pending,t[68]=g.start,t[69]=c):c=t[69];let l;t[70]!==g.offering||t[71]!==g.resolveOffer||t[72]!==h?.ahead?(l=g.offering?(0,P.jsx)(X,{onResolve:g.resolveOffer,strandedCommitCount:h?.ahead??0}):null,t[70]=g.offering,t[71]=g.resolveOffer,t[72]=h?.ahead,t[73]=l):l=t[73];let u;t[74]!==D||t[75]!==c||t[76]!==l?(u=(0,P.jsxs)(P.Fragment,{children:[c,D,l]}),t[74]=D,t[75]=c,t[76]=l,t[77]=u):u=t[77],F=u}let L;t[78]===O?L=t[79]:(L=(0,P.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:O}),t[78]=O,t[79]=L);let R;t[80]===N?R=t[81]:(R=(0,P.jsx)(`p`,{className:`max-w-md text-balance text-base leading-6 text-foreground/90`,children:N}),t[80]=N,t[81]=R);let z;t[82]===F?z=t[83]:(z=(0,P.jsx)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-center`,children:F}),t[82]=F,t[83]=z);let B;return t[84]!==I||t[85]!==L||t[86]!==R||t[87]!==z?(B=(0,P.jsxs)(P.Fragment,{children:[L,R,I,z]}),t[84]=I,t[85]=L,t[86]=R,t[87]=z,t[88]=B):B=t[88],B}function Q(e){return e.replace(/^\/+|\/+$/g,``)}function $(e,t){if(t.kind===`folder`){if(T(e))return Q(t.path)===``;let n=D(e);return n!==null&&Q(n)===Q(t.path)}let n=D(e);return n===null?!1:E(n)===E(t.path)}function te(){let e=null,t=new Set,n=!1;function r(){for(let e of t)e()}function i(t){e!==t&&(e=t,r())}function a(){e!==null&&($(window.location.hash,e)||i(null))}function o(){n||typeof window>`u`||(n=!0,window.addEventListener(`hashchange`,a))}return{arm(e){o(),i(e)},clear(){i(null)},getSnapshot(){return e},subscribe(e){return t.add(e),()=>{t.delete(e)}},dispose(){n&&typeof window<`u`&&(window.removeEventListener(`hashchange`,a),n=!1),i(null)}}}var ne=te();function re(e,t){return e===null||e.kind!==`missing`||t===null||E(t.path)!==e.target?null:t}export{V as a,B as i,ne as n,L as o,Z as r,I as s,re as t};
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-RQ5o7P7w.js";import{n as s}from"./dist-Bkx5dDHT2.js";import{t as c}from"./createLucideIcon-6iYxif1u.js";import{c as l,d as u,i as d,n as f,o as p,p as m,s as h,t as g}from"./EnableSyncConfirmDialog-CZhoCX06.js";import{t as _}from"./arrow-up-right-D_WN0VGP.js";import{t as v}from"./check-xiKupoJh.js";import{t as y}from"./folder-open-CB-trByC.js";import{t as b}from"./info-CsTy513y.js";import{t as x}from"./spinner-D7fgqgRw.js";import{n as S}from"./miss-dialog-store-DKfFwAsF.js";import{t as C}from"./refresh-cw-CAV3aG7d.js";import{t as w}from"./triangle-alert-xKPljhlK.js";import{_ as T,r as E,s as D}from"./doc-paths-DCnBNou3.js";import{t as O}from"./external-link-CHCx4FXC.js";var k=c(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),A=c(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),j=c(`file-x-corner`,[[`path`,{d:`M11 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5`,key:`1jo35a`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m15 17 5 5`,key:`36xl1x`}],[`path`,{d:`m20 17-5 5`,key:`vdz27y`}]]),M=a(),N=e(n(),1),P=t(),F=`https://git-scm.com/docs/git-push`;function I(e,t){return e===`empty`?!0:!(e!==`stale`&&e!==`absent`||e===`stale`&&t?.syncEnabled===!0)}function ee(e){return e?e.state!==`dormant`&&e.state!==`disabled`&&e.state!==`auth-error`&&e.state!==`conflict`:!1}function L(e){let t=(0,M.c)(52),{freshness:n,status:a,kind:s}=e,{_:c}=i(),{confirmOpen:l,setConfirmOpen:u,onToggleRequest:m,onConfirm:h}=d(p()),[y,S]=(0,N.useState)(`idle`),T=(0,N.useRef)(null),E,D;if(t[0]!==a||t[1]!==y?(E=()=>{if(!(y!==`pending`||!a)){if(a.pushError||a.pushErrorCode){S(`idle`);return}(a.lastSyncUtc??null)!==T.current&&S(`synced`)}},D=[y,a],t[0]=a,t[1]=y,t[2]=E,t[3]=D):(E=t[2],D=t[3]),(0,N.useEffect)(E,D),!I(n,a))return null;if(n===`empty`){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(w,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),t[4]=e):e=t[4];let n;t[5]===c?n=t[6]:(n=c({id:`eazHgv`}),t[5]=c,t[6]=n);let r;return t[7]===n?r=t[8]:(r=(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[e,(0,P.jsx)(`span`,{children:n})]}),t[7]=n,t[8]=r),r}if(y===`synced`){let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[(0,P.jsx)(v,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:(0,P.jsx)(r,{id:`fxbCNQ`})})]}),t[9]=e):e=t[9],e}let O=a?.syncEnabled===!0,k=a?.pushPermission?.checkStatus===`denied`,A=!!(a?.pushError||a?.pushErrorCode),j=k||A,L=n===`absent`&&!O,B;if(n===`absent`&&!O){let e;t[10]!==c||t[11]!==s?(e=c(s===`folder`?{id:`PrJYSN`}:{id:`3BnyYc`}),t[10]=c,t[11]=s,t[12]=e):e=t[12],B=e}else if(n===`stale`){let e;t[13]!==c||t[14]!==s?(e=c(s===`folder`?{id:`Gt4gOO`}:{id:`2IYGkU`}),t[13]=c,t[14]=s,t[15]=e):e=t[15],B=e}else{let e;t[16]!==c||t[17]!==s?(e=c(s===`folder`?{id:`nqV0Kk`}:{id:`gwykHF`}),t[16]=c,t[17]=s,t[18]=e):e=t[18],B=e}let V;t[19]!==c||t[20]!==A||t[21]!==k?(V=k?c({id:`9OIqw4`}):A?c({id:`K6MQQk`}):null,t[19]=c,t[20]=A,t[21]=k,t[22]=V):V=t[22];let H=V,U;t[23]===a?.lastSyncUtc?U=t[24]:(U=()=>{T.current=a?.lastSyncUtc??null,S(`pending`),f(`sync`).catch(e=>{console.warn(`[share-freshness] sync trigger failed`,e instanceof Error?e.message:e),S(`idle`)})},t[23]=a?.lastSyncUtc,t[24]=U);let W=U,G=L?w:b,K;t[25]===G?K=t[26]:(K=(0,P.jsx)(G,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),t[25]=G,t[26]=K);let q;t[27]===B?q=t[28]:(q=(0,P.jsx)(`span`,{children:B}),t[27]=B,t[28]=q);let J;t[29]===H?J=t[30]:(J=H?(0,P.jsx)(`span`,{children:H}):null,t[29]=H,t[30]=J);let Y;t[31]!==j||t[32]!==W||t[33]!==m||t[34]!==a||t[35]!==O||t[36]!==y?(Y=j?null:O?ee(a)?(0,P.jsx)(`div`,{children:y===`pending`?(0,P.jsxs)(o,{variant:`outline`,size:`xs`,disabled:!0,children:[(0,P.jsx)(x,{icon:C,className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`EHu0x2`})]}):(0,P.jsx)(o,{variant:`outline`,size:`xs`,onClick:W,children:(0,P.jsx)(r,{id:`lb_UU4`})})}):null:(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,P.jsx)(o,{variant:`outline`,size:`xs`,onClick:()=>m(!0),children:(0,P.jsx)(r,{id:`XU0OXn`})}),(0,P.jsxs)(`a`,{href:F,target:`_blank`,rel:`noopener noreferrer`,onClick:z,onAuxClick:R,className:`inline-flex items-center gap-1 transition-colors hover:text-primary`,children:[(0,P.jsx)(r,{id:`GLxIKR`}),(0,P.jsx)(_,{className:`size-3 shrink-0`,"aria-hidden":`true`})]})]}),t[31]=j,t[32]=W,t[33]=m,t[34]=a,t[35]=O,t[36]=y,t[37]=Y):Y=t[37];let X;t[38]!==q||t[39]!==J||t[40]!==Y?(X=(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[q,J,Y]}),t[38]=q,t[39]=J,t[40]=Y,t[41]=X):X=t[41];let Z;t[42]!==K||t[43]!==X?(Z=(0,P.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed border-border bg-muted/40 p-2 text-xs text-muted-foreground`,"data-testid":`share-freshness-row`,children:[K,X]}),t[42]=K,t[43]=X,t[44]=Z):Z=t[44];let Q;t[45]!==l||t[46]!==h||t[47]!==u?(Q=(0,P.jsx)(g,{open:l,onOpenChange:u,onConfirm:h}),t[45]=l,t[46]=h,t[47]=u,t[48]=Q):Q=t[48];let $;return t[49]!==Z||t[50]!==Q?($=(0,P.jsxs)(P.Fragment,{children:[Z,Q]}),t[49]=Z,t[50]=Q,t[51]=$):$=t[51],$}function R(e){return O(e,F)}function z(e){return O(e,F)}function B(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function V(e){let t=(0,M.c)(13),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={phase:`pending`},t[0]=n):n=t[0];let[r,i]=(0,N.useState)(n),[a,o]=(0,N.useState)(0),s=e.branch,c;t[1]!==s||t[2]!==e.kind||t[3]!==e.path?(c=()=>{let t=window.okDesktop??null;if(!t||s===null){i({phase:`resolved`,resolution:{verdict:`unknown`}});return}let n=!1;return t.project.fetchTargetStatus({projectPath:t.config.projectPath,branch:s,path:e.path,kind:e.kind}).then(e=>{n||i({phase:`resolved`,resolution:e??{verdict:`unknown`}})}).catch(e=>{n||(console.warn(`[receive] miss target-status fetch failed`,e instanceof Error?e.message:e),i({phase:`resolved`,resolution:{verdict:`unknown`}}))}),()=>{n=!0}},t[1]=s,t[2]=e.kind,t[3]=e.path,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==a||t[7]!==e.kind||t[8]!==e.path?(l=[s,e.kind,e.path,a],t[5]=s,t[6]=a,t[7]=e.kind,t[8]=e.path,t[9]=l):l=t[9],(0,N.useEffect)(c,l);let u;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{i({phase:`pending`}),o(H)},t[10]=u):u=t[10];let d;return t[11]===r?d=t[12]:(d={state:r,refetch:u},t[11]=r,t[12]=d),d}function H(e){return e+1}function U(e){let t=(0,M.c)(15),{onEnabled:n}=e,i=p(),a;t[0]===n?a=t[1]:(a={onEnabled:n},t[0]=n,t[1]=a);let{confirmOpen:s,setConfirmOpen:c,onToggleRequest:l,onConfirm:u}=d(i,a),f;t[2]===l?f=t[3]:(f=()=>l(!0),t[2]=l,t[3]=f);let m,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,P.jsx)(C,{className:`size-4`,"aria-hidden":`true`}),h=(0,P.jsx)(r,{id:`XU0OXn`}),t[4]=m,t[5]=h):(m=t[4],h=t[5]);let _;t[6]===f?_=t[7]:(_=(0,P.jsxs)(o,{onClick:f,"data-testid":`share-receive-miss-enable-sync`,children:[m,h]}),t[6]=f,t[7]=_);let v;t[8]!==s||t[9]!==u||t[10]!==c?(v=(0,P.jsx)(g,{open:s,onOpenChange:c,onConfirm:u}),t[8]=s,t[9]=u,t[10]=c,t[11]=v):v=t[11];let y;return t[12]!==_||t[13]!==v?(y=(0,P.jsxs)(P.Fragment,{children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14],y}function W(e){let t=(0,M.c)(23),{status:n,onSyncCompleted:a}=e,{_:c}=i(),[l,u]=(0,N.useState)(!1),d=(0,N.useRef)(null),p;t[0]!==a||t[1]!==l||t[2]!==n.lastSyncUtc||t[3]!==n.pushError||t[4]!==n.pushErrorCode?(p=()=>{if(l){if(n.pushError||n.pushErrorCode){u(!1);return}(n.lastSyncUtc??null)!==d.current&&(u(!1),a?.())}},t[0]=a,t[1]=l,t[2]=n.lastSyncUtc,t[3]=n.pushError,t[4]=n.pushErrorCode,t[5]=p):p=t[5];let m;t[6]!==a||t[7]!==l||t[8]!==n?(m=[l,n,a],t[6]=a,t[7]=l,t[8]=n,t[9]=m):m=t[9],(0,N.useEffect)(p,m);let h;t[10]!==c||t[11]!==n.lastSyncUtc?(h=()=>{d.current=n.lastSyncUtc??null,u(!0),f(`sync`).catch(e=>{console.warn(`[receive] miss sync trigger failed`,e instanceof Error?e.message:e),u(!1),s.error(c({id:`1u-mAI`}))})},t[10]=c,t[11]=n.lastSyncUtc,t[12]=h):h=t[12];let g=h,_;t[13]!==g||t[14]!==l?(_=l?(0,P.jsxs)(o,{disabled:!0,"aria-busy":`true`,"data-testid":`share-receive-miss-sync-now`,children:[(0,P.jsx)(x,{icon:C,className:`size-4`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`EHu0x2`})]}):(0,P.jsxs)(o,{onClick:g,"data-testid":`share-receive-miss-sync-now`,children:[(0,P.jsx)(C,{className:`size-4`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`lb_UU4`})]}),t[13]=g,t[14]=l,t[15]=_):_=t[15];let v;t[16]===l?v=t[17]:(v=l?(0,P.jsx)(r,{id:`dXOolp`}):null,t[16]=l,t[17]=v);let y;t[18]===v?y=t[19]:(y=(0,P.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,"data-testid":`share-receive-miss-sync-status`,children:v}),t[18]=v,t[19]=y);let b;return t[20]!==_||t[21]!==y?(b=(0,P.jsxs)(P.Fragment,{children:[_,y]}),t[20]=_,t[21]=y,t[22]=b):b=t[22],b}var G=!1;function K(e){return!G&&e!==null&&e.syncEnabled!==!0}function q(e){return e===null?!1:e.hasRemote&&e.lastPullUtc!==void 0&&e.state!==`conflict`}function J(e,t){let n=(0,M.c)(15),[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(!1),l=(0,N.useRef)(null),u,d;n[0]!==t||n[1]!==r||n[2]!==e?(u=()=>{if(!r||(e?.lastPullUtc??null)===l.current)return;i(!1);let n=e?.lastPullOutcome??null;if(n===null){t?.();return}switch(n){case`refused`:case`error`:o(n);return;case`succeeded`:case`up-to-date`:if(K(e)){G=!0,c(!0);return}t?.();return;case`conflict`:t?.();return;default:t?.();return}},d=[r,e,t],n[0]=t,n[1]=r,n[2]=e,n[3]=u,n[4]=d):(u=n[3],d=n[4]),(0,N.useEffect)(u,d);let p;n[5]===t?p=n[6]:(p=()=>{c(!1),t?.()},n[5]=t,n[6]=p);let m;n[7]===e?.lastPullUtc?m=n[8]:(m=()=>{l.current=e?.lastPullUtc??null,o(null),i(!0),f(`pull`).catch(e=>{console.warn(`[receive] miss pull trigger failed`,e instanceof Error?e.message:e),i(!1),o(`error`)})},n[7]=e?.lastPullUtc,n[8]=m);let h;return n[9]!==a||n[10]!==s||n[11]!==r||n[12]!==p||n[13]!==m?(h={pending:r,failure:a,offering:s,resolveOffer:p,start:m},n[9]=a,n[10]=s,n[11]=r,n[12]=p,n[13]=m,n[14]=h):h=n[14],h}function Y(e){let t=(0,M.c)(10),{pending:n,onPull:i}=e,a;t[0]!==i||t[1]!==n?(a=n?(0,P.jsxs)(o,{disabled:!0,"aria-busy":`true`,"data-testid":`share-receive-miss-pull-now`,children:[(0,P.jsx)(x,{icon:C,className:`size-4`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`4uNLmk`})]}):(0,P.jsxs)(o,{onClick:i,"data-testid":`share-receive-miss-pull-now`,children:[(0,P.jsx)(m,{className:`size-4`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`fevEu0`})]}),t[0]=i,t[1]=n,t[2]=a):a=t[2];let s;t[3]===n?s=t[4]:(s=n?(0,P.jsx)(r,{id:`glG1TR`}):null,t[3]=n,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,P.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,"data-testid":`share-receive-miss-pull-status`,children:s}),t[5]=s,t[6]=c);let l;return t[7]!==a||t[8]!==c?(l=(0,P.jsxs)(P.Fragment,{children:[a,c]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function X(e){let t=(0,M.c)(18),{onResolve:n,strandedCommitCount:r}=e,i=l(),a=(0,N.useRef)(!1),o;t[0]===n?o=t[1]:(o=function(){a.current||(a.current=!0,n())},t[0]=n,t[1]=o);let s=o,c;t[2]===s?c=t[3]:(c={onApplied:s},t[2]=s,t[3]=c);let{confirmOpen:u,setConfirmOpen:d,onModeSelect:f,onConfirm:p}=h(i,`off`,c),m=(0,N.useRef)(!1),_,v;t[4]===f?(_=t[5],v=t[6]):(_=()=>{m.current||(m.current=!0,f(`follow`))},v=[f],t[4]=f,t[5]=_,t[6]=v),(0,N.useEffect)(_,v);let y;t[7]!==s||t[8]!==d?(y=e=>{d(e),e||s()},t[7]=s,t[8]=d,t[9]=y):y=t[9];let b;t[10]!==p||t[11]!==s?(b=()=>{p(),s()},t[10]=p,t[11]=s,t[12]=b):b=t[12];let x;return t[13]!==u||t[14]!==r||t[15]!==y||t[16]!==b?(x=(0,P.jsx)(g,{open:u,onOpenChange:y,onConfirm:b,variant:`follow`,strandedCommitCount:r}),t[13]=u,t[14]=r,t[15]=y,t[16]=b,t[17]=x):x=t[17],x}function Z(e){let t=(0,M.c)(89),{nav:n,state:a,onBrowseFolder:s,onOpenRenamed:c,onEnableAutoSync:l,onSyncCompleted:d,onPullApplied:f}=e,{_:p}=i(),h=u(),g=J(h,f),_=n.branch,v;t[0]!==p||t[1]!==n.kind?(v=n.kind===`folder`?p({id:`ugoTXs`}):p({id:`XH30C4`}),t[0]=p,t[1]=n.kind,t[2]=v):v=t[2];let b=v;if(a.phase===`pending`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(x,{className:`size-5`,"aria-hidden":`true`}),(0,P.jsx)(r,{id:`c8jBgX`})]}),t[3]=e):e=t[3],e}let{resolution:C}=a,w,T;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,P.jsx)(y,{className:`size-4`,"aria-hidden":`true`}),T=(0,P.jsx)(r,{id:`hItdtk`}),t[4]=w,t[5]=T):(w=t[4],T=t[5]);let E;t[6]===s?E=t[7]:(E=(0,P.jsxs)(o,{variant:`outline`,onClick:s,"data-testid":`share-receive-miss-browse`,children:[w,T]}),t[6]=s,t[7]=E);let D=E,O,N,F,I=null;if(C.verdict===`renamed`){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(S,{className:`size-9`,"aria-hidden":`true`}),t[8]=e):e=t[8],O=e;let n;t[9]!==C.renamedTo||t[10]!==b?(n={0:C.renamedTo,targetNoun:b},t[9]=C.renamedTo,t[10]=b,t[11]=n):n=t[11];let i;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[12]=i):i=t[12];let a;t[13]===n?a=t[14]:(a=(0,P.jsx)(r,{id:`P0HC30`,values:n,components:i}),t[13]=n,t[14]=a),N=a;let s;t[15]!==c||t[16]!==C.renamedTo?(s=()=>c(C.renamedTo),t[15]=c,t[16]=C.renamedTo,t[17]=s):s=t[17];let l,u;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,P.jsx)(S,{className:`size-4`,"aria-hidden":`true`}),u=(0,P.jsx)(r,{id:`AItsE5`}),t[18]=l,t[19]=u):(l=t[18],u=t[19]);let d;t[20]===s?d=t[21]:(d=(0,P.jsxs)(o,{onClick:s,"data-testid":`share-receive-miss-open-renamed`,children:[l,u]}),t[20]=s,t[21]=d);let f;t[22]!==D||t[23]!==d?(f=(0,P.jsxs)(P.Fragment,{children:[d,D]}),t[22]=D,t[23]=d,t[24]=f):f=t[24],F=f}else if(C.verdict===`deleted`){let e;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(j,{className:`size-9`,"aria-hidden":`true`}),t[25]=e):e=t[25],O=e;let n;t[26]!==_||t[27]!==b?(n={targetNoun:b,branch:_},t[26]=_,t[27]=b,t[28]=n):n=t[28];let i;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[29]=i):i=t[29];let a;t[30]===n?a=t[31]:(a=(0,P.jsx)(r,{id:`kpqWwG`,values:n,components:i}),t[30]=n,t[31]=a),N=a,F=D}else if(C.verdict===`never-on-branch`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(A,{className:`size-9`,"aria-hidden":`true`}),t[32]=e):e=t[32],O=e;let n;t[33]!==_||t[34]!==b?(n={targetNoun:b,branch:_},t[33]=_,t[34]=b,t[35]=n):n=t[35];let i;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})},t[36]=i):i=t[36];let a;t[37]===n?a=t[38]:(a=(0,P.jsx)(r,{id:`i9TPUi`,values:n,components:i}),t[37]=n,t[38]=a),N=a,F=D}else if(C.verdict===`changed-locally`){let e;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(k,{className:`size-9`,"aria-hidden":`true`}),t[39]=e):e=t[39],O=e;let n=h?.syncEnabled===!0,i=h?.pushPermission?.checkStatus===`denied`||!!(h?.pushError||h?.pushErrorCode);if(n){let e;t[40]!==_||t[41]!==b?(e=_===null?(0,P.jsx)(r,{id:`RyIKxy`,values:{targetNoun:b}}):(0,P.jsx)(r,{id:`l6kpzR`,values:{targetNoun:b,branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[40]=_,t[41]=b,t[42]=e):e=t[42],N=e}else{let e;t[43]!==_||t[44]!==b?(e=_===null?(0,P.jsx)(r,{id:`UuYo7g`,values:{targetNoun:b}}):(0,P.jsx)(r,{id:`HoWElC`,values:{targetNoun:b,branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[43]=_,t[44]=b,t[45]=e):e=t[45],N=e}let a=null;if(h?.syncEnabled){if(ee(h)&&!i){let e;t[46]!==d||t[47]!==h?(e=(0,P.jsx)(W,{status:h,onSyncCompleted:d}),t[46]=d,t[47]=h,t[48]=e):e=t[48],a=e}}else if(h!==null){let e;t[49]===l?e=t[50]:(e=(0,P.jsx)(U,{onEnabled:l}),t[49]=l,t[50]=e),a=e}let o;t[51]!==D||t[52]!==a?(o=(0,P.jsxs)(P.Fragment,{children:[a,D]}),t[51]=D,t[52]=a,t[53]=o):o=t[53],F=o}else{let e;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(m,{className:`size-9`,"aria-hidden":`true`}),t[54]=e):e=t[54],O=e;let n;t[55]===h?n=t[56]:(n=q(h),t[55]=h,t[56]=n);let i=n;if(i){let e;t[57]===_?e=t[58]:(e=_===null?(0,P.jsx)(r,{id:`gwEcOD`}):(0,P.jsx)(r,{id:`wvK7Ay`,values:{branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[57]=_,t[58]=e),N=e}else{let e;t[59]===_?e=t[60]:(e=_===null?(0,P.jsx)(r,{id:`Xewl6B`}):(0,P.jsx)(r,{id:`d1JjXo`,values:{branch:_},components:{0:(0,P.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}}),t[59]=_,t[60]=e),N=e}let a=g.failure===null?`sr-only`:`max-w-md text-balance text-1sm text-destructive`,o;t[61]===g.failure?o=t[62]:(o=g.failure===`refused`?(0,P.jsx)(r,{id:`Xp7Kq4`}):g.failure===`error`?(0,P.jsx)(r,{id:`JG_8KT`}):null,t[61]=g.failure,t[62]=o);let s;t[63]!==a||t[64]!==o?(s=(0,P.jsx)(`p`,{role:`alert`,className:a,"data-testid":`share-receive-miss-pull-error`,children:o}),t[63]=a,t[64]=o,t[65]=s):s=t[65],I=s;let c;t[66]!==i||t[67]!==g.pending||t[68]!==g.start?(c=i?(0,P.jsx)(Y,{pending:g.pending,onPull:g.start}):null,t[66]=i,t[67]=g.pending,t[68]=g.start,t[69]=c):c=t[69];let l;t[70]!==g.offering||t[71]!==g.resolveOffer||t[72]!==h?.ahead?(l=g.offering?(0,P.jsx)(X,{onResolve:g.resolveOffer,strandedCommitCount:h?.ahead??0}):null,t[70]=g.offering,t[71]=g.resolveOffer,t[72]=h?.ahead,t[73]=l):l=t[73];let u;t[74]!==D||t[75]!==c||t[76]!==l?(u=(0,P.jsxs)(P.Fragment,{children:[c,D,l]}),t[74]=D,t[75]=c,t[76]=l,t[77]=u):u=t[77],F=u}let L;t[78]===O?L=t[79]:(L=(0,P.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:O}),t[78]=O,t[79]=L);let R;t[80]===N?R=t[81]:(R=(0,P.jsx)(`p`,{className:`max-w-md text-balance text-base leading-6 text-foreground/90`,children:N}),t[80]=N,t[81]=R);let z;t[82]===F?z=t[83]:(z=(0,P.jsx)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-center`,children:F}),t[82]=F,t[83]=z);let B;return t[84]!==I||t[85]!==L||t[86]!==R||t[87]!==z?(B=(0,P.jsxs)(P.Fragment,{children:[L,R,I,z]}),t[84]=I,t[85]=L,t[86]=R,t[87]=z,t[88]=B):B=t[88],B}function Q(e){return e.replace(/^\/+|\/+$/g,``)}function $(e,t){if(t.kind===`folder`){if(T(e))return Q(t.path)===``;let n=D(e);return n!==null&&Q(n)===Q(t.path)}let n=D(e);return n===null?!1:E(n)===E(t.path)}function te(){let e=null,t=new Set,n=!1;function r(){for(let e of t)e()}function i(t){e!==t&&(e=t,r())}function a(){e!==null&&($(window.location.hash,e)||i(null))}function o(){n||typeof window>`u`||(n=!0,window.addEventListener(`hashchange`,a))}return{arm(e){o(),i(e)},clear(){i(null)},getSnapshot(){return e},subscribe(e){return t.add(e),()=>{t.delete(e)}},dispose(){n&&typeof window<`u`&&(window.removeEventListener(`hashchange`,a),n=!1),i(null)}}}var ne=te();function re(e,t){return e===null||e.kind!==`missing`||t===null||E(t.path)!==e.target?null:t}export{V as a,B as i,ne as n,L as o,Z as r,I as s,re as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{I as e}from"./DocumentContext-
|
|
1
|
+
import{I as e}from"./DocumentContext-DQeqcbba.js";import{O as t}from"./CodeMirrorPropInput-CfyM9jmf.js";function n(n){let r=e(n.state.selection.content(),n.state.schema);return t().serialize(r).trim()}function r(e){return e.lineCount===1&&e.charLen<100?{kind:`inline`,markdown:e.markdown}:e.surface===`source`&&e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?{kind:`lines`,startLine:e.sourceLineStart,endLine:e.sourceLineEnd}:{kind:`anchor`,markdown:e.markdown}}function i(e,t){return e.sourceLineStart!==void 0&&e.sourceLineEnd!==void 0?`${t} (${e.sourceLineStart===e.sourceLineEnd?`${e.sourceLineStart}`:`${e.sourceLineStart}-${e.sourceLineEnd}`})`:e.lineCount>1?`${t} (${e.lineCount} lines)`:`${t} (selection)`}function a(e){let t=e.replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),n=[],r=!1;for(let e of t){let t=e.trim();if(/^(```|~~~)/.test(t)){r||n.push(`code`),r=!r;continue}if(r||t===``)continue;if(/^\|.*\|?$/.test(t)&&t.includes(`|`)){n[n.length-1]!==`table`&&n.push(`table`);continue}if(/^<\/?[A-Za-z]/.test(t)){n[n.length-1]!==`component`&&n.push(`component`);continue}let i=t.match(/^#{1,6}\s+(.*)$/);if(i){n.push(i[1]??``);continue}let a=t.match(/^[-*+]\s+(.*)$/);if(a){n.push(`• ${a[1]??``}`);continue}let o=t.match(/^\d+\.\s+(.*)$/);if(o){n.push(`• ${o[1]??``}`);continue}let s=t.match(/^>\s?(.*)$/);if(s){n.push(s[1]??``);continue}n.push(t)}return n.join(` `).replace(/\s+/g,` `).trim()}var o=new Map,s=new Set,c=(e,t)=>`${t}:${e}`;function l(){for(let e of s)e()}function u(e,t){return e.markdown===t.markdown&&e.sourceLineStart===t.sourceLineStart&&e.sourceLineEnd===t.sourceLineEnd}function d(e,t,n){let r=c(e,t);if(n===null){o.delete(r)&&l();return}let i=o.get(r);i&&u(i,n)||(o.set(r,n),l())}function f(e,t){return e===null?null:o.get(c(e,t))??null}function p(e){return s.add(e),()=>{s.delete(e)}}function m(e,t){if(e.state.selection.empty)return null;let r=n(e);return r.trim()?{surface:`wysiwyg`,docName:t,markdown:r,charLen:r.trim().length,lineCount:(r.match(/\n/g)?.length??0)+1}:null}function h(e,t){return e.trim()?{surface:`frontmatter`,docName:t,markdown:e,charLen:e.trim().length,lineCount:(e.match(/\n/g)?.length??0)+1}:null}function g(e,t){let n=[],r=1/0,i=-1;for(let t of e.state.selection.ranges)t.empty||(n.push(e.state.sliceDoc(t.from,t.to)),r=Math.min(r,t.from),i=Math.max(i,t.to));if(n.length===0)return null;let a=n.join(`
|
|
4
4
|
`);if(!a.trim())return null;let o=e.state.doc.lineAt(r).number,s=e.state.doc.lineAt(i).number;return{surface:`source`,docName:t,markdown:a,charLen:a.trim().length,lineCount:s-o+1,sourceLineStart:o,sourceLineEnd:s}}export{h as a,r as c,i,p as l,a as n,g as o,d as r,m as s,f as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{L as n,Sn as r,Vn as i,i as a}from"./DocumentContext-q72mQT_t.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./compiler-runtime-BfE3aGVn.js";import{s as u}from"./local-menu-action-bus-BKJCODnD.js";import{t as d}from"./utils-CPqDy6Hr.js";import{c as f,i as p,n as m,o as h,s as g,t as _}from"./ChangedOutsideBadge-BTzPOikC.js";import{t as v}from"./button-RQ5o7P7w.js";import{i as y,n as b,t as x}from"./tooltip-x7BNUa3s.js";import{a as S,c as C,i as w,n as T,o as E,r as D,s as O,t as k}from"./dialog-Bxcn1sLm.js";import{a as A,c as j,i as M,l as N,n as P,o as F,s as I,u as L}from"./context-menu-CYgsnEgV.js";import{a as R,d as z,f as B,i as V,n as H,o as U,p as W,u as G}from"./dropdown-menu-K4eCFwQy.js";import{t as ee}from"./label-BT2yjpKR.js";import{S as K,a as q,f as J,h as Y,i as te,m as X,n as ne,o as re,p as ie,r as ae,s as oe}from"./terminal-cli-display-BqUx5532.js";import{An as se,Bt as ce,Dn as le,Dt as ue,Ei as de,Fn as fe,Gt as pe,Ia as me,In as he,Ir as ge,Ln as _e,Mn as ve,On as ye,Pn as be,Wt as xe,an as Se,at as Ce,do as we,fn as Te,io as Ee,kn as De,ot as Oe,pn as ke,so as Ae,un as je}from"./dist-B6uhnkqb2.js";import{i as Me}from"./use-settings-route-Ln_W_o3I.js";import{t as Ne}from"./dist-DoS8xGN6.js";import{n as Z}from"./dist-Bkx5dDHT2.js";import{c as Pe,n as Fe,o as Ie}from"./documents-events-BE14yj3s.js";import{h as Le}from"./use-apply-config-color-theme-6RHjH1SX.js";import{t as Re}from"./parse-api-error-Mgtc4OJu.js";import{n as ze,t as Be}from"./workspace-paths-C2pS_Pbn.js";import{t as Ve}from"./use-workspace-C5uwuxa8.js";import{t as He}from"./createLucideIcon-6iYxif1u.js";import{t as Ue}from"./RegisteredAgentIcon-BgDInKA9.js";import{n as We,r as Ge}from"./ManagedArtifactProperties-B4gUE4uy.js";import{n as Ke}from"./CopyButton-DhHoiQJR.js";import{t as qe}from"./folder-open-CB-trByC.js";import{t as Je}from"./folder-C8rE1Soy.js";import{t as Ye}from"./list-plus-ByOuGBSE.js";import{t as Xe}from"./trash-2-CSpv7np3.js";import{t as Ze}from"./input-VnbFvuKd.js";import{J as Qe,q as $e,x as et}from"./navigation-targets-GITJ7Tz8.js";import{a as tt,c as nt,f as rt,n as it,r as at}from"./skill-scope-qH5lhviP.js";import{t as ot}from"./badge-zHd29IKW.js";import{A as st,C as ct,M as lt,a as ut,b as dt,k as ft,m as pt,n as mt,r as ht,t as gt,u as _t,w as vt,x as yt,y as bt}from"./skills-api-Dl_Mtb7L.js";import{t as xt}from"./use-skills-DyoXP6p3.js";import{t as St}from"./use-open-skill-BZcJfbB3.js";import{n as Ct}from"./clipboard-adapter-DEJxizFj.js";import{t as wt}from"./DiffView-BjOsi4GM.js";var Q=t(),$=e(o(),1),Tt=l();function Et(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function Dt(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Re(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:Ne._({id:`1vn0CI`})}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:Ne._({id:`NoY1k4`})}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??Ne._({id:`MrUmCD`})}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Ot(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?Et(e):Dt()}var kt=`ok:skill:cowork:installed`,At=`1`,jt=250,Mt=`/api/skill/install-state`;function Nt(e){return`${kt}:v${e}`}var Pt=new Map;async function Ft(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Pt.get(n);if(r)return r;let i=It(e,t);return Pt.set(n,i),i.finally(()=>{Pt.get(n)===i&&Pt.delete(n)}),i}async function It(e,t){let n=e.installer===void 0?Ot():e.installer,r=Lt(e.storage),i=e.fetchSnapshot??zt,a=e.serverTimeoutMs??jt,o=null;if(!t.force){try{o=await Bt(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Nt(o?.currentVersion??e.fallbackSkillVersion??Rt());if(!t.force&&r?.getItem(s)===At)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,At)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Lt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Rt(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function zt(){let e;try{e=await fetch(Mt,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Bt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Vt(e){return Ft({},e)}function Ht(){return Ft({},{force:!0})}async function Ut(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function Wt(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Ut({target:`claude-cowork`,url:je({mode:`cowork`},e)},n);case`claude-code`:return Ut({target:`claude-code`,url:je({mode:`code`},e)},n);case`codex`:return Ut({target:`codex`,url:Te(e)},n);case`cursor`:return Ut({target:`cursor`,url:ke(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Gt(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var Kt=`open-knowledge:agent-thread-launch`;function qt(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(Kt,{detail:e}))}function Jt(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(Kt,n),()=>t.removeEventListener(Kt,n)}function Yt(e){if(!e.docName||!e.workspace)return null;let t=Be(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:ze(n,t,r)}}function Xt(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function Zt(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function Qt(e){return Y(e.installUrl).then(()=>void 0)}function $t(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function en(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function tn(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace;if(e.docName){let r=e.docRelativePath??Be(e.docName),i={scope:`doc`,docRelativePath:r,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?i:{...i,selection:e.selection},projectDir:t,docPath:ze(t,r,n)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function nn(e){return`Opened in ${e}.`}function rn(e,t=1){return t>=3?Ne._({id:`bi2C2s`,values:{displayName:e}}):t===2?Ne._({id:`1J0c0X`,values:{displayName:e}}):Ne._({id:`Xs7IcT`,values:{displayName:e}})}function an(e){return e>=3?null:e===2?Ne._({id:`Xp94R1`}):Ne._({id:`6gRgw8`})}function on(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function sn(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function cn(e,t,n,r){return e.compose?Se(sn(e.compose,t,n,r)):e.selection?be({...e.selection,target:t,transport:r}):e.skill?fe(e.skill.name,e.skill.scope,n):e.ask?le(e.ask.relativePath,e.ask.instruction,n,t,r):de(e.docContext===null?e.folderRelativePath?ve(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?De(n,e.instruction,r):ye(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):se(e.docContext.relativePath,n,e.instruction,r))}function ln(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${Ce} ${cn(e,xe[t].handoffTarget,!1,`terminal`)}`:he(e.docContext?.relativePath??null)}function un(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${Oe} ${cn(e,`claude-code`,!1,`terminal`)}`:_e(e.docContext?.relativePath??null)}function dn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function fn(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function pn(e,t){qt({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:un(e),docName:dn(e),titleHint:fn(e)})}async function mn(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(Ne._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(Ne._({id:`PezM4_`})),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(Ne._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:cn(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=on(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(nn(u));else{let i=an(r),a=rn(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{mn(e,t,n,r+1)}}})}return a}function hn(e){return ie.find(t=>t.id===e)?.displayName??e}function gn(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function _n(){return{dispatchHandoff:Wt,recordHandoff:Gt,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>gn(),getDisplayName:hn,ensureCoworkSkillInstalled:Vt,autoOpen:!0}}function vn(){let e=(0,Tt.c)(2),{merged:t}=Le(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>mn(e,t,{..._n(),autoOpen:n}),reinstallCoworkSkill:Ht},e[0]=n,e[1]=r),r}var yn=He(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),bn=He(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),xn=He(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Sn=He(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);function Cn(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(M,{...r}):(0,Q.jsx)(V,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function wn(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(A,{...r}):(0,Q.jsx)(R,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Tn(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(P,{...r}):(0,Q.jsx)(H,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function En(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(F,{...r}):(0,Q.jsx)(U,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Dn(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(I,{...r}):(0,Q.jsx)(G,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function On(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(j,{...r}):(0,Q.jsx)(z,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function kn(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(N,{...r}):(0,Q.jsx)(B,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function An(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(L,{...r}):(0,Q.jsx)(W,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var jn=Object.freeze({hosts:null,source:null}),Mn=new Map,Nn=new Map;function Pn(e,t){return`${e}:${t}`}function Fn(e){return Mn.get(e)??jn}function In(e,t){let n=Nn.get(e)??new Set;return Nn.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&Nn.delete(e)}}function Ln(e,t){let n=Fn(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?Mn.delete(e):Mn.set(e,r);for(let t of Nn.get(e)??[])t()}}var Rn=ce.options,zn=`min-w-[24rem]`;function Bn(e,t){let n=(0,Tt.c)(45),r=t.installingName===e.name,i=(0,$.useRef)(e),[a,o]=(0,$.useState)(!1),s=(0,$.useRef)(!1),c,l;n[0]===r?(c=n[1],l=n[2]):(c=()=>{s.current&&!r&&o(!0),s.current=r},l=[r],n[0]=r,n[1]=c,n[2]=l),(0,$.useEffect)(c,l);let u,d;n[3]===e?(u=n[4],d=n[5]):(u=()=>{e!==i.current&&(i.current=e,o(!1))},d=[e],n[3]=e,n[4]=u,n[5]=d),(0,$.useEffect)(u,d);let f=r||a,p;n[6]!==e.name||n[7]!==e.scope?(p=Pn(e.scope,e.name),n[6]=e.name,n[7]=e.scope,n[8]=p):p=n[8];let m=p,h,g;n[9]===m?(h=n[10],g=n[11]):(h=e=>In(m,e),g=()=>Fn(m),n[9]=m,n[10]=h,n[11]=g);let _=(0,$.useSyncExternalStore)(h,g),v=_.hosts,y=_.source,b,x;n[12]!==y||n[13]!==m||n[14]!==e.hosts?(b=()=>{y!==null&&e.hosts[0]===y&&Ln(m,{source:null})},x=[e.hosts,y,m],n[12]=y,n[13]=m,n[14]=e.hosts,n[15]=b,n[16]=x):(b=n[15],x=n[16]),(0,$.useEffect)(b,x);let S=e.linkMode===!0,C=v??e.hosts,w;n[17]===C?w=n[18]:(w=new Set(C),n[17]=C,n[18]=w);let T=w,E=v?v.length>0:e.installed,D=(0,$.useRef)(e.hosts),O,k;n[19]!==v||n[20]!==e.hosts?(O=()=>{v===null&&(D.current=e.hosts)},k=[v,e.hosts],n[19]=v,n[20]=e.hosts,n[21]=O,n[22]=k):(O=n[21],k=n[22]),(0,$.useEffect)(O,k);let A;n[23]===e.hosts?A=n[24]:(A=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=A);let j=A,M,N;n[25]!==m||n[26]!==j?(M=()=>{let e=Fn(m).hosts;e&&[...e].sort().join(`,`)===j&&Ln(m,{hosts:null})},N=[j,m],n[25]=m,n[26]=j,n[27]=M,n[28]=N):(M=n[27],N=n[28]),(0,$.useEffect)(M,N);let P=(0,$.useRef)(null),F=(0,$.useRef)(null),I,L;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{P.current&&clearTimeout(P.current),F.current?.(),F.current=null},L=[],n[29]=I,n[30]=L):(I=n[29],L=n[30]),(0,$.useEffect)(I,L);let R;n[31]!==t||n[32]!==m||n[33]!==e?(R=function(n,r){D.current=n,Ln(m,{hosts:n}),P.current&&clearTimeout(P.current);let i=async()=>{F.current=null,P.current=null;let r=await t.install(e,n.filter(ge));if(!r.ok){Ln(m,{hosts:null});return}D.current=[...r.hosts],Ln(m,{hosts:[...r.hosts]})};r?(F.current=()=>void i(),P.current=setTimeout(()=>void i(),350)):(F.current=null,i())},n[31]=t,n[32]=m,n[33]=e,n[34]=R):R=n[34];let z=R,B;return n[35]!==t||n[36]!==z||n[37]!==T||n[38]!==E||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(B={hostSet:T,installed:E,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),z([...n],!0)},installAll(){let t=D.current.filter(Un),n=e.installableEditors??Rn,r=Rn.filter(e=>n.includes(e)||D.current.includes(e));z([...t,...r],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>dt({scope:e.scope,name:e.name,dir:n,mode:r})).then(Hn)},unplaceAt(n){t.runLocationWrite(e,()=>st({scope:e.scope,name:e.name,path:n})).then(Vn)},setSource(n){Ln(m,{source:n}),t.runLocationWrite(e,()=>ft({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(Ln(m,{source:null}),Z.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=z,n[37]=T,n[38]=E,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=B):B=n[44],B}function Vn(e){e.ok||Z.error(e.error)}function Hn(e){e.ok||Z.error(e.error)}function Un(e){return!Rn.includes(e)}function Wn(e){let t=(0,Tt.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Q.jsx)(y,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Q.jsx)(b,{side:`right`,className:`max-w-xs`,children:n}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(x,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Gn(e){let t=(0,Tt.c)(165),{toggles:n,skill:r,onResolveFork:i,onRunStart:a,menuKind:o}=e,l=o===void 0?`dropdown`:o,{_:u}=c(),{hostSet:d,toggleEditor:f,installAll:p}=n,h;t[0]===r?h=t[1]:(h=e=>r?`${nt(e,r.scope)}/${r.name}`:null,t[0]=r,t[1]=h);let g=h,y=xt(),b;t[2]!==y.data||t[3]!==y.status||t[4]!==r?(b=r!==void 0&&((r.hosts??[]).includes(`agents`)||y.status===`ready`&&y.data.some(rr)),t[2]=y.data,t[3]=y.status,t[4]=r,t[5]=b):b=t[5];let x=b,S;t[6]!==y.data||t[7]!==y.status||t[8]!==r?(S=r?.hostAliases??(r&&y.status===`ready`?Object.assign({},...y.data.filter(e=>e.scope===r.scope).map(nr)):{}),t[6]=y.data,t[7]=y.status,t[8]=r,t[9]=S):S=t[9];let C=S,w;t[10]!==y.data||t[11]!==y.status||t[12]!==r?(w=r?.installableEditors??(r&&y.status===`ready`?y.data.find(e=>e.scope===r.scope)?.installableEditors:void 0),t[10]=y.data,t[11]=y.status,t[12]=r,t[13]=w):w=t[13];let T=w,E,D,O,k,A,j,M;if(t[14]!==u||t[15]!==C||t[16]!==y.data||t[17]!==y.status||t[18]!==d||t[19]!==x||t[20]!==p||t[21]!==T||t[22]!==l||t[23]!==i||t[24]!==a||t[25]!==g||t[26]!==r||t[27]!==f||t[28]!==n){let e=T?new Set(T):null,o;t[36]===C?o=t[37]:(o=e=>!(e in C),t[36]=C,t[37]=o);let c=(x?[`agents`,...Rn]:Rn).filter(o).filter(t=>t===`agents`||e===null||e.has(t)||d.has(t)),h;t[38]===g?h=t[39]:(h=e=>g(e),t[38]=g,t[39]=h);let b=new Set(c.map(h)),S=r?.scope===`global`?`~/`:``,w;t[40]!==S||t[41]!==r?(w=r?.path?.includes(`/`)?`${S}${r.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,t[40]=S,t[41]=r,t[42]=w):w=t[42];let N=w,P=N!==null&&!b.has(N)?N:null,F=P===null?n.sourceHost??r?.hosts?.[0]:void 0,I;t[43]===C?I=t[44]:(I=e=>it(C,e),t[43]=C,t[44]=I);let L=I,R=tr,z;t[45]!==u||t[46]!==L?(z=e=>{let t=L(e);return t.length===0?!0:window.confirm(u({id:`Uobeu9`,values:{0:t.map(R).join(`, `),rootRel:e}}))},t[45]=u,t[46]=L,t[47]=z):z=t[47];let B=z,V;t[48]!==u||t[49]!==r?(V=(e,t)=>{let n=e.includes(`/`)?e:nt(e,r?.scope??`project`);return(0,Q.jsx)(Wn,{hint:u({id:`0dslv8`,values:{0:R(e),1:R(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":u({id:`G6Lrs_`,values:{0:R(e)}}),onClick:i=>{i.preventDefault(),i.stopPropagation(),window.confirm(u({id:`iiqOKM`,values:{0:R(e),1:r.name,2:R(e),subRoot:n,poolRootRel:t}}))&&yt({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?Ie():Z.error(u({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,Q.jsx)(m,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[48]=u,t[49]=r,t[50]=V):V=t[50];let H=V,U;t[51]===r?.conflictHosts?U=t[52]:(U=r?.conflictHosts??[],t[51]=r?.conflictHosts,t[52]=U);let W;t[53]===U?W=t[54]:(W=new Set(U),t[53]=U,t[54]=W);let G=W,ee;t[55]===r?.driftPaths?ee=t[56]:(ee=r?.driftPaths??[],t[55]=r?.driftPaths,t[56]=ee);let K;t[57]===ee?K=t[58]:(K=new Set(ee),t[57]=ee,t[58]=K);let q=K;E=n.installing;let J=er,Y;t[59]===r?.symlinkedHosts?Y=t[60]:(Y=r?.symlinkedHosts??[],t[59]=r?.symlinkedHosts,t[60]=Y);let te;t[61]===Y?te=t[62]:(te=new Set(Y),t[61]=Y,t[62]=te);let X=te,ne=[...[...d].filter(e=>e!==F&&!(e in C)&&!G.has(e)&&!e.includes(`/`)).map(e=>X.has(e)?`link`:`copy`),...(r?.customPlacements??[]).map($n)],re=ne.filter(Qn).length;O=ne.length===0?n.linkMode?`link`:`copy`:re*2>=ne.length?`link`:`copy`;let ie;t[63]!==C||t[64]!==G||t[65]!==d||t[66]!==X||t[67]!==g||t[68]!==F?(ie=[...d].filter(e=>e!==F&&!(e in C)&&!G.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:g(e)??R(e),mode:X.has(e)?`link`:`copy`})),t[63]=C,t[64]=G,t[65]=d,t[66]=X,t[67]=g,t[68]=F,t[69]=ie):ie=t[69];let ae;t[70]===r?.customPlacements?ae=t[71]:(ae=r?.customPlacements??[],t[70]=r?.customPlacements,t[71]=ae);let oe;if(t[72]!==S||t[73]!==ie||t[74]!==ae){let e;t[76]===S?e=t[77]:(e=e=>({target:at(e),display:`${S}${e.path}`,mode:e.mode}),t[76]=S,t[77]=e),oe=[...ie,...ae.map(e)],t[72]=S,t[73]=ie,t[74]=ae,t[75]=oe}else oe=t[75];D=oe;let se;t[78]!==u||t[79]!==a||t[80]!==n?(se=(e,t,r)=>{let i=r===`link`?`copy`:`link`;return(0,Q.jsx)(Wn,{hint:u(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 font-normal text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(u(i===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(a?.(),n.convertLocation?.(e,i))},"data-testid":`skill-convert-${e}`,children:r===`link`?(0,Q.jsx)(s,{id:`uUCrBv`}):(0,Q.jsx)(s,{id:`iaPtht`})})})},t[78]=u,t[79]=a,t[80]=n,t[81]=se):se=t[81];let ce=se,le;t[82]===r?.customPlacements?le=t[83]:(le=r?.customPlacements??[],t[82]=r?.customPlacements,t[83]=le);let ue=new Map(le.map(Zn)),de=new Set(ue.keys());if(y.status===`ready`&&r){for(let e of y.data)if(e.scope===r.scope)for(let t of e.customPlacements??[]){let e=at(t);e!==``&&de.add(e)}}let fe=r===void 0?[]:[...de].sort().map(e=>({root:e,display:`${S}${e}/${r.name}`,placed:ue.get(e)??null})).filter(e=>!b.has(e.display)&&e.display!==N&&!(e.root in C)),pe;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Q.jsx)(s,{id:`npcziF`}),t[84]=pe):pe=t[84];let he;t[85]===u?he=t[86]:(he=u({id:`6f_UX4`}),t[85]=u,t[86]=he);let ge;t[87]===p?ge=t[88]:(ge=()=>p(),t[87]=p,t[88]=ge);let _e;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Q.jsx)(s,{id:`N40H-G`}),t[89]=_e):_e=t[89];let ve;t[90]!==E||t[91]!==ge?(ve=(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:E,onClick:ge,"data-testid":`skill-install-all`,children:_e}),t[90]=E,t[91]=ge,t[92]=ve):ve=t[92];let ye;t[93]!==he||t[94]!==ve?(ye=(0,Q.jsx)(Wn,{hint:he,children:ve}),t[93]=he,t[94]=ve,t[95]=ye):ye=t[95],t[96]!==l||t[97]!==ye?(k=(0,Q.jsxs)(En,{menuKind:l,className:`flex items-center justify-between gap-2`,children:[pe,ye]}),t[96]=l,t[97]=ye,t[98]=k):k=t[98],t[99]!==u||t[100]!==H||t[101]!==E||t[102]!==l||t[103]!==P||t[104]!==L?(A=P===null?null:(0,Q.jsx)(Wn,{hint:u({id:`pXB6SL`}),children:(0,Q.jsxs)(Tn,{menuKind:l,disabled:E,checked:!0,onSelect:Xn,"data-testid":`skill-source-row`,children:[(0,Q.jsx)(Je,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:P}),(()=>{let e=J(P).split(`/`).slice(0,-1).join(`/`),t=L(e);return t.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>H(t,e))}):null})(),(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(s,{id:`tiFPjk`})})]})]})}),t[99]=u,t[100]=H,t[101]=E,t[102]=l,t[103]=P,t[104]=L,t[105]=A):A=t[105];let be;t[106]!==u||t[107]!==H||t[108]!==E||t[109]!==B||t[110]!==G||t[111]!==ce||t[112]!==q||t[113]!==O||t[114]!==d||t[115]!==X||t[116]!==l||t[117]!==i||t[118]!==g||t[119]!==r?.hosts||t[120]!==F||t[121]!==L||t[122]!==f||t[123]!==n?(be=e=>{let t=g(e),a=e===`agents`?`.agents`:me[e],o=J(t).split(`/`).slice(0,-1).join(`/`),c=L(o);return(0,Q.jsx)(Wn,{hint:G.has(e)?u({id:`8HvJlU`,values:{0:t??a}}):e===F?t?u({id:`ssk6rl`,values:{path:t}}):a:d.has(e)?u(t?{id:`9ieZhu`,values:{path:t}}:{id:`n3T3EE`,values:{label:a}}):u(t?O===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}:{id:`Pp0Vgd`,values:{label:a}}),children:(0,Q.jsxs)(Tn,{menuKind:l,disabled:E,checked:d.has(e),onCheckedChange:t=>{G.has(e)||t===!0&&!B(o)||f(e,t===!0)},onSelect:Yn,className:`group`,"data-testid":`skill-install-editor-${e}`,children:[(0,Q.jsx)(m,{host:e,"aria-hidden":!0,className:`size-4`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:t??a}),c.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${e}`,children:c.map(e=>H(e,o))}):null,G.has(e)?(0,Q.jsx)(Wn,{hint:u({id:`_O7dJS`}),children:(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:t=>{t.preventDefault(),i?.(e)},"data-testid":`skill-fork-chip-${e}`,children:(0,Q.jsx)(s,{id:`jng7Ko`})})}):e===F?(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(s,{id:`tiFPjk`})}):d.has(e)&&r?.hosts?(0,Q.jsxs)(Q.Fragment,{children:[!E&&(X.has(e)?`link`:`copy`)!==O?ce(e,t??a,X.has(e)?`link`:`copy`):null,(0,Q.jsx)(Wn,{hint:u({id:`nBgzKO`}),children:(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e)},"data-testid":`skill-set-source-${e}`,children:(0,Q.jsx)(s,{id:`VNNRfN`})})})]}):null,!E&&q.has(J(t))?(0,Q.jsx)(Wn,{hint:u({id:`iz1LdD`}),children:(0,Q.jsx)(_,{testId:`skill-drift-${e}`})}):null]})]})},e)},t[106]=u,t[107]=H,t[108]=E,t[109]=B,t[110]=G,t[111]=ce,t[112]=q,t[113]=O,t[114]=d,t[115]=X,t[116]=l,t[117]=i,t[118]=g,t[119]=r?.hosts,t[120]=F,t[121]=L,t[122]=f,t[123]=n,t[124]=be):be=t[124],j=c.map(be);let xe;t[125]!==u||t[126]!==H||t[127]!==E||t[128]!==B||t[129]!==ce||t[130]!==q||t[131]!==O||t[132]!==l||t[133]!==L||t[134]!==n?(xe=e=>(0,Q.jsx)(Wn,{hint:e.placed===null?u(O===`link`?{id:`ybWWR2`,values:{0:e.display}}:{id:`fDjZxw`,values:{0:e.display}}):u({id:`C0cll5`,values:{0:e.display}}),children:(0,Q.jsxs)(Tn,{menuKind:l,disabled:E,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!B(e.root))return;n.placeAt(e.root,O)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:Jn,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,Q.jsx)(m,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,Q.jsx)(Je,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),L(e.root).length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-custom-${e.root}`,children:L(e.root).map(t=>H(t,e.root))}):null,!E&&e.placed!==null&&q.has(e.placed.path)?(0,Q.jsx)(Wn,{hint:u({id:`iz1LdD`}),children:(0,Q.jsx)(_,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,Q.jsxs)(Q.Fragment,{children:[!E&&e.placed.mode!==O?ce(e.root,e.display,e.placed.mode):null,(0,Q.jsx)(Wn,{hint:u({id:`nBgzKO`}),children:(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e.root)},"data-testid":`skill-set-source-custom-${e.root}`,children:(0,Q.jsx)(s,{id:`VNNRfN`})})})]})]})]})},e.root),t[125]=u,t[126]=H,t[127]=E,t[128]=B,t[129]=ce,t[130]=q,t[131]=O,t[132]=l,t[133]=L,t[134]=n,t[135]=xe):xe=t[135],M=fe.map(xe),t[14]=u,t[15]=C,t[16]=y.data,t[17]=y.status,t[18]=d,t[19]=x,t[20]=p,t[21]=T,t[22]=l,t[23]=i,t[24]=a,t[25]=g,t[26]=r,t[27]=f,t[28]=n,t[29]=E,t[30]=D,t[31]=O,t[32]=k,t[33]=A,t[34]=j,t[35]=M}else E=t[29],D=t[30],O=t[31],k=t[32],A=t[33],j=t[34],M=t[35];let N;t[136]!==u||t[137]!==E||t[138]!==D||t[139]!==O||t[140]!==a||t[141]!==n?(N=D.length>0&&n.convertLocations?(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-auto whitespace-normal p-0 text-left font-normal text-[11px] text-muted-foreground leading-snug hover:bg-transparent hover:text-foreground`,onClick:e=>{e.preventDefault();let t=O===`link`?`copy`:`link`,r=D.filter(e=>e.mode!==t);if(r.length===0)return;let i=u(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),o=u(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),s=r.map(qn).join(`
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{L as n,Sn as r,Vn as i,i as a}from"./DocumentContext-DQeqcbba.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./compiler-runtime-BfE3aGVn.js";import{s as u}from"./local-menu-action-bus-BKJCODnD.js";import{t as d}from"./utils-CPqDy6Hr.js";import{c as f,i as p,n as m,o as h,s as g,t as _}from"./ChangedOutsideBadge-B0as4qVr.js";import{t as v}from"./button-RQ5o7P7w.js";import{i as y,n as b,t as x}from"./tooltip-x7BNUa3s.js";import{a as S,c as C,i as w,n as T,o as E,r as D,s as O,t as k}from"./dialog-Bxcn1sLm.js";import{a as A,c as j,i as M,l as N,n as P,o as F,s as I,u as L}from"./context-menu-CYgsnEgV.js";import{a as R,d as z,f as B,i as V,n as H,o as U,p as W,u as G}from"./dropdown-menu-K4eCFwQy.js";import{t as ee}from"./label-BT2yjpKR.js";import{S as K,a as q,f as J,h as Y,i as te,m as X,n as ne,o as re,p as ie,r as ae,s as oe}from"./terminal-cli-display-BqUx5532.js";import{An as se,Bt as ce,Dn as le,Dt as ue,Ei as de,Fn as fe,Gt as pe,Ia as me,In as he,Ir as ge,Ln as _e,Mn as ve,On as ye,Pn as be,Wt as xe,an as Se,at as Ce,do as we,fn as Te,io as Ee,kn as De,ot as Oe,pn as ke,so as Ae,un as je}from"./dist-B6uhnkqb2.js";import{i as Me}from"./use-settings-route-Ln_W_o3I.js";import{t as Ne}from"./dist-DoS8xGN6.js";import{n as Z}from"./dist-Bkx5dDHT2.js";import{c as Pe,n as Fe,o as Ie}from"./documents-events-BE14yj3s.js";import{h as Le}from"./use-apply-config-color-theme-6RHjH1SX.js";import{t as Re}from"./parse-api-error-Mgtc4OJu.js";import{n as ze,t as Be}from"./workspace-paths-C2pS_Pbn.js";import{t as Ve}from"./use-workspace-C5uwuxa8.js";import{t as He}from"./createLucideIcon-6iYxif1u.js";import{t as Ue}from"./RegisteredAgentIcon-BgDInKA9.js";import{n as We,r as Ge}from"./ManagedArtifactProperties-CNkIjYyD.js";import{n as Ke}from"./CopyButton-DhHoiQJR.js";import{t as qe}from"./folder-open-CB-trByC.js";import{t as Je}from"./folder-C8rE1Soy.js";import{t as Ye}from"./list-plus-ByOuGBSE.js";import{t as Xe}from"./trash-2-CSpv7np3.js";import{t as Ze}from"./input-VnbFvuKd.js";import{J as Qe,q as $e,x as et}from"./navigation-targets-GITJ7Tz8.js";import{a as tt,c as nt,f as rt,n as it,r as at}from"./skill-scope-qH5lhviP.js";import{t as ot}from"./badge-zHd29IKW.js";import{A as st,C as ct,M as lt,a as ut,b as dt,k as ft,m as pt,n as mt,r as ht,t as gt,u as _t,w as vt,x as yt,y as bt}from"./skills-api-Dl_Mtb7L.js";import{t as xt}from"./use-skills-DyoXP6p3.js";import{t as St}from"./use-open-skill-DN4VQ0HP.js";import{n as Ct}from"./clipboard-adapter-DEJxizFj.js";import{t as wt}from"./DiffView-BjOsi4GM.js";var Q=t(),$=e(o(),1),Tt=l();function Et(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function Dt(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Re(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:Ne._({id:`1vn0CI`})}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:Ne._({id:`NoY1k4`})}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??Ne._({id:`MrUmCD`})}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Ot(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?Et(e):Dt()}var kt=`ok:skill:cowork:installed`,At=`1`,jt=250,Mt=`/api/skill/install-state`;function Nt(e){return`${kt}:v${e}`}var Pt=new Map;async function Ft(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Pt.get(n);if(r)return r;let i=It(e,t);return Pt.set(n,i),i.finally(()=>{Pt.get(n)===i&&Pt.delete(n)}),i}async function It(e,t){let n=e.installer===void 0?Ot():e.installer,r=Lt(e.storage),i=e.fetchSnapshot??zt,a=e.serverTimeoutMs??jt,o=null;if(!t.force){try{o=await Bt(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Nt(o?.currentVersion??e.fallbackSkillVersion??Rt());if(!t.force&&r?.getItem(s)===At)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,At)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Lt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Rt(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function zt(){let e;try{e=await fetch(Mt,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Bt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Vt(e){return Ft({},e)}function Ht(){return Ft({},{force:!0})}async function Ut(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function Wt(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Ut({target:`claude-cowork`,url:je({mode:`cowork`},e)},n);case`claude-code`:return Ut({target:`claude-code`,url:je({mode:`code`},e)},n);case`codex`:return Ut({target:`codex`,url:Te(e)},n);case`cursor`:return Ut({target:`cursor`,url:ke(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Gt(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var Kt=`open-knowledge:agent-thread-launch`;function qt(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(Kt,{detail:e}))}function Jt(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(Kt,n),()=>t.removeEventListener(Kt,n)}function Yt(e){if(!e.docName||!e.workspace)return null;let t=Be(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:ze(n,t,r)}}function Xt(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function Zt(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function Qt(e){return Y(e.installUrl).then(()=>void 0)}function $t(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function en(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function tn(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace;if(e.docName){let r=e.docRelativePath??Be(e.docName),i={scope:`doc`,docRelativePath:r,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?i:{...i,selection:e.selection},projectDir:t,docPath:ze(t,r,n)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function nn(e){return`Opened in ${e}.`}function rn(e,t=1){return t>=3?Ne._({id:`bi2C2s`,values:{displayName:e}}):t===2?Ne._({id:`1J0c0X`,values:{displayName:e}}):Ne._({id:`Xs7IcT`,values:{displayName:e}})}function an(e){return e>=3?null:e===2?Ne._({id:`Xp94R1`}):Ne._({id:`6gRgw8`})}function on(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function sn(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function cn(e,t,n,r){return e.compose?Se(sn(e.compose,t,n,r)):e.selection?be({...e.selection,target:t,transport:r}):e.skill?fe(e.skill.name,e.skill.scope,n):e.ask?le(e.ask.relativePath,e.ask.instruction,n,t,r):de(e.docContext===null?e.folderRelativePath?ve(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?De(n,e.instruction,r):ye(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):se(e.docContext.relativePath,n,e.instruction,r))}function ln(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${Ce} ${cn(e,xe[t].handoffTarget,!1,`terminal`)}`:he(e.docContext?.relativePath??null)}function un(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${Oe} ${cn(e,`claude-code`,!1,`terminal`)}`:_e(e.docContext?.relativePath??null)}function dn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function fn(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function pn(e,t){qt({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:un(e),docName:dn(e),titleHint:fn(e)})}async function mn(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(Ne._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(Ne._({id:`PezM4_`})),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(Ne._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:cn(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=on(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(nn(u));else{let i=an(r),a=rn(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{mn(e,t,n,r+1)}}})}return a}function hn(e){return ie.find(t=>t.id===e)?.displayName??e}function gn(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function _n(){return{dispatchHandoff:Wt,recordHandoff:Gt,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>gn(),getDisplayName:hn,ensureCoworkSkillInstalled:Vt,autoOpen:!0}}function vn(){let e=(0,Tt.c)(2),{merged:t}=Le(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>mn(e,t,{..._n(),autoOpen:n}),reinstallCoworkSkill:Ht},e[0]=n,e[1]=r),r}var yn=He(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),bn=He(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),xn=He(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Sn=He(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);function Cn(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(M,{...r}):(0,Q.jsx)(V,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function wn(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(A,{...r}):(0,Q.jsx)(R,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Tn(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(P,{...r}):(0,Q.jsx)(H,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function En(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(F,{...r}):(0,Q.jsx)(U,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function Dn(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(I,{...r}):(0,Q.jsx)(G,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function On(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(j,{...r}):(0,Q.jsx)(z,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function kn(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(N,{...r}):(0,Q.jsx)(B,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function An(e){let t=(0,Tt.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({menuKind:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=n===`context`?(0,Q.jsx)(L,{...r}):(0,Q.jsx)(W,{...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var jn=Object.freeze({hosts:null,source:null}),Mn=new Map,Nn=new Map;function Pn(e,t){return`${e}:${t}`}function Fn(e){return Mn.get(e)??jn}function In(e,t){let n=Nn.get(e)??new Set;return Nn.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&Nn.delete(e)}}function Ln(e,t){let n=Fn(e),r={...n,...t};if(!(r.hosts===n.hosts&&r.source===n.source)){r.hosts===null&&r.source===null?Mn.delete(e):Mn.set(e,r);for(let t of Nn.get(e)??[])t()}}var Rn=ce.options,zn=`min-w-[24rem]`;function Bn(e,t){let n=(0,Tt.c)(45),r=t.installingName===e.name,i=(0,$.useRef)(e),[a,o]=(0,$.useState)(!1),s=(0,$.useRef)(!1),c,l;n[0]===r?(c=n[1],l=n[2]):(c=()=>{s.current&&!r&&o(!0),s.current=r},l=[r],n[0]=r,n[1]=c,n[2]=l),(0,$.useEffect)(c,l);let u,d;n[3]===e?(u=n[4],d=n[5]):(u=()=>{e!==i.current&&(i.current=e,o(!1))},d=[e],n[3]=e,n[4]=u,n[5]=d),(0,$.useEffect)(u,d);let f=r||a,p;n[6]!==e.name||n[7]!==e.scope?(p=Pn(e.scope,e.name),n[6]=e.name,n[7]=e.scope,n[8]=p):p=n[8];let m=p,h,g;n[9]===m?(h=n[10],g=n[11]):(h=e=>In(m,e),g=()=>Fn(m),n[9]=m,n[10]=h,n[11]=g);let _=(0,$.useSyncExternalStore)(h,g),v=_.hosts,y=_.source,b,x;n[12]!==y||n[13]!==m||n[14]!==e.hosts?(b=()=>{y!==null&&e.hosts[0]===y&&Ln(m,{source:null})},x=[e.hosts,y,m],n[12]=y,n[13]=m,n[14]=e.hosts,n[15]=b,n[16]=x):(b=n[15],x=n[16]),(0,$.useEffect)(b,x);let S=e.linkMode===!0,C=v??e.hosts,w;n[17]===C?w=n[18]:(w=new Set(C),n[17]=C,n[18]=w);let T=w,E=v?v.length>0:e.installed,D=(0,$.useRef)(e.hosts),O,k;n[19]!==v||n[20]!==e.hosts?(O=()=>{v===null&&(D.current=e.hosts)},k=[v,e.hosts],n[19]=v,n[20]=e.hosts,n[21]=O,n[22]=k):(O=n[21],k=n[22]),(0,$.useEffect)(O,k);let A;n[23]===e.hosts?A=n[24]:(A=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=A);let j=A,M,N;n[25]!==m||n[26]!==j?(M=()=>{let e=Fn(m).hosts;e&&[...e].sort().join(`,`)===j&&Ln(m,{hosts:null})},N=[j,m],n[25]=m,n[26]=j,n[27]=M,n[28]=N):(M=n[27],N=n[28]),(0,$.useEffect)(M,N);let P=(0,$.useRef)(null),F=(0,$.useRef)(null),I,L;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{P.current&&clearTimeout(P.current),F.current?.(),F.current=null},L=[],n[29]=I,n[30]=L):(I=n[29],L=n[30]),(0,$.useEffect)(I,L);let R;n[31]!==t||n[32]!==m||n[33]!==e?(R=function(n,r){D.current=n,Ln(m,{hosts:n}),P.current&&clearTimeout(P.current);let i=async()=>{F.current=null,P.current=null;let r=await t.install(e,n.filter(ge));if(!r.ok){Ln(m,{hosts:null});return}D.current=[...r.hosts],Ln(m,{hosts:[...r.hosts]})};r?(F.current=()=>void i(),P.current=setTimeout(()=>void i(),350)):(F.current=null,i())},n[31]=t,n[32]=m,n[33]=e,n[34]=R):R=n[34];let z=R,B;return n[35]!==t||n[36]!==z||n[37]!==T||n[38]!==E||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(B={hostSet:T,installed:E,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),z([...n],!0)},installAll(){let t=D.current.filter(Un),n=e.installableEditors??Rn,r=Rn.filter(e=>n.includes(e)||D.current.includes(e));z([...t,...r],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>dt({scope:e.scope,name:e.name,dir:n,mode:r})).then(Hn)},unplaceAt(n){t.runLocationWrite(e,()=>st({scope:e.scope,name:e.name,path:n})).then(Vn)},setSource(n){Ln(m,{source:n}),t.runLocationWrite(e,()=>ft({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(Ln(m,{source:null}),Z.error(e.error))})},convertLocation(n,r){t.convertLocations(e,[{target:n,mode:r}])},convertLocations(n){t.convertLocations(e,n)}},n[35]=t,n[36]=z,n[37]=T,n[38]=E,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=B):B=n[44],B}function Vn(e){e.ok||Z.error(e.error)}function Hn(e){e.ok||Z.error(e.error)}function Un(e){return!Rn.includes(e)}function Wn(e){let t=(0,Tt.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Q.jsx)(y,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Q.jsx)(b,{side:`right`,className:`max-w-xs`,children:n}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(x,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Gn(e){let t=(0,Tt.c)(165),{toggles:n,skill:r,onResolveFork:i,onRunStart:a,menuKind:o}=e,l=o===void 0?`dropdown`:o,{_:u}=c(),{hostSet:d,toggleEditor:f,installAll:p}=n,h;t[0]===r?h=t[1]:(h=e=>r?`${nt(e,r.scope)}/${r.name}`:null,t[0]=r,t[1]=h);let g=h,y=xt(),b;t[2]!==y.data||t[3]!==y.status||t[4]!==r?(b=r!==void 0&&((r.hosts??[]).includes(`agents`)||y.status===`ready`&&y.data.some(rr)),t[2]=y.data,t[3]=y.status,t[4]=r,t[5]=b):b=t[5];let x=b,S;t[6]!==y.data||t[7]!==y.status||t[8]!==r?(S=r?.hostAliases??(r&&y.status===`ready`?Object.assign({},...y.data.filter(e=>e.scope===r.scope).map(nr)):{}),t[6]=y.data,t[7]=y.status,t[8]=r,t[9]=S):S=t[9];let C=S,w;t[10]!==y.data||t[11]!==y.status||t[12]!==r?(w=r?.installableEditors??(r&&y.status===`ready`?y.data.find(e=>e.scope===r.scope)?.installableEditors:void 0),t[10]=y.data,t[11]=y.status,t[12]=r,t[13]=w):w=t[13];let T=w,E,D,O,k,A,j,M;if(t[14]!==u||t[15]!==C||t[16]!==y.data||t[17]!==y.status||t[18]!==d||t[19]!==x||t[20]!==p||t[21]!==T||t[22]!==l||t[23]!==i||t[24]!==a||t[25]!==g||t[26]!==r||t[27]!==f||t[28]!==n){let e=T?new Set(T):null,o;t[36]===C?o=t[37]:(o=e=>!(e in C),t[36]=C,t[37]=o);let c=(x?[`agents`,...Rn]:Rn).filter(o).filter(t=>t===`agents`||e===null||e.has(t)||d.has(t)),h;t[38]===g?h=t[39]:(h=e=>g(e),t[38]=g,t[39]=h);let b=new Set(c.map(h)),S=r?.scope===`global`?`~/`:``,w;t[40]!==S||t[41]!==r?(w=r?.path?.includes(`/`)?`${S}${r.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,t[40]=S,t[41]=r,t[42]=w):w=t[42];let N=w,P=N!==null&&!b.has(N)?N:null,F=P===null?n.sourceHost??r?.hosts?.[0]:void 0,I;t[43]===C?I=t[44]:(I=e=>it(C,e),t[43]=C,t[44]=I);let L=I,R=tr,z;t[45]!==u||t[46]!==L?(z=e=>{let t=L(e);return t.length===0?!0:window.confirm(u({id:`Uobeu9`,values:{0:t.map(R).join(`, `),rootRel:e}}))},t[45]=u,t[46]=L,t[47]=z):z=t[47];let B=z,V;t[48]!==u||t[49]!==r?(V=(e,t)=>{let n=e.includes(`/`)?e:nt(e,r?.scope??`project`);return(0,Q.jsx)(Wn,{hint:u({id:`0dslv8`,values:{0:R(e),1:R(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":u({id:`G6Lrs_`,values:{0:R(e)}}),onClick:i=>{i.preventDefault(),i.stopPropagation(),window.confirm(u({id:`iiqOKM`,values:{0:R(e),1:r.name,2:R(e),subRoot:n,poolRootRel:t}}))&&yt({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?Ie():Z.error(u({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,Q.jsx)(m,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[48]=u,t[49]=r,t[50]=V):V=t[50];let H=V,U;t[51]===r?.conflictHosts?U=t[52]:(U=r?.conflictHosts??[],t[51]=r?.conflictHosts,t[52]=U);let W;t[53]===U?W=t[54]:(W=new Set(U),t[53]=U,t[54]=W);let G=W,ee;t[55]===r?.driftPaths?ee=t[56]:(ee=r?.driftPaths??[],t[55]=r?.driftPaths,t[56]=ee);let K;t[57]===ee?K=t[58]:(K=new Set(ee),t[57]=ee,t[58]=K);let q=K;E=n.installing;let J=er,Y;t[59]===r?.symlinkedHosts?Y=t[60]:(Y=r?.symlinkedHosts??[],t[59]=r?.symlinkedHosts,t[60]=Y);let te;t[61]===Y?te=t[62]:(te=new Set(Y),t[61]=Y,t[62]=te);let X=te,ne=[...[...d].filter(e=>e!==F&&!(e in C)&&!G.has(e)&&!e.includes(`/`)).map(e=>X.has(e)?`link`:`copy`),...(r?.customPlacements??[]).map($n)],re=ne.filter(Qn).length;O=ne.length===0?n.linkMode?`link`:`copy`:re*2>=ne.length?`link`:`copy`;let ie;t[63]!==C||t[64]!==G||t[65]!==d||t[66]!==X||t[67]!==g||t[68]!==F?(ie=[...d].filter(e=>e!==F&&!(e in C)&&!G.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:g(e)??R(e),mode:X.has(e)?`link`:`copy`})),t[63]=C,t[64]=G,t[65]=d,t[66]=X,t[67]=g,t[68]=F,t[69]=ie):ie=t[69];let ae;t[70]===r?.customPlacements?ae=t[71]:(ae=r?.customPlacements??[],t[70]=r?.customPlacements,t[71]=ae);let oe;if(t[72]!==S||t[73]!==ie||t[74]!==ae){let e;t[76]===S?e=t[77]:(e=e=>({target:at(e),display:`${S}${e.path}`,mode:e.mode}),t[76]=S,t[77]=e),oe=[...ie,...ae.map(e)],t[72]=S,t[73]=ie,t[74]=ae,t[75]=oe}else oe=t[75];D=oe;let se;t[78]!==u||t[79]!==a||t[80]!==n?(se=(e,t,r)=>{let i=r===`link`?`copy`:`link`;return(0,Q.jsx)(Wn,{hint:u(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 font-normal text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(u(i===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(a?.(),n.convertLocation?.(e,i))},"data-testid":`skill-convert-${e}`,children:r===`link`?(0,Q.jsx)(s,{id:`uUCrBv`}):(0,Q.jsx)(s,{id:`iaPtht`})})})},t[78]=u,t[79]=a,t[80]=n,t[81]=se):se=t[81];let ce=se,le;t[82]===r?.customPlacements?le=t[83]:(le=r?.customPlacements??[],t[82]=r?.customPlacements,t[83]=le);let ue=new Map(le.map(Zn)),de=new Set(ue.keys());if(y.status===`ready`&&r){for(let e of y.data)if(e.scope===r.scope)for(let t of e.customPlacements??[]){let e=at(t);e!==``&&de.add(e)}}let fe=r===void 0?[]:[...de].sort().map(e=>({root:e,display:`${S}${e}/${r.name}`,placed:ue.get(e)??null})).filter(e=>!b.has(e.display)&&e.display!==N&&!(e.root in C)),pe;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Q.jsx)(s,{id:`npcziF`}),t[84]=pe):pe=t[84];let he;t[85]===u?he=t[86]:(he=u({id:`6f_UX4`}),t[85]=u,t[86]=he);let ge;t[87]===p?ge=t[88]:(ge=()=>p(),t[87]=p,t[88]=ge);let _e;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Q.jsx)(s,{id:`N40H-G`}),t[89]=_e):_e=t[89];let ve;t[90]!==E||t[91]!==ge?(ve=(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:E,onClick:ge,"data-testid":`skill-install-all`,children:_e}),t[90]=E,t[91]=ge,t[92]=ve):ve=t[92];let ye;t[93]!==he||t[94]!==ve?(ye=(0,Q.jsx)(Wn,{hint:he,children:ve}),t[93]=he,t[94]=ve,t[95]=ye):ye=t[95],t[96]!==l||t[97]!==ye?(k=(0,Q.jsxs)(En,{menuKind:l,className:`flex items-center justify-between gap-2`,children:[pe,ye]}),t[96]=l,t[97]=ye,t[98]=k):k=t[98],t[99]!==u||t[100]!==H||t[101]!==E||t[102]!==l||t[103]!==P||t[104]!==L?(A=P===null?null:(0,Q.jsx)(Wn,{hint:u({id:`pXB6SL`}),children:(0,Q.jsxs)(Tn,{menuKind:l,disabled:E,checked:!0,onSelect:Xn,"data-testid":`skill-source-row`,children:[(0,Q.jsx)(Je,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:P}),(()=>{let e=J(P).split(`/`).slice(0,-1).join(`/`),t=L(e);return t.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>H(t,e))}):null})(),(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(s,{id:`tiFPjk`})})]})]})}),t[99]=u,t[100]=H,t[101]=E,t[102]=l,t[103]=P,t[104]=L,t[105]=A):A=t[105];let be;t[106]!==u||t[107]!==H||t[108]!==E||t[109]!==B||t[110]!==G||t[111]!==ce||t[112]!==q||t[113]!==O||t[114]!==d||t[115]!==X||t[116]!==l||t[117]!==i||t[118]!==g||t[119]!==r?.hosts||t[120]!==F||t[121]!==L||t[122]!==f||t[123]!==n?(be=e=>{let t=g(e),a=e===`agents`?`.agents`:me[e],o=J(t).split(`/`).slice(0,-1).join(`/`),c=L(o);return(0,Q.jsx)(Wn,{hint:G.has(e)?u({id:`8HvJlU`,values:{0:t??a}}):e===F?t?u({id:`ssk6rl`,values:{path:t}}):a:d.has(e)?u(t?{id:`9ieZhu`,values:{path:t}}:{id:`n3T3EE`,values:{label:a}}):u(t?O===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}:{id:`Pp0Vgd`,values:{label:a}}),children:(0,Q.jsxs)(Tn,{menuKind:l,disabled:E,checked:d.has(e),onCheckedChange:t=>{G.has(e)||t===!0&&!B(o)||f(e,t===!0)},onSelect:Yn,className:`group`,"data-testid":`skill-install-editor-${e}`,children:[(0,Q.jsx)(m,{host:e,"aria-hidden":!0,className:`size-4`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:t??a}),c.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${e}`,children:c.map(e=>H(e,o))}):null,G.has(e)?(0,Q.jsx)(Wn,{hint:u({id:`_O7dJS`}),children:(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:t=>{t.preventDefault(),i?.(e)},"data-testid":`skill-fork-chip-${e}`,children:(0,Q.jsx)(s,{id:`jng7Ko`})})}):e===F?(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(s,{id:`tiFPjk`})}):d.has(e)&&r?.hosts?(0,Q.jsxs)(Q.Fragment,{children:[!E&&(X.has(e)?`link`:`copy`)!==O?ce(e,t??a,X.has(e)?`link`:`copy`):null,(0,Q.jsx)(Wn,{hint:u({id:`nBgzKO`}),children:(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e)},"data-testid":`skill-set-source-${e}`,children:(0,Q.jsx)(s,{id:`VNNRfN`})})})]}):null,!E&&q.has(J(t))?(0,Q.jsx)(Wn,{hint:u({id:`iz1LdD`}),children:(0,Q.jsx)(_,{testId:`skill-drift-${e}`})}):null]})]})},e)},t[106]=u,t[107]=H,t[108]=E,t[109]=B,t[110]=G,t[111]=ce,t[112]=q,t[113]=O,t[114]=d,t[115]=X,t[116]=l,t[117]=i,t[118]=g,t[119]=r?.hosts,t[120]=F,t[121]=L,t[122]=f,t[123]=n,t[124]=be):be=t[124],j=c.map(be);let xe;t[125]!==u||t[126]!==H||t[127]!==E||t[128]!==B||t[129]!==ce||t[130]!==q||t[131]!==O||t[132]!==l||t[133]!==L||t[134]!==n?(xe=e=>(0,Q.jsx)(Wn,{hint:e.placed===null?u(O===`link`?{id:`ybWWR2`,values:{0:e.display}}:{id:`fDjZxw`,values:{0:e.display}}):u({id:`C0cll5`,values:{0:e.display}}),children:(0,Q.jsxs)(Tn,{menuKind:l,disabled:E,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!B(e.root))return;n.placeAt(e.root,O)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:Jn,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,Q.jsx)(m,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,Q.jsx)(Je,{"aria-hidden":!0,className:`size-4 text-muted-foreground`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.display}),L(e.root).length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-custom-${e.root}`,children:L(e.root).map(t=>H(t,e.root))}):null,!E&&e.placed!==null&&q.has(e.placed.path)?(0,Q.jsx)(Wn,{hint:u({id:`iz1LdD`}),children:(0,Q.jsx)(_,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,Q.jsxs)(Q.Fragment,{children:[!E&&e.placed.mode!==O?ce(e.root,e.display,e.placed.mode):null,(0,Q.jsx)(Wn,{hint:u({id:`nBgzKO`}),children:(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e.root)},"data-testid":`skill-set-source-custom-${e.root}`,children:(0,Q.jsx)(s,{id:`VNNRfN`})})})]})]})]})},e.root),t[125]=u,t[126]=H,t[127]=E,t[128]=B,t[129]=ce,t[130]=q,t[131]=O,t[132]=l,t[133]=L,t[134]=n,t[135]=xe):xe=t[135],M=fe.map(xe),t[14]=u,t[15]=C,t[16]=y.data,t[17]=y.status,t[18]=d,t[19]=x,t[20]=p,t[21]=T,t[22]=l,t[23]=i,t[24]=a,t[25]=g,t[26]=r,t[27]=f,t[28]=n,t[29]=E,t[30]=D,t[31]=O,t[32]=k,t[33]=A,t[34]=j,t[35]=M}else E=t[29],D=t[30],O=t[31],k=t[32],A=t[33],j=t[34],M=t[35];let N;t[136]!==u||t[137]!==E||t[138]!==D||t[139]!==O||t[140]!==a||t[141]!==n?(N=D.length>0&&n.convertLocations?(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,className:`h-auto whitespace-normal p-0 text-left font-normal text-[11px] text-muted-foreground leading-snug hover:bg-transparent hover:text-foreground`,onClick:e=>{e.preventDefault();let t=O===`link`?`copy`:`link`,r=D.filter(e=>e.mode!==t);if(r.length===0)return;let i=u(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),o=u(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),s=r.map(qn).join(`
|
|
2
2
|
`);window.confirm(`${i}\n\n${o}\n\n${s}\n\n${u({id:`Cu6GXQ`})}`)&&(a?.(),n.convertLocations?.(r.map(e=>({target:e.target,mode:t}))))},disabled:E,"data-testid":`skill-convert-all`,children:O===`link`?(0,Q.jsx)(s,{id:`rcJmK8`}):(0,Q.jsx)(s,{id:`LBv_TR`})}),(0,Q.jsx)(Wn,{hint:u({id:`0J6nhG`}),children:(0,Q.jsx)(v,{variant:`ghost`,size:`sm`,"aria-label":u({id:`qJSo0_`}),className:`size-4 shrink-0 rounded-full border border-border/60 p-0 font-normal text-[9px] text-muted-foreground hover:border-foreground/40 hover:bg-transparent hover:text-foreground`,onClick:Kn,"data-testid":`skill-convert-all-help`,children:`?`})})]}):null,t[136]=u,t[137]=E,t[138]=D,t[139]=O,t[140]=a,t[141]=n,t[142]=N):N=t[142];let P;t[143]===l?P=t[144]:(P=(0,Q.jsx)(Dn,{menuKind:l}),t[143]=l,t[144]=P);let F;t[145]===u?F=t[146]:(F=u({id:`jqe7Yq`}),t[145]=u,t[146]=F);let I;t[147]===r?.scope?I=t[148]:(I=()=>{window.location.hash=r?.scope===`global`?`#settings/user-skills`:`#settings/skills`},t[147]=r?.scope,t[148]=I);let L,R;t[149]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(Sn,{"aria-hidden":!0}),R=(0,Q.jsx)(s,{id:`ZBF9fn`}),t[149]=L,t[150]=R):(L=t[149],R=t[150]);let z;t[151]!==l||t[152]!==I?(z=(0,Q.jsxs)(wn,{menuKind:l,onSelect:I,children:[L,R]}),t[151]=l,t[152]=I,t[153]=z):z=t[153];let B;t[154]!==F||t[155]!==z?(B=(0,Q.jsx)(Wn,{hint:F,children:z}),t[154]=F,t[155]=z,t[156]=B):B=t[156];let V;return t[157]!==N||t[158]!==P||t[159]!==B||t[160]!==k||t[161]!==A||t[162]!==j||t[163]!==M?(V=(0,Q.jsxs)(Q.Fragment,{children:[k,A,j,M,N,P,B]}),t[157]=N,t[158]=P,t[159]=B,t[160]=k,t[161]=A,t[162]=j,t[163]=M,t[164]=V):V=t[164],V}function Kn(e){return e.preventDefault()}function qn(e){return e.display}function Jn(e){return e.preventDefault()}function Yn(e){return e.preventDefault()}function Xn(e){return e.preventDefault()}function Zn(e){return[at(e),e]}function Qn(e){return e===`link`}function $n(e){return e.mode}function er(e){return(e??``).replace(/^~\//,``)}function tr(e){return e===`agents`?`.agents`:me[e]??e}function nr(e){return e.hostAliases??{}}function rr(e){return e.hosts.includes(`agents`)||e.path.startsWith(`.agents/`)}function ir(e){let t=(0,Tt.c)(23),{onAddProperty:n,className:r,problemCount:i,problemMessages:a}=e,o=i===void 0?0:i,{_:l}=c(),u=o>0,f;t[0]!==l||t[1]!==u||t[2]!==o?(f=l(u?{id:`3KOHFt`,values:{problemCount:o}}:{id:`81H_23`}),t[0]=l,t[1]=u,t[2]=o,t[3]=f):f=t[3];let p=f,m;t[4]===r?m=t[5]:(m=d(`relative`,r),t[4]=r,t[5]=m);let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(Ye,{}),t[6]=h):h=t[6];let g;t[7]!==u||t[8]!==o?(g=u?(0,Q.jsx)(ot,{variant:`notification`,"aria-hidden":`true`,"data-testid":`add-properties-problem-badge`,className:`pointer-events-none absolute -top-0.5 -right-0.5 size-3.5 rounded-full p-0 font-sans text-[9px] leading-none tabular-nums`,children:o>9?`9+`:o}):null,t[7]=u,t[8]=o,t[9]=g):g=t[9];let _;t[10]===g?_=t[11]:(_=(0,Q.jsxs)(y,{children:[h,g]}),t[10]=g,t[11]=_);let S;t[12]!==p||t[13]!==n||t[14]!==m||t[15]!==_?(S=(0,Q.jsx)(v,{variant:`ghost`,size:`icon`,"aria-label":p,onClick:n,"data-testid":`add-properties-button`,className:m,asChild:!0,children:_}),t[12]=p,t[13]=n,t[14]=m,t[15]=_,t[16]=S):S=t[16];let C;t[17]!==u||t[18]!==a?(C=(0,Q.jsx)(b,{side:`bottom`,children:u?(0,Q.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:(0,Q.jsx)(s,{id:`AwrGuz`})}),a?.map(ar),(0,Q.jsx)(`span`,{className:`pt-0.5 opacity-70`,children:(0,Q.jsx)(s,{id:`yh5-4s`})})]}):(0,Q.jsx)(s,{id:`81H_23`})}),t[17]=u,t[18]=a,t[19]=C):C=t[19];let w;return t[20]!==S||t[21]!==C?(w=(0,Q.jsxs)(x,{children:[S,C]}),t[20]=S,t[21]=C,t[22]=w):w=t[22],w}function ar(e,t){return(0,Q.jsx)(`span`,{className:`opacity-90`,children:e},t)}function or(e){return e?Ne._({id:`wTcjov`}):null}function sr(e){let t=(0,Tt.c)(46),{_:i}=c(),a=n(),o=h(),l=K(),d=J();if(a)return null;let{input:f,installStates:p,dispatch:m}=e,g=f===null,_,v,y,b,x,S,C,w,T,E,D;if(t[0]!==i||t[1]!==m||t[2]!==f||t[3]!==g||t[4]!==p||t[5]!==d||t[6]!==l||t[7]!==o){let e=or(g),n;t[19]===d?n=t[20]:(n=e=>q(d,e.id),t[19]=d,t[20]=n);let a=X.filter(n),c;t[21]===d?c=t[22]:(c=e=>re(d,e.source,e.id,!0,e.supported),t[21]=d,t[22]=c);let u=l.filter(c),h=o?pe.filter(e=>oe(d,e,o.installedClis)):[];y=a.length>0,b=o!==null&&h.length>0,x=u.length>0,v=j,t[23]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsxs)(L,{children:[(0,Q.jsx)(r,{"aria-hidden":`true`}),(0,Q.jsx)(s,{id:`O7_W_a`})]}),t[23]=D):D=t[23],_=N,S=`max-h-80`,C=x?(0,Q.jsxs)(M,{"aria-label":i({id:`vPKX2i`}),children:[(0,Q.jsxs)(F,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(s,{id:`RXEbZy`}),(0,Q.jsx)(te,{})]}),u.map(t=>{let n=t.name;return(0,Q.jsxs)(A,{onSelect:()=>{f!==null&&pn(f,{agent:{source:t.source,id:t.id}})},disabled:g,"data-testid":`empty-space-open-in-thread-${t.id}`,"aria-label":e?i({id:`gtGQ9S`,values:{agentName:n,hint:e}}):void 0,children:[(0,Q.jsx)(Ue,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(s,{id:`5PrrYw`,values:{agentName:n}})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[24]!==y||t[25]!==b||t[26]!==x?(w=x&&(b||y)?(0,Q.jsx)(I,{}):null,t[24]=y,t[25]=b,t[26]=x,t[27]=w):w=t[27],T=b?(0,Q.jsxs)(M,{"aria-label":i({id:`ALhMYW`}),children:[(0,Q.jsx)(F,{children:(0,Q.jsx)(s,{id:`ALhMYW`})}),h.map(t=>{let{displayName:n}=xe[t];return(0,Q.jsxs)(A,{onSelect:()=>{f!==null&&o.launchInTerminal(f,t)},disabled:g,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":i(e?{id:`AIn2Yv`,values:{displayName:n,hint:e}}:{id:`QYfQdv`,values:{displayName:n}}),children:[(0,Q.jsx)(ae,{id:ne(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:n}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,E=y?(0,Q.jsxs)(Q.Fragment,{children:[b?(0,Q.jsx)(I,{}):null,(0,Q.jsxs)(M,{"aria-label":i({id:`BBqGS9`}),children:[(0,Q.jsx)(F,{children:(0,Q.jsx)(s,{id:`BBqGS9`})}),a.map(t=>{let n=!g,{displayName:r}=t,a=i(e?{id:`1ZpfyB`,values:{displayName:r,hint:e}}:{id:`WqLq6M`,values:{displayName:r}});return(0,Q.jsxs)(A,{disabled:!n,onSelect:()=>{if(f){if(p[t.id]?.installed!==!0){Qt(t);return}m(t.id,f)}},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(ae,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=i,t[1]=m,t[2]=f,t[3]=g,t[4]=p,t[5]=d,t[6]=l,t[7]=o,t[8]=_,t[9]=v,t[10]=y,t[11]=b,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D}else _=t[8],v=t[9],y=t[10],b=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18];let O;t[28]!==y||t[29]!==b||t[30]!==x?(O=x||b||y?(0,Q.jsx)(I,{}):null,t[28]=y,t[29]=b,t[30]=x,t[31]=O):O=t[31];let k;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(u,{"aria-hidden":`true`}),t[32]=k):k=t[32];let P;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsxs)(A,{onSelect:Me,"data-testid":`empty-space-open-in-settings`,children:[k,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(s,{id:`jRAGrQ`})})]}),t[33]=P):P=t[33];let R;t[34]!==_||t[35]!==S||t[36]!==C||t[37]!==w||t[38]!==T||t[39]!==E||t[40]!==O?(R=(0,Q.jsxs)(_,{className:S,children:[C,w,T,E,O,P]}),t[34]=_,t[35]=S,t[36]=C,t[37]=w,t[38]=T,t[39]=E,t[40]=O,t[41]=R):R=t[41];let z;return t[42]!==v||t[43]!==D||t[44]!==R?(z=(0,Q.jsxs)(v,{children:[D,R]}),t[42]=v,t[43]=D,t[44]=R,t[45]=z):z=t[45],z}function cr(e){return e===`darwin`?Ne._({id:`LtSYdi`}):e===`win32`?Ne._({id:`qi1F96`}):Ne._({id:`e1Rn_k`})}function lr(e){return e?Ne._({id:`wTcjov`}):null}function ur(e){let t=(0,Tt.c)(47),{_:i}=c(),a=n(),o=h(),l=K(),d=J();if(a)return null;let{input:f,installStates:p,dispatch:m,onBeforeLaunch:g}=e,_=f===null,v,y,b,x,S,C,w,T,E,D,O;if(t[0]!==i||t[1]!==m||t[2]!==f||t[3]!==_||t[4]!==p||t[5]!==g||t[6]!==d||t[7]!==l||t[8]!==o){let e=lr(_),n;t[20]===d?n=t[21]:(n=e=>q(d,e.id),t[20]=d,t[21]=n);let a=X.filter(n),c;t[22]===d?c=t[23]:(c=e=>re(d,e.source,e.id,!0,e.supported),t[22]=d,t[23]=c);let u=l.filter(c),h=o?pe.filter(e=>oe(d,e,o.installedClis)):[];b=a.length>0,x=o!==null&&h.length>0,S=u.length>0,y=z,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsxs)(W,{children:[(0,Q.jsx)(r,{"aria-hidden":`true`}),(0,Q.jsx)(s,{id:`O7_W_a`})]}),t[24]=O):O=t[24],v=B,C=`max-h-80`,w=S?(0,Q.jsxs)(V,{"aria-label":i({id:`vPKX2i`}),children:[(0,Q.jsxs)(U,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(s,{id:`RXEbZy`}),(0,Q.jsx)(te,{})]}),u.map(t=>{let n=t.name;return(0,Q.jsxs)(R,{onSelect:()=>{f!==null&&(g?.(),pn(f,{agent:{source:t.source,id:t.id}}))},disabled:_,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":e?i({id:`gtGQ9S`,values:{agentName:n,hint:e}}):void 0,children:[(0,Q.jsx)(Ue,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(s,{id:`5PrrYw`,values:{agentName:n}})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==b||t[26]!==x||t[27]!==S?(T=S&&(x||b)?(0,Q.jsx)(G,{}):null,t[25]=b,t[26]=x,t[27]=S,t[28]=T):T=t[28],E=x?(0,Q.jsxs)(V,{"aria-label":i({id:`ALhMYW`}),children:[(0,Q.jsx)(U,{children:(0,Q.jsx)(s,{id:`ALhMYW`})}),h.map(t=>{let{displayName:n}=xe[t];return(0,Q.jsxs)(R,{onSelect:()=>{f!==null&&(g?.(),o.launchInTerminal(f,t))},disabled:_,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":i(e?{id:`AIn2Yv`,values:{displayName:n,hint:e}}:{id:`QYfQdv`,values:{displayName:n}}),children:[(0,Q.jsx)(ae,{id:ne(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:n}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,D=b?(0,Q.jsxs)(Q.Fragment,{children:[x?(0,Q.jsx)(G,{}):null,(0,Q.jsxs)(V,{"aria-label":i({id:`BBqGS9`}),children:[(0,Q.jsx)(U,{children:(0,Q.jsx)(s,{id:`BBqGS9`})}),a.map(t=>{let n=!_,{displayName:r}=t,a=i(e?{id:`1ZpfyB`,values:{displayName:r,hint:e}}:{id:`WqLq6M`,values:{displayName:r}});return(0,Q.jsxs)(R,{disabled:!n,onSelect:()=>{if(f){if(g?.(),p[t.id]?.installed!==!0){Qt(t);return}m(t.id,f)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(ae,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=i,t[1]=m,t[2]=f,t[3]=_,t[4]=p,t[5]=g,t[6]=d,t[7]=l,t[8]=o,t[9]=v,t[10]=y,t[11]=b,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D,t[19]=O}else v=t[9],y=t[10],b=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18],O=t[19];let k;t[29]!==b||t[30]!==x||t[31]!==S?(k=S||x||b?(0,Q.jsx)(G,{}):null,t[29]=b,t[30]=x,t[31]=S,t[32]=k):k=t[32];let A;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(u,{"aria-hidden":`true`}),t[33]=A):A=t[33];let j;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsxs)(R,{onSelect:Me,"data-testid":`file-tree-open-in-settings`,children:[A,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(s,{id:`jRAGrQ`})})]}),t[34]=j):j=t[34];let M;t[35]!==v||t[36]!==C||t[37]!==w||t[38]!==T||t[39]!==E||t[40]!==D||t[41]!==k?(M=(0,Q.jsxs)(v,{className:C,children:[w,T,E,D,k,j]}),t[35]=v,t[36]=C,t[37]=w,t[38]=T,t[39]=E,t[40]=D,t[41]=k,t[42]=M):M=t[42];let N;return t[43]!==y||t[44]!==O||t[45]!==M?(N=(0,Q.jsxs)(y,{children:[O,M]}),t[43]=y,t[44]=O,t[45]=M,t[46]=N):N=t[46],N}function dr(e){let t=Ae(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=Ee(e);return n?{scope:`global`,name:n.name,rel:n.rel}:null}function fr(e,t,n){return e.filter(e=>{let r=et(e);if(r.kind===`skill-file`)return r.scope===t&&r.name===n;if(r.kind!==`doc`)return!1;let i=dr(r.docName);return i?.scope===t&&i.name===n})}function pr(e,t,n){let r=$e(t,n);return e.filter(e=>{let i=et(e);return i.kind===`skill-file`?i.scope===t.scope&&i.name===t.name&&i.path===n:i.kind===`doc`&&i.docName===r})}function mr(e,t,n){let r=dr(e);if(!r||r.rel===null)return null;let i=t.find(e=>e.scope===r.scope&&e.name===r.name);if(!i||i.managed)return null;let a=`references/${r.rel}${n}`;return $e(i,a)===e?{skill:i,filePath:a}:null}function hr(e,t){let n=new Map(t.map(e=>[`${e.scope}\u0000${e.name}`,e])),r=[];for(let t of e){let e=dr(t);if(!e||n.has(`${e.scope}\u0000${e.name}`))continue;let i=e.scope===`project`?`global`:`project`,a=n.get(`${i}\u0000${e.name}`);e.rel===null&&a!==void 0?r.push({kind:`retarget`,fromDocName:t,toDocName:Qe(a)}):r.push({kind:`close`,docName:t})}return r}function gr(){let e=(0,Tt.c)(15),{openTabs:t,closeDocument:n}=a(),r=We(),i;e[0]===t?i=e[1]:(i=t.some(vr),e[0]=t,e[1]=i);let o=i,s;e[2]===o?s=e[3]:(s={enabled:o},e[2]=o,e[3]=s);let c=xt(s),l=(0,$.useRef)(null),u;e[4]!==n||e[5]!==t||e[6]!==r||e[7]!==c.data||e[8]!==c.status?(u=()=>{if(c.status!==`ready`)return;let e=c.data,i=`${t.join(``)}\u0002${e.map(_r).sort().join(``)}`;if(l.current===i)return;l.current=i;let a=hr(t,e);for(let e of a)e.kind===`retarget`?r(e.fromDocName,e.toDocName):n(e.docName)},e[4]=n,e[5]=t,e[6]=r,e[7]=c.data,e[8]=c.status,e[9]=u):u=e[9];let d;e[10]!==n||e[11]!==t||e[12]!==r||e[13]!==c?(d=[c,t,r,n],e[10]=n,e[11]=t,e[12]=r,e[13]=c,e[14]=d):d=e[14],(0,$.useEffect)(u,d)}function _r(e){return`${e.scope}\u0000${e.name}`}function vr(e){return dr(e)!==null}function yr(e){let t=(0,Tt.c)(19),{skill:n,onOpenChange:r,onDeleted:i}=e,{_:o}=c(),{setSkillsSidebar:s,closeTabs:l,openTabs:u}=a(),[d,f]=(0,$.useState)(!1),m;t[0]!==o||t[1]!==l||t[2]!==i||t[3]!==r||t[4]!==u||t[5]!==s?(m=async function(e){s(!0),f(!0);let t=await mt(e.scope,e.name);if(f(!1),!t.ok){let{error:e}=t;Z.error(o({id:`AtBdnD`,values:{error:e}}));return}Z.success(o({id:`h9QFb9`,values:{0:e.name}})),l(fr(u,e.scope,e.name),{force:!0}),i(),r(!1)},t[0]=o,t[1]=l,t[2]=i,t[3]=r,t[4]=u,t[5]=s,t[6]=m):m=t[6];let h=m,g=n!==null,_;t[7]!==d||t[8]!==r?(_=e=>{!e&&!d&&r(!1)},t[7]=d,t[8]=r,t[9]=_):_=t[9];let v;t[10]!==o||t[11]!==d||t[12]!==h||t[13]!==n?(v=n?(0,Q.jsx)(p,{itemName:o({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:d,onDelete:()=>h(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?o({id:`WnsbUT`,values:{0:n.path}}):o({id:`E1Da_b`,values:{0:n.path}})}):null,t[10]=o,t[11]=d,t[12]=h,t[13]=n,t[14]=v):v=t[14];let y;return t[15]!==g||t[16]!==_||t[17]!==v?(y=(0,Q.jsx)(k,{open:g,onOpenChange:_,children:v}),t[15]=g,t[16]=_,t[17]=v,t[18]=y):y=t[18],y}function br(e){let t=e.split(`/`);return t.some(e=>e===``||e===`.`||e===`..`)||t.length===0||t.length===1&&t[0].toLowerCase()===`skill.md`?!1:!/\s/.test(e)}function xr(e){let t=(0,Tt.c)(66),{target:n,onOpenChange:r}=e,{_:i}=c(),{openTarget:o}=a(),l=(0,$.useId)(),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.prefix??`references/`)},t[0]=n,t[1]=m);let h=n?.skill.scope,g=n?.skill.name,_=n?.prefix,y;if(t[2]!==h||t[3]!==g||t[4]!==_?(y=[h,g,_],t[2]=h,t[3]=g,t[4]=_,t[5]=y):y=t[5],(0,$.useEffect)(m,y),!n)return null;let b,x,T,D;t[6]!==u||t[7]!==f?(D=u.trim(),x=D===``||!br(D),b=!x&&!f,T=D.includes(`/`)?D.split(`/`).slice(0,-1).join(`/`):null,t[6]=u,t[7]=f,t[8]=b,t[9]=x,t[10]=T,t[11]=D):(b=t[8],x=t[9],T=t[10],D=t[11]);let A=T,j;t[12]!==i||t[13]!==b||t[14]!==r||t[15]!==o||t[16]!==n||t[17]!==D?(j=async function(){if(!n||!b)return;p(!0);let e=/\.mdx?$/i.test(D),t=await lt({scope:n.skill.scope,name:n.skill.name,path:D,content:e?`# ${D.split(`/`).pop()?.replace(/\.mdx?$/i,``)??``}\n`:``});if(p(!1),!t.ok){Z.error(i({id:`a_2_uB`,values:{0:t.error,trimmed:D}}));return}if(Z.success(i({id:`MXSt4t`,values:{0:t.path}})),e){let e=$e(n.skill,D);o({kind:`doc`,target:e,docName:e})}r(!1)},t[12]=i,t[13]=b,t[14]=r,t[15]=o,t[16]=n,t[17]=D,t[18]=j):j=t[18];let M=j,N;t[19]!==r||t[20]!==f?(N=e=>{!e&&!f&&r(!1)},t[19]=r,t[20]=f,t[21]=N):N=t[21];let P;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(C,{children:(0,Q.jsx)(s,{id:`wQvvZY`})}),t[22]=P):P=t[22];let F;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsxs)(O,{children:[P,(0,Q.jsx)(S,{children:(0,Q.jsx)(s,{id:`lM4c-I`})})]}),t[23]=F):F=t[23];let I;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(s,{id:`I6gXOa`}),t[24]=I):I=t[24];let L;t[25]===l?L=t[26]:(L=(0,Q.jsx)(ee,{htmlFor:l,children:I}),t[25]=l,t[26]=L);let R;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>d(e.target.value),t[27]=R):R=t[27];let z=x&&D!==``,B;t[28]===M?B=t[29]:(B=e=>{e.key===`Enter`&&M()},t[28]=M,t[29]=B);let V;t[30]!==l||t[31]!==u||t[32]!==z||t[33]!==B?(V=(0,Q.jsx)(Ze,{id:l,value:u,onChange:R,placeholder:`references/notes.md`,"aria-invalid":z,onKeyDown:B}),t[30]=l,t[31]=u,t[32]=z,t[33]=B,t[34]=V):V=t[34];let H;t[35]!==A||t[36]!==x||t[37]!==D?(H=x&&D!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(s,{id:`fVzizW`})}):A?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(s,{id:`9lso1Y`,values:{folderPart:A},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):null,t[35]=A,t[36]=x,t[37]=D,t[38]=H):H=t[38];let U;t[39]!==L||t[40]!==V||t[41]!==H?(U=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[L,V,H]}),t[39]=L,t[40]=V,t[41]=H,t[42]=U):U=t[42];let W;t[43]===r?W=t[44]:(W=()=>r(!1),t[43]=r,t[44]=W);let G;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(s,{id:`dEgA5A`}),t[45]=G):G=t[45];let K;t[46]!==f||t[47]!==W?(K=(0,Q.jsx)(v,{variant:`outline`,onClick:W,disabled:f,children:G}),t[46]=f,t[47]=W,t[48]=K):K=t[48];let q;t[49]===M?q=t[50]:(q=()=>void M(),t[49]=M,t[50]=q);let J=!b,Y;t[51]===f?Y=t[52]:(Y=f?(0,Q.jsx)(s,{id:`E9bKSA`}):(0,Q.jsx)(s,{id:`hYgDIe`}),t[51]=f,t[52]=Y);let te;t[53]!==q||t[54]!==J||t[55]!==Y?(te=(0,Q.jsx)(v,{onClick:q,disabled:J,children:Y}),t[53]=q,t[54]=J,t[55]=Y,t[56]=te):te=t[56];let X;t[57]!==K||t[58]!==te?(X=(0,Q.jsxs)(E,{children:[K,te]}),t[57]=K,t[58]=te,t[59]=X):X=t[59];let ne;t[60]!==U||t[61]!==X?(ne=(0,Q.jsxs)(w,{className:`sm:max-w-md`,children:[F,U,X]}),t[60]=U,t[61]=X,t[62]=ne):ne=t[62];let re;return t[63]!==ne||t[64]!==N?(re=(0,Q.jsx)(k,{open:!0,onOpenChange:N,children:ne}),t[63]=ne,t[64]=N,t[65]=re):re=t[65],re}function Sr(e){let t=(0,Tt.c)(18),{target:n,onOpenChange:r}=e,{_:i}=c(),{setSkillsSidebar:o,closeTabs:s,openTabs:l}=a(),[u,d]=(0,$.useState)(!1),f;t[0]!==i||t[1]!==s||t[2]!==r||t[3]!==l||t[4]!==o?(f=async function(e){let{skill:t,filePath:n}=e;o(!0),d(!0);let a=await ht({scope:t.scope,name:t.name,path:n});if(d(!1),!a.ok){Z.error(i({id:`CBT70t`,values:{0:a.error}}));return}if(!a.existed){Z.error(i({id:`q4efaG`,values:{filePath:n}})),r(!1);return}Z.success(i({id:`gOmloS`,values:{filePath:n}})),s(pr(l,t,n),{force:!0}),r(!1)},t[0]=i,t[1]=s,t[2]=r,t[3]=l,t[4]=o,t[5]=f):f=t[5];let m=f,h=n!==null,g;t[6]!==u||t[7]!==r?(g=e=>{!e&&!u&&r(!1)},t[6]=u,t[7]=r,t[8]=g):g=t[8];let _;t[9]!==i||t[10]!==u||t[11]!==m||t[12]!==n?(_=n?(0,Q.jsx)(p,{itemName:i({id:`wZPUJx`,values:{0:n.filePath}}),isSubmitting:u,onDelete:()=>m(n),customDescription:i({id:`ppzof_`,values:{0:tt(n.skill.path),1:n.filePath,2:n.skill.name}})}):null,t[9]=i,t[10]=u,t[11]=m,t[12]=n,t[13]=_):_=t[13];let v;return t[14]!==h||t[15]!==g||t[16]!==_?(v=(0,Q.jsx)(k,{open:h,onOpenChange:g,children:_}),t[14]=h,t[15]=g,t[16]=_,t[17]=v):v=t[17],v}function Cr(e){let t=(0,Tt.c)(64),{target:n,onOpenChange:r}=e,{_:i}=c(),a=We(),o=(0,$.useId)(),[l,u]=(0,$.useState)(``),[d,f]=(0,$.useState)(!1),p;t[0]===n?p=t[1]:(p=()=>{n&&u(n.filePath)},t[0]=n,t[1]=p);let m=n?.skill.scope,h=n?.skill.name,g=n?.filePath,_;if(t[2]!==m||t[3]!==h||t[4]!==g?(_=[m,h,g],t[2]=m,t[3]=h,t[4]=g,t[5]=_):_=t[5],(0,$.useEffect)(p,_),!n)return null;let y,b,x;t[6]!==l||t[7]!==n.filePath?(b=l.trim(),x=b===n.filePath,y=b===``||!br(b),t[6]=l,t[7]=n.filePath,t[8]=y,t[9]=b,t[10]=x):(y=t[8],b=t[9],x=t[10]);let T=y,D=!T&&!x&&!d,A;t[11]!==i||t[12]!==D||t[13]!==r||t[14]!==a||t[15]!==n||t[16]!==b?(A=async function(){if(!n||!D)return;f(!0);let e=await ct({scope:n.skill.scope,name:n.skill.name,from:n.filePath,to:b});if(f(!1),!e.ok){Z.error(i({id:`11ukmX`,values:{0:e.error}}));return}e.fromDocName!==void 0&&e.toDocName!==void 0&&a(e.fromDocName,e.toDocName),Z.success(i({id:`XszXjc`,values:{0:e.to}})),r(!1)},t[11]=i,t[12]=D,t[13]=r,t[14]=a,t[15]=n,t[16]=b,t[17]=A):A=t[17];let j=A,M;t[18]!==r||t[19]!==d?(M=e=>{!e&&!d&&r(!1)},t[18]=r,t[19]=d,t[20]=M):M=t[20];let N;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(C,{children:(0,Q.jsx)(s,{id:`yckias`})}),t[21]=N):N=t[21];let P;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsxs)(O,{children:[N,(0,Q.jsx)(S,{children:(0,Q.jsx)(s,{id:`HzVAoz`})})]}),t[22]=P):P=t[22];let F;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(s,{id:`I6gXOa`}),t[23]=F):F=t[23];let I;t[24]===o?I=t[25]:(I=(0,Q.jsx)(ee,{htmlFor:o,children:F}),t[24]=o,t[25]=I);let L;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>u(e.target.value),t[26]=L):L=t[26];let R=T&&b!==``,z;t[27]===j?z=t[28]:(z=e=>{e.key===`Enter`&&j()},t[27]=j,t[28]=z);let B;t[29]!==o||t[30]!==l||t[31]!==R||t[32]!==z?(B=(0,Q.jsx)(Ze,{id:o,value:l,onChange:L,"aria-invalid":R,onKeyDown:z}),t[29]=o,t[30]=l,t[31]=R,t[32]=z,t[33]=B):B=t[33];let V;t[34]!==T||t[35]!==b?(V=T&&b!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(s,{id:`fVzizW`})}):null,t[34]=T,t[35]=b,t[36]=V):V=t[36];let H;t[37]!==I||t[38]!==B||t[39]!==V?(H=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[I,B,V]}),t[37]=I,t[38]=B,t[39]=V,t[40]=H):H=t[40];let U;t[41]===r?U=t[42]:(U=()=>r(!1),t[41]=r,t[42]=U);let W;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(s,{id:`dEgA5A`}),t[43]=W):W=t[43];let G;t[44]!==d||t[45]!==U?(G=(0,Q.jsx)(v,{variant:`outline`,onClick:U,disabled:d,children:W}),t[44]=d,t[45]=U,t[46]=G):G=t[46];let K;t[47]===j?K=t[48]:(K=()=>void j(),t[47]=j,t[48]=K);let q=!D,J;t[49]===d?J=t[50]:(J=d?(0,Q.jsx)(s,{id:`tHKQ6j`}):(0,Q.jsx)(s,{id:`2wxgft`}),t[49]=d,t[50]=J);let Y;t[51]!==K||t[52]!==q||t[53]!==J?(Y=(0,Q.jsx)(v,{onClick:K,disabled:q,children:J}),t[51]=K,t[52]=q,t[53]=J,t[54]=Y):Y=t[54];let te;t[55]!==G||t[56]!==Y?(te=(0,Q.jsxs)(E,{children:[G,Y]}),t[55]=G,t[56]=Y,t[57]=te):te=t[57];let X;t[58]!==H||t[59]!==te?(X=(0,Q.jsxs)(w,{className:`sm:max-w-md`,children:[P,H,te]}),t[58]=H,t[59]=te,t[60]=X):X=t[60];let ne;return t[61]!==X||t[62]!==M?(ne=(0,Q.jsx)(k,{open:!0,onOpenChange:M,children:X}),t[61]=X,t[62]=M,t[63]=ne):ne=t[63],ne}function wr(e){let t=(0,Tt.c)(59),{target:n,onOpenChange:r}=e,{_:i}=c(),a=(0,$.useId)(),[o,l]=(0,$.useState)(null),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(``),[y,b]=(0,$.useState)(!1),x;t[0]===n?x=t[1]:(x=()=>{if(l(null),d(null),p(!1),h(!1),!n)return;let{skill:e,editor:t}=n,r=e.absolutePath?.slice(0,-`/${e.path}`.length)??null;if(r===null){p(!0);return}let i=`${r}/${e.path.replace(/\/SKILL\.mdx?$/i,``)}`,a=`${r}/${nt(t,e.scope)}/${e.name}`,o=new AbortController;for(let[t,n]of[[i,d],[a,l]])_t({source:t,name:e.name},o.signal).then(e=>{o.signal.aborted||(e.ok?n(e.skillMd):p(!0))}).catch(()=>{o.signal.aborted||p(!0)});return()=>o.abort()},t[0]=n,t[1]=x);let D=n?.skill.scope,A=n?.skill.name,j=n?.editor,M;if(t[2]!==D||t[3]!==A||t[4]!==j?(M=[D,A,j],t[2]=D,t[3]=A,t[4]=j,t[5]=M):M=t[5],(0,$.useEffect)(x,M),!n)return null;let{skill:N,editor:P}=n,F;t[6]!==i||t[7]!==P||t[8]!==r||t[9]!==N.name||t[10]!==N.scope||t[11]!==n||t[12]!==g?(F=async function(e){if(!n)return;b(!0);let t=await vt({scope:N.scope,name:N.name,editor:P,action:e,...e===`rename`?{toName:g.trim()}:{}});if(b(!1),!t.ok){Z.error(i({id:`MIF36T`,values:{0:t.error}}));return}Z.success(i(e===`align`?{id:`QKgePK`,values:{editor:P}}:e===`make-source`?{id:`It9oAP`,values:{editor:P}}:{id:`b2ezG_`,values:{0:g.trim()}})),r(!1)},t[6]=i,t[7]=P,t[8]=r,t[9]=N.name,t[10]=N.scope,t[11]=n,t[12]=g,t[13]=F):F=t[13];let I=F,L,R;t[14]!==N.name||t[15]!==g?(R=g.trim(),L=R===``||!ue.test(R)||R===N.name,t[14]=N.name,t[15]=g,t[16]=L,t[17]=R):(L=t[16],R=t[17]);let z=L,B;t[18]!==y||t[19]!==r?(B=e=>{!e&&!y&&r(!1)},t[18]=y,t[19]=r,t[20]=B):B=t[20];let V;t[21]!==P||t[22]!==N.name?(V=(0,Q.jsx)(C,{children:(0,Q.jsx)(s,{id:`q8aCbb`,values:{0:N.name,editor:P}})}),t[21]=P,t[22]=N.name,t[23]=V):V=t[23];let H;t[24]===P?H=t[25]:(H=(0,Q.jsx)(S,{children:(0,Q.jsx)(s,{id:`QASTNu`,values:{editor:P}})}),t[24]=P,t[25]=H);let U;t[26]!==H||t[27]!==V?(U=(0,Q.jsxs)(O,{children:[V,H]}),t[26]=H,t[27]=V,t[28]=U):U=t[28];let W;t[29]!==u||t[30]!==o||t[31]!==f?(W=u!==null&&o!==null?(0,Q.jsx)(wt,{oldContent:u,newContent:o,layout:`unified`}):f?(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center px-6 text-center text-muted-foreground text-sm`,children:(0,Q.jsx)(s,{id:`5BlXTD`})}):(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center text-muted-foreground text-sm`,children:(0,Q.jsx)(s,{id:`1V17kO`})}),t[29]=u,t[30]=o,t[31]=f,t[32]=W):W=t[32];let G;t[33]!==I||t[34]!==P||t[35]!==a||t[36]!==z||t[37]!==m||t[38]!==N.name||t[39]!==g||t[40]!==R?(G=m?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,Q.jsx)(ee,{htmlFor:a,children:(0,Q.jsx)(s,{id:`pSimwP`,values:{editor:P}})}),(0,Q.jsx)(Ze,{id:a,value:g,onChange:e=>_(e.target.value),placeholder:`${N.name}-${P}`,"aria-invalid":z&&R!==``,onKeyDown:e=>{e.key===`Enter`&&!z&&I(`rename`)}})]}):null,t[33]=I,t[34]=P,t[35]=a,t[36]=z,t[37]=m,t[38]=N.name,t[39]=g,t[40]=R,t[41]=G):G=t[41];let K;t[42]!==W||t[43]!==G?(K=(0,Q.jsxs)(T,{className:`min-h-0 flex-1 overflow-auto`,children:[W,G]}),t[42]=W,t[43]=G,t[44]=K):K=t[44];let q;t[45]!==I||t[46]!==y||t[47]!==P||t[48]!==z||t[49]!==m||t[50]!==N.name?(q=(0,Q.jsx)(E,{children:m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(v,{variant:`outline`,onClick:()=>h(!1),disabled:y,children:(0,Q.jsx)(s,{id:`iH8pgl`})}),(0,Q.jsx)(v,{onClick:()=>void I(`rename`),disabled:y||z,children:(0,Q.jsx)(s,{id:`AT0e50`})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(v,{variant:`outline`,onClick:()=>{_(`${N.name}-${P}`),h(!0)},disabled:y,children:(0,Q.jsx)(s,{id:`AT0e50`})}),(0,Q.jsx)(v,{variant:`outline`,onClick:()=>void I(`make-source`),disabled:y,children:(0,Q.jsx)(s,{id:`xWomUD`,values:{editor:P}})}),(0,Q.jsx)(v,{onClick:()=>void I(`align`),disabled:y,children:(0,Q.jsx)(s,{id:`PZn2LP`})})]})}),t[45]=I,t[46]=y,t[47]=P,t[48]=z,t[49]=m,t[50]=N.name,t[51]=q):q=t[51];let J;t[52]!==U||t[53]!==K||t[54]!==q?(J=(0,Q.jsxs)(w,{className:`flex max-h-[85vh] w-full max-w-3xl flex-col`,children:[U,K,q]}),t[52]=U,t[53]=K,t[54]=q,t[55]=J):J=t[55];let Y;return t[56]!==J||t[57]!==B?(Y=(0,Q.jsx)(k,{open:!0,onOpenChange:B,children:J}),t[56]=J,t[57]=B,t[58]=Y):Y=t[58],Y}function Tr(e){let t=(0,Tt.c)(75),{skill:n,existingNames:r,onOpenChange:i,onRenamed:a}=e,o=Ge(),c=n!==null,l=(0,$.useId)(),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.name)},t[0]=n,t[1]=m);let h=n?.scope,g=n?.name,_;if(t[2]!==h||t[3]!==g?(_=[h,g],t[2]=h,t[3]=g,t[4]=_):_=t[4],(0,$.useEffect)(m,_),!n)return null;let y,b,x,T,D,A;if(t[5]!==r||t[6]!==u||t[7]!==n.name){D=u.trim(),A=D===n.name;let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\s/,t[14]=e):e=t[14];let i;t[15]===u?i=t[16]:(i=e.test(u),t[15]=u,t[16]=i),y=i,T=D.length>64,b=D===``||!ue.test(D)||T,x=!b&&!A&&r.has(D),t[5]=r,t[6]=u,t[7]=n.name,t[8]=y,t[9]=b,t[10]=x,t[11]=T,t[12]=D,t[13]=A}else y=t[8],b=t[9],x=t[10],T=t[11],D=t[12],A=t[13];let j=x,M=!b&&!j&&!A&&!f,N;t[17]!==M||t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==n||t[22]!==D?(N=async function(){if(!n||!M)return;p(!0);let e=await o({scope:n.scope,name:n.name},D);p(!1),e.ok&&(a?.(D),i(!1))},t[17]=M,t[18]=i,t[19]=a,t[20]=o,t[21]=n,t[22]=D,t[23]=N):N=t[23];let P=N,F;t[24]===i?F=t[25]:(F=e=>e?null:i(!1),t[24]=i,t[25]=F);let I;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(C,{children:(0,Q.jsx)(s,{id:`dw_3cv`})}),t[26]=I):I=t[26];let L;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsxs)(O,{children:[I,(0,Q.jsx)(S,{children:(0,Q.jsx)(s,{id:`R9IDFz`})})]}),t[27]=L):L=t[27];let R;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(s,{id:`6YtxFj`}),t[28]=R):R=t[28];let z;t[29]===l?z=t[30]:(z=(0,Q.jsx)(ee,{htmlFor:l,children:R}),t[29]=l,t[30]=z);let B;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>d(e.target.value),t[31]=B):B=t[31];let V;t[32]===P?V=t[33]:(V=e=>{e.key===`Enter`&&P()},t[32]=P,t[33]=V);let H=b||j,U=b&&D!==``||j?`${l}-error`:void 0,W;t[34]!==l||t[35]!==u||t[36]!==V||t[37]!==H||t[38]!==U?(W=(0,Q.jsx)(Ze,{id:l,value:u,onChange:B,onKeyDown:V,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:64,"aria-invalid":H,"aria-describedby":U,className:`font-mono`}),t[34]=l,t[35]=u,t[36]=V,t[37]=H,t[38]=U,t[39]=W):W=t[39];let G;t[40]!==j||t[41]!==y||t[42]!==l||t[43]!==b||t[44]!==T||t[45]!==D?(G=b&&D!==``?(0,Q.jsx)(`p`,{id:`${l}-error`,className:`text-xs text-destructive`,children:y?(0,Q.jsx)(s,{id:`iUwpZI`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}}):T?(0,Q.jsx)(s,{id:`lK9c4T`}):(0,Q.jsx)(s,{id:`A50vr3`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):j?(0,Q.jsx)(`p`,{id:`${l}-error`,className:`text-xs text-destructive`,children:(0,Q.jsx)(s,{id:`YJ1BTp`})}):null,t[40]=j,t[41]=y,t[42]=l,t[43]=b,t[44]=T,t[45]=D,t[46]=G):G=t[46];let K;t[47]!==z||t[48]!==W||t[49]!==G?(K=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[z,W,G]}),t[47]=z,t[48]=W,t[49]=G,t[50]=K):K=t[50];let q;t[51]===i?q=t[52]:(q=()=>i(!1),t[51]=i,t[52]=q);let J;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(s,{id:`dEgA5A`}),t[53]=J):J=t[53];let Y;t[54]!==f||t[55]!==q?(Y=(0,Q.jsx)(v,{variant:`outline`,className:`font-mono uppercase`,onClick:q,disabled:f,children:J}),t[54]=f,t[55]=q,t[56]=Y):Y=t[56];let te;t[57]===P?te=t[58]:(te=()=>void P(),t[57]=P,t[58]=te);let X=!M,ne;t[59]===f?ne=t[60]:(ne=f?(0,Q.jsx)(s,{id:`tHKQ6j`}):(0,Q.jsx)(s,{id:`2wxgft`}),t[59]=f,t[60]=ne);let re;t[61]!==te||t[62]!==X||t[63]!==ne?(re=(0,Q.jsx)(v,{onClick:te,disabled:X,children:ne}),t[61]=te,t[62]=X,t[63]=ne,t[64]=re):re=t[64];let ie;t[65]!==Y||t[66]!==re?(ie=(0,Q.jsxs)(E,{children:[Y,re]}),t[65]=Y,t[66]=re,t[67]=ie):ie=t[67];let ae;t[68]!==K||t[69]!==ie?(ae=(0,Q.jsxs)(w,{children:[L,K,ie]}),t[68]=K,t[69]=ie,t[70]=ae):ae=t[70];let oe;return t[71]!==c||t[72]!==ae||t[73]!==F?(oe=(0,Q.jsx)(k,{open:c,onOpenChange:F,children:ae}),t[71]=c,t[72]=ae,t[73]=F,t[74]=oe):oe=t[74],oe}function Er(){let e=(0,Tt.c)(5),{_:t}=c(),n=rt(),r=We(),i=xt(),a;return e[0]!==t||e[1]!==r||e[2]!==n||e[3]!==i?(a=async(e,a)=>{if(a===e.scope)return!1;Fe(e.scope,e.name);let o=await bt({name:e.name,fromScope:e.scope,toScope:a});if(Pe(e.scope,e.name),!o.ok)return Z.error(t({id:`07eGJB`,values:{0:o.error}})),!1;Z.success(t({id:`yhI6P0`,values:{0:e.name,1:n[a]}}));let s=i.status===`ready`?i.data.find(t=>t.scope===e.scope&&t.name===e.name):void 0;return r(s?Qe(s):we(e.scope,e.name),a===`project`&&o.path!==void 0?`${o.path.replace(/\/+$/,``)}/SKILL`:we(a,e.name)),!0},e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function Dr(e){let t=(0,Tt.c)(38),{target:n,onOpenChange:r}=e,i=rt(),a=Er(),[o,c]=(0,$.useState)(!1);if(!n)return null;let{scope:l,name:u,toScope:d}=n,f;t[0]!==o||t[1]!==r?(f=e=>!e&&!o&&r(!1),t[0]=o,t[1]=r,t[2]=f):f=t[2];let p=i[d],m;t[3]===p?m=t[4]:(m=(0,Q.jsx)(C,{children:(0,Q.jsx)(s,{id:`SXEdCq`,values:{0:p}})}),t[3]=p,t[4]=m);let h=i[l],g=i[d],_=i[d],y;t[5]!==u||t[6]!==h||t[7]!==g||t[8]!==_?(y={0:h,1:g,2:_,name:u},t[5]=u,t[6]=h,t[7]=g,t[8]=_,t[9]=y):y=t[9];let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b={0:(0,Q.jsx)(`code`,{className:`font-mono`})},t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x=(0,Q.jsx)(S,{children:(0,Q.jsx)(s,{id:`7bIiJ7`,values:y,components:b})}),t[11]=y,t[12]=x);let T;t[13]!==m||t[14]!==x?(T=(0,Q.jsxs)(O,{children:[m,x]}),t[13]=m,t[14]=x,t[15]=T):T=t[15];let A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(s,{id:`dEgA5A`}),t[16]=A):A=t[16];let j;t[17]===o?j=t[18]:(j=(0,Q.jsx)(D,{asChild:!0,children:(0,Q.jsx)(v,{variant:`outline`,disabled:o,children:A})}),t[17]=o,t[18]=j);let M;t[19]!==a||t[20]!==u||t[21]!==r||t[22]!==l||t[23]!==d?(M=async()=>{c(!0),await a({scope:l,name:u},d),c(!1),r(!1)},t[19]=a,t[20]=u,t[21]=r,t[22]=l,t[23]=d,t[24]=M):M=t[24];let N;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(s,{id:`QWdKwH`}),t[25]=N):N=t[25];let P;t[26]!==o||t[27]!==M?(P=(0,Q.jsx)(v,{"data-testid":`skill-scope-move-confirm`,disabled:o,onClick:M,children:N}),t[26]=o,t[27]=M,t[28]=P):P=t[28];let F;t[29]!==j||t[30]!==P?(F=(0,Q.jsxs)(E,{children:[j,P]}),t[29]=j,t[30]=P,t[31]=F):F=t[31];let I;t[32]!==T||t[33]!==F?(I=(0,Q.jsxs)(w,{className:`sm:max-w-md`,children:[T,F]}),t[32]=T,t[33]=F,t[34]=I):I=t[34];let L;return t[35]!==f||t[36]!==I?(L=(0,Q.jsx)(k,{open:!0,onOpenChange:f,children:I}),t[35]=f,t[36]=I,t[37]=L):L=t[37],L}function Or(){let e=(0,Tt.c)(50),{_:t}=c(),n=St(),[r,i]=(0,$.useState)(null),[a,o]=(0,$.useState)(null),[s,l]=(0,$.useState)(null),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(null),[g,_]=(0,$.useState)(null),[v,y]=(0,$.useState)(null),b;e[0]===t?b=e[1]:(b=async function(e,n,r){y(e.name);let i=await pt({scope:e.scope,name:e.name,...n?{targets:[...n]}:{},...r?.linkMode===void 0?{}:{linkMode:r.linkMode}});if(y(null),!i.ok)return Z.error(t({id:`Mj8R8K`,values:{0:i.error}})),i;let a=kr,o=new Set(i.hosts),s=i.hosts.filter(t=>!e.hosts.includes(t)),c=e.hosts.filter(e=>!o.has(e)),l=e=>{let t=i.warningCodes.indexOf(e);return t>=0?i.warnings[t]:void 0},u=l(`no-targets`);if(u)return Z.warning(u),i;if(s.length>0){let e=l(`scripts-present`);e&&Z.warning(e);let t=l(`no-description`);t&&Z.warning(t)}return i.hosts.length===0?Z.success(t({id:`4pDZ2N`,values:{0:e.name}})):s.length>0&&c.length===0?Z.success(t({id:`PPFQ3o`,values:{0:e.name,1:a(s)}})):c.length>0&&s.length===0?Z.success(t({id:`OOIVJo`,values:{0:e.name,1:a(c)}})):s.length>0&&c.length>0?Z.success(t({id:`OxplNM`,values:{0:e.name,1:a(s),2:a(c)}})):Z.success(t({id:`wDgmsr`,values:{0:e.name,1:a(i.hosts)}})),i},e[0]=t,e[1]=b);let x=b,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=async function(e,t){if(t.length!==0){y(e.name);for(let{target:n,mode:r}of t){let t=await gt({scope:e.scope,name:e.name,target:n,mode:r});if(!t.ok){Z.error(t.error);break}}y(null)}},e[2]=S):S=e[2];let C=S,w;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=async function(e,t){y(e.name);let n=await t();return y(null),n},e[3]=w):w=e[3];let T=w,E;e[4]!==t||e[5]!==n?(E=async function(e,r){let i=await ut({scope:e.scope,name:e.name,existingNames:r});if(!i.ok){Z.error(t({id:`UPjaXD`,values:{0:e.name,1:i.error}}));return}Z.success(t({id:`0g7rCZ`,values:{0:i.name}})),n(e.scope,i.name)},e[4]=t,e[5]=n,e[6]=E):E=e[6];let D=E,O,k;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>{e||i(null)},k=()=>i(null),e[7]=O,e[8]=k):(O=e[7],k=e[8]);let A;e[9]===r?A=e[10]:(A=(0,Q.jsx)(yr,{skill:r,onOpenChange:O,onDeleted:k}),e[9]=r,e[10]=A);let j=a?.skill??null,M=a?.existingNames??jr,N,P;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{e||o(null)},N=()=>o(null),e[11]=N,e[12]=P):(N=e[11],P=e[12]);let F;e[13]!==j||e[14]!==M?(F=(0,Q.jsx)(Tr,{skill:j,existingNames:M,onOpenChange:P,onRenamed:N}),e[13]=j,e[14]=M,e[15]=F):F=e[15];let I;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>{e||l(null)},e[16]=I):I=e[16];let L;e[17]===s?L=e[18]:(L=(0,Q.jsx)(Dr,{target:s,onOpenChange:I}),e[17]=s,e[18]=L);let R;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{e||d(null)},e[19]=R):R=e[19];let z;e[20]===u?z=e[21]:(z=(0,Q.jsx)(Cr,{target:u,onOpenChange:R}),e[20]=u,e[21]=z);let B;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{e||p(null)},e[22]=B):B=e[22];let V;e[23]===f?V=e[24]:(V=(0,Q.jsx)(Sr,{target:f,onOpenChange:B}),e[23]=f,e[24]=V);let H;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{e||h(null)},e[25]=H):H=e[25];let U;e[26]===m?U=e[27]:(U=(0,Q.jsx)(xr,{target:m,onOpenChange:H}),e[26]=m,e[27]=U);let W;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>{e||_(null)},e[28]=W):W=e[28];let G;e[29]===g?G=e[30]:(G=(0,Q.jsx)(wr,{target:g,onOpenChange:W}),e[29]=g,e[30]=G);let ee;e[31]!==F||e[32]!==L||e[33]!==z||e[34]!==V||e[35]!==U||e[36]!==G||e[37]!==A?(ee=(0,Q.jsxs)(Q.Fragment,{children:[A,F,L,z,V,U,G]}),e[31]=F,e[32]=L,e[33]=z,e[34]=V,e[35]=U,e[36]=G,e[37]=A,e[38]=ee):ee=e[38];let K=ee,q,J,Y,te,X,ne;e[39]===Symbol.for(`react.memo_cache_sentinel`)?(q=(e,t)=>o({skill:e,existingNames:t}),J=(e,t)=>l({scope:e.scope,name:e.name,toScope:t}),Y=(e,t)=>d({skill:e,filePath:t}),te=(e,t)=>p({skill:e,filePath:t}),X=(e,t)=>h(t===void 0?{skill:e}:{skill:e,prefix:t}),ne=(e,t)=>_({skill:e,editor:t}),e[39]=q,e[40]=J,e[41]=Y,e[42]=te,e[43]=X,e[44]=ne):(q=e[39],J=e[40],Y=e[41],te=e[42],X=e[43],ne=e[44]);let re;return e[45]!==K||e[46]!==D||e[47]!==x||e[48]!==v?(re={installingName:v,install:x,convertLocations:C,runLocationWrite:T,duplicate:D,requestDelete:i,requestRename:q,requestScopeMove:J,requestFileRename:Y,requestFileDelete:te,requestFileCreate:X,requestForkResolve:ne,dialogs:K},e[45]=K,e[46]=D,e[47]=x,e[48]=v,e[49]=re):re=e[49],re}function kr(e){return e.map(Ar).join(`, `)}function Ar(e){return me[e]??e}var jr=new Set;function Mr(e){let t=(0,Tt.c)(7),{absolutePath:n,menuKind:r}=e,i=r===void 0?`dropdown`:r,a=typeof window<`u`?window.okDesktop:void 0;if(!a||!n)return null;let o;t[0]===n?o=t[1]:(o=()=>void a.shell.showItemInFolder(n),t[0]=n,t[1]=o);let s,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(qe,{"aria-hidden":!0}),c=cr(a.platform),t[2]=s,t[3]=c):(s=t[2],c=t[3]);let l;return t[4]!==i||t[5]!==o?(l=(0,Q.jsxs)(wn,{menuKind:i,onSelect:o,children:[s,c]}),t[4]=i,t[5]=o,t[6]=l):l=t[6],l}function Nr(e){let t=(0,Tt.c)(68),{skill:n,filePath:r,actions:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,{_:l}=c(),u;t[0]!==r||t[1]!==n.absolutePath?(u=n.absolutePath?`${tt(n.absolutePath)}/${r}`:void 0,t[0]=r,t[1]=n.absolutePath,t[2]=u):u=t[2];let d=u,f;t[3]===n.path?f=t[4]:(f=tt(n.path),t[3]=n.path,t[4]=f);let p=`${f}/${r}`,m;t[5]===l?m=t[6]:(m=async function(e){try{await Ct(e),Z.success(l({id:`SXCSQd`}))}catch{Z.error(l({id:`cRHuuI`}))}},t[5]=l,t[6]=m);let h=m,g;t[7]!==i||t[8]!==r||t[9]!==n?(g=()=>i.requestFileRename(n,r),t[7]=i,t[8]=r,t[9]=n,t[10]=g):g=t[10];let _,v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(xn,{"aria-hidden":!0}),v=(0,Q.jsx)(s,{id:`2wxgft`}),t[11]=_,t[12]=v):(_=t[11],v=t[12]);let y;t[13]!==o||t[14]!==g?(y=(0,Q.jsxs)(wn,{menuKind:o,onSelect:g,children:[_,v]}),t[13]=o,t[14]=g,t[15]=y):y=t[15];let b;t[16]!==d||t[17]!==o?(b=(0,Q.jsx)(Mr,{absolutePath:d,menuKind:o}),t[16]=d,t[17]=o,t[18]=b):b=t[18];let x,S;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(Ke,{"aria-hidden":!0}),S=(0,Q.jsx)(s,{id:`zd00pH`}),t[19]=x,t[20]=S):(x=t[19],S=t[20]);let C;t[21]===o?C=t[22]:(C=(0,Q.jsxs)(An,{menuKind:o,children:[x,S]}),t[21]=o,t[22]=C);let w;t[23]!==d||t[24]!==h||t[25]!==o?(w=d?(0,Q.jsx)(wn,{menuKind:o,onSelect:()=>void h(d),children:(0,Q.jsx)(s,{id:`z2funE`})}):null,t[23]=d,t[24]=h,t[25]=o,t[26]=w):w=t[26];let T;t[27]!==h||t[28]!==p?(T=()=>void h(p),t[27]=h,t[28]=p,t[29]=T):T=t[29];let E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(s,{id:`xloBjn`}),t[30]=E):E=t[30];let D;t[31]!==o||t[32]!==T?(D=(0,Q.jsx)(wn,{menuKind:o,onSelect:T,children:E}),t[31]=o,t[32]=T,t[33]=D):D=t[33];let O;t[34]!==o||t[35]!==w||t[36]!==D?(O=(0,Q.jsxs)(Cn,{menuKind:o,children:[w,D]}),t[34]=o,t[35]=w,t[36]=D,t[37]=O):O=t[37];let k;t[38]!==o||t[39]!==O?(k=(0,Q.jsx)(kn,{menuKind:o,children:O}),t[38]=o,t[39]=O,t[40]=k):k=t[40];let A;t[41]!==o||t[42]!==C||t[43]!==k?(A=(0,Q.jsxs)(On,{menuKind:o,children:[C,k]}),t[41]=o,t[42]=C,t[43]=k,t[44]=A):A=t[44];let j;t[45]!==o||t[46]!==A||t[47]!==y||t[48]!==b?(j=(0,Q.jsxs)(Cn,{menuKind:o,children:[y,b,A]}),t[45]=o,t[46]=A,t[47]=y,t[48]=b,t[49]=j):j=t[49];let M;t[50]===o?M=t[51]:(M=(0,Q.jsx)(Dn,{menuKind:o}),t[50]=o,t[51]=M);let N;t[52]!==i||t[53]!==r||t[54]!==n?(N=()=>i.requestFileDelete(n,r),t[52]=i,t[53]=r,t[54]=n,t[55]=N):N=t[55];let P,F;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(Xe,{"aria-hidden":!0}),F=(0,Q.jsx)(s,{id:`cnGeoo`}),t[56]=P,t[57]=F):(P=t[56],F=t[57]);let I;t[58]!==o||t[59]!==N?(I=(0,Q.jsxs)(wn,{menuKind:o,variant:`destructive`,onSelect:N,children:[P,F]}),t[58]=o,t[59]=N,t[60]=I):I=t[60];let L;t[61]!==o||t[62]!==I?(L=(0,Q.jsx)(Cn,{menuKind:o,children:I}),t[61]=o,t[62]=I,t[63]=L):L=t[63];let R;return t[64]!==j||t[65]!==M||t[66]!==L?(R=(0,Q.jsxs)(Q.Fragment,{children:[j,M,L]}),t[64]=j,t[65]=M,t[66]=L,t[67]=R):R=t[67],R}function Pr(e){let t=(0,Tt.c)(15),{skill:n,actions:r,existingNames:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,s=Ve(),c=g().states,{dispatch:l}=vn(),u=typeof window<`u`?window.okDesktop:void 0,d;t[0]!==n.name||t[1]!==n.scope||t[2]!==s?(d=en({skillName:n.name,scope:n.scope,workspace:s}),t[0]=n.name,t[1]=n.scope,t[2]=s,t[3]=d):d=t[3];let f=d,p;t[4]!==l||t[5]!==f||t[6]!==c||t[7]!==o?(p=o===`context`?(0,Q.jsx)(sr,{input:f,installStates:c,dispatch:l}):(0,Q.jsx)(ur,{input:f,installStates:c,isElectronHost:u!=null,dispatch:l}),t[4]=l,t[5]=f,t[6]=c,t[7]=o,t[8]=p):p=t[8];let m;return t[9]!==r||t[10]!==i||t[11]!==o||t[12]!==n||t[13]!==p?(m=(0,Q.jsx)(Fr,{actions:r,existingNames:i,menuKind:o,skill:n,openWithAi:p}),t[9]=r,t[10]=i,t[11]=o,t[12]=n,t[13]=p,t[14]=m):m=t[14],m}function Fr(e){let t=(0,Tt.c)(124),{actions:n,existingNames:r,menuKind:a,openWithAi:o,skill:l}=e,{_:u}=c(),d=rt(),p=Bn(l,n),m=l.absolutePath,h;t[0]===u?h=t[1]:(h=async function(e){try{await Ct(e),Z.success(u({id:`SXCSQd`}))}catch{Z.error(u({id:`cRHuuI`}))}},t[0]=u,t[1]=h);let g=h,_;t[2]!==m||t[3]!==a?(_=(0,Q.jsx)(Mr,{absolutePath:m,menuKind:a}),t[2]=m,t[3]=a,t[4]=_):_=t[4];let v,y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(Ke,{"aria-hidden":!0}),y=(0,Q.jsx)(s,{id:`zd00pH`}),t[5]=v,t[6]=y):(v=t[5],y=t[6]);let b;t[7]===a?b=t[8]:(b=(0,Q.jsxs)(An,{menuKind:a,children:[v,y]}),t[7]=a,t[8]=b);let x;t[9]!==m||t[10]!==g||t[11]!==a?(x=m?(0,Q.jsx)(wn,{menuKind:a,onSelect:()=>void g(m),children:(0,Q.jsx)(s,{id:`z2funE`})}):null,t[9]=m,t[10]=g,t[11]=a,t[12]=x):x=t[12];let S;t[13]!==g||t[14]!==l.path?(S=()=>void g(l.path),t[13]=g,t[14]=l.path,t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(s,{id:`xloBjn`}),t[16]=C):C=t[16];let w;t[17]!==a||t[18]!==S?(w=(0,Q.jsx)(wn,{menuKind:a,onSelect:S,children:C}),t[17]=a,t[18]=S,t[19]=w):w=t[19];let T;t[20]!==a||t[21]!==x||t[22]!==w?(T=(0,Q.jsxs)(Cn,{menuKind:a,children:[x,w]}),t[20]=a,t[21]=x,t[22]=w,t[23]=T):T=t[23];let E;t[24]!==a||t[25]!==T?(E=(0,Q.jsx)(kn,{menuKind:a,children:T}),t[24]=a,t[25]=T,t[26]=E):E=t[26];let D;t[27]!==a||t[28]!==E||t[29]!==b?(D=(0,Q.jsxs)(On,{menuKind:a,children:[b,E]}),t[27]=a,t[28]=E,t[29]=b,t[30]=D):D=t[30];let O;t[31]!==a||t[32]!==o||t[33]!==D||t[34]!==_?(O=(0,Q.jsxs)(Cn,{menuKind:a,children:[_,o,D]}),t[31]=a,t[32]=o,t[33]=D,t[34]=_,t[35]=O):O=t[35];let k;t[36]===a?k=t[37]:(k=(0,Q.jsx)(Dn,{menuKind:a}),t[36]=a,t[37]=k);let A;t[38]!==n||t[39]!==r||t[40]!==l?(A=()=>void n.duplicate(l,r),t[38]=n,t[39]=r,t[40]=l,t[41]=A):A=t[41];let j,M;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(i,{"aria-hidden":!0}),M=(0,Q.jsx)(s,{id:`euc6Ns`}),t[42]=j,t[43]=M):(j=t[42],M=t[43]);let N;t[44]!==a||t[45]!==A?(N=(0,Q.jsxs)(wn,{menuKind:a,onSelect:A,children:[j,M]}),t[44]=a,t[45]=A,t[46]=N):N=t[46];let P;t[47]!==n||t[48]!==r||t[49]!==l?(P=()=>n.requestRename(l,r),t[47]=n,t[48]=r,t[49]=l,t[50]=P):P=t[50];let F,I;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(xn,{"aria-hidden":!0}),I=(0,Q.jsx)(s,{id:`2wxgft`}),t[51]=F,t[52]=I):(F=t[51],I=t[52]);let L;t[53]!==a||t[54]!==P?(L=(0,Q.jsxs)(wn,{menuKind:a,onSelect:P,children:[F,I]}),t[53]=a,t[54]=P,t[55]=L):L=t[55];let R;t[56]!==n||t[57]!==l?(R=()=>n.requestFileCreate(l),t[56]=n,t[57]=l,t[58]=R):R=t[58];let z,B;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(f,{"aria-hidden":!0}),B=(0,Q.jsx)(s,{id:`HdkSiO`}),t[59]=z,t[60]=B):(z=t[59],B=t[60]);let V;t[61]!==a||t[62]!==R?(V=(0,Q.jsxs)(wn,{menuKind:a,onSelect:R,children:[z,B]}),t[61]=a,t[62]=R,t[63]=V):V=t[63];let H,U;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(bn,{"aria-hidden":!0}),U=(0,Q.jsx)(s,{id:`TKQ7K-`}),t[64]=H,t[65]=U):(H=t[64],U=t[65]);let W;t[66]===a?W=t[67]:(W=(0,Q.jsxs)(An,{menuKind:a,children:[H,U]}),t[66]=a,t[67]=W);let G;t[68]!==n||t[69]!==l?(G=e=>n.requestForkResolve(l,e),t[68]=n,t[69]=l,t[70]=G):G=t[70];let ee;t[71]!==p||t[72]!==a||t[73]!==l||t[74]!==G?(ee=(0,Q.jsx)(Gn,{toggles:p,skill:l,menuKind:a,onResolveFork:G}),t[71]=p,t[72]=a,t[73]=l,t[74]=G,t[75]=ee):ee=t[75];let K;t[76]!==a||t[77]!==ee?(K=(0,Q.jsx)(Cn,{menuKind:a,children:ee}),t[76]=a,t[77]=ee,t[78]=K):K=t[78];let q;t[79]!==a||t[80]!==K?(q=(0,Q.jsx)(kn,{menuKind:a,className:zn,children:K}),t[79]=a,t[80]=K,t[81]=q):q=t[81];let J;t[82]!==a||t[83]!==W||t[84]!==q?(J=(0,Q.jsxs)(On,{menuKind:a,children:[W,q]}),t[82]=a,t[83]=W,t[84]=q,t[85]=J):J=t[85];let Y;t[86]!==n||t[87]!==l?(Y=()=>n.requestScopeMove(l,l.scope===`project`?`global`:`project`),t[86]=n,t[87]=l,t[88]=Y):Y=t[88];let te;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(yn,{"aria-hidden":!0}),t[89]=te):te=t[89];let X;t[90]!==d.global||t[91]!==d.project||t[92]!==l.scope?(X=l.scope===`project`?(0,Q.jsx)(s,{id:`bpytj4`,values:{0:d.global}}):(0,Q.jsx)(s,{id:`bpytj4`,values:{0:d.project}}),t[90]=d.global,t[91]=d.project,t[92]=l.scope,t[93]=X):X=t[93];let ne;t[94]!==a||t[95]!==Y||t[96]!==X?(ne=(0,Q.jsxs)(wn,{menuKind:a,onSelect:Y,children:[te,X]}),t[94]=a,t[95]=Y,t[96]=X,t[97]=ne):ne=t[97];let re;t[98]!==a||t[99]!==N||t[100]!==L||t[101]!==V||t[102]!==J||t[103]!==ne?(re=(0,Q.jsxs)(Cn,{menuKind:a,children:[N,L,V,J,ne]}),t[98]=a,t[99]=N,t[100]=L,t[101]=V,t[102]=J,t[103]=ne,t[104]=re):re=t[104];let ie;t[105]===a?ie=t[106]:(ie=(0,Q.jsx)(Dn,{menuKind:a}),t[105]=a,t[106]=ie);let ae;t[107]!==n||t[108]!==l?(ae=()=>n.requestDelete(l),t[107]=n,t[108]=l,t[109]=ae):ae=t[109];let oe,se;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Q.jsx)(Xe,{"aria-hidden":!0}),se=(0,Q.jsx)(s,{id:`cnGeoo`}),t[110]=oe,t[111]=se):(oe=t[110],se=t[111]);let ce;t[112]!==a||t[113]!==ae?(ce=(0,Q.jsxs)(wn,{menuKind:a,variant:`destructive`,onSelect:ae,children:[oe,se]}),t[112]=a,t[113]=ae,t[114]=ce):ce=t[114];let le;t[115]!==a||t[116]!==ce?(le=(0,Q.jsx)(Cn,{menuKind:a,children:ce}),t[115]=a,t[116]=ce,t[117]=le):le=t[117];let ue;return t[118]!==O||t[119]!==k||t[120]!==re||t[121]!==ie||t[122]!==le?(ue=(0,Q.jsxs)(Q.Fragment,{children:[O,k,re,ie,le]}),t[118]=O,t[119]=k,t[120]=re,t[121]=ie,t[122]=le,t[123]=ue):ue=t[123],ue}export{ln as C,vn as D,pn as E,Jt as O,Xt as S,Qt as T,yn as _,Dr as a,$t as b,ur as c,ir as d,Rn as f,Sn as g,Bn as h,Or as i,cr as l,Gn as m,Nr as n,mr as o,zn as p,Mr as r,gr as s,Pr as t,sr as u,tn as v,hn as w,Yt as x,Zt as y};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{L as e}from"./CodeMirrorPropInput-
|
|
1
|
+
import{L as e}from"./CodeMirrorPropInput-CfyM9jmf.js";import{C as t,D as n,E as r,G as i,L as a,S as o,U as s,W as c,g as l,it as u,rt as d}from"./config-provider-CCU8qlmR.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-B0Beym3_.js";var b=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:a(this.yanchor),yhead:a(this.yhead)}}static fromJSON(t){return new e(r(t.yanchor),r(t.yhead))}},x=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new l(e)}toYPos(e,t=0){return n(this.ytext,e,t)}fromYPos(e){let n=t(r(e),this.ytext.doc);if(n==null||n.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:n.index,assoc:n.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 s(`span`,[i(`class`,`cm-ySelectionCaret`),i(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[c(``),s(`div`,[i(`class`,`cm-ySelectionCaretDot`)]),c(``),s(`div`,[i(`class`,`cm-ySelectionInfo`)],[c(this.name)]),c(``)])}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 i=this.conf.ytext,a=i.doc,s=this.conf.awareness,c=[],l=this.conf.awareness.getLocalState();if(l!=null){let t=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),a=t?e.state.selection.main:null,c=l.cursor==null?null:r(l.cursor.anchor),u=l.cursor==null?null:r(l.cursor.head);if(a!=null){let e=n(i,a.anchor),t=n(i,a.head);(l.cursor==null||!o(c,e)||!o(u,t))&&s.setLocalStateField(`cursor`,{anchor:e,head:t})}else l.cursor!=null&&t&&s.setLocalStateField(`cursor`,null)}s.getStates().forEach((n,r)=>{if(r===s.doc.clientID)return;let o=n.cursor;if(o==null||o.anchor==null||o.head==null)return;let l=t(o.anchor,a),f=t(o.head,a);if(l==null||f==null||l.type!==i||f.type!==i)return;let{color:p=`#30bced`,name:h=`Anonymous`}=n.user||{},g=n.user&&n.user.colorLight||p+`33`,_=u(l.index,f.index),v=d(l.index,f.index),y=e.view.state.doc.lineAt(_),b=e.view.state.doc.lineAt(v);if(y.number===b.number)c.push({from:_,to:v,value:m.mark({attributes:{style:`background-color: ${g}`},class:`cm-ySelection`})});else{c.push({from:_,to:y.from+y.length,value:m.mark({attributes:{style:`background-color: ${g}`},class:`cm-ySelection`})}),c.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;c.push({from:n,to:n,value:m.line({attributes:{style:`background-color: ${g}`,class:`cm-yLineSelection`}})})}}c.push({from:f.index,to:f.index,value:m.widget({side:f.index-l.index>0?-1:1,block:!1,widget:new O(p,h)})})}),this.decorations=m.set(c,!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=[{key:`Mod-z`,run:F,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:I,preventDefault:!0},{key:`Mod-Shift-z`,run:I,preventDefault:!0}],R=(e,t,{undoManager:n=new l(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 n,R as t};
|