@inkeep/open-knowledge 0.47.0-beta.21 → 0.47.0-beta.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/{acp-harness-probe-DXYqzFYA.mjs → acp-harness-probe-DT9_Vxdv.mjs} +2 -2
  2. package/dist/cli.mjs +6 -6
  3. package/dist/constants-oL_SnsqG.mjs +2 -0
  4. package/dist/index.mjs +1 -1
  5. package/dist/{init-BqXcwHZr.mjs → init-BAn_74tu.mjs} +3 -3
  6. package/dist/init-BvUdLid7.mjs +1 -0
  7. package/dist/{launch-json-removal--78GOuKl.mjs → launch-json-removal-BfBphAFi.mjs} +2 -2
  8. package/dist/{loader-BEBLs0tu.mjs → loader-Cn_VO29L.mjs} +2 -2
  9. package/dist/loader-DVLQnSyf.mjs +1 -0
  10. package/dist/{preview-iFFl27Qj.mjs → preview-BxddJAc3.mjs} +2 -2
  11. package/dist/preview-CPgNYcXY.mjs +1 -0
  12. package/dist/public/assets/FeedbackForm-Bn8BQxGY.js +1 -0
  13. package/dist/public/assets/ManagedArtifactProperties-CBMGEIBV.js +1 -0
  14. package/dist/public/assets/{ManagedArtifactProperties-BKmB2Biq.js → ManagedArtifactProperties-olm0bTI0.js} +1 -1
  15. package/dist/public/assets/{SessionsHost-BGzKrV22.js → SessionsHost-MxcgcWYN.js} +1 -1
  16. package/dist/public/assets/{SettingsDialogBody-DCVQf8Sd.js → SettingsDialogBody-CHz-Z6pp.js} +3 -3
  17. package/dist/public/assets/{SkillToolbarControls-_SvouuNK.js → SkillToolbarControls-DlGm1wVN.js} +1 -1
  18. package/dist/public/assets/{TerminalWindowApp-DyVBq2Ss.js → TerminalWindowApp-CYCVh6Qa.js} +1 -1
  19. package/dist/public/assets/{index-gkgpssO7.js → index-5hvjqRxk.js} +108 -108
  20. package/dist/public/assets/{skill-actions-BRtvvjCU.js → skill-actions-BFg9EzmY.js} +1 -1
  21. package/dist/public/assets/{sortable.esm-DR5PU-kX.js → sortable.esm-lATz1Hrd.js} +1 -1
  22. package/dist/public/assets/{terminal-launch-events-BBXOhZSh.js → terminal-launch-events-D3RRaYEw.js} +1 -1
  23. package/dist/public/index.html +5 -5
  24. package/dist/{repair-launch-json-DXxrE4q1.mjs → repair-launch-json-CJpyPmD0.mjs} +2 -2
  25. package/dist/{repair-mcp-configs-CJYHrV-m.mjs → repair-mcp-configs-CWnhMNts.mjs} +2 -2
  26. package/dist/{src-CoiPAaPO.mjs → src-SNA6giz2.mjs} +2 -2
  27. package/dist/start-BG2a-Q5T.mjs +1 -0
  28. package/dist/{start-BSKY8GSZ.mjs → start-oGvb5oXN.mjs} +2 -2
  29. package/package.json +4 -4
  30. package/dist/constants-DlluQJ9P.mjs +0 -2
  31. package/dist/init-BH_UUTAa.mjs +0 -1
  32. package/dist/loader-JMKw2q8P.mjs +0 -1
  33. package/dist/preview-B4LkEOYR.mjs +0 -1
  34. package/dist/public/assets/FeedbackForm-DBEWSa2N.js +0 -1
  35. package/dist/public/assets/ManagedArtifactProperties-Bz4VLtAN.js +0 -1
  36. package/dist/start-B_TU8YFy.mjs +0 -1
@@ -1,2 +1,2 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{L as n,Ln as r,R as i,bn as a,i as o,z as s}from"./DocumentContext-BpUSHG7l.js";import{t as c}from"./react-f2sANaYj.js";import{n as l,r as u}from"./dist-Nvb76hAm.js";import{t as d}from"./compiler-runtime-BfE3aGVn.js";import{l as f}from"./terminal-input-events-BGPQuYMh.js";import{t as p}from"./utils-CPqDy6Hr.js";import{t as m}from"./use-workspace-Di9mo5VO.js";import{c as h,i as g,n as _,o as v,s as y,t as b}from"./ChangedOutsideBadge--Hze6vD1.js";import{t as x}from"./button-RQ5o7P7w.js";import{i as S,n as C,t as w}from"./tooltip-x7BNUa3s.js";import{a as T,c as E,i as D,n as O,o as ee,r as k,s as A,t as j}from"./dialog-CCQHftjy.js";import{a as M,d as N,f as P,i as F,n as I,o as L,p as R,u as z}from"./dropdown-menu-AlVJ7dJz.js";import{t as te}from"./label-G0lbYOgL.js";import{C as B,a as V,f as H,h as U,m as W,n as G,o as K,p as q,r as J,s as Y,t as ne}from"./agent-visibility-DooA6q6Y.js";import{$t as X,Ba as re,Cn as ie,Ct as ae,Jt as oe,Nt as se,Pt as ce,Ra as le,Sn as ue,Ua as de,_n as fe,ai as pe,gn as me,ha as he,hn as ge,it as _e,kt as ve,mn as ye,nn as be,rt as xe,tn as Se,wn as Ce,xn as we,xr as Te,yn as Ee}from"./dist-CLzUuFWF2.js";import{t as De}from"./createLucideIcon-DihYAFEK.js";import{t as Oe}from"./RegisteredAgentIcon-MOyQ-5gc.js";import{n as ke,r as Ae}from"./ManagedArtifactProperties-BKmB2Biq.js";import{n as je}from"./CopyButton-D6N3opvE.js";import{t as Me}from"./folder-open-Ceue91os.js";import{t as Ne}from"./folder-DcWlgZbb.js";import{t as Pe}from"./trash-2-B8G0hzas.js";import{n as Z}from"./dist-DmEZHXvB.js";import{t as Fe}from"./input-CtKG6a5B.js";import{t as Ie}from"./dist-CpRBr-Ct.js";import{i as Le}from"./use-settings-route-DzedD2vL.js";import{t as Re}from"./parse-api-error-BFe1cdS7.js";import{G as ze,O as Be,W as Ve}from"./navigation-targets-CBDcAPCE.js";import{c as He,n as Ue,o as We}from"./documents-events-BXEDUEK0.js";import{c as Ge,f as Ke,n as qe,r as Je}from"./skill-scope-DQD8O86J.js";import{t as Ye}from"./badge-CnYDYmI5.js";import{A as Xe,D as Ze,O as Qe,S as $e,_ as et,c as tt,f as nt,i as rt,n as it,t as at,v as ot,x as st,y as ct}from"./skills-api-CmrsjdWe.js";import{n as lt}from"./config-context-DO4l6dU6.js";import{t as ut}from"./use-skills-DrxE5iKU.js";import{t as dt}from"./use-open-skill-CItHgrjr.js";import{n as ft}from"./clipboard-adapter-DPkNOslT.js";import{t as pt}from"./DiffView-by44lBMn.js";var mt=De(`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`}]]),ht=De(`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`}]]),gt=De(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),_t=De(`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`}]]),vt=De(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Q=t(),$=e(c(),1),yt=d();function bt(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 xt(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:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function St(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?bt(e):xt()}var Ct=`ok:skill:cowork:installed`,wt=`1`,Tt=250,Et=`/api/skill/install-state`;function Dt(e){return`${Ct}:v${e}`}var Ot=new Map;async function kt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Ot.get(n);if(r)return r;let i=At(e,t);return Ot.set(n,i),i.finally(()=>{Ot.get(n)===i&&Ot.delete(n)}),i}async function At(e,t){let n=e.installer===void 0?St():e.installer,r=jt(e.storage),i=e.fetchSnapshot??Nt,a=e.serverTimeoutMs??Tt,o=null;if(!t.force){try{o=await Pt(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=Dt(o?.currentVersion??e.fallbackSkillVersion??Mt());if(!t.force&&r?.getItem(s)===wt)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,wt)}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 jt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Mt(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Nt(){let e;try{e=await fetch(Et,{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 Pt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Ft(e){return kt({},e)}function It(){return kt({},{force:!0})}async function Lt(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 Rt(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Lt({target:`claude-cowork`,url:X({mode:`cowork`},e)},n);case`claude-code`:return Lt({target:`claude-code`,url:X({mode:`code`},e)},n);case`codex`:return Lt({target:`codex`,url:Se(e)},n);case`cursor`:return Lt({target:`cursor`,url:be(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 zt(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 Bt=`open-knowledge:agent-thread-launch`;function Vt(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(Bt,{detail:e}))}function Ht(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(Bt,n),()=>t.removeEventListener(Bt,n)}function Ut(e){if(!e.docName||!e.workspace)return null;let t=n(e.docName),{contentDir:r,pathSeparator:a}=e.workspace;return{docContext:{relativePath:t},projectDir:r,docPath:i(r,t,a)}}function Wt(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function Gt(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function Kt(e){return q(e.installUrl).then(()=>void 0)}function qt(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function Jt(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function Yt(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:r}=e.workspace;if(e.docName){let a=e.docRelativePath??n(e.docName),o={scope:`doc`,docRelativePath:a,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?o:{...o,selection:e.selection},projectDir:t,docPath:i(t,a,r)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function Xt(e){return`Opened in ${e}.`}function Zt(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function Qt(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function $t(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 en(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 tn(e,t,n,r){return e.compose?oe(en(e.compose,t,n,r)):e.selection?we({...e.selection,target:t,transport:r}):e.skill?ue(e.skill.name,e.skill.scope,n):e.ask?ye(e.ask.relativePath,e.ask.instruction,n,t,r):pe(e.docContext===null?e.folderRelativePath?Ee(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?me(n,e.instruction,r):ge(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):fe(e.docContext.relativePath,n,e.instruction,r))}function nn(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${xe} ${tn(e,se[t].handoffTarget,!1,`terminal`)}`:ie(e.docContext?.relativePath??null)}function rn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${_e} ${tn(e,`claude-code`,!1,`terminal`)}`:Ce(e.docContext?.relativePath??null)}function an(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function on(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 sn(e,t){Vt({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:rn(e),docName:an(e),titleHint:on(e)})}async function cn(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`OpenKnowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:tn(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=$t(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(Xt(u));else{let i=Qt(r),a=Zt(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{cn(e,t,n,r+1)}}})}return a}function ln(e){return W.find(t=>t.id===e)?.displayName??e}function un(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function dn(){return{dispatchHandoff:Rt,recordHandoff:zt,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>un(),getDisplayName:ln,ensureCoworkSkillInstalled:Ft,autoOpen:!0}}function fn(){let e=(0,yt.c)(2),{merged:t}=lt(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>cn(e,t,{...dn(),autoOpen:n}),reinstallCoworkSkill:It},e[0]=n,e[1]=r),r}var pn=Object.freeze({hosts:null,source:null}),mn=new Map,hn=new Map;function gn(e,t){return`${e}:${t}`}function _n(e){return mn.get(e)??pn}function vn(e,t){let n=hn.get(e)??new Set;return hn.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&hn.delete(e)}}function yn(e,t){let n=_n(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 hn.get(e)??[])t()}}var bn=ve.options,xn=`min-w-[24rem]`;function Sn(e,t){let n=(0,yt.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=gn(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=>vn(m,e),g=()=>_n(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&&yn(m,{source:null})},x=[e.hosts,y,m],n[12]=y,n[13]=m,n[14]=e.hosts,n[15]=b,n[16]=x):(b=n[15],x=n[16]),(0,$.useEffect)(b,x);let S=e.linkMode===!0,C=v??e.hosts,w;n[17]===C?w=n[18]:(w=new Set(C),n[17]=C,n[18]=w);let T=w,E=v?v.length>0:e.installed,D=(0,$.useRef)(e.hosts),O,ee;n[19]!==v||n[20]!==e.hosts?(O=()=>{v===null&&(D.current=e.hosts)},ee=[v,e.hosts],n[19]=v,n[20]=e.hosts,n[21]=O,n[22]=ee):(O=n[21],ee=n[22]),(0,$.useEffect)(O,ee);let k;n[23]===e.hosts?k=n[24]:(k=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=k);let A=k,j,M;n[25]!==m||n[26]!==A?(j=()=>{let e=_n(m).hosts;e&&[...e].sort().join(`,`)===A&&yn(m,{hosts:null})},M=[A,m],n[25]=m,n[26]=A,n[27]=j,n[28]=M):(j=n[27],M=n[28]),(0,$.useEffect)(j,M);let N=(0,$.useRef)(null),P=(0,$.useRef)(null),F,I;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>()=>{N.current&&clearTimeout(N.current),P.current?.(),P.current=null},I=[],n[29]=F,n[30]=I):(F=n[29],I=n[30]),(0,$.useEffect)(F,I);let L;n[31]!==t||n[32]!==m||n[33]!==e?(L=function(n,r){D.current=n,yn(m,{hosts:n}),N.current&&clearTimeout(N.current);let i=async()=>{P.current=null,N.current=null;let r=await t.install(e,n.filter(Te));if(!r.ok){yn(m,{hosts:null});return}D.current=[...r.hosts],yn(m,{hosts:[...r.hosts]})};r?(P.current=()=>void i(),N.current=setTimeout(()=>void i(),350)):(P.current=null,i())},n[31]=t,n[32]=m,n[33]=e,n[34]=L):L=n[34];let R=L,z;return n[35]!==t||n[36]!==R||n[37]!==T||n[38]!==E||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(z={hostSet:T,installed:E,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),R([...n],!0)},installAll(){let t=D.current.filter(Tn),n=e.installableEditors??bn,r=bn.filter(e=>n.includes(e)||D.current.includes(e));R([...t,...r],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>ot({scope:e.scope,name:e.name,dir:n,mode:r})).then(wn)},unplaceAt(n){t.runLocationWrite(e,()=>Qe({scope:e.scope,name:e.name,path:n})).then(Cn)},setSource(n){yn(m,{source:n}),t.runLocationWrite(e,()=>Ze({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(yn(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]=R,n[37]=T,n[38]=E,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=z):z=n[44],z}function Cn(e){e.ok||Z.error(e.error)}function wn(e){e.ok||Z.error(e.error)}function Tn(e){return!bn.includes(e)}function En(e){let t=(0,yt.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Q.jsx)(S,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Q.jsx)(C,{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)(w,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Dn(e){let t=(0,yt.c)(155),{toggles:n,skill:r,onResolveFork:i,onRunStart:a}=e,{_:o}=u(),{hostSet:s,toggleEditor:c,installAll:d}=n,f;t[0]===r?f=t[1]:(f=e=>r?`${Ge(e,r.scope)}/${r.name}`:null,t[0]=r,t[1]=f);let p=f,m=ut(),h;t[2]!==m.data||t[3]!==m.status||t[4]!==r?(h=r!==void 0&&((r.hosts??[]).includes(`agents`)||m.status===`ready`&&m.data.some(zn)),t[2]=m.data,t[3]=m.status,t[4]=r,t[5]=h):h=t[5];let g=h,v;t[6]!==m.data||t[7]!==m.status||t[8]!==r?(v=r?.hostAliases??(r&&m.status===`ready`?Object.assign({},...m.data.filter(e=>e.scope===r.scope).map(Rn)):{}),t[6]=m.data,t[7]=m.status,t[8]=r,t[9]=v):v=t[9];let y=v,S;t[10]!==m.data||t[11]!==m.status||t[12]!==r?(S=r?.installableEditors??(r&&m.status===`ready`?m.data.find(e=>e.scope===r.scope)?.installableEditors:void 0),t[10]=m.data,t[11]=m.status,t[12]=r,t[13]=S):S=t[13];let C=S,w,T,E,D,O,ee,k;if(t[14]!==o||t[15]!==y||t[16]!==m.data||t[17]!==m.status||t[18]!==s||t[19]!==g||t[20]!==d||t[21]!==C||t[22]!==i||t[23]!==a||t[24]!==p||t[25]!==r||t[26]!==c||t[27]!==n){let e=C?new Set(C):null,u;t[35]===y?u=t[36]:(u=e=>!(e in y),t[35]=y,t[36]=u);let f=(g?[`agents`,...bn]:bn).filter(u).filter(t=>t===`agents`||e===null||e.has(t)||s.has(t)),h;t[37]===p?h=t[38]:(h=e=>p(e),t[37]=p,t[38]=h);let v=new Set(f.map(h)),S=r?.scope===`global`?`~/`:``,A;t[39]!==S||t[40]!==r?(A=r?.path?.includes(`/`)?`${S}${r.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,t[39]=S,t[40]=r,t[41]=A):A=t[41];let j=A,M=j!==null&&!v.has(j)?j:null,N=M===null?n.sourceHost??r?.hosts?.[0]:void 0,P;t[42]===y?P=t[43]:(P=e=>qe(y,e),t[42]=y,t[43]=P);let F=P,R=Ln,z;t[44]!==o||t[45]!==F?(z=e=>{let t=F(e);return t.length===0?!0:window.confirm(o({id:`Uobeu9`,values:{0:t.map(R).join(`, `),rootRel:e}}))},t[44]=o,t[45]=F,t[46]=z):z=t[46];let te=z,B;t[47]!==o||t[48]!==r?(B=(e,t)=>{let n=e.includes(`/`)?e:Ge(e,r?.scope??`project`);return(0,Q.jsx)(En,{hint:o({id:`0dslv8`,values:{0:R(e),1:R(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":o({id:`G6Lrs_`,values:{0:R(e)}}),onClick:i=>{i.preventDefault(),i.stopPropagation(),window.confirm(o({id:`iiqOKM`,values:{0:R(e),1:r.name,2:R(e),subRoot:n,poolRootRel:t}}))&&ct({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?We():Z.error(o({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,Q.jsx)(_,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[47]=o,t[48]=r,t[49]=B):B=t[49];let V=B,H;t[50]===r?.conflictHosts?H=t[51]:(H=r?.conflictHosts??[],t[50]=r?.conflictHosts,t[51]=H);let U;t[52]===H?U=t[53]:(U=new Set(H),t[52]=H,t[53]=U);let W=U,G;t[54]===r?.driftPaths?G=t[55]:(G=r?.driftPaths??[],t[54]=r?.driftPaths,t[55]=G);let K;t[56]===G?K=t[57]:(K=new Set(G),t[56]=G,t[57]=K);let q=K;w=n.installing;let J=In,Y;t[58]===r?.symlinkedHosts?Y=t[59]:(Y=r?.symlinkedHosts??[],t[58]=r?.symlinkedHosts,t[59]=Y);let ne;t[60]===Y?ne=t[61]:(ne=new Set(Y),t[60]=Y,t[61]=ne);let X=ne,re=[...[...s].filter(e=>e!==N&&!(e in y)&&!W.has(e)&&!e.includes(`/`)).map(e=>X.has(e)?`link`:`copy`),...(r?.customPlacements??[]).map(Fn)],ie=re.filter(Pn).length;E=re.length===0?n.linkMode?`link`:`copy`:ie*2>=re.length?`link`:`copy`;let ae;t[62]!==y||t[63]!==W||t[64]!==s||t[65]!==X||t[66]!==p||t[67]!==N?(ae=[...s].filter(e=>e!==N&&!(e in y)&&!W.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:p(e)??R(e),mode:X.has(e)?`link`:`copy`})),t[62]=y,t[63]=W,t[64]=s,t[65]=X,t[66]=p,t[67]=N,t[68]=ae):ae=t[68];let oe;t[69]===r?.customPlacements?oe=t[70]:(oe=r?.customPlacements??[],t[69]=r?.customPlacements,t[70]=oe);let se;if(t[71]!==S||t[72]!==ae||t[73]!==oe){let e;t[75]===S?e=t[76]:(e=e=>({target:Je(e),display:`${S}${e.path}`,mode:e.mode}),t[75]=S,t[76]=e),se=[...ae,...oe.map(e)],t[71]=S,t[72]=ae,t[73]=oe,t[74]=se}else se=t[74];T=se;let ce;t[77]!==o||t[78]!==a||t[79]!==n?(ce=(e,t,r)=>{let i=r===`link`?`copy`:`link`;return(0,Q.jsx)(En,{hint:o(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 font-normal text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(o(i===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(a?.(),n.convertLocation?.(e,i))},"data-testid":`skill-convert-${e}`,children:r===`link`?(0,Q.jsx)(l,{id:`uUCrBv`}):(0,Q.jsx)(l,{id:`iaPtht`})})})},t[77]=o,t[78]=a,t[79]=n,t[80]=ce):ce=t[80];let le=ce,ue;t[81]===r?.customPlacements?ue=t[82]:(ue=r?.customPlacements??[],t[81]=r?.customPlacements,t[82]=ue);let de=new Map(ue.map(Nn)),fe=new Set(de.keys());if(m.status===`ready`&&r){for(let e of m.data)if(e.scope===r.scope)for(let t of e.customPlacements??[]){let e=Je(t);e!==``&&fe.add(e)}}let pe=r===void 0?[]:[...fe].sort().map(e=>({root:e,display:`${S}${e}/${r.name}`,placed:de.get(e)??null})).filter(e=>!v.has(e.display)&&e.display!==j&&!(e.root in y)),me;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Q.jsx)(l,{id:`npcziF`}),t[83]=me):me=t[83];let ge;t[84]===o?ge=t[85]:(ge=o({id:`6f_UX4`}),t[84]=o,t[85]=ge);let _e;t[86]===d?_e=t[87]:(_e=()=>d(),t[86]=d,t[87]=_e);let ve;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(l,{id:`N40H-G`}),t[88]=ve):ve=t[88];let ye;t[89]!==w||t[90]!==_e?(ye=(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:w,onClick:_e,"data-testid":`skill-install-all`,children:ve}),t[89]=w,t[90]=_e,t[91]=ye):ye=t[91],t[92]!==ge||t[93]!==ye?(D=(0,Q.jsxs)(L,{className:`flex items-center justify-between gap-2`,children:[me,(0,Q.jsx)(En,{hint:ge,children:ye})]}),t[92]=ge,t[93]=ye,t[94]=D):D=t[94],t[95]!==o||t[96]!==V||t[97]!==w||t[98]!==M||t[99]!==F?(O=M===null?null:(0,Q.jsx)(En,{hint:o({id:`pXB6SL`}),children:(0,Q.jsxs)(I,{disabled:w,checked:!0,onSelect:Mn,"data-testid":`skill-source-row`,children:[(0,Q.jsx)(Ne,{"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:M}),(()=>{let e=J(M).split(`/`).slice(0,-1).join(`/`),t=F(e);return t.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>V(t,e))}):null})(),(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(l,{id:`tiFPjk`})})]})]})}),t[95]=o,t[96]=V,t[97]=w,t[98]=M,t[99]=F,t[100]=O):O=t[100];let be;t[101]!==o||t[102]!==V||t[103]!==w||t[104]!==te||t[105]!==W||t[106]!==le||t[107]!==q||t[108]!==E||t[109]!==s||t[110]!==X||t[111]!==i||t[112]!==p||t[113]!==r?.hosts||t[114]!==N||t[115]!==F||t[116]!==c||t[117]!==n?(be=e=>{let t=p(e),a=e===`agents`?`.agents`:he[e],u=J(t).split(`/`).slice(0,-1).join(`/`),d=F(u);return(0,Q.jsx)(En,{hint:W.has(e)?o({id:`8HvJlU`,values:{0:t??a}}):e===N?t?o({id:`ssk6rl`,values:{path:t}}):a:s.has(e)?o(t?{id:`9ieZhu`,values:{path:t}}:{id:`n3T3EE`,values:{label:a}}):o(t?E===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}:{id:`Pp0Vgd`,values:{label:a}}),children:(0,Q.jsxs)(I,{disabled:w,checked:s.has(e),onCheckedChange:t=>{W.has(e)||t===!0&&!te(u)||c(e,t===!0)},onSelect:jn,className:`group`,"data-testid":`skill-install-editor-${e}`,children:[(0,Q.jsx)(_,{host:e,"aria-hidden":!0,className:`size-4`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:t??a}),d.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${e}`,children:d.map(e=>V(e,u))}):null,W.has(e)?(0,Q.jsx)(En,{hint:o({id:`_O7dJS`}),children:(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:t=>{t.preventDefault(),i?.(e)},"data-testid":`skill-fork-chip-${e}`,children:(0,Q.jsx)(l,{id:`jng7Ko`})})}):e===N?(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(l,{id:`tiFPjk`})}):s.has(e)&&r?.hosts?(0,Q.jsxs)(Q.Fragment,{children:[!w&&(X.has(e)?`link`:`copy`)!==E?le(e,t??a,X.has(e)?`link`:`copy`):null,(0,Q.jsx)(En,{hint:o({id:`nBgzKO`}),children:(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e)},"data-testid":`skill-set-source-${e}`,children:(0,Q.jsx)(l,{id:`VNNRfN`})})})]}):null,!w&&q.has(J(t))?(0,Q.jsx)(En,{hint:o({id:`iz1LdD`}),children:(0,Q.jsx)(b,{testId:`skill-drift-${e}`})}):null]})]})},e)},t[101]=o,t[102]=V,t[103]=w,t[104]=te,t[105]=W,t[106]=le,t[107]=q,t[108]=E,t[109]=s,t[110]=X,t[111]=i,t[112]=p,t[113]=r?.hosts,t[114]=N,t[115]=F,t[116]=c,t[117]=n,t[118]=be):be=t[118],ee=f.map(be);let xe;t[119]!==o||t[120]!==V||t[121]!==w||t[122]!==te||t[123]!==le||t[124]!==q||t[125]!==E||t[126]!==F||t[127]!==n?(xe=e=>(0,Q.jsx)(En,{hint:e.placed===null?o(E===`link`?{id:`ybWWR2`,values:{0:e.display}}:{id:`fDjZxw`,values:{0:e.display}}):o({id:`C0cll5`,values:{0:e.display}}),children:(0,Q.jsxs)(I,{disabled:w,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!te(e.root))return;n.placeAt(e.root,E)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:An,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,Q.jsx)(_,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,Q.jsx)(Ne,{"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}),F(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:F(e.root).map(t=>V(t,e.root))}):null,!w&&e.placed!==null&&q.has(e.placed.path)?(0,Q.jsx)(En,{hint:o({id:`iz1LdD`}),children:(0,Q.jsx)(b,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,Q.jsxs)(Q.Fragment,{children:[!w&&e.placed.mode!==E?le(e.root,e.display,e.placed.mode):null,(0,Q.jsx)(En,{hint:o({id:`nBgzKO`}),children:(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e.root)},"data-testid":`skill-set-source-custom-${e.root}`,children:(0,Q.jsx)(l,{id:`VNNRfN`})})})]})]})]})},e.root),t[119]=o,t[120]=V,t[121]=w,t[122]=te,t[123]=le,t[124]=q,t[125]=E,t[126]=F,t[127]=n,t[128]=xe):xe=t[128],k=pe.map(xe),t[14]=o,t[15]=y,t[16]=m.data,t[17]=m.status,t[18]=s,t[19]=g,t[20]=d,t[21]=C,t[22]=i,t[23]=a,t[24]=p,t[25]=r,t[26]=c,t[27]=n,t[28]=w,t[29]=T,t[30]=E,t[31]=D,t[32]=O,t[33]=ee,t[34]=k}else w=t[28],T=t[29],E=t[30],D=t[31],O=t[32],ee=t[33],k=t[34];let A;t[129]!==o||t[130]!==w||t[131]!==T||t[132]!==E||t[133]!==a||t[134]!==n?(A=T.length>0&&n.convertLocations?(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-auto whitespace-normal p-0 text-left font-normal text-[11px] text-muted-foreground leading-snug hover:bg-transparent hover:text-foreground`,onClick:e=>{e.preventDefault();let t=E===`link`?`copy`:`link`,r=T.filter(e=>e.mode!==t);if(r.length===0)return;let i=o(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),s=o(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),c=r.map(kn).join(`
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{L as n,Ln as r,R as i,bn as a,i as o,z as s}from"./DocumentContext-BpUSHG7l.js";import{t as c}from"./react-f2sANaYj.js";import{n as l,r as u}from"./dist-Nvb76hAm.js";import{t as d}from"./compiler-runtime-BfE3aGVn.js";import{l as f}from"./terminal-input-events-BGPQuYMh.js";import{t as p}from"./utils-CPqDy6Hr.js";import{t as m}from"./use-workspace-Di9mo5VO.js";import{c as h,i as g,n as _,o as v,s as y,t as b}from"./ChangedOutsideBadge--Hze6vD1.js";import{t as x}from"./button-RQ5o7P7w.js";import{i as S,n as C,t as w}from"./tooltip-x7BNUa3s.js";import{a as T,c as E,i as D,n as O,o as ee,r as k,s as A,t as j}from"./dialog-CCQHftjy.js";import{a as M,d as N,f as P,i as F,n as I,o as L,p as R,u as z}from"./dropdown-menu-AlVJ7dJz.js";import{t as te}from"./label-G0lbYOgL.js";import{C as B,a as V,f as H,h as U,m as W,n as G,o as K,p as q,r as J,s as Y,t as ne}from"./agent-visibility-DooA6q6Y.js";import{$t as X,Ba as re,Cn as ie,Ct as ae,Jt as oe,Nt as se,Pt as ce,Ra as le,Sn as ue,Ua as de,_n as fe,ai as pe,gn as me,ha as he,hn as ge,it as _e,kt as ve,mn as ye,nn as be,rt as xe,tn as Se,wn as Ce,xn as we,xr as Te,yn as Ee}from"./dist-CLzUuFWF2.js";import{t as De}from"./createLucideIcon-DihYAFEK.js";import{t as Oe}from"./RegisteredAgentIcon-MOyQ-5gc.js";import{n as ke,r as Ae}from"./ManagedArtifactProperties-olm0bTI0.js";import{n as je}from"./CopyButton-D6N3opvE.js";import{t as Me}from"./folder-open-Ceue91os.js";import{t as Ne}from"./folder-DcWlgZbb.js";import{t as Pe}from"./trash-2-B8G0hzas.js";import{n as Z}from"./dist-DmEZHXvB.js";import{t as Fe}from"./input-CtKG6a5B.js";import{t as Ie}from"./dist-CpRBr-Ct.js";import{i as Le}from"./use-settings-route-DzedD2vL.js";import{t as Re}from"./parse-api-error-BFe1cdS7.js";import{G as ze,O as Be,W as Ve}from"./navigation-targets-CBDcAPCE.js";import{c as He,n as Ue,o as We}from"./documents-events-BXEDUEK0.js";import{c as Ge,f as Ke,n as qe,r as Je}from"./skill-scope-DQD8O86J.js";import{t as Ye}from"./badge-CnYDYmI5.js";import{A as Xe,D as Ze,O as Qe,S as $e,_ as et,c as tt,f as nt,i as rt,n as it,t as at,v as ot,x as st,y as ct}from"./skills-api-CmrsjdWe.js";import{n as lt}from"./config-context-DO4l6dU6.js";import{t as ut}from"./use-skills-DrxE5iKU.js";import{t as dt}from"./use-open-skill-CItHgrjr.js";import{n as ft}from"./clipboard-adapter-DPkNOslT.js";import{t as pt}from"./DiffView-by44lBMn.js";var mt=De(`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`}]]),ht=De(`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`}]]),gt=De(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),_t=De(`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`}]]),vt=De(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Q=t(),$=e(c(),1),yt=d();function bt(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 xt(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:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function St(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?bt(e):xt()}var Ct=`ok:skill:cowork:installed`,wt=`1`,Tt=250,Et=`/api/skill/install-state`;function Dt(e){return`${Ct}:v${e}`}var Ot=new Map;async function kt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Ot.get(n);if(r)return r;let i=At(e,t);return Ot.set(n,i),i.finally(()=>{Ot.get(n)===i&&Ot.delete(n)}),i}async function At(e,t){let n=e.installer===void 0?St():e.installer,r=jt(e.storage),i=e.fetchSnapshot??Nt,a=e.serverTimeoutMs??Tt,o=null;if(!t.force){try{o=await Pt(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=Dt(o?.currentVersion??e.fallbackSkillVersion??Mt());if(!t.force&&r?.getItem(s)===wt)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,wt)}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 jt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Mt(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Nt(){let e;try{e=await fetch(Et,{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 Pt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Ft(e){return kt({},e)}function It(){return kt({},{force:!0})}async function Lt(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 Rt(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Lt({target:`claude-cowork`,url:X({mode:`cowork`},e)},n);case`claude-code`:return Lt({target:`claude-code`,url:X({mode:`code`},e)},n);case`codex`:return Lt({target:`codex`,url:Se(e)},n);case`cursor`:return Lt({target:`cursor`,url:be(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 zt(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 Bt=`open-knowledge:agent-thread-launch`;function Vt(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(Bt,{detail:e}))}function Ht(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(Bt,n),()=>t.removeEventListener(Bt,n)}function Ut(e){if(!e.docName||!e.workspace)return null;let t=n(e.docName),{contentDir:r,pathSeparator:a}=e.workspace;return{docContext:{relativePath:t},projectDir:r,docPath:i(r,t,a)}}function Wt(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function Gt(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function Kt(e){return q(e.installUrl).then(()=>void 0)}function qt(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function Jt(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function Yt(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:r}=e.workspace;if(e.docName){let a=e.docRelativePath??n(e.docName),o={scope:`doc`,docRelativePath:a,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?o:{...o,selection:e.selection},projectDir:t,docPath:i(t,a,r)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function Xt(e){return`Opened in ${e}.`}function Zt(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function Qt(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function $t(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 en(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 tn(e,t,n,r){return e.compose?oe(en(e.compose,t,n,r)):e.selection?we({...e.selection,target:t,transport:r}):e.skill?ue(e.skill.name,e.skill.scope,n):e.ask?ye(e.ask.relativePath,e.ask.instruction,n,t,r):pe(e.docContext===null?e.folderRelativePath?Ee(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?me(n,e.instruction,r):ge(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):fe(e.docContext.relativePath,n,e.instruction,r))}function nn(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${xe} ${tn(e,se[t].handoffTarget,!1,`terminal`)}`:ie(e.docContext?.relativePath??null)}function rn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${_e} ${tn(e,`claude-code`,!1,`terminal`)}`:Ce(e.docContext?.relativePath??null)}function an(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function on(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 sn(e,t){Vt({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:rn(e),docName:an(e),titleHint:on(e)})}async function cn(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`OpenKnowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install OpenKnowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:tn(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=$t(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(Xt(u));else{let i=Qt(r),a=Zt(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{cn(e,t,n,r+1)}}})}return a}function ln(e){return W.find(t=>t.id===e)?.displayName??e}function un(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function dn(){return{dispatchHandoff:Rt,recordHandoff:zt,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>un(),getDisplayName:ln,ensureCoworkSkillInstalled:Ft,autoOpen:!0}}function fn(){let e=(0,yt.c)(2),{merged:t}=lt(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>cn(e,t,{...dn(),autoOpen:n}),reinstallCoworkSkill:It},e[0]=n,e[1]=r),r}var pn=Object.freeze({hosts:null,source:null}),mn=new Map,hn=new Map;function gn(e,t){return`${e}:${t}`}function _n(e){return mn.get(e)??pn}function vn(e,t){let n=hn.get(e)??new Set;return hn.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&hn.delete(e)}}function yn(e,t){let n=_n(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 hn.get(e)??[])t()}}var bn=ve.options,xn=`min-w-[24rem]`;function Sn(e,t){let n=(0,yt.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=gn(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=>vn(m,e),g=()=>_n(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&&yn(m,{source:null})},x=[e.hosts,y,m],n[12]=y,n[13]=m,n[14]=e.hosts,n[15]=b,n[16]=x):(b=n[15],x=n[16]),(0,$.useEffect)(b,x);let S=e.linkMode===!0,C=v??e.hosts,w;n[17]===C?w=n[18]:(w=new Set(C),n[17]=C,n[18]=w);let T=w,E=v?v.length>0:e.installed,D=(0,$.useRef)(e.hosts),O,ee;n[19]!==v||n[20]!==e.hosts?(O=()=>{v===null&&(D.current=e.hosts)},ee=[v,e.hosts],n[19]=v,n[20]=e.hosts,n[21]=O,n[22]=ee):(O=n[21],ee=n[22]),(0,$.useEffect)(O,ee);let k;n[23]===e.hosts?k=n[24]:(k=[...e.hosts].sort().join(`,`),n[23]=e.hosts,n[24]=k);let A=k,j,M;n[25]!==m||n[26]!==A?(j=()=>{let e=_n(m).hosts;e&&[...e].sort().join(`,`)===A&&yn(m,{hosts:null})},M=[A,m],n[25]=m,n[26]=A,n[27]=j,n[28]=M):(j=n[27],M=n[28]),(0,$.useEffect)(j,M);let N=(0,$.useRef)(null),P=(0,$.useRef)(null),F,I;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>()=>{N.current&&clearTimeout(N.current),P.current?.(),P.current=null},I=[],n[29]=F,n[30]=I):(F=n[29],I=n[30]),(0,$.useEffect)(F,I);let L;n[31]!==t||n[32]!==m||n[33]!==e?(L=function(n,r){D.current=n,yn(m,{hosts:n}),N.current&&clearTimeout(N.current);let i=async()=>{P.current=null,N.current=null;let r=await t.install(e,n.filter(Te));if(!r.ok){yn(m,{hosts:null});return}D.current=[...r.hosts],yn(m,{hosts:[...r.hosts]})};r?(P.current=()=>void i(),N.current=setTimeout(()=>void i(),350)):(P.current=null,i())},n[31]=t,n[32]=m,n[33]=e,n[34]=L):L=n[34];let R=L,z;return n[35]!==t||n[36]!==R||n[37]!==T||n[38]!==E||n[39]!==f||n[40]!==y||n[41]!==m||n[42]!==S||n[43]!==e?(z={hostSet:T,installed:E,installing:f,toggleEditor(e,t){let n=new Set(D.current);t?n.add(e):n.delete(e),R([...n],!0)},installAll(){let t=D.current.filter(Tn),n=e.installableEditors??bn,r=bn.filter(e=>n.includes(e)||D.current.includes(e));R([...t,...r],!1)},linkMode:S,sourceHost:y??e.hosts[0],placeAt(n,r){t.runLocationWrite(e,()=>ot({scope:e.scope,name:e.name,dir:n,mode:r})).then(wn)},unplaceAt(n){t.runLocationWrite(e,()=>Qe({scope:e.scope,name:e.name,path:n})).then(Cn)},setSource(n){yn(m,{source:n}),t.runLocationWrite(e,()=>Ze({scope:e.scope,name:e.name,target:n})).then(e=>{e.ok||(yn(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]=R,n[37]=T,n[38]=E,n[39]=f,n[40]=y,n[41]=m,n[42]=S,n[43]=e,n[44]=z):z=n[44],z}function Cn(e){e.ok||Z.error(e.error)}function wn(e){e.ok||Z.error(e.error)}function Tn(e){return!bn.includes(e)}function En(e){let t=(0,yt.c)(7),{hint:n,children:r}=e,i;t[0]===r?i=t[1]:(i=(0,Q.jsx)(S,{asChild:!0,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Q.jsx)(C,{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)(w,{children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Dn(e){let t=(0,yt.c)(155),{toggles:n,skill:r,onResolveFork:i,onRunStart:a}=e,{_:o}=u(),{hostSet:s,toggleEditor:c,installAll:d}=n,f;t[0]===r?f=t[1]:(f=e=>r?`${Ge(e,r.scope)}/${r.name}`:null,t[0]=r,t[1]=f);let p=f,m=ut(),h;t[2]!==m.data||t[3]!==m.status||t[4]!==r?(h=r!==void 0&&((r.hosts??[]).includes(`agents`)||m.status===`ready`&&m.data.some(zn)),t[2]=m.data,t[3]=m.status,t[4]=r,t[5]=h):h=t[5];let g=h,v;t[6]!==m.data||t[7]!==m.status||t[8]!==r?(v=r?.hostAliases??(r&&m.status===`ready`?Object.assign({},...m.data.filter(e=>e.scope===r.scope).map(Rn)):{}),t[6]=m.data,t[7]=m.status,t[8]=r,t[9]=v):v=t[9];let y=v,S;t[10]!==m.data||t[11]!==m.status||t[12]!==r?(S=r?.installableEditors??(r&&m.status===`ready`?m.data.find(e=>e.scope===r.scope)?.installableEditors:void 0),t[10]=m.data,t[11]=m.status,t[12]=r,t[13]=S):S=t[13];let C=S,w,T,E,D,O,ee,k;if(t[14]!==o||t[15]!==y||t[16]!==m.data||t[17]!==m.status||t[18]!==s||t[19]!==g||t[20]!==d||t[21]!==C||t[22]!==i||t[23]!==a||t[24]!==p||t[25]!==r||t[26]!==c||t[27]!==n){let e=C?new Set(C):null,u;t[35]===y?u=t[36]:(u=e=>!(e in y),t[35]=y,t[36]=u);let f=(g?[`agents`,...bn]:bn).filter(u).filter(t=>t===`agents`||e===null||e.has(t)||s.has(t)),h;t[37]===p?h=t[38]:(h=e=>p(e),t[37]=p,t[38]=h);let v=new Set(f.map(h)),S=r?.scope===`global`?`~/`:``,A;t[39]!==S||t[40]!==r?(A=r?.path?.includes(`/`)?`${S}${r.path.replace(/\/SKILL\.mdx?$/i,``)}`:null,t[39]=S,t[40]=r,t[41]=A):A=t[41];let j=A,M=j!==null&&!v.has(j)?j:null,N=M===null?n.sourceHost??r?.hosts?.[0]:void 0,P;t[42]===y?P=t[43]:(P=e=>qe(y,e),t[42]=y,t[43]=P);let F=P,R=Ln,z;t[44]!==o||t[45]!==F?(z=e=>{let t=F(e);return t.length===0?!0:window.confirm(o({id:`Uobeu9`,values:{0:t.map(R).join(`, `),rootRel:e}}))},t[44]=o,t[45]=F,t[46]=z):z=t[46];let te=z,B;t[47]!==o||t[48]!==r?(B=(e,t)=>{let n=e.includes(`/`)?e:Ge(e,r?.scope??`project`);return(0,Q.jsx)(En,{hint:o({id:`0dslv8`,values:{0:R(e),1:R(e),2:r?.name??``,poolRootRel:t,subRoot:n}}),children:(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-4 shrink-0 px-0`,"aria-label":o({id:`G6Lrs_`,values:{0:R(e)}}),onClick:i=>{i.preventDefault(),i.stopPropagation(),window.confirm(o({id:`iiqOKM`,values:{0:R(e),1:r.name,2:R(e),subRoot:n,poolRootRel:t}}))&&ct({scope:r.scope,root:n,action:`unlink`,exclude:[r.name]}).then(e=>{e.ok?We():Z.error(o({id:`PRgIJh`,values:{0:e.error,subRoot:n}}))})},"data-testid":`skill-audience-unfollow-${e}`,children:(0,Q.jsx)(_,{host:e,"aria-hidden":!0,className:`size-3.5`})})},e)},t[47]=o,t[48]=r,t[49]=B):B=t[49];let V=B,H;t[50]===r?.conflictHosts?H=t[51]:(H=r?.conflictHosts??[],t[50]=r?.conflictHosts,t[51]=H);let U;t[52]===H?U=t[53]:(U=new Set(H),t[52]=H,t[53]=U);let W=U,G;t[54]===r?.driftPaths?G=t[55]:(G=r?.driftPaths??[],t[54]=r?.driftPaths,t[55]=G);let K;t[56]===G?K=t[57]:(K=new Set(G),t[56]=G,t[57]=K);let q=K;w=n.installing;let J=In,Y;t[58]===r?.symlinkedHosts?Y=t[59]:(Y=r?.symlinkedHosts??[],t[58]=r?.symlinkedHosts,t[59]=Y);let ne;t[60]===Y?ne=t[61]:(ne=new Set(Y),t[60]=Y,t[61]=ne);let X=ne,re=[...[...s].filter(e=>e!==N&&!(e in y)&&!W.has(e)&&!e.includes(`/`)).map(e=>X.has(e)?`link`:`copy`),...(r?.customPlacements??[]).map(Fn)],ie=re.filter(Pn).length;E=re.length===0?n.linkMode?`link`:`copy`:ie*2>=re.length?`link`:`copy`;let ae;t[62]!==y||t[63]!==W||t[64]!==s||t[65]!==X||t[66]!==p||t[67]!==N?(ae=[...s].filter(e=>e!==N&&!(e in y)&&!W.has(e)&&!e.includes(`/`)).map(e=>({target:e,display:p(e)??R(e),mode:X.has(e)?`link`:`copy`})),t[62]=y,t[63]=W,t[64]=s,t[65]=X,t[66]=p,t[67]=N,t[68]=ae):ae=t[68];let oe;t[69]===r?.customPlacements?oe=t[70]:(oe=r?.customPlacements??[],t[69]=r?.customPlacements,t[70]=oe);let se;if(t[71]!==S||t[72]!==ae||t[73]!==oe){let e;t[75]===S?e=t[76]:(e=e=>({target:Je(e),display:`${S}${e.path}`,mode:e.mode}),t[75]=S,t[76]=e),se=[...ae,...oe.map(e)],t[71]=S,t[72]=ae,t[73]=oe,t[74]=se}else se=t[74];T=se;let ce;t[77]!==o||t[78]!==a||t[79]!==n?(ce=(e,t,r)=>{let i=r===`link`?`copy`:`link`;return(0,Q.jsx)(En,{hint:o(r===`link`?{id:`FeXcUS`,values:{display:t}}:{id:`ugQcJX`,values:{display:t}}),children:(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 font-normal text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:r=>{r.preventDefault(),r.stopPropagation(),window.confirm(o(i===`link`?{id:`m0eHej`,values:{display:t}}:{id:`HbcQYf`,values:{display:t}}))&&(a?.(),n.convertLocation?.(e,i))},"data-testid":`skill-convert-${e}`,children:r===`link`?(0,Q.jsx)(l,{id:`uUCrBv`}):(0,Q.jsx)(l,{id:`iaPtht`})})})},t[77]=o,t[78]=a,t[79]=n,t[80]=ce):ce=t[80];let le=ce,ue;t[81]===r?.customPlacements?ue=t[82]:(ue=r?.customPlacements??[],t[81]=r?.customPlacements,t[82]=ue);let de=new Map(ue.map(Nn)),fe=new Set(de.keys());if(m.status===`ready`&&r){for(let e of m.data)if(e.scope===r.scope)for(let t of e.customPlacements??[]){let e=Je(t);e!==``&&fe.add(e)}}let pe=r===void 0?[]:[...fe].sort().map(e=>({root:e,display:`${S}${e}/${r.name}`,placed:de.get(e)??null})).filter(e=>!v.has(e.display)&&e.display!==j&&!(e.root in y)),me;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Q.jsx)(l,{id:`npcziF`}),t[83]=me):me=t[83];let ge;t[84]===o?ge=t[85]:(ge=o({id:`6f_UX4`}),t[84]=o,t[85]=ge);let _e;t[86]===d?_e=t[87]:(_e=()=>d(),t[86]=d,t[87]=_e);let ve;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(l,{id:`N40H-G`}),t[88]=ve):ve=t[88];let ye;t[89]!==w||t[90]!==_e?(ye=(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-5 px-1.5 font-normal text-[11px] text-muted-foreground hover:text-foreground`,disabled:w,onClick:_e,"data-testid":`skill-install-all`,children:ve}),t[89]=w,t[90]=_e,t[91]=ye):ye=t[91],t[92]!==ge||t[93]!==ye?(D=(0,Q.jsxs)(L,{className:`flex items-center justify-between gap-2`,children:[me,(0,Q.jsx)(En,{hint:ge,children:ye})]}),t[92]=ge,t[93]=ye,t[94]=D):D=t[94],t[95]!==o||t[96]!==V||t[97]!==w||t[98]!==M||t[99]!==F?(O=M===null?null:(0,Q.jsx)(En,{hint:o({id:`pXB6SL`}),children:(0,Q.jsxs)(I,{disabled:w,checked:!0,onSelect:Mn,"data-testid":`skill-source-row`,children:[(0,Q.jsx)(Ne,{"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:M}),(()=>{let e=J(M).split(`/`).slice(0,-1).join(`/`),t=F(e);return t.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-source`,children:t.map(t=>V(t,e))}):null})(),(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(l,{id:`tiFPjk`})})]})]})}),t[95]=o,t[96]=V,t[97]=w,t[98]=M,t[99]=F,t[100]=O):O=t[100];let be;t[101]!==o||t[102]!==V||t[103]!==w||t[104]!==te||t[105]!==W||t[106]!==le||t[107]!==q||t[108]!==E||t[109]!==s||t[110]!==X||t[111]!==i||t[112]!==p||t[113]!==r?.hosts||t[114]!==N||t[115]!==F||t[116]!==c||t[117]!==n?(be=e=>{let t=p(e),a=e===`agents`?`.agents`:he[e],u=J(t).split(`/`).slice(0,-1).join(`/`),d=F(u);return(0,Q.jsx)(En,{hint:W.has(e)?o({id:`8HvJlU`,values:{0:t??a}}):e===N?t?o({id:`ssk6rl`,values:{path:t}}):a:s.has(e)?o(t?{id:`9ieZhu`,values:{path:t}}:{id:`n3T3EE`,values:{label:a}}):o(t?E===`link`?{id:`1LtA5r`,values:{path:t}}:{id:`opPbzN`,values:{path:t}}:{id:`Pp0Vgd`,values:{label:a}}),children:(0,Q.jsxs)(I,{disabled:w,checked:s.has(e),onCheckedChange:t=>{W.has(e)||t===!0&&!te(u)||c(e,t===!0)},onSelect:jn,className:`group`,"data-testid":`skill-install-editor-${e}`,children:[(0,Q.jsx)(_,{host:e,"aria-hidden":!0,className:`size-4`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:t??a}),d.length>0?(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-testid":`skill-row-audience-${e}`,children:d.map(e=>V(e,u))}):null,W.has(e)?(0,Q.jsx)(En,{hint:o({id:`_O7dJS`}),children:(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-yellow-500/40 bg-yellow-500/10 px-1 text-[10px] text-yellow-600 uppercase tracking-wide hover:bg-yellow-500/20`,onClick:t=>{t.preventDefault(),i?.(e)},"data-testid":`skill-fork-chip-${e}`,children:(0,Q.jsx)(l,{id:`jng7Ko`})})}):e===N?(0,Q.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded border border-border/60 px-1 text-[10px] uppercase tracking-wide text-muted-foreground`,children:(0,Q.jsx)(l,{id:`tiFPjk`})}):s.has(e)&&r?.hosts?(0,Q.jsxs)(Q.Fragment,{children:[!w&&(X.has(e)?`link`:`copy`)!==E?le(e,t??a,X.has(e)?`link`:`copy`):null,(0,Q.jsx)(En,{hint:o({id:`nBgzKO`}),children:(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e)},"data-testid":`skill-set-source-${e}`,children:(0,Q.jsx)(l,{id:`VNNRfN`})})})]}):null,!w&&q.has(J(t))?(0,Q.jsx)(En,{hint:o({id:`iz1LdD`}),children:(0,Q.jsx)(b,{testId:`skill-drift-${e}`})}):null]})]})},e)},t[101]=o,t[102]=V,t[103]=w,t[104]=te,t[105]=W,t[106]=le,t[107]=q,t[108]=E,t[109]=s,t[110]=X,t[111]=i,t[112]=p,t[113]=r?.hosts,t[114]=N,t[115]=F,t[116]=c,t[117]=n,t[118]=be):be=t[118],ee=f.map(be);let xe;t[119]!==o||t[120]!==V||t[121]!==w||t[122]!==te||t[123]!==le||t[124]!==q||t[125]!==E||t[126]!==F||t[127]!==n?(xe=e=>(0,Q.jsx)(En,{hint:e.placed===null?o(E===`link`?{id:`ybWWR2`,values:{0:e.display}}:{id:`fDjZxw`,values:{0:e.display}}):o({id:`C0cll5`,values:{0:e.display}}),children:(0,Q.jsxs)(I,{disabled:w,checked:e.placed!==null,onCheckedChange:t=>{if(t===!0&&e.placed===null){if(!te(e.root))return;n.placeAt(e.root,E)}else e.placed!==null&&n.unplaceAt?.(e.placed.path)},onSelect:An,className:`group`,"data-testid":`skill-custom-root-${e.root}`,children:[e.root===`.agents/skills`?(0,Q.jsx)(_,{host:`agents`,"aria-hidden":!0,className:`size-4`}):(0,Q.jsx)(Ne,{"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}),F(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:F(e.root).map(t=>V(t,e.root))}):null,!w&&e.placed!==null&&q.has(e.placed.path)?(0,Q.jsx)(En,{hint:o({id:`iz1LdD`}),children:(0,Q.jsx)(b,{testId:`skill-drift-custom-${e.root}`})}):e.placed===null?null:(0,Q.jsxs)(Q.Fragment,{children:[!w&&e.placed.mode!==E?le(e.root,e.display,e.placed.mode):null,(0,Q.jsx)(En,{hint:o({id:`nBgzKO`}),children:(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-5 shrink-0 rounded border border-border/60 px-1 font-normal text-[10px] text-muted-foreground uppercase tracking-wide opacity-0 focus-visible:opacity-100 group-hover:opacity-100 hover:border-foreground/40 hover:text-foreground`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.setSource?.(e.root)},"data-testid":`skill-set-source-custom-${e.root}`,children:(0,Q.jsx)(l,{id:`VNNRfN`})})})]})]})]})},e.root),t[119]=o,t[120]=V,t[121]=w,t[122]=te,t[123]=le,t[124]=q,t[125]=E,t[126]=F,t[127]=n,t[128]=xe):xe=t[128],k=pe.map(xe),t[14]=o,t[15]=y,t[16]=m.data,t[17]=m.status,t[18]=s,t[19]=g,t[20]=d,t[21]=C,t[22]=i,t[23]=a,t[24]=p,t[25]=r,t[26]=c,t[27]=n,t[28]=w,t[29]=T,t[30]=E,t[31]=D,t[32]=O,t[33]=ee,t[34]=k}else w=t[28],T=t[29],E=t[30],D=t[31],O=t[32],ee=t[33],k=t[34];let A;t[129]!==o||t[130]!==w||t[131]!==T||t[132]!==E||t[133]!==a||t[134]!==n?(A=T.length>0&&n.convertLocations?(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 pt-1 pb-1.5`,children:[(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-auto whitespace-normal p-0 text-left font-normal text-[11px] text-muted-foreground leading-snug hover:bg-transparent hover:text-foreground`,onClick:e=>{e.preventDefault();let t=E===`link`?`copy`:`link`,r=T.filter(e=>e.mode!==t);if(r.length===0)return;let i=o(t===`copy`?{id:`iOAsF1`}:{id:`MS8lMS`}),s=o(t===`copy`?{id:`gZiT5e`}:{id:`PhIa-X`}),c=r.map(kn).join(`
2
2
  `);window.confirm(`${i}\n\n${s}\n\n${c}\n\n${o({id:`Cu6GXQ`})}`)&&(a?.(),n.convertLocations?.(r.map(e=>({target:e.target,mode:t}))))},disabled:w,"data-testid":`skill-convert-all`,children:E===`link`?(0,Q.jsx)(l,{id:`rcJmK8`}):(0,Q.jsx)(l,{id:`LBv_TR`})}),(0,Q.jsx)(En,{hint:o({id:`0J6nhG`}),children:(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,"aria-label":o({id:`qJSo0_`}),className:`size-4 shrink-0 rounded-full border border-border/60 p-0 font-normal text-[9px] text-muted-foreground hover:border-foreground/40 hover:bg-transparent hover:text-foreground`,onClick:On,"data-testid":`skill-convert-all-help`,children:`?`})})]}):null,t[129]=o,t[130]=w,t[131]=T,t[132]=E,t[133]=a,t[134]=n,t[135]=A):A=t[135];let j;t[136]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(z,{}),t[136]=j):j=t[136];let N;t[137]===o?N=t[138]:(N=o({id:`jqe7Yq`}),t[137]=o,t[138]=N);let P;t[139]===r?.scope?P=t[140]:(P=()=>{window.location.hash=r?.scope===`global`?`#settings/user-skills`:`#settings/skills`},t[139]=r?.scope,t[140]=P);let F,R;t[141]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(vt,{"aria-hidden":!0}),R=(0,Q.jsx)(l,{id:`ZBF9fn`}),t[141]=F,t[142]=R):(F=t[141],R=t[142]);let te;t[143]===P?te=t[144]:(te=(0,Q.jsxs)(M,{onSelect:P,children:[F,R]}),t[143]=P,t[144]=te);let B;t[145]!==N||t[146]!==te?(B=(0,Q.jsx)(En,{hint:N,children:te}),t[145]=N,t[146]=te,t[147]=B):B=t[147];let V;return t[148]!==B||t[149]!==D||t[150]!==O||t[151]!==ee||t[152]!==k||t[153]!==A?(V=(0,Q.jsxs)(Q.Fragment,{children:[D,O,ee,k,A,j,B]}),t[148]=B,t[149]=D,t[150]=O,t[151]=ee,t[152]=k,t[153]=A,t[154]=V):V=t[154],V}function On(e){return e.preventDefault()}function kn(e){return e.display}function An(e){return e.preventDefault()}function jn(e){return e.preventDefault()}function Mn(e){return e.preventDefault()}function Nn(e){return[Je(e),e]}function Pn(e){return e===`link`}function Fn(e){return e.mode}function In(e){return(e??``).replace(/^~\//,``)}function Ln(e){return e===`agents`?`.agents`:he[e]??e}function Rn(e){return e.hostAliases??{}}function zn(e){return e.hosts.includes(`agents`)||e.path.startsWith(`.agents/`)}function Bn(e){let t=(0,yt.c)(23),{onAddProperty:n,className:r,problemCount:i,problemMessages:a}=e,o=i===void 0?0:i,{_:s}=u(),c=o>0,d;t[0]!==s||t[1]!==c||t[2]!==o?(d=s(c?{id:`3KOHFt`,values:{problemCount:o}}:{id:`81H_23`}),t[0]=s,t[1]=c,t[2]=o,t[3]=d):d=t[3];let f=d,m;t[4]===r?m=t[5]:(m=p(`relative`,r),t[4]=r,t[5]=m);let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(gt,{}),t[6]=h):h=t[6];let g;t[7]!==c||t[8]!==o?(g=c?(0,Q.jsx)(Ye,{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]=c,t[8]=o,t[9]=g):g=t[9];let _;t[10]===g?_=t[11]:(_=(0,Q.jsxs)(S,{children:[h,g]}),t[10]=g,t[11]=_);let v;t[12]!==f||t[13]!==n||t[14]!==m||t[15]!==_?(v=(0,Q.jsx)(x,{variant:`ghost`,size:`icon`,"aria-label":f,onClick:n,"data-testid":`add-properties-button`,className:m,asChild:!0,children:_}),t[12]=f,t[13]=n,t[14]=m,t[15]=_,t[16]=v):v=t[16];let y;t[17]!==c||t[18]!==a?(y=(0,Q.jsx)(C,{side:`bottom`,children:c?(0,Q.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:(0,Q.jsx)(l,{id:`AwrGuz`})}),a?.map(Vn),(0,Q.jsx)(`span`,{className:`pt-0.5 opacity-70`,children:(0,Q.jsx)(l,{id:`yh5-4s`})})]}):(0,Q.jsx)(l,{id:`81H_23`})}),t[17]=c,t[18]=a,t[19]=y):y=t[19];let b;return t[20]!==v||t[21]!==y?(b=(0,Q.jsxs)(w,{children:[v,y]}),t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function Vn(e,t){return(0,Q.jsx)(`span`,{className:`opacity-90`,children:e},t)}function Hn(e){return e?Ie._({id:`wTcjov`}):null}function Un(e){let t=(0,yt.c)(47),{_:n}=u(),r=s(),i=v(),o=B(),c=H();if(r)return null;let{input:d,installStates:p,dispatch:m,onBeforeLaunch:h}=e,g=d===null,_,y,b,x,S,C,w,T,E,D,O;if(t[0]!==n||t[1]!==m||t[2]!==d||t[3]!==g||t[4]!==p||t[5]!==h||t[6]!==c||t[7]!==o||t[8]!==i){let e=Hn(g),r;t[20]===c?r=t[21]:(r=e=>ne(c,e.id),t[20]=c,t[21]=r);let s=U.filter(r),u;t[22]===c?u=t[23]:(u=e=>G(c,e.source,e.id,!0,e.supported),t[22]=c,t[23]=u);let f=o.filter(u),v=i?ce.filter(e=>J(c,e,i.installedClis)):[];b=s.length>0,x=i!==null&&v.length>0,S=f.length>0,y=N,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsxs)(R,{children:[(0,Q.jsx)(a,{"aria-hidden":`true`}),(0,Q.jsx)(l,{id:`O7_W_a`})]}),t[24]=O):O=t[24],_=P,C=`max-h-80`,w=S?(0,Q.jsxs)(F,{"aria-label":n({id:`vPKX2i`}),children:[(0,Q.jsxs)(L,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(l,{id:`RXEbZy`}),(0,Q.jsx)(Y,{})]}),f.map(t=>{let r=t.name;return(0,Q.jsxs)(M,{onSelect:()=>{d!==null&&(h?.(),sn(d,{agent:{source:t.source,id:t.id}}))},disabled:g,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":e?n({id:`gtGQ9S`,values:{agentName:r,hint:e}}):void 0,children:[(0,Q.jsx)(Oe,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(l,{id:`5PrrYw`,values:{agentName:r}})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==b||t[26]!==x||t[27]!==S?(T=S&&(x||b)?(0,Q.jsx)(z,{}):null,t[25]=b,t[26]=x,t[27]=S,t[28]=T):T=t[28],E=x?(0,Q.jsxs)(F,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(L,{children:(0,Q.jsx)(l,{id:`ALhMYW`})}),v.map(t=>{let{displayName:r}=se[t];return(0,Q.jsxs)(M,{onSelect:()=>{d!==null&&(h?.(),i.launchInTerminal(d,t))},disabled:g,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Q.jsx)(K,{id:V(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,D=b?(0,Q.jsxs)(Q.Fragment,{children:[x?(0,Q.jsx)(z,{}):null,(0,Q.jsxs)(F,{"aria-label":n({id:`BBqGS9`}),children:[(0,Q.jsx)(L,{children:(0,Q.jsx)(l,{id:`BBqGS9`})}),s.map(t=>{let r=!g,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Q.jsxs)(M,{disabled:!r,onSelect:()=>{if(d){if(h?.(),p[t.id]?.installed!==!0){Kt(t);return}m(t.id,d)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(K,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=m,t[2]=d,t[3]=g,t[4]=p,t[5]=h,t[6]=c,t[7]=o,t[8]=i,t[9]=_,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 _=t[9],y=t[10],b=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18],O=t[19];let ee;t[29]!==b||t[30]!==x||t[31]!==S?(ee=S||x||b?(0,Q.jsx)(z,{}):null,t[29]=b,t[30]=x,t[31]=S,t[32]=ee):ee=t[32];let k;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(f,{"aria-hidden":`true`}),t[33]=k):k=t[33];let A;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsxs)(M,{onSelect:Le,"data-testid":`file-tree-open-in-settings`,children:[k,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(l,{id:`jRAGrQ`})})]}),t[34]=A):A=t[34];let j;t[35]!==_||t[36]!==C||t[37]!==w||t[38]!==T||t[39]!==E||t[40]!==D||t[41]!==ee?(j=(0,Q.jsxs)(_,{className:C,children:[w,T,E,D,ee,A]}),t[35]=_,t[36]=C,t[37]=w,t[38]=T,t[39]=E,t[40]=D,t[41]=ee,t[42]=j):j=t[42];let I;return t[43]!==y||t[44]!==O||t[45]!==j?(I=(0,Q.jsxs)(y,{children:[O,j]}),t[43]=y,t[44]=O,t[45]=j,t[46]=I):I=t[46],I}function Wn(e){let t=re(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=le(e);return n?{scope:`global`,name:n.name,rel:n.rel}:null}function Gn(e,t,n){return e.filter(e=>{let r=Be(e);if(r.kind===`skill-file`)return r.scope===t&&r.name===n;if(r.kind!==`doc`)return!1;let i=Wn(r.docName);return i?.scope===t&&i.name===n})}function Kn(e,t){let n=new Map(t.map(e=>[`${e.scope}\u0000${e.name}`,e])),r=[];for(let t of e){let e=Wn(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:ze(a)}):r.push({kind:`close`,docName:t})}return r}function qn(){let e=(0,yt.c)(15),{openTabs:t,closeDocument:n}=o(),r=ke(),i;e[0]===t?i=e[1]:(i=t.some(Yn),e[0]=t,e[1]=i);let a=i,s;e[2]===a?s=e[3]:(s={enabled:a},e[2]=a,e[3]=s);let c=ut(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(Jn).sort().join(``)}`;if(l.current===i)return;l.current=i;let a=Kn(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 Jn(e){return`${e.scope}\u0000${e.name}`}function Yn(e){return Wn(e)!==null}function Xn(e){let t=(0,yt.c)(19),{skill:n,onOpenChange:r,onDeleted:i}=e,{_:a}=u(),{setSkillsSidebar:s,closeTabs:c,openTabs:l}=o(),[d,f]=(0,$.useState)(!1),p;t[0]!==a||t[1]!==c||t[2]!==i||t[3]!==r||t[4]!==l||t[5]!==s?(p=async function(e){s(!0),f(!0);let t=await it(e.scope,e.name);if(f(!1),!t.ok){let{error:e}=t;Z.error(a({id:`AtBdnD`,values:{error:e}}));return}Z.success(a({id:`h9QFb9`,values:{0:e.name}})),c(Gn(l,e.scope,e.name),{force:!0}),i(),r(!1)},t[0]=a,t[1]=c,t[2]=i,t[3]=r,t[4]=l,t[5]=s,t[6]=p):p=t[6];let m=p,h=n!==null,_;t[7]!==d||t[8]!==r?(_=e=>{!e&&!d&&r(!1)},t[7]=d,t[8]=r,t[9]=_):_=t[9];let v;t[10]!==a||t[11]!==d||t[12]!==m||t[13]!==n?(v=n?(0,Q.jsx)(g,{itemName:a({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:d,onDelete:()=>m(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?a({id:`WnsbUT`,values:{0:n.path}}):a({id:`E1Da_b`,values:{0:n.path}})}):null,t[10]=a,t[11]=d,t[12]=m,t[13]=n,t[14]=v):v=t[14];let y;return t[15]!==h||t[16]!==_||t[17]!==v?(y=(0,Q.jsx)(j,{open:h,onOpenChange:_,children:v}),t[15]=h,t[16]=_,t[17]=v,t[18]=y):y=t[18],y}function Zn(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 Qn(e){let t=(0,yt.c)(66),{target:n,onOpenChange:r}=e,{_:i}=u(),{openTarget:a}=o(),s=(0,$.useId)(),[c,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.prefix??`references/`)},t[0]=n,t[1]=m);let h=n?.skill.scope,g=n?.skill.name,_=n?.prefix,v;if(t[2]!==h||t[3]!==g||t[4]!==_?(v=[h,g,_],t[2]=h,t[3]=g,t[4]=_,t[5]=v):v=t[5],(0,$.useEffect)(m,v),!n)return null;let y,b,S,C;t[6]!==c||t[7]!==f?(C=c.trim(),b=C===``||!Zn(C),y=!b&&!f,S=C.includes(`/`)?C.split(`/`).slice(0,-1).join(`/`):null,t[6]=c,t[7]=f,t[8]=y,t[9]=b,t[10]=S,t[11]=C):(y=t[8],b=t[9],S=t[10],C=t[11]);let w=S,O;t[12]!==i||t[13]!==y||t[14]!==r||t[15]!==a||t[16]!==n||t[17]!==C?(O=async function(){if(!n||!y)return;p(!0);let e=/\.mdx?$/i.test(C),t=await Xe({scope:n.skill.scope,name:n.skill.name,path:C,content:e?`# ${C.split(`/`).pop()?.replace(/\.mdx?$/i,``)??``}\n`:``});if(p(!1),!t.ok){Z.error(i({id:`a_2_uB`,values:{0:t.error,trimmed:C}}));return}if(Z.success(i({id:`MXSt4t`,values:{0:t.path}})),e){let e=Ve(n.skill,C);a({kind:`doc`,target:e,docName:e})}r(!1)},t[12]=i,t[13]=y,t[14]=r,t[15]=a,t[16]=n,t[17]=C,t[18]=O):O=t[18];let k=O,M;t[19]!==r||t[20]!==f?(M=e=>{!e&&!f&&r(!1)},t[19]=r,t[20]=f,t[21]=M):M=t[21];let N;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(E,{children:(0,Q.jsx)(l,{id:`wQvvZY`})}),t[22]=N):N=t[22];let P;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsxs)(A,{children:[N,(0,Q.jsx)(T,{children:(0,Q.jsx)(l,{id:`lM4c-I`})})]}),t[23]=P):P=t[23];let F;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(l,{id:`I6gXOa`}),t[24]=F):F=t[24];let I;t[25]===s?I=t[26]:(I=(0,Q.jsx)(te,{htmlFor:s,children:F}),t[25]=s,t[26]=I);let L;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>d(e.target.value),t[27]=L):L=t[27];let R=b&&C!==``,z;t[28]===k?z=t[29]:(z=e=>{e.key===`Enter`&&k()},t[28]=k,t[29]=z);let B;t[30]!==s||t[31]!==c||t[32]!==R||t[33]!==z?(B=(0,Q.jsx)(Fe,{id:s,value:c,onChange:L,placeholder:`references/notes.md`,"aria-invalid":R,onKeyDown:z}),t[30]=s,t[31]=c,t[32]=R,t[33]=z,t[34]=B):B=t[34];let V;t[35]!==w||t[36]!==b||t[37]!==C?(V=b&&C!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(l,{id:`fVzizW`})}):w?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(l,{id:`9lso1Y`,values:{folderPart:w},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):null,t[35]=w,t[36]=b,t[37]=C,t[38]=V):V=t[38];let H;t[39]!==I||t[40]!==B||t[41]!==V?(H=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[I,B,V]}),t[39]=I,t[40]=B,t[41]=V,t[42]=H):H=t[42];let U;t[43]===r?U=t[44]:(U=()=>r(!1),t[43]=r,t[44]=U);let W;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(l,{id:`dEgA5A`}),t[45]=W):W=t[45];let G;t[46]!==f||t[47]!==U?(G=(0,Q.jsx)(x,{variant:`outline`,onClick:U,disabled:f,children:W}),t[46]=f,t[47]=U,t[48]=G):G=t[48];let K;t[49]===k?K=t[50]:(K=()=>void k(),t[49]=k,t[50]=K);let q=!y,J;t[51]===f?J=t[52]:(J=f?(0,Q.jsx)(l,{id:`E9bKSA`}):(0,Q.jsx)(l,{id:`hYgDIe`}),t[51]=f,t[52]=J);let Y;t[53]!==K||t[54]!==q||t[55]!==J?(Y=(0,Q.jsx)(x,{onClick:K,disabled:q,children:J}),t[53]=K,t[54]=q,t[55]=J,t[56]=Y):Y=t[56];let ne;t[57]!==G||t[58]!==Y?(ne=(0,Q.jsxs)(ee,{children:[G,Y]}),t[57]=G,t[58]=Y,t[59]=ne):ne=t[59];let X;t[60]!==H||t[61]!==ne?(X=(0,Q.jsxs)(D,{className:`sm:max-w-md`,children:[P,H,ne]}),t[60]=H,t[61]=ne,t[62]=X):X=t[62];let re;return t[63]!==X||t[64]!==M?(re=(0,Q.jsx)(j,{open:!0,onOpenChange:M,children:X}),t[63]=X,t[64]=M,t[65]=re):re=t[65],re}function $n(e){let t=(0,yt.c)(64),{target:n,onOpenChange:r}=e,{_:i}=u(),a=ke(),o=(0,$.useId)(),[s,c]=(0,$.useState)(``),[d,f]=(0,$.useState)(!1),p;t[0]===n?p=t[1]:(p=()=>{n&&c(n.filePath)},t[0]=n,t[1]=p);let m=n?.skill.scope,h=n?.skill.name,g=n?.filePath,_;if(t[2]!==m||t[3]!==h||t[4]!==g?(_=[m,h,g],t[2]=m,t[3]=h,t[4]=g,t[5]=_):_=t[5],(0,$.useEffect)(p,_),!n)return null;let v,y,b;t[6]!==s||t[7]!==n.filePath?(y=s.trim(),b=y===n.filePath,v=y===``||!Zn(y),t[6]=s,t[7]=n.filePath,t[8]=v,t[9]=y,t[10]=b):(v=t[8],y=t[9],b=t[10]);let S=v,C=!S&&!b&&!d,w;t[11]!==i||t[12]!==C||t[13]!==r||t[14]!==a||t[15]!==n||t[16]!==y?(w=async function(){if(!n||!C)return;f(!0);let e=await st({scope:n.skill.scope,name:n.skill.name,from:n.filePath,to:y});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]=C,t[13]=r,t[14]=a,t[15]=n,t[16]=y,t[17]=w):w=t[17];let O=w,k;t[18]!==r||t[19]!==d?(k=e=>{!e&&!d&&r(!1)},t[18]=r,t[19]=d,t[20]=k):k=t[20];let M;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(E,{children:(0,Q.jsx)(l,{id:`yckias`})}),t[21]=M):M=t[21];let N;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsxs)(A,{children:[M,(0,Q.jsx)(T,{children:(0,Q.jsx)(l,{id:`HzVAoz`})})]}),t[22]=N):N=t[22];let P;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(l,{id:`I6gXOa`}),t[23]=P):P=t[23];let F;t[24]===o?F=t[25]:(F=(0,Q.jsx)(te,{htmlFor:o,children:P}),t[24]=o,t[25]=F);let I;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>c(e.target.value),t[26]=I):I=t[26];let L=S&&y!==``,R;t[27]===O?R=t[28]:(R=e=>{e.key===`Enter`&&O()},t[27]=O,t[28]=R);let z;t[29]!==o||t[30]!==s||t[31]!==L||t[32]!==R?(z=(0,Q.jsx)(Fe,{id:o,value:s,onChange:I,"aria-invalid":L,onKeyDown:R}),t[29]=o,t[30]=s,t[31]=L,t[32]=R,t[33]=z):z=t[33];let B;t[34]!==S||t[35]!==y?(B=S&&y!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(l,{id:`fVzizW`})}):null,t[34]=S,t[35]=y,t[36]=B):B=t[36];let V;t[37]!==F||t[38]!==z||t[39]!==B?(V=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[F,z,B]}),t[37]=F,t[38]=z,t[39]=B,t[40]=V):V=t[40];let H;t[41]===r?H=t[42]:(H=()=>r(!1),t[41]=r,t[42]=H);let U;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(l,{id:`dEgA5A`}),t[43]=U):U=t[43];let W;t[44]!==d||t[45]!==H?(W=(0,Q.jsx)(x,{variant:`outline`,onClick:H,disabled:d,children:U}),t[44]=d,t[45]=H,t[46]=W):W=t[46];let G;t[47]===O?G=t[48]:(G=()=>void O(),t[47]=O,t[48]=G);let K=!C,q;t[49]===d?q=t[50]:(q=d?(0,Q.jsx)(l,{id:`tHKQ6j`}):(0,Q.jsx)(l,{id:`2wxgft`}),t[49]=d,t[50]=q);let J;t[51]!==G||t[52]!==K||t[53]!==q?(J=(0,Q.jsx)(x,{onClick:G,disabled:K,children:q}),t[51]=G,t[52]=K,t[53]=q,t[54]=J):J=t[54];let Y;t[55]!==W||t[56]!==J?(Y=(0,Q.jsxs)(ee,{children:[W,J]}),t[55]=W,t[56]=J,t[57]=Y):Y=t[57];let ne;t[58]!==V||t[59]!==Y?(ne=(0,Q.jsxs)(D,{className:`sm:max-w-md`,children:[N,V,Y]}),t[58]=V,t[59]=Y,t[60]=ne):ne=t[60];let X;return t[61]!==ne||t[62]!==k?(X=(0,Q.jsx)(j,{open:!0,onOpenChange:k,children:ne}),t[61]=ne,t[62]=k,t[63]=X):X=t[63],X}function er(e){let t=(0,yt.c)(59),{target:n,onOpenChange:r}=e,{_:i}=u(),a=(0,$.useId)(),[o,s]=(0,$.useState)(null),[c,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(``),[v,y]=(0,$.useState)(!1),b;t[0]===n?b=t[1]:(b=()=>{if(s(null),d(null),p(!1),h(!1),!n)return;let{skill:e,editor:t}=n,r=e.absolutePath?.slice(0,-`/${e.path}`.length)??null;if(r===null){p(!0);return}let i=`${r}/${e.path.replace(/\/SKILL\.mdx?$/i,``)}`,a=`${r}/${Ge(t,e.scope)}/${e.name}`,o=new AbortController;for(let[t,n]of[[i,d],[a,s]])tt({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]=b);let S=n?.skill.scope,C=n?.skill.name,w=n?.editor,k;if(t[2]!==S||t[3]!==C||t[4]!==w?(k=[S,C,w],t[2]=S,t[3]=C,t[4]=w,t[5]=k):k=t[5],(0,$.useEffect)(b,k),!n)return null;let{skill:M,editor:N}=n,P;t[6]!==i||t[7]!==N||t[8]!==r||t[9]!==M.name||t[10]!==M.scope||t[11]!==n||t[12]!==g?(P=async function(e){if(!n)return;y(!0);let t=await $e({scope:M.scope,name:M.name,editor:N,action:e,...e===`rename`?{toName:g.trim()}:{}});if(y(!1),!t.ok){Z.error(i({id:`MIF36T`,values:{0:t.error}}));return}Z.success(i(e===`align`?{id:`QKgePK`,values:{editor:N}}:e===`make-source`?{id:`It9oAP`,values:{editor:N}}:{id:`b2ezG_`,values:{0:g.trim()}})),r(!1)},t[6]=i,t[7]=N,t[8]=r,t[9]=M.name,t[10]=M.scope,t[11]=n,t[12]=g,t[13]=P):P=t[13];let F=P,I,L;t[14]!==M.name||t[15]!==g?(L=g.trim(),I=L===``||!ae.test(L)||L===M.name,t[14]=M.name,t[15]=g,t[16]=I,t[17]=L):(I=t[16],L=t[17]);let R=I,z;t[18]!==v||t[19]!==r?(z=e=>{!e&&!v&&r(!1)},t[18]=v,t[19]=r,t[20]=z):z=t[20];let B;t[21]!==N||t[22]!==M.name?(B=(0,Q.jsx)(E,{children:(0,Q.jsx)(l,{id:`q8aCbb`,values:{0:M.name,editor:N}})}),t[21]=N,t[22]=M.name,t[23]=B):B=t[23];let V;t[24]===N?V=t[25]:(V=(0,Q.jsx)(T,{children:(0,Q.jsx)(l,{id:`QASTNu`,values:{editor:N}})}),t[24]=N,t[25]=V);let H;t[26]!==V||t[27]!==B?(H=(0,Q.jsxs)(A,{children:[B,V]}),t[26]=V,t[27]=B,t[28]=H):H=t[28];let U;t[29]!==c||t[30]!==o||t[31]!==f?(U=c!==null&&o!==null?(0,Q.jsx)(pt,{oldContent:c,newContent:o,layout:`unified`}):f?(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center px-6 text-center text-muted-foreground text-sm`,children:(0,Q.jsx)(l,{id:`5BlXTD`})}):(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center text-muted-foreground text-sm`,children:(0,Q.jsx)(l,{id:`1V17kO`})}),t[29]=c,t[30]=o,t[31]=f,t[32]=U):U=t[32];let W;t[33]!==F||t[34]!==N||t[35]!==a||t[36]!==R||t[37]!==m||t[38]!==M.name||t[39]!==g||t[40]!==L?(W=m?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,Q.jsx)(te,{htmlFor:a,children:(0,Q.jsx)(l,{id:`pSimwP`,values:{editor:N}})}),(0,Q.jsx)(Fe,{id:a,value:g,onChange:e=>_(e.target.value),placeholder:`${M.name}-${N}`,"aria-invalid":R&&L!==``,onKeyDown:e=>{e.key===`Enter`&&!R&&F(`rename`)}})]}):null,t[33]=F,t[34]=N,t[35]=a,t[36]=R,t[37]=m,t[38]=M.name,t[39]=g,t[40]=L,t[41]=W):W=t[41];let G;t[42]!==U||t[43]!==W?(G=(0,Q.jsxs)(O,{className:`min-h-0 flex-1 overflow-auto`,children:[U,W]}),t[42]=U,t[43]=W,t[44]=G):G=t[44];let K;t[45]!==F||t[46]!==v||t[47]!==N||t[48]!==R||t[49]!==m||t[50]!==M.name?(K=(0,Q.jsx)(ee,{children:m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(x,{variant:`outline`,onClick:()=>h(!1),disabled:v,children:(0,Q.jsx)(l,{id:`iH8pgl`})}),(0,Q.jsx)(x,{onClick:()=>void F(`rename`),disabled:v||R,children:(0,Q.jsx)(l,{id:`AT0e50`})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(x,{variant:`outline`,onClick:()=>{_(`${M.name}-${N}`),h(!0)},disabled:v,children:(0,Q.jsx)(l,{id:`AT0e50`})}),(0,Q.jsx)(x,{variant:`outline`,onClick:()=>void F(`make-source`),disabled:v,children:(0,Q.jsx)(l,{id:`xWomUD`,values:{editor:N}})}),(0,Q.jsx)(x,{onClick:()=>void F(`align`),disabled:v,children:(0,Q.jsx)(l,{id:`PZn2LP`})})]})}),t[45]=F,t[46]=v,t[47]=N,t[48]=R,t[49]=m,t[50]=M.name,t[51]=K):K=t[51];let q;t[52]!==H||t[53]!==G||t[54]!==K?(q=(0,Q.jsxs)(D,{className:`flex max-h-[85vh] w-full max-w-3xl flex-col`,children:[H,G,K]}),t[52]=H,t[53]=G,t[54]=K,t[55]=q):q=t[55];let J;return t[56]!==q||t[57]!==z?(J=(0,Q.jsx)(j,{open:!0,onOpenChange:z,children:q}),t[56]=q,t[57]=z,t[58]=J):J=t[58],J}function tr(e){let t=(0,yt.c)(75),{skill:n,existingNames:r,onOpenChange:i,onRenamed:a}=e,o=Ae(),s=n!==null,c=(0,$.useId)(),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.name)},t[0]=n,t[1]=m);let h=n?.scope,g=n?.name,_;if(t[2]!==h||t[3]!==g?(_=[h,g],t[2]=h,t[3]=g,t[4]=_):_=t[4],(0,$.useEffect)(m,_),!n)return null;let v,y,b,S,C,w;if(t[5]!==r||t[6]!==u||t[7]!==n.name){C=u.trim(),w=C===n.name;let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\s/,t[14]=e):e=t[14];let i;t[15]===u?i=t[16]:(i=e.test(u),t[15]=u,t[16]=i),v=i,S=C.length>64,y=C===``||!ae.test(C)||S,b=!y&&!w&&r.has(C),t[5]=r,t[6]=u,t[7]=n.name,t[8]=v,t[9]=y,t[10]=b,t[11]=S,t[12]=C,t[13]=w}else v=t[8],y=t[9],b=t[10],S=t[11],C=t[12],w=t[13];let O=b,k=!y&&!O&&!w&&!f,M;t[17]!==k||t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==n||t[22]!==C?(M=async function(){if(!n||!k)return;p(!0);let e=await o({scope:n.scope,name:n.name},C);p(!1),e.ok&&(a?.(C),i(!1))},t[17]=k,t[18]=i,t[19]=a,t[20]=o,t[21]=n,t[22]=C,t[23]=M):M=t[23];let N=M,P;t[24]===i?P=t[25]:(P=e=>e?null:i(!1),t[24]=i,t[25]=P);let F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(E,{children:(0,Q.jsx)(l,{id:`dw_3cv`})}),t[26]=F):F=t[26];let I;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsxs)(A,{children:[F,(0,Q.jsx)(T,{children:(0,Q.jsx)(l,{id:`R9IDFz`})})]}),t[27]=I):I=t[27];let L;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(l,{id:`6YtxFj`}),t[28]=L):L=t[28];let R;t[29]===c?R=t[30]:(R=(0,Q.jsx)(te,{htmlFor:c,children:L}),t[29]=c,t[30]=R);let z;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>d(e.target.value),t[31]=z):z=t[31];let B;t[32]===N?B=t[33]:(B=e=>{e.key===`Enter`&&N()},t[32]=N,t[33]=B);let V=y||O,H=y&&C!==``||O?`${c}-error`:void 0,U;t[34]!==c||t[35]!==u||t[36]!==B||t[37]!==V||t[38]!==H?(U=(0,Q.jsx)(Fe,{id:c,value:u,onChange:z,onKeyDown:B,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:64,"aria-invalid":V,"aria-describedby":H,className:`font-mono`}),t[34]=c,t[35]=u,t[36]=B,t[37]=V,t[38]=H,t[39]=U):U=t[39];let W;t[40]!==O||t[41]!==v||t[42]!==c||t[43]!==y||t[44]!==S||t[45]!==C?(W=y&&C!==``?(0,Q.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:v?(0,Q.jsx)(l,{id:`iUwpZI`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}}):S?(0,Q.jsx)(l,{id:`lK9c4T`}):(0,Q.jsx)(l,{id:`A50vr3`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):O?(0,Q.jsx)(`p`,{id:`${c}-error`,className:`text-xs text-destructive`,children:(0,Q.jsx)(l,{id:`YJ1BTp`})}):null,t[40]=O,t[41]=v,t[42]=c,t[43]=y,t[44]=S,t[45]=C,t[46]=W):W=t[46];let G;t[47]!==R||t[48]!==U||t[49]!==W?(G=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[R,U,W]}),t[47]=R,t[48]=U,t[49]=W,t[50]=G):G=t[50];let K;t[51]===i?K=t[52]:(K=()=>i(!1),t[51]=i,t[52]=K);let q;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Q.jsx)(l,{id:`dEgA5A`}),t[53]=q):q=t[53];let J;t[54]!==f||t[55]!==K?(J=(0,Q.jsx)(x,{variant:`outline`,className:`font-mono uppercase`,onClick:K,disabled:f,children:q}),t[54]=f,t[55]=K,t[56]=J):J=t[56];let Y;t[57]===N?Y=t[58]:(Y=()=>void N(),t[57]=N,t[58]=Y);let ne=!k,X;t[59]===f?X=t[60]:(X=f?(0,Q.jsx)(l,{id:`tHKQ6j`}):(0,Q.jsx)(l,{id:`2wxgft`}),t[59]=f,t[60]=X);let re;t[61]!==Y||t[62]!==ne||t[63]!==X?(re=(0,Q.jsx)(x,{onClick:Y,disabled:ne,children:X}),t[61]=Y,t[62]=ne,t[63]=X,t[64]=re):re=t[64];let ie;t[65]!==J||t[66]!==re?(ie=(0,Q.jsxs)(ee,{children:[J,re]}),t[65]=J,t[66]=re,t[67]=ie):ie=t[67];let oe;t[68]!==G||t[69]!==ie?(oe=(0,Q.jsxs)(D,{children:[I,G,ie]}),t[68]=G,t[69]=ie,t[70]=oe):oe=t[70];let se;return t[71]!==s||t[72]!==oe||t[73]!==P?(se=(0,Q.jsx)(j,{open:s,onOpenChange:P,children:oe}),t[71]=s,t[72]=oe,t[73]=P,t[74]=se):se=t[74],se}function nr(){let e=(0,yt.c)(5),{_:t}=u(),n=Ke(),r=ke(),i=ut(),a;return e[0]!==t||e[1]!==r||e[2]!==n||e[3]!==i?(a=async(e,a)=>{if(a===e.scope)return!1;Ue(e.scope,e.name);let o=await et({name:e.name,fromScope:e.scope,toScope:a});if(He(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?ze(s):de(e.scope,e.name),a===`project`&&o.path!==void 0?`${o.path.replace(/\/+$/,``)}/SKILL`:de(a,e.name)),!0},e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function rr(e){let t=(0,yt.c)(38),{target:n,onOpenChange:r}=e,i=Ke(),a=nr(),[o,s]=(0,$.useState)(!1);if(!n)return null;let{scope:c,name:u,toScope:d}=n,f;t[0]!==o||t[1]!==r?(f=e=>!e&&!o&&r(!1),t[0]=o,t[1]=r,t[2]=f):f=t[2];let p=i[d],m;t[3]===p?m=t[4]:(m=(0,Q.jsx)(E,{children:(0,Q.jsx)(l,{id:`SXEdCq`,values:{0:p}})}),t[3]=p,t[4]=m);let h=i[c],g=i[d],_=i[d],v;t[5]!==u||t[6]!==h||t[7]!==g||t[8]!==_?(v={0:h,1:g,2:_,name:u},t[5]=u,t[6]=h,t[7]=g,t[8]=_,t[9]=v):v=t[9];let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y={0:(0,Q.jsx)(`code`,{className:`font-mono`})},t[10]=y):y=t[10];let b;t[11]===v?b=t[12]:(b=(0,Q.jsx)(T,{children:(0,Q.jsx)(l,{id:`7bIiJ7`,values:v,components:y})}),t[11]=v,t[12]=b);let S;t[13]!==m||t[14]!==b?(S=(0,Q.jsxs)(A,{children:[m,b]}),t[13]=m,t[14]=b,t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(l,{id:`dEgA5A`}),t[16]=C):C=t[16];let w;t[17]===o?w=t[18]:(w=(0,Q.jsx)(k,{asChild:!0,children:(0,Q.jsx)(x,{variant:`outline`,disabled:o,children:C})}),t[17]=o,t[18]=w);let O;t[19]!==a||t[20]!==u||t[21]!==r||t[22]!==c||t[23]!==d?(O=async()=>{s(!0),await a({scope:c,name:u},d),s(!1),r(!1)},t[19]=a,t[20]=u,t[21]=r,t[22]=c,t[23]=d,t[24]=O):O=t[24];let M;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(l,{id:`QWdKwH`}),t[25]=M):M=t[25];let N;t[26]!==o||t[27]!==O?(N=(0,Q.jsx)(x,{"data-testid":`skill-scope-move-confirm`,disabled:o,onClick:O,children:M}),t[26]=o,t[27]=O,t[28]=N):N=t[28];let P;t[29]!==w||t[30]!==N?(P=(0,Q.jsxs)(ee,{children:[w,N]}),t[29]=w,t[30]=N,t[31]=P):P=t[31];let F;t[32]!==S||t[33]!==P?(F=(0,Q.jsxs)(D,{className:`sm:max-w-md`,children:[S,P]}),t[32]=S,t[33]=P,t[34]=F):F=t[34];let I;return t[35]!==f||t[36]!==F?(I=(0,Q.jsx)(j,{open:!0,onOpenChange:f,children:F}),t[35]=f,t[36]=F,t[37]=I):I=t[37],I}function ir(){let e=(0,yt.c)(45),{_:t}=u(),n=dt(),[r,i]=(0,$.useState)(null),[a,o]=(0,$.useState)(null),[s,c]=(0,$.useState)(null),[l,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(null),[g,_]=(0,$.useState)(null),v;e[0]===t?v=e[1]:(v=async function(e,n,r){_(e.name);let i=await nt({scope:e.scope,name:e.name,...n?{targets:[...n]}:{},...r?.linkMode===void 0?{}:{linkMode:r.linkMode}});if(_(null),!i.ok)return Z.error(t({id:`Mj8R8K`,values:{0:i.error}})),i;let a=ar,o=new Set(i.hosts),s=i.hosts.filter(t=>!e.hosts.includes(t)),c=e.hosts.filter(e=>!o.has(e)),l=e=>{let t=i.warningCodes.indexOf(e);return t>=0?i.warnings[t]:void 0},u=l(`no-targets`);if(u)return Z.warning(u),i;if(s.length>0){let e=l(`scripts-present`);e&&Z.warning(e);let t=l(`no-description`);t&&Z.warning(t)}return i.hosts.length===0?Z.success(t({id:`4pDZ2N`,values:{0:e.name}})):s.length>0&&c.length===0?Z.success(t({id:`PPFQ3o`,values:{0:e.name,1:a(s)}})):c.length>0&&s.length===0?Z.success(t({id:`OOIVJo`,values:{0:e.name,1:a(c)}})):s.length>0&&c.length>0?Z.success(t({id:`OxplNM`,values:{0:e.name,1:a(s),2:a(c)}})):Z.success(t({id:`wDgmsr`,values:{0:e.name,1:a(i.hosts)}})),i},e[0]=t,e[1]=v);let y=v,b;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=async function(e,t){if(t.length!==0){_(e.name);for(let{target:n,mode:r}of t){let t=await at({scope:e.scope,name:e.name,target:n,mode:r});if(!t.ok){Z.error(t.error);break}}_(null)}},e[2]=b):b=e[2];let x=b,S;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(S=async function(e,t){_(e.name);let n=await t();return _(null),n},e[3]=S):S=e[3];let C=S,w;e[4]!==t||e[5]!==n?(w=async function(e,r){let i=await rt({scope:e.scope,name:e.name,existingNames:r});if(!i.ok){Z.error(t({id:`UPjaXD`,values:{0:e.name,1:i.error}}));return}Z.success(t({id:`0g7rCZ`,values:{0:i.name}})),n(e.scope,i.name)},e[4]=t,e[5]=n,e[6]=w):w=e[6];let T=w,E,D;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||i(null)},D=()=>i(null),e[7]=E,e[8]=D):(E=e[7],D=e[8]);let O;e[9]===r?O=e[10]:(O=(0,Q.jsx)(Xn,{skill:r,onOpenChange:E,onDeleted:D}),e[9]=r,e[10]=O);let ee=a?.skill??null,k=a?.existingNames??sr,A,j;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{e||o(null)},A=()=>o(null),e[11]=A,e[12]=j):(A=e[11],j=e[12]);let M;e[13]!==ee||e[14]!==k?(M=(0,Q.jsx)(tr,{skill:ee,existingNames:k,onOpenChange:j,onRenamed:A}),e[13]=ee,e[14]=k,e[15]=M):M=e[15];let N;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{e||c(null)},e[16]=N):N=e[16];let P;e[17]===s?P=e[18]:(P=(0,Q.jsx)(rr,{target:s,onOpenChange:N}),e[17]=s,e[18]=P);let F;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{e||d(null)},e[19]=F):F=e[19];let I;e[20]===l?I=e[21]:(I=(0,Q.jsx)($n,{target:l,onOpenChange:F}),e[20]=l,e[21]=I);let L;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{e||p(null)},e[22]=L):L=e[22];let R;e[23]===f?R=e[24]:(R=(0,Q.jsx)(Qn,{target:f,onOpenChange:L}),e[23]=f,e[24]=R);let z;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{e||h(null)},e[25]=z):z=e[25];let te;e[26]===m?te=e[27]:(te=(0,Q.jsx)(er,{target:m,onOpenChange:z}),e[26]=m,e[27]=te);let B;e[28]!==M||e[29]!==P||e[30]!==I||e[31]!==R||e[32]!==te||e[33]!==O?(B=(0,Q.jsxs)(Q.Fragment,{children:[O,M,P,I,R,te]}),e[28]=M,e[29]=P,e[30]=I,e[31]=R,e[32]=te,e[33]=O,e[34]=B):B=e[34];let V=B,H,U,W,G,K;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=(e,t)=>o({skill:e,existingNames:t}),U=(e,t)=>c({scope:e.scope,name:e.name,toScope:t}),W=(e,t)=>d({skill:e,filePath:t}),G=(e,t)=>p(t===void 0?{skill:e}:{skill:e,prefix:t}),K=(e,t)=>h({skill:e,editor:t}),e[35]=H,e[36]=U,e[37]=W,e[38]=G,e[39]=K):(H=e[35],U=e[36],W=e[37],G=e[38],K=e[39]);let q;return e[40]!==V||e[41]!==T||e[42]!==y||e[43]!==g?(q={installingName:g,install:y,convertLocations:x,runLocationWrite:C,duplicate:T,requestDelete:i,requestRename:H,requestScopeMove:U,requestFileRename:W,requestFileCreate:G,requestForkResolve:K,dialogs:V},e[40]=V,e[41]=T,e[42]=y,e[43]=g,e[44]=q):q=e[44],q}function ar(e){return e.map(or).join(`, `)}function or(e){return he[e]??e}var sr=new Set;function cr(e){let t=(0,yt.c)(29),{skill:n,filePath:r,actions:i}=e,{_:a}=u(),o=typeof window<`u`?window.okDesktop:void 0,s=n.absolutePath?`${n.absolutePath}/${r}`:void 0,c=`${n.path}/${r}`,d;t[0]===a?d=t[1]:(d=async function(e){try{await ft(e),Z.success(a({id:`SXCSQd`}))}catch{Z.error(a({id:`cRHuuI`}))}},t[0]=a,t[1]=d);let f=d,p;t[2]!==i||t[3]!==r||t[4]!==n?(p=()=>i.requestFileRename(n,r),t[2]=i,t[3]=r,t[4]=n,t[5]=p):p=t[5];let m,h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(_t,{"aria-hidden":!0}),h=(0,Q.jsx)(l,{id:`2wxgft`}),t[6]=m,t[7]=h):(m=t[6],h=t[7]);let g;t[8]===p?g=t[9]:(g=(0,Q.jsxs)(M,{onSelect:p,children:[m,h]}),t[8]=p,t[9]=g);let _;t[10]===s?_=t[11]:(_=o&&s?(0,Q.jsxs)(M,{onSelect:()=>void o.shell.showItemInFolder(s),children:[(0,Q.jsx)(Me,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`LtSYdi`})]}):null,t[10]=s,t[11]=_);let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsxs)(R,{children:[(0,Q.jsx)(je,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`zd00pH`})]}),t[12]=v):v=t[12];let y;t[13]!==s||t[14]!==f?(y=s?(0,Q.jsx)(M,{onSelect:()=>void f(s),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[13]=s,t[14]=f,t[15]=y):y=t[15];let b;t[16]!==f||t[17]!==c?(b=()=>void f(c),t[16]=f,t[17]=c,t[18]=b):b=t[18];let x;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(l,{id:`xloBjn`}),t[19]=x):x=t[19];let S;t[20]===b?S=t[21]:(S=(0,Q.jsx)(M,{onSelect:b,children:x}),t[20]=b,t[21]=S);let C;t[22]!==S||t[23]!==y?(C=(0,Q.jsxs)(N,{children:[v,(0,Q.jsxs)(P,{children:[y,S]})]}),t[22]=S,t[23]=y,t[24]=C):C=t[24];let w;return t[25]!==C||t[26]!==g||t[27]!==_?(w=(0,Q.jsxs)(Q.Fragment,{children:[g,_,C]}),t[25]=C,t[26]=g,t[27]=_,t[28]=w):w=t[28],w}function lr(e){let t=(0,yt.c)(86),{skill:n,actions:i,existingNames:a}=e,{_:o}=u(),s=m(),c=Ke(),d=y().states,{dispatch:f}=fn(),p=Sn(n,i),g=typeof window<`u`?window.okDesktop:void 0,_=n.absolutePath,v;t[0]===o?v=t[1]:(v=async function(e){try{await ft(e),Z.success(o({id:`SXCSQd`}))}catch{Z.error(o({id:`cRHuuI`}))}},t[0]=o,t[1]=v);let b=v,x;t[2]===_?x=t[3]:(x=g&&_?(0,Q.jsxs)(M,{onSelect:()=>void g.shell.showItemInFolder(_),children:[(0,Q.jsx)(Me,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`LtSYdi`})]}):null,t[2]=_,t[3]=x);let S;t[4]!==n.name||t[5]!==n.scope||t[6]!==s?(S=Jt({skillName:n.name,scope:n.scope,workspace:s}),t[4]=n.name,t[5]=n.scope,t[6]=s,t[7]=S):S=t[7];let C;t[8]!==f||t[9]!==d||t[10]!==S?(C=(0,Q.jsx)(Un,{input:S,installStates:d,isElectronHost:g!=null,dispatch:f}),t[8]=f,t[9]=d,t[10]=S,t[11]=C):C=t[11];let w;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsxs)(R,{children:[(0,Q.jsx)(je,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`zd00pH`})]}),t[12]=w):w=t[12];let T;t[13]!==_||t[14]!==b?(T=_?(0,Q.jsx)(M,{onSelect:()=>void b(_),children:(0,Q.jsx)(l,{id:`z2funE`})}):null,t[13]=_,t[14]=b,t[15]=T):T=t[15];let E;t[16]!==b||t[17]!==n.path?(E=()=>void b(n.path),t[16]=b,t[17]=n.path,t[18]=E):E=t[18];let D;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(l,{id:`xloBjn`}),t[19]=D):D=t[19];let O;t[20]===E?O=t[21]:(O=(0,Q.jsx)(M,{onSelect:E,children:D}),t[20]=E,t[21]=O);let ee;t[22]!==T||t[23]!==O?(ee=(0,Q.jsxs)(N,{children:[w,(0,Q.jsxs)(P,{children:[T,O]})]}),t[22]=T,t[23]=O,t[24]=ee):ee=t[24];let k;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(z,{}),t[25]=k):k=t[25];let A;t[26]!==i||t[27]!==a||t[28]!==n?(A=()=>void i.duplicate(n,a),t[26]=i,t[27]=a,t[28]=n,t[29]=A):A=t[29];let j,F;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(r,{"aria-hidden":!0}),F=(0,Q.jsx)(l,{id:`euc6Ns`}),t[30]=j,t[31]=F):(j=t[30],F=t[31]);let I;t[32]===A?I=t[33]:(I=(0,Q.jsxs)(M,{onSelect:A,children:[j,F]}),t[32]=A,t[33]=I);let L;t[34]!==i||t[35]!==a||t[36]!==n?(L=()=>i.requestRename(n,a),t[34]=i,t[35]=a,t[36]=n,t[37]=L):L=t[37];let te,B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(_t,{"aria-hidden":!0}),B=(0,Q.jsx)(l,{id:`2wxgft`}),t[38]=te,t[39]=B):(te=t[38],B=t[39]);let V;t[40]===L?V=t[41]:(V=(0,Q.jsxs)(M,{onSelect:L,children:[te,B]}),t[40]=L,t[41]=V);let H;t[42]!==i||t[43]!==n?(H=()=>i.requestFileCreate(n),t[42]=i,t[43]=n,t[44]=H):H=t[44];let U,W;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(h,{"aria-hidden":!0}),W=(0,Q.jsx)(l,{id:`HdkSiO`}),t[45]=U,t[46]=W):(U=t[45],W=t[46]);let G;t[47]===H?G=t[48]:(G=(0,Q.jsxs)(M,{onSelect:H,children:[U,W]}),t[47]=H,t[48]=G);let K;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsxs)(R,{children:[(0,Q.jsx)(ht,{"aria-hidden":!0}),(0,Q.jsx)(l,{id:`TKQ7K-`})]}),t[49]=K):K=t[49];let q;t[50]!==i||t[51]!==n?(q=e=>i.requestForkResolve(n,e),t[50]=i,t[51]=n,t[52]=q):q=t[52];let J;t[53]!==p||t[54]!==n||t[55]!==q?(J=(0,Q.jsxs)(N,{children:[K,(0,Q.jsx)(P,{className:xn,children:(0,Q.jsx)(Dn,{toggles:p,skill:n,onResolveFork:q})})]}),t[53]=p,t[54]=n,t[55]=q,t[56]=J):J=t[56];let Y;t[57]!==i||t[58]!==n?(Y=()=>i.requestScopeMove(n,n.scope===`project`?`global`:`project`),t[57]=i,t[58]=n,t[59]=Y):Y=t[59];let ne;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(mt,{"aria-hidden":!0}),t[60]=ne):ne=t[60];let X;t[61]!==c.global||t[62]!==c.project||t[63]!==n.scope?(X=n.scope===`project`?(0,Q.jsx)(l,{id:`bpytj4`,values:{0:c.global}}):(0,Q.jsx)(l,{id:`bpytj4`,values:{0:c.project}}),t[61]=c.global,t[62]=c.project,t[63]=n.scope,t[64]=X):X=t[64];let re;t[65]!==Y||t[66]!==X?(re=(0,Q.jsxs)(M,{onSelect:Y,children:[ne,X]}),t[65]=Y,t[66]=X,t[67]=re):re=t[67];let ie;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Q.jsx)(z,{}),t[68]=ie):ie=t[68];let ae;t[69]!==i||t[70]!==n?(ae=()=>i.requestDelete(n),t[69]=i,t[70]=n,t[71]=ae):ae=t[71];let oe,se;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Q.jsx)(Pe,{"aria-hidden":!0}),se=(0,Q.jsx)(l,{id:`cnGeoo`}),t[72]=oe,t[73]=se):(oe=t[72],se=t[73]);let ce;t[74]===ae?ce=t[75]:(ce=(0,Q.jsxs)(M,{variant:`destructive`,onSelect:ae,children:[oe,se]}),t[74]=ae,t[75]=ce);let le;return t[76]!==ee||t[77]!==I||t[78]!==V||t[79]!==x||t[80]!==G||t[81]!==J||t[82]!==re||t[83]!==ce||t[84]!==C?(le=(0,Q.jsxs)(Q.Fragment,{children:[x,C,ee,k,I,V,G,J,re,ie,ce]}),t[76]=ee,t[77]=I,t[78]=V,t[79]=x,t[80]=G,t[81]=J,t[82]=re,t[83]=ce,t[84]=C,t[85]=le):le=t[85],le}export{vt as C,Ht as S,mt as T,nn as _,qn as a,sn as b,bn as c,Sn as d,Yt as f,Wt as g,Ut as h,rr as i,xn as l,qt as m,cr as n,Un as o,Gt as p,ir as r,Bn as s,lr as t,Dn as u,ln as v,gt as w,fn as x,Kt as y};
@@ -2,4 +2,4 @@ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";impor
2
2
  To pick up a draggable item, press the space bar.
3
3
  While dragging, use the arrow keys to move the item.
4
4
  Press space again to drop the item in its new position, or press escape to cancel.
5
- `},ce={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function N(e){let{announcements:t=ce,container:n,hiddenTextDescribedById:a,screenReaderInstructions:o=se}=e,{announce:s,announcement:c}=ie(),l=S(`DndLiveRegion`),[u,d]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{d(!0)},[]),M((0,i.useMemo)(()=>({onDragStart(e){let{active:n}=e;s(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&s(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;s(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;s(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;s(t.onDragCancel({active:n,over:r}))}}),[s,t])),!u)return null;let f=i.createElement(i.Fragment,null,i.createElement(re,{id:a,value:o.draggable}),i.createElement(j,{id:l,announcement:c}));return n?(0,r.createPortal)(f,n):f}var P;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(P||={});function F(){}function I(e,t){return(0,i.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function L(){var e=[...arguments];return(0,i.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var R=Object.freeze({x:0,y:0});function z(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function le(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ue(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function de(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function fe(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function B(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var pe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=B(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=z(B(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(le)},V=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=de(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=de(r),o=i.reduce((e,t,r)=>e+z(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(le)};function me(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var he=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=me(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(ue)};function ge(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function H(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:R}function _e(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var ve=_e(1);function U(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function ye(e,t,n){let r=U(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var be={ignoreTransform:!1};function W(e,t){t===void 0&&(t=be);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=l(e).getComputedStyle(e);t&&(n=ye(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function G(e){return W(e,{ignoreTransform:!0})}function xe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Se(e,t){return t===void 0&&(t=l(e).getComputedStyle(e)),t.position===`fixed`}function Ce(e,t){t===void 0&&(t=l(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function we(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(u(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!d(i)||f(i)||n.includes(i))return n;let a=l(e).getComputedStyle(i);return i!==e&&Ce(i,a)&&n.push(i),Se(i,a)?n:r(i.parentNode)}return e?r(e):n}function Te(e){let[t]=we(e,1);return t??null}function Ee(e){return!o||!e?null:s(e)?e:c(e)?u(e)||e===p(e).scrollingElement?window:d(e)?e:null:null}function K(e){return s(e)?e.scrollX:e.scrollLeft}function q(e){return s(e)?e.scrollY:e.scrollTop}function J(e){return{x:K(e),y:q(e)}}var Y;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Y||={});function X(e){return!o||!e?!1:e===document.scrollingElement}function De(e){let t={x:0,y:0},n=X(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Oe={x:.2,y:.2};function ke(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Oe);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=De(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Y.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Y.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Y.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Y.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Ae(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function je(e){return e.reduce((e,t)=>w(e,J(t)),R)}function Me(e){return e.reduce((e,t)=>e+K(t),0)}function Ne(e){return e.reduce((e,t)=>e+q(t),0)}function Pe(e,t){if(t===void 0&&(t=W),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Te(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Fe=[[`x`,[`left`,`right`],Me],[`y`,[`top`,`bottom`],Ne]],Ie=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=we(t),r=je(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Fe)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},Le=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Re(e){let{EventTarget:t}=l(e);return e instanceof t?e:p(e)}function ze(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Z;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Z||={});function Be(e){e.preventDefault()}function Ve(e){e.stopPropagation()}var Q;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Q||={});var He={start:[Q.Space,Q.Enter],cancel:[Q.Esc],end:[Q.Space,Q.Enter,Q.Tab]},Ue=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Q.Right:return{...n,x:n.x+25};case Q.Left:return{...n,x:n.x-25};case Q.Down:return{...n,y:n.y+25};case Q.Up:return{...n,y:n.y-25}}},We=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Le(p(t)),this.windowListeners=new Le(l(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Z.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Pe(n),t(R)}handleKeyDown(e){if(D(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=He,coordinateGetter:a=Ue,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:R;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=T(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=De(n),p=Ae(n),m={x:Math.min(i===Q.Right?p.right-p.width/2:p.right,Math.max(i===Q.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Q.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Q.Down?p.top:p.top+p.height/2,u.y))},h=i===Q.Right&&!s||i===Q.Left&&!c,g=i===Q.Down&&!l||i===Q.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Q.Right&&e<=d.x||i===Q.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Q.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Q.Down&&e<=d.y||i===Q.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Q.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,w(T(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};We.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=He,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Ge(e){return!!(e&&`distance`in e)}function Ke(e){return!!(e&&`delay`in e)}var qe=class{constructor(e,t,n){n===void 0&&(n=Re(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=p(i),this.documentListeners=new Le(this.document),this.listeners=new Le(n),this.windowListeners=new Le(l(i)),this.initialCoordinates=te(r)??R,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.DragStart,Be),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),this.windowListeners.add(Z.ContextMenu,Be),this.documentListeners.add(Z.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ke(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Ge(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Z.Click,Ve,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Z.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=te(e)??R,s=T(n,o);if(!t&&a){if(Ge(a)){if(a.tolerance!=null&&ze(s,a.tolerance))return this.handleCancel();if(ze(s,a.distance))return this.handleStart()}if(Ke(a)&&ze(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Q.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Je={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Ye=class extends qe{constructor(e){let{event:t}=e,n=p(t.target);super(e,Je,n)}};Ye.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Xe={move:{name:`mousemove`},end:{name:`mouseup`}},Ze;(function(e){e[e.RightClick=2]=`RightClick`})(Ze||={});var Qe=class extends qe{constructor(e){super(e,Xe,p(e.event.target))}};Qe.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Ze.RightClick?!1:(r?.({event:n}),!0)}}];var $e={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},et=class extends qe{constructor(e){super(e,$e)}static setup(){return window.addEventListener($e.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener($e.move.name,e)};function e(){}}};et.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var tt;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(tt||={});var nt;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(nt||={});function rt(e){let{acceleration:t,activator:n=tt.Pointer,canScroll:r,draggingRect:a,enabled:o,interval:s=5,order:c=nt.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:p}=e,m=at({delta:f,disabled:!o}),[h,_]=g(),v=(0,i.useRef)({x:0,y:0}),y=(0,i.useRef)({x:0,y:0}),b=(0,i.useMemo)(()=>{switch(n){case tt.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case tt.DraggableRect:return a}},[n,a,l]),x=(0,i.useRef)(null),S=(0,i.useCallback)(()=>{let e=x.current;if(!e)return;let t=v.current.x*y.current.x,n=v.current.y*y.current.y;e.scrollBy(t,n)},[]),C=(0,i.useMemo)(()=>c===nt.TreeOrder?[...u].reverse():u,[c,u]);(0,i.useEffect)(()=>{if(!o||!u.length||!b){_();return}for(let e of C){if(r?.(e)===!1)continue;let n=d[u.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=ke(e,n,b,t,p);for(let e of[`x`,`y`])m[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){_(),x.current=e,h(S,s),v.current=a,y.current=i;return}}v.current={x:0,y:0},y.current={x:0,y:0},_()},[t,S,r,_,o,s,JSON.stringify(b),JSON.stringify(m),h,u,C,d,JSON.stringify(p)])}var it={x:{[Y.Backward]:!1,[Y.Forward]:!1},y:{[Y.Backward]:!1,[Y.Forward]:!1}};function at(e){let{delta:t,disabled:n}=e,r=b(t);return v(e=>{if(n||!r||!e)return it;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Y.Backward]:e.x[Y.Backward]||i.x===-1,[Y.Forward]:e.x[Y.Forward]||i.x===1},y:{[Y.Backward]:e.y[Y.Backward]||i.y===-1,[Y.Forward]:e.y[Y.Forward]||i.y===1}}},[n,t,r])}function ot(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return v(e=>t==null?null:r??e??null,[r,t])}function st(e,t){return(0,i.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var ct;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(ct||={});var lt;(function(e){e.Optimized=`optimized`})(lt||={});var ut=new Map;function dt(e,t){let{dragging:n,dependencies:r,config:a}=t,[o,s]=(0,i.useState)(null),{frequency:c,measure:l,strategy:u}=a,d=(0,i.useRef)(e),f=y(),p=_(f),m=(0,i.useCallback)(function(e){e===void 0&&(e=[]),!p.current&&s(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),h=(0,i.useRef)(null),g=v(t=>{if(f&&!n)return ut;if(!t||t===ut||d.current!==e||o!=null){let t=new Map;for(let n of e){if(!n)continue;if(o&&o.length>0&&!o.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Ie(l(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,o,n,f,l]);return(0,i.useEffect)(()=>{d.current=e},[e]),(0,i.useEffect)(()=>{f||m()},[n,f]),(0,i.useEffect)(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),(0,i.useEffect)(()=>{f||typeof c!=`number`||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},c))},[c,f,m,...r]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:o!=null};function y(){switch(u){case ct.Always:return!1;case ct.BeforeDragging:return n;default:return!n}}}function ft(e,t){return v(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function pt(e,t){return ft(e,t)}function mt(e){let{callback:t,disabled:n}=e,r=h(t),a=(0,i.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,i.useEffect)(()=>()=>a?.disconnect(),[a]),a}function ht(e){let{callback:t,disabled:n}=e,r=h(t),a=(0,i.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,i.useEffect)(()=>()=>a?.disconnect(),[a]),a}function gt(e){return new Ie(W(e),e)}function _t(e,t,n){t===void 0&&(t=gt);let[r,a]=(0,i.useState)(null);function o(){a(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let s=mt({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),c=ht({callback:o});return m(()=>{o(),e?(c?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),s?.disconnect())},[e]),r}function vt(e){return H(e,ft(e))}var yt=[];function bt(e){let t=(0,i.useRef)(e),n=v(n=>e?n&&n!==yt&&e&&t.current&&e.parentNode===t.current.parentNode?n:we(e):yt,[e]);return(0,i.useEffect)(()=>{t.current=e},[e]),n}function xt(e){let[t,n]=(0,i.useState)(null),r=(0,i.useRef)(e),a=(0,i.useCallback)(e=>{let t=Ee(e.target);t&&n(e=>e?(e.set(t,J(t)),new Map(e)):null)},[]);return(0,i.useEffect)(()=>{let t=r.current;if(e!==t){i(t);let o=e.map(e=>{let t=Ee(e);return t?(t.addEventListener(`scroll`,a,{passive:!0}),[t,J(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach(e=>{Ee(e)?.removeEventListener(`scroll`,a)})}},[a,e]),(0,i.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>w(e,t),R):je(e):R,[e,t])}function St(e,t){t===void 0&&(t=[]);let n=(0,i.useRef)(null);return(0,i.useEffect)(()=>{n.current=null},t),(0,i.useEffect)(()=>{let t=e!==R;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?T(e,n.current):R}function Ct(e){(0,i.useEffect)(()=>{if(!o)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function wt(e,t){return(0,i.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Tt(e){return(0,i.useMemo)(()=>e?xe(e):null,[e])}var Et=[];function Dt(e,t){t===void 0&&(t=W);let[n]=e,r=Tt(n?l(n):null),[a,o]=(0,i.useState)(Et);function s(){o(()=>e.length?e.map(e=>X(e)?r:new Ie(t(e),e)):Et)}let c=ht({callback:s});return m(()=>{c?.disconnect(),s(),e.forEach(e=>c?.observe(e))},[e]),a}function Ot(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return d(t)?t:e}function kt(e){let{measure:t}=e,[n,r]=(0,i.useState)(null),a=ht({callback:(0,i.useCallback)(e=>{for(let{target:n}of e)if(d(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[o,s]=y((0,i.useCallback)(e=>{let n=Ot(e);a?.disconnect(),n&&a?.observe(n),r(n?t(n):null)},[t,a]));return(0,i.useMemo)(()=>({nodeRef:o,rect:n,setRef:s}),[n,o,s])}var At=[{sensor:Ye,options:{}},{sensor:We,options:{}}],jt={current:{}},Mt={draggable:{measure:G},droppable:{measure:G,strategy:ct.WhileDragging,frequency:lt.Optimized},dragOverlay:{measure:W}},Nt=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Pt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Nt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:F},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Mt,measureDroppableContainers:F,windowRect:null,measuringScheduled:!1},Ft={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:F,draggableNodes:new Map,over:null,measureDroppableContainers:F},It=(0,i.createContext)(Ft),Lt=(0,i.createContext)(Pt);function Rt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Nt}}}function zt(e,t){switch(t.type){case P.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case P.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case P.DragEnd:case P.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case P.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Nt(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case P.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Nt(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case P.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Nt(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Bt(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:a}=(0,i.useContext)(It),o=b(r),s=b(n?.id);return(0,i.useEffect)(()=>{if(!t&&!r&&o&&s!=null){if(!D(o)||document.activeElement===o.target)return;let e=a.get(s);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=A(e);if(t){t.focus();break}}})}},[r,t,a,s,o]),null}function Vt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Ht(e){return(0,i.useMemo)(()=>({draggable:{...Mt.draggable,...e?.draggable},droppable:{...Mt.droppable,...e?.droppable},dragOverlay:{...Mt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ut(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e,o=(0,i.useRef)(!1),{x:s,y:c}=typeof a==`boolean`?{x:a,y:a}:a;m(()=>{if(!s&&!c||!t){o.current=!1;return}if(o.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=H(n(e),r);if(s||(i.x=0),c||(i.y=0),o.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=Te(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,s,c,r,n])}var Wt=(0,i.createContext)({...R,scaleX:1,scaleY:1}),$;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})($||={});var Gt=(0,i.memo)(function(e){let{id:t,accessibility:n,autoScroll:a=!0,children:o,sensors:s=At,collisionDetection:c=he,measuring:u,modifiers:d,...f}=e,[p,h]=(0,i.useReducer)(zt,void 0,Rt),[g,v]=oe(),[y,b]=(0,i.useState)($.Uninitialized),x=y===$.Initialized,{draggable:{active:C,nodes:T,translate:E},droppable:{containers:D}}=p,ee=C==null?null:T.get(C),O=(0,i.useRef)({initial:null,translated:null}),k=(0,i.useMemo)(()=>C==null?null:{id:C,data:ee?.data??jt,rect:O},[C,ee]),A=(0,i.useRef)(null),[ne,re]=(0,i.useState)(null),[j,ie]=(0,i.useState)(null),M=_(f,Object.values(f)),se=S(`DndDescribedBy`,t),ce=(0,i.useMemo)(()=>D.getEnabled(),[D]),F=Ht(u),{droppableRects:I,measureDroppableContainers:L,measuringScheduled:R}=dt(ce,{dragging:x,dependencies:[E.x,E.y],config:F.droppable}),z=ot(T,C),le=(0,i.useMemo)(()=>j?te(j):null,[j]),ue=Pe(),de=pt(z,F.draggable.measure);Ut({activeNode:C==null?null:T.get(C),config:ue.layoutShiftCompensation,initialRect:de,measure:F.draggable.measure});let B=_t(z,F.draggable.measure,de),pe=_t(z?z.parentElement:null),V=(0,i.useRef)({activatorEvent:null,active:null,activeNode:z,collisionRect:null,collisions:null,droppableRects:I,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:D,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),me=D.getNodeFor(V.current.over?.id),H=kt({measure:F.dragOverlay.measure}),_e=H.nodeRef.current??z,U=x?H.rect??B:null,ye=!!(H.nodeRef.current&&H.rect),be=vt(ye?null:B),W=Tt(_e?l(_e):null),G=bt(x?me??z:null),xe=Dt(G),Se=Vt(d,{transform:{x:E.x-be.x,y:E.y-be.y,scaleX:1,scaleY:1},activatorEvent:j,active:k,activeNodeRect:B,containerNodeRect:pe,draggingNodeRect:U,over:V.current.over,overlayNodeRect:H.rect,scrollableAncestors:G,scrollableAncestorRects:xe,windowRect:W}),Ce=le?w(le,E):null,we=xt(G),Te=St(we),Ee=St(we,[B]),K=w(Se,Te),q=U?ve(U,Se):null,J=k&&q?c({active:k,collisionRect:q,droppableRects:I,droppableContainers:ce,pointerCoordinates:Ce}):null,Y=fe(J,`id`),[X,De]=(0,i.useState)(null),Oe=ge(ye?Se:w(Se,Ee),X?.rect??null,B),ke=(0,i.useRef)(null),Ae=(0,i.useCallback)((e,t)=>{let{sensor:n,options:i}=t;if(A.current==null)return;let a=T.get(A.current);if(!a)return;let o=e.nativeEvent;ke.current=new n({active:A.current,activeNode:a,event:o,options:i,context:V,onAbort(e){if(!T.get(e))return;let{onDragAbort:t}=M.current,n={id:e};t?.(n),g({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!T.get(e))return;let{onDragPending:i}=M.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),g({type:`onDragPending`,event:a})},onStart(e){let t=A.current;if(t==null)return;let n=T.get(t);if(!n)return;let{onDragStart:i}=M.current,a={activatorEvent:o,active:{id:t,data:n.data,rect:O}};(0,r.unstable_batchedUpdates)(()=>{i?.(a),b($.Initializing),h({type:P.DragStart,initialCoordinates:e,active:t}),g({type:`onDragStart`,event:a}),re(ke.current),ie(o)})},onMove(e){h({type:P.DragMove,coordinates:e})},onEnd:s(P.DragEnd),onCancel:s(P.DragCancel)});function s(e){return async function(){let{active:t,collisions:n,over:i,scrollAdjustedTranslate:a}=V.current,s=null;if(t&&a){let{cancelDrop:r}=M.current;s={activatorEvent:o,active:t,collisions:n,delta:a,over:i},e===P.DragEnd&&typeof r==`function`&&await Promise.resolve(r(s))&&(e=P.DragCancel)}A.current=null,(0,r.unstable_batchedUpdates)(()=>{h({type:e}),b($.Uninitialized),De(null),re(null),ie(null),ke.current=null;let t=e===P.DragEnd?`onDragEnd`:`onDragCancel`;if(s){let e=M.current[t];e?.(s),g({type:t,event:s})}})}}},[T]),je=st(s,(0,i.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=T.get(r);if(A.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},A.current=r,Ae(n,t))},[T,Ae]));Ct(s),m(()=>{B&&y===$.Initializing&&b($.Initialized)},[B,y]),(0,i.useEffect)(()=>{let{onDragMove:e}=M.current,{active:t,activatorEvent:n,collisions:i,over:a}=V.current;if(!t||!n)return;let o={active:t,activatorEvent:n,collisions:i,delta:{x:K.x,y:K.y},over:a};(0,r.unstable_batchedUpdates)(()=>{e?.(o),g({type:`onDragMove`,event:o})})},[K.x,K.y]),(0,i.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:i,scrollAdjustedTranslate:a}=V.current;if(!e||A.current==null||!t||!a)return;let{onDragOver:o}=M.current,s=i.get(Y),c=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:a.x,y:a.y},over:c};(0,r.unstable_batchedUpdates)(()=>{De(c),o?.(l),g({type:`onDragOver`,event:l})})},[Y]),m(()=>{V.current={activatorEvent:j,active:k,activeNode:z,collisionRect:q,collisions:J,droppableRects:I,draggableNodes:T,draggingNode:_e,draggingNodeRect:U,droppableContainers:D,over:X,scrollableAncestors:G,scrollAdjustedTranslate:K},O.current={initial:U,translated:q}},[k,z,J,q,T,_e,U,I,D,X,G,K]),rt({...ue,delta:E,draggingRect:q,pointerCoordinates:Ce,scrollableAncestors:G,scrollableAncestorRects:xe});let Me=(0,i.useMemo)(()=>({active:k,activeNode:z,activeNodeRect:B,activatorEvent:j,collisions:J,containerNodeRect:pe,dragOverlay:H,draggableNodes:T,droppableContainers:D,droppableRects:I,over:X,measureDroppableContainers:L,scrollableAncestors:G,scrollableAncestorRects:xe,measuringConfiguration:F,measuringScheduled:R,windowRect:W}),[k,z,B,j,J,pe,H,T,D,I,X,L,G,xe,F,R,W]),Ne=(0,i.useMemo)(()=>({activatorEvent:j,activators:je,active:k,activeNodeRect:B,ariaDescribedById:{draggable:se},dispatch:h,draggableNodes:T,over:X,measureDroppableContainers:L}),[j,je,k,B,h,se,T,X,L]);return i.createElement(ae.Provider,{value:v},i.createElement(It.Provider,{value:Ne},i.createElement(Lt.Provider,{value:Me},i.createElement(Wt.Provider,{value:Oe},o)),i.createElement(Bt,{disabled:n?.restoreFocus===!1})),i.createElement(N,{...n,hiddenTextDescribedById:se}));function Pe(){let e=ne?.autoScrollEnabled===!1,t=typeof a==`object`?a.enabled===!1:a===!1,n=x&&!e&&!t;return typeof a==`object`?{...a,enabled:n}:{enabled:n}}}),Kt=(0,i.createContext)(null),qt=`button`,Jt=`Draggable`;function Yt(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e,o=S(Jt),{activators:s,activatorEvent:c,active:l,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:p}=(0,i.useContext)(It),{role:h=qt,roleDescription:g=`draggable`,tabIndex:v=0}=a??{},b=l?.id===t,x=(0,i.useContext)(b?Wt:Kt),[C,w]=y(),[T,E]=y(),D=wt(s,t),ee=_(n);return m(()=>(f.set(t,{id:t,key:o,node:C,activatorNode:T,data:ee}),()=>{let e=f.get(t);e&&e.key===o&&f.delete(t)}),[f,t]),{active:l,activatorEvent:c,activeNodeRect:u,attributes:(0,i.useMemo)(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":b&&h===qt?!0:void 0,"aria-roledescription":g,"aria-describedby":d.draggable}),[r,h,v,b,g,d.draggable]),isDragging:b,listeners:r?void 0:D,node:C,over:p,setNodeRef:w,setActivatorNodeRef:E,transform:x}}function Xt(){return(0,i.useContext)(Lt)}var Zt=`Droppable`,Qt={timeout:25};function $t(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e,o=S(Zt),{active:s,dispatch:c,over:l,measureDroppableContainers:u}=(0,i.useContext)(It),d=(0,i.useRef)({disabled:n}),f=(0,i.useRef)(!1),p=(0,i.useRef)(null),m=(0,i.useRef)(null),{disabled:h,updateMeasurementsFor:g,timeout:v}={...Qt,...a},b=_(g??r),x=ht({callback:(0,i.useCallback)(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),m.current=null},v)},[v]),disabled:h||!s}),[C,w]=y((0,i.useCallback)((e,t)=>{x&&(t&&(x.unobserve(t),f.current=!1),e&&x.observe(e))},[x])),T=_(t);return(0,i.useEffect)(()=>{!x||!C.current||(x.disconnect(),f.current=!1,x.observe(C.current))},[C,x]),(0,i.useEffect)(()=>(c({type:P.RegisterDroppable,element:{id:r,key:o,disabled:n,node:C,rect:p,data:T}}),()=>c({type:P.UnregisterDroppable,key:o,id:r})),[r]),(0,i.useEffect)(()=>{n!==d.current.disabled&&(c({type:P.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,c]),{active:s,rect:p,isOver:l?.id===r,node:C,over:l,setNodeRef:w}}function en(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function tn(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function nn(e){return e!==null&&e>=0}function rn(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function an(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var on={scaleX:1,scaleY:1},sn=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=cn(t,a,r);if(a===r){let e=t[i];return e?{x:r<i?e.left+e.width-(o.left+o.width):e.left-o.left,y:0,...on}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...on}:a<r&&a>=i?{x:o.width+s,y:0,...on}:{x:0,y:0,...on}};function cn(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return!r||!i&&!a?0:n<t?i?r.left-(i.left+i.width):a.left-(r.left+r.width):a?a.left-(r.left+r.width):r.left-(i.left+i.width)}var ln=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=en(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},un={scaleX:1,scaleY:1},dn=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...un}:null}let s=fn(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...un}:r<t&&r>=a?{x:0,y:o.height+s,...un}:{x:0,y:0,...un}};function fn(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var pn=`Sortable`,mn=i.createContext({activeIndex:-1,containerId:pn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ln,disabled:{draggable:!1,droppable:!1}});function hn(e){let{children:t,id:n,items:r,strategy:a=ln,disabled:o=!1}=e,{active:s,dragOverlay:c,droppableRects:l,over:u,measureDroppableContainers:d}=Xt(),f=S(pn,n),p=c.rect!==null,h=(0,i.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),g=s!=null,_=s?h.indexOf(s.id):-1,v=u?h.indexOf(u.id):-1,y=(0,i.useRef)(h),b=!rn(h,y.current),x=v!==-1&&_===-1||b,C=an(o);m(()=>{b&&g&&d(h)},[b,h,g,d]),(0,i.useEffect)(()=>{y.current=h},[h]);let w=(0,i.useMemo)(()=>({activeIndex:_,containerId:f,disabled:C,disableTransforms:x,items:h,overIndex:v,useDragOverlay:p,sortedRects:tn(h,l),strategy:a}),[_,f,C.draggable,C.droppable,x,h,v,l,p,a]);return i.createElement(mn.Provider,{value:w},t)}var gn=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return en(n,r,i).indexOf(t)},_n=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},vn={duration:200,easing:`ease`},yn=`transform`,bn=O.Transition.toString({property:yn,duration:0,easing:`linear`}),xn={roleDescription:`sortable`};function Sn(e){let{disabled:t,index:n,node:r,rect:a}=e,[o,s]=(0,i.useState)(null),c=(0,i.useRef)(n);return m(()=>{if(!t&&n!==c.current&&r.current){let e=a.current;if(e){let t=W(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&s(n)}}n!==c.current&&(c.current=n)},[t,n,r,a]),(0,i.useEffect)(()=>{o&&s(null)},[o]),o}function Cn(e){let{animateLayoutChanges:t=_n,attributes:n,disabled:r,data:o,getNewIndex:s=gn,id:c,strategy:l,resizeObserverConfig:u,transition:d=vn}=e,{items:f,containerId:p,activeIndex:m,disabled:h,disableTransforms:g,sortedRects:_,overIndex:v,useDragOverlay:y,strategy:b}=(0,i.useContext)(mn),x=wn(r,h),S=f.indexOf(c),C=(0,i.useMemo)(()=>({sortable:{containerId:p,index:S,items:f},...o}),[p,o,S,f]),w=(0,i.useMemo)(()=>f.slice(f.indexOf(c)),[f,c]),{rect:T,node:E,isOver:ee,setNodeRef:te}=$t({id:c,data:C,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:w,...u}}),{active:k,activatorEvent:A,activeNodeRect:ne,attributes:re,setNodeRef:j,listeners:ie,isDragging:ae,over:M,setActivatorNodeRef:oe,transform:se}=Yt({id:c,data:C,attributes:{...xn,...n},disabled:x.draggable}),ce=a(te,j),N=!!k,P=N&&!g&&nn(m)&&nn(v),F=!y&&ae,I=P?(F&&P?se:null)??(l??b)({rects:_,activeNodeRect:ne,activeIndex:m,overIndex:v,index:S}):null,L=nn(m)&&nn(v)?s({id:c,items:f,activeIndex:m,overIndex:v}):S,R=k?.id,z=(0,i.useRef)({activeId:R,items:f,newIndex:L,containerId:p}),le=f!==z.current.items,ue=t({active:k,containerId:p,isDragging:ae,isSorting:N,id:c,index:S,items:f,newIndex:z.current.newIndex,previousItems:z.current.items,previousContainerId:z.current.containerId,transition:d,wasDragging:z.current.activeId!=null}),de=Sn({disabled:!ue,index:S,node:E,rect:T});return(0,i.useEffect)(()=>{N&&z.current.newIndex!==L&&(z.current.newIndex=L),p!==z.current.containerId&&(z.current.containerId=p),f!==z.current.items&&(z.current.items=f)},[N,L,p,f]),(0,i.useEffect)(()=>{if(R===z.current.activeId)return;if(R!=null&&z.current.activeId==null){z.current.activeId=R;return}let e=setTimeout(()=>{z.current.activeId=R},50);return()=>clearTimeout(e)},[R]),{active:k,activeIndex:m,attributes:re,data:C,rect:T,index:S,newIndex:L,items:f,isOver:ee,isSorting:N,isDragging:ae,listeners:ie,node:E,overIndex:v,over:M,setNodeRef:ce,setActivatorNodeRef:oe,setDroppableNodeRef:te,setDraggableNodeRef:j,transform:de??I,transition:fe()};function fe(){if(de||le&&z.current.newIndex===S)return bn;if(!(F&&!D(A)||!d)&&(N||ue))return O.Transition.toString({...d,property:yn})}}function wn(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function Tn(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var En=[Q.Down,Q.Right,Q.Up,Q.Left],Dn=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(En.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case Q.Down:r.top<a.top&&t.push(n);break;case Q.Up:r.top>a.top&&t.push(n);break;case Q.Left:r.left>a.left&&t.push(n);break;case Q.Right:r.left<a.left&&t.push(n);break}});let c=V({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=fe(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=we(c).some((e,t)=>s[t]!==e),i=On(e,t),a=kn(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:T(u,l)}}}};function On(e,t){return!Tn(e)||!Tn(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function kn(e,t){return!Tn(e)||!Tn(t)||!On(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{Cn as a,Q as c,pe as d,I as f,Dn as i,We as l,O as m,en as n,dn as o,L as p,sn as r,Gt as s,hn as t,Ye as u};
5
+ `},ce={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function N(e){let{announcements:t=ce,container:n,hiddenTextDescribedById:a,screenReaderInstructions:o=se}=e,{announce:s,announcement:c}=ie(),l=S(`DndLiveRegion`),[u,d]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{d(!0)},[]),M((0,i.useMemo)(()=>({onDragStart(e){let{active:n}=e;s(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&s(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;s(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;s(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;s(t.onDragCancel({active:n,over:r}))}}),[s,t])),!u)return null;let f=i.createElement(i.Fragment,null,i.createElement(re,{id:a,value:o.draggable}),i.createElement(j,{id:l,announcement:c}));return n?(0,r.createPortal)(f,n):f}var P;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(P||={});function F(){}function I(e,t){return(0,i.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function L(){var e=[...arguments];return(0,i.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var R=Object.freeze({x:0,y:0});function z(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function le(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ue(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function de(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function fe(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function B(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var pe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=B(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=z(B(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(le)},V=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=de(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=de(r),o=i.reduce((e,t,r)=>e+z(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(le)};function me(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var he=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=me(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(ue)};function ge(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function H(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:R}function _e(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var ve=_e(1);function U(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function ye(e,t,n){let r=U(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var be={ignoreTransform:!1};function W(e,t){t===void 0&&(t=be);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=l(e).getComputedStyle(e);t&&(n=ye(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function G(e){return W(e,{ignoreTransform:!0})}function xe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Se(e,t){return t===void 0&&(t=l(e).getComputedStyle(e)),t.position===`fixed`}function Ce(e,t){t===void 0&&(t=l(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function we(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(u(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!d(i)||f(i)||n.includes(i))return n;let a=l(e).getComputedStyle(i);return i!==e&&Ce(i,a)&&n.push(i),Se(i,a)?n:r(i.parentNode)}return e?r(e):n}function Te(e){let[t]=we(e,1);return t??null}function Ee(e){return!o||!e?null:s(e)?e:c(e)?u(e)||e===p(e).scrollingElement?window:d(e)?e:null:null}function K(e){return s(e)?e.scrollX:e.scrollLeft}function q(e){return s(e)?e.scrollY:e.scrollTop}function J(e){return{x:K(e),y:q(e)}}var Y;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Y||={});function X(e){return!o||!e?!1:e===document.scrollingElement}function De(e){let t={x:0,y:0},n=X(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Oe={x:.2,y:.2};function ke(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Oe);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=De(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Y.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Y.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Y.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Y.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Ae(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function je(e){return e.reduce((e,t)=>w(e,J(t)),R)}function Me(e){return e.reduce((e,t)=>e+K(t),0)}function Ne(e){return e.reduce((e,t)=>e+q(t),0)}function Pe(e,t){if(t===void 0&&(t=W),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Te(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Fe=[[`x`,[`left`,`right`],Me],[`y`,[`top`,`bottom`],Ne]],Ie=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=we(t),r=je(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Fe)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},Le=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Re(e){let{EventTarget:t}=l(e);return e instanceof t?e:p(e)}function ze(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Z;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Z||={});function Be(e){e.preventDefault()}function Ve(e){e.stopPropagation()}var Q;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Q||={});var He={start:[Q.Space,Q.Enter],cancel:[Q.Esc],end:[Q.Space,Q.Enter,Q.Tab]},Ue=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Q.Right:return{...n,x:n.x+25};case Q.Left:return{...n,x:n.x-25};case Q.Down:return{...n,y:n.y+25};case Q.Up:return{...n,y:n.y-25}}},We=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Le(p(t)),this.windowListeners=new Le(l(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Z.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Pe(n),t(R)}handleKeyDown(e){if(D(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=He,coordinateGetter:a=Ue,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:R;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=T(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=De(n),p=Ae(n),m={x:Math.min(i===Q.Right?p.right-p.width/2:p.right,Math.max(i===Q.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Q.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Q.Down?p.top:p.top+p.height/2,u.y))},h=i===Q.Right&&!s||i===Q.Left&&!c,g=i===Q.Down&&!l||i===Q.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Q.Right&&e<=d.x||i===Q.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Q.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Q.Down&&e<=d.y||i===Q.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Q.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,w(T(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};We.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=He,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Ge(e){return!!(e&&`distance`in e)}function Ke(e){return!!(e&&`delay`in e)}var qe=class{constructor(e,t,n){n===void 0&&(n=Re(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=p(i),this.documentListeners=new Le(this.document),this.listeners=new Le(n),this.windowListeners=new Le(l(i)),this.initialCoordinates=te(r)??R,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Z.Resize,this.handleCancel),this.windowListeners.add(Z.DragStart,Be),this.windowListeners.add(Z.VisibilityChange,this.handleCancel),this.windowListeners.add(Z.ContextMenu,Be),this.documentListeners.add(Z.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ke(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Ge(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Z.Click,Ve,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Z.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=te(e)??R,s=T(n,o);if(!t&&a){if(Ge(a)){if(a.tolerance!=null&&ze(s,a.tolerance))return this.handleCancel();if(ze(s,a.distance))return this.handleStart()}if(Ke(a)&&ze(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Q.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Je={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Ye=class extends qe{constructor(e){let{event:t}=e,n=p(t.target);super(e,Je,n)}};Ye.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Xe={move:{name:`mousemove`},end:{name:`mouseup`}},Ze;(function(e){e[e.RightClick=2]=`RightClick`})(Ze||={});var Qe=class extends qe{constructor(e){super(e,Xe,p(e.event.target))}};Qe.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Ze.RightClick?!1:(r?.({event:n}),!0)}}];var $e={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},et=class extends qe{constructor(e){super(e,$e)}static setup(){return window.addEventListener($e.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener($e.move.name,e)};function e(){}}};et.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var tt;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(tt||={});var nt;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(nt||={});function rt(e){let{acceleration:t,activator:n=tt.Pointer,canScroll:r,draggingRect:a,enabled:o,interval:s=5,order:c=nt.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:p}=e,m=at({delta:f,disabled:!o}),[h,_]=g(),v=(0,i.useRef)({x:0,y:0}),y=(0,i.useRef)({x:0,y:0}),b=(0,i.useMemo)(()=>{switch(n){case tt.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case tt.DraggableRect:return a}},[n,a,l]),x=(0,i.useRef)(null),S=(0,i.useCallback)(()=>{let e=x.current;if(!e)return;let t=v.current.x*y.current.x,n=v.current.y*y.current.y;e.scrollBy(t,n)},[]),C=(0,i.useMemo)(()=>c===nt.TreeOrder?[...u].reverse():u,[c,u]);(0,i.useEffect)(()=>{if(!o||!u.length||!b){_();return}for(let e of C){if(r?.(e)===!1)continue;let n=d[u.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=ke(e,n,b,t,p);for(let e of[`x`,`y`])m[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){_(),x.current=e,h(S,s),v.current=a,y.current=i;return}}v.current={x:0,y:0},y.current={x:0,y:0},_()},[t,S,r,_,o,s,JSON.stringify(b),JSON.stringify(m),h,u,C,d,JSON.stringify(p)])}var it={x:{[Y.Backward]:!1,[Y.Forward]:!1},y:{[Y.Backward]:!1,[Y.Forward]:!1}};function at(e){let{delta:t,disabled:n}=e,r=b(t);return v(e=>{if(n||!r||!e)return it;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Y.Backward]:e.x[Y.Backward]||i.x===-1,[Y.Forward]:e.x[Y.Forward]||i.x===1},y:{[Y.Backward]:e.y[Y.Backward]||i.y===-1,[Y.Forward]:e.y[Y.Forward]||i.y===1}}},[n,t,r])}function ot(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return v(e=>t==null?null:r??e??null,[r,t])}function st(e,t){return(0,i.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var ct;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(ct||={});var lt;(function(e){e.Optimized=`optimized`})(lt||={});var ut=new Map;function dt(e,t){let{dragging:n,dependencies:r,config:a}=t,[o,s]=(0,i.useState)(null),{frequency:c,measure:l,strategy:u}=a,d=(0,i.useRef)(e),f=y(),p=_(f),m=(0,i.useCallback)(function(e){e===void 0&&(e=[]),!p.current&&s(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),h=(0,i.useRef)(null),g=v(t=>{if(f&&!n)return ut;if(!t||t===ut||d.current!==e||o!=null){let t=new Map;for(let n of e){if(!n)continue;if(o&&o.length>0&&!o.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Ie(l(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,o,n,f,l]);return(0,i.useEffect)(()=>{d.current=e},[e]),(0,i.useEffect)(()=>{f||m()},[n,f]),(0,i.useEffect)(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),(0,i.useEffect)(()=>{f||typeof c!=`number`||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},c))},[c,f,m,...r]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:o!=null};function y(){switch(u){case ct.Always:return!1;case ct.BeforeDragging:return n;default:return!n}}}function ft(e,t){return v(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function pt(e,t){return ft(e,t)}function mt(e){let{callback:t,disabled:n}=e,r=h(t),a=(0,i.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,i.useEffect)(()=>()=>a?.disconnect(),[a]),a}function ht(e){let{callback:t,disabled:n}=e,r=h(t),a=(0,i.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,i.useEffect)(()=>()=>a?.disconnect(),[a]),a}function gt(e){return new Ie(W(e),e)}function _t(e,t,n){t===void 0&&(t=gt);let[r,a]=(0,i.useState)(null);function o(){a(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let s=mt({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),c=ht({callback:o});return m(()=>{o(),e?(c?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),s?.disconnect())},[e]),r}function vt(e){return H(e,ft(e))}var yt=[];function bt(e){let t=(0,i.useRef)(e),n=v(n=>e?n&&n!==yt&&e&&t.current&&e.parentNode===t.current.parentNode?n:we(e):yt,[e]);return(0,i.useEffect)(()=>{t.current=e},[e]),n}function xt(e){let[t,n]=(0,i.useState)(null),r=(0,i.useRef)(e),a=(0,i.useCallback)(e=>{let t=Ee(e.target);t&&n(e=>e?(e.set(t,J(t)),new Map(e)):null)},[]);return(0,i.useEffect)(()=>{let t=r.current;if(e!==t){i(t);let o=e.map(e=>{let t=Ee(e);return t?(t.addEventListener(`scroll`,a,{passive:!0}),[t,J(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach(e=>{Ee(e)?.removeEventListener(`scroll`,a)})}},[a,e]),(0,i.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>w(e,t),R):je(e):R,[e,t])}function St(e,t){t===void 0&&(t=[]);let n=(0,i.useRef)(null);return(0,i.useEffect)(()=>{n.current=null},t),(0,i.useEffect)(()=>{let t=e!==R;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?T(e,n.current):R}function Ct(e){(0,i.useEffect)(()=>{if(!o)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function wt(e,t){return(0,i.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Tt(e){return(0,i.useMemo)(()=>e?xe(e):null,[e])}var Et=[];function Dt(e,t){t===void 0&&(t=W);let[n]=e,r=Tt(n?l(n):null),[a,o]=(0,i.useState)(Et);function s(){o(()=>e.length?e.map(e=>X(e)?r:new Ie(t(e),e)):Et)}let c=ht({callback:s});return m(()=>{c?.disconnect(),s(),e.forEach(e=>c?.observe(e))},[e]),a}function Ot(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return d(t)?t:e}function kt(e){let{measure:t}=e,[n,r]=(0,i.useState)(null),a=ht({callback:(0,i.useCallback)(e=>{for(let{target:n}of e)if(d(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[o,s]=y((0,i.useCallback)(e=>{let n=Ot(e);a?.disconnect(),n&&a?.observe(n),r(n?t(n):null)},[t,a]));return(0,i.useMemo)(()=>({nodeRef:o,rect:n,setRef:s}),[n,o,s])}var At=[{sensor:Ye,options:{}},{sensor:We,options:{}}],jt={current:{}},Mt={draggable:{measure:G},droppable:{measure:G,strategy:ct.WhileDragging,frequency:lt.Optimized},dragOverlay:{measure:W}},Nt=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Pt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Nt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:F},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Mt,measureDroppableContainers:F,windowRect:null,measuringScheduled:!1},Ft={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:F,draggableNodes:new Map,over:null,measureDroppableContainers:F},It=(0,i.createContext)(Ft),Lt=(0,i.createContext)(Pt);function Rt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Nt}}}function zt(e,t){switch(t.type){case P.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case P.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case P.DragEnd:case P.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case P.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Nt(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case P.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Nt(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case P.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Nt(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Bt(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:a}=(0,i.useContext)(It),o=b(r),s=b(n?.id);return(0,i.useEffect)(()=>{if(!t&&!r&&o&&s!=null){if(!D(o)||document.activeElement===o.target)return;let e=a.get(s);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=A(e);if(t){t.focus();break}}})}},[r,t,a,s,o]),null}function Vt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Ht(e){return(0,i.useMemo)(()=>({draggable:{...Mt.draggable,...e?.draggable},droppable:{...Mt.droppable,...e?.droppable},dragOverlay:{...Mt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ut(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e,o=(0,i.useRef)(!1),{x:s,y:c}=typeof a==`boolean`?{x:a,y:a}:a;m(()=>{if(!s&&!c||!t){o.current=!1;return}if(o.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=H(n(e),r);if(s||(i.x=0),c||(i.y=0),o.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=Te(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,s,c,r,n])}var Wt=(0,i.createContext)({...R,scaleX:1,scaleY:1}),$;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})($||={});var Gt=(0,i.memo)(function(e){let{id:t,accessibility:n,autoScroll:a=!0,children:o,sensors:s=At,collisionDetection:c=he,measuring:u,modifiers:d,...f}=e,[p,h]=(0,i.useReducer)(zt,void 0,Rt),[g,v]=oe(),[y,b]=(0,i.useState)($.Uninitialized),x=y===$.Initialized,{draggable:{active:C,nodes:T,translate:E},droppable:{containers:D}}=p,ee=C==null?null:T.get(C),O=(0,i.useRef)({initial:null,translated:null}),k=(0,i.useMemo)(()=>C==null?null:{id:C,data:ee?.data??jt,rect:O},[C,ee]),A=(0,i.useRef)(null),[ne,re]=(0,i.useState)(null),[j,ie]=(0,i.useState)(null),M=_(f,Object.values(f)),se=S(`DndDescribedBy`,t),ce=(0,i.useMemo)(()=>D.getEnabled(),[D]),F=Ht(u),{droppableRects:I,measureDroppableContainers:L,measuringScheduled:R}=dt(ce,{dragging:x,dependencies:[E.x,E.y],config:F.droppable}),z=ot(T,C),le=(0,i.useMemo)(()=>j?te(j):null,[j]),ue=Pe(),de=pt(z,F.draggable.measure);Ut({activeNode:C==null?null:T.get(C),config:ue.layoutShiftCompensation,initialRect:de,measure:F.draggable.measure});let B=_t(z,F.draggable.measure,de),pe=_t(z?z.parentElement:null),V=(0,i.useRef)({activatorEvent:null,active:null,activeNode:z,collisionRect:null,collisions:null,droppableRects:I,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:D,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),me=D.getNodeFor(V.current.over?.id),H=kt({measure:F.dragOverlay.measure}),_e=H.nodeRef.current??z,U=x?H.rect??B:null,ye=!!(H.nodeRef.current&&H.rect),be=vt(ye?null:B),W=Tt(_e?l(_e):null),G=bt(x?me??z:null),xe=Dt(G),Se=Vt(d,{transform:{x:E.x-be.x,y:E.y-be.y,scaleX:1,scaleY:1},activatorEvent:j,active:k,activeNodeRect:B,containerNodeRect:pe,draggingNodeRect:U,over:V.current.over,overlayNodeRect:H.rect,scrollableAncestors:G,scrollableAncestorRects:xe,windowRect:W}),Ce=le?w(le,E):null,we=xt(G),Te=St(we),Ee=St(we,[B]),K=w(Se,Te),q=U?ve(U,Se):null,J=k&&q?c({active:k,collisionRect:q,droppableRects:I,droppableContainers:ce,pointerCoordinates:Ce}):null,Y=fe(J,`id`),[X,De]=(0,i.useState)(null),Oe=ge(ye?Se:w(Se,Ee),X?.rect??null,B),ke=(0,i.useRef)(null),Ae=(0,i.useCallback)((e,t)=>{let{sensor:n,options:i}=t;if(A.current==null)return;let a=T.get(A.current);if(!a)return;let o=e.nativeEvent;ke.current=new n({active:A.current,activeNode:a,event:o,options:i,context:V,onAbort(e){if(!T.get(e))return;let{onDragAbort:t}=M.current,n={id:e};t?.(n),g({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!T.get(e))return;let{onDragPending:i}=M.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),g({type:`onDragPending`,event:a})},onStart(e){let t=A.current;if(t==null)return;let n=T.get(t);if(!n)return;let{onDragStart:i}=M.current,a={activatorEvent:o,active:{id:t,data:n.data,rect:O}};(0,r.unstable_batchedUpdates)(()=>{i?.(a),b($.Initializing),h({type:P.DragStart,initialCoordinates:e,active:t}),g({type:`onDragStart`,event:a}),re(ke.current),ie(o)})},onMove(e){h({type:P.DragMove,coordinates:e})},onEnd:s(P.DragEnd),onCancel:s(P.DragCancel)});function s(e){return async function(){let{active:t,collisions:n,over:i,scrollAdjustedTranslate:a}=V.current,s=null;if(t&&a){let{cancelDrop:r}=M.current;s={activatorEvent:o,active:t,collisions:n,delta:a,over:i},e===P.DragEnd&&typeof r==`function`&&await Promise.resolve(r(s))&&(e=P.DragCancel)}A.current=null,(0,r.unstable_batchedUpdates)(()=>{h({type:e}),b($.Uninitialized),De(null),re(null),ie(null),ke.current=null;let t=e===P.DragEnd?`onDragEnd`:`onDragCancel`;if(s){let e=M.current[t];e?.(s),g({type:t,event:s})}})}}},[T]),je=st(s,(0,i.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=T.get(r);if(A.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},A.current=r,Ae(n,t))},[T,Ae]));Ct(s),m(()=>{B&&y===$.Initializing&&b($.Initialized)},[B,y]),(0,i.useEffect)(()=>{let{onDragMove:e}=M.current,{active:t,activatorEvent:n,collisions:i,over:a}=V.current;if(!t||!n)return;let o={active:t,activatorEvent:n,collisions:i,delta:{x:K.x,y:K.y},over:a};(0,r.unstable_batchedUpdates)(()=>{e?.(o),g({type:`onDragMove`,event:o})})},[K.x,K.y]),(0,i.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:i,scrollAdjustedTranslate:a}=V.current;if(!e||A.current==null||!t||!a)return;let{onDragOver:o}=M.current,s=i.get(Y),c=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,l={active:e,activatorEvent:t,collisions:n,delta:{x:a.x,y:a.y},over:c};(0,r.unstable_batchedUpdates)(()=>{De(c),o?.(l),g({type:`onDragOver`,event:l})})},[Y]),m(()=>{V.current={activatorEvent:j,active:k,activeNode:z,collisionRect:q,collisions:J,droppableRects:I,draggableNodes:T,draggingNode:_e,draggingNodeRect:U,droppableContainers:D,over:X,scrollableAncestors:G,scrollAdjustedTranslate:K},O.current={initial:U,translated:q}},[k,z,J,q,T,_e,U,I,D,X,G,K]),rt({...ue,delta:E,draggingRect:q,pointerCoordinates:Ce,scrollableAncestors:G,scrollableAncestorRects:xe});let Me=(0,i.useMemo)(()=>({active:k,activeNode:z,activeNodeRect:B,activatorEvent:j,collisions:J,containerNodeRect:pe,dragOverlay:H,draggableNodes:T,droppableContainers:D,droppableRects:I,over:X,measureDroppableContainers:L,scrollableAncestors:G,scrollableAncestorRects:xe,measuringConfiguration:F,measuringScheduled:R,windowRect:W}),[k,z,B,j,J,pe,H,T,D,I,X,L,G,xe,F,R,W]),Ne=(0,i.useMemo)(()=>({activatorEvent:j,activators:je,active:k,activeNodeRect:B,ariaDescribedById:{draggable:se},dispatch:h,draggableNodes:T,over:X,measureDroppableContainers:L}),[j,je,k,B,h,se,T,X,L]);return i.createElement(ae.Provider,{value:v},i.createElement(It.Provider,{value:Ne},i.createElement(Lt.Provider,{value:Me},i.createElement(Wt.Provider,{value:Oe},o)),i.createElement(Bt,{disabled:n?.restoreFocus===!1})),i.createElement(N,{...n,hiddenTextDescribedById:se}));function Pe(){let e=ne?.autoScrollEnabled===!1,t=typeof a==`object`?a.enabled===!1:a===!1,n=x&&!e&&!t;return typeof a==`object`?{...a,enabled:n}:{enabled:n}}}),Kt=(0,i.createContext)(null),qt=`button`,Jt=`Draggable`;function Yt(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e,o=S(Jt),{activators:s,activatorEvent:c,active:l,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:p}=(0,i.useContext)(It),{role:h=qt,roleDescription:g=`draggable`,tabIndex:v=0}=a??{},b=l?.id===t,x=(0,i.useContext)(b?Wt:Kt),[C,w]=y(),[T,E]=y(),D=wt(s,t),ee=_(n);return m(()=>(f.set(t,{id:t,key:o,node:C,activatorNode:T,data:ee}),()=>{let e=f.get(t);e&&e.key===o&&f.delete(t)}),[f,t]),{active:l,activatorEvent:c,activeNodeRect:u,attributes:(0,i.useMemo)(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":b&&h===qt?!0:void 0,"aria-roledescription":g,"aria-describedby":d.draggable}),[r,h,v,b,g,d.draggable]),isDragging:b,listeners:r?void 0:D,node:C,over:p,setNodeRef:w,setActivatorNodeRef:E,transform:x}}function Xt(){return(0,i.useContext)(Lt)}var Zt=`Droppable`,Qt={timeout:25};function $t(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e,o=S(Zt),{active:s,dispatch:c,over:l,measureDroppableContainers:u}=(0,i.useContext)(It),d=(0,i.useRef)({disabled:n}),f=(0,i.useRef)(!1),p=(0,i.useRef)(null),m=(0,i.useRef)(null),{disabled:h,updateMeasurementsFor:g,timeout:v}={...Qt,...a},b=_(g??r),x=ht({callback:(0,i.useCallback)(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),m.current=null},v)},[v]),disabled:h||!s}),[C,w]=y((0,i.useCallback)((e,t)=>{x&&(t&&(x.unobserve(t),f.current=!1),e&&x.observe(e))},[x])),T=_(t);return(0,i.useEffect)(()=>{!x||!C.current||(x.disconnect(),f.current=!1,x.observe(C.current))},[C,x]),(0,i.useEffect)(()=>(c({type:P.RegisterDroppable,element:{id:r,key:o,disabled:n,node:C,rect:p,data:T}}),()=>c({type:P.UnregisterDroppable,key:o,id:r})),[r]),(0,i.useEffect)(()=>{n!==d.current.disabled&&(c({type:P.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,c]),{active:s,rect:p,isOver:l?.id===r,node:C,over:l,setNodeRef:w}}function en(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function tn(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function nn(e){return e!==null&&e>=0}function rn(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function an(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var on={scaleX:1,scaleY:1},sn=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=cn(t,a,r);if(a===r){let e=t[i];return e?{x:r<i?e.left+e.width-(o.left+o.width):e.left-o.left,y:0,...on}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...on}:a<r&&a>=i?{x:o.width+s,y:0,...on}:{x:0,y:0,...on}};function cn(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return!r||!i&&!a?0:n<t?i?r.left-(i.left+i.width):a.left-(r.left+r.width):a?a.left-(r.left+r.width):r.left-(i.left+i.width)}var ln=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=en(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},un={scaleX:1,scaleY:1},dn=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...un}:null}let s=fn(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...un}:r<t&&r>=a?{x:0,y:o.height+s,...un}:{x:0,y:0,...un}};function fn(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var pn=`Sortable`,mn=i.createContext({activeIndex:-1,containerId:pn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ln,disabled:{draggable:!1,droppable:!1}});function hn(e){let{children:t,id:n,items:r,strategy:a=ln,disabled:o=!1}=e,{active:s,dragOverlay:c,droppableRects:l,over:u,measureDroppableContainers:d}=Xt(),f=S(pn,n),p=c.rect!==null,h=(0,i.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),g=s!=null,_=s?h.indexOf(s.id):-1,v=u?h.indexOf(u.id):-1,y=(0,i.useRef)(h),b=!rn(h,y.current),x=v!==-1&&_===-1||b,C=an(o);m(()=>{b&&g&&d(h)},[b,h,g,d]),(0,i.useEffect)(()=>{y.current=h},[h]);let w=(0,i.useMemo)(()=>({activeIndex:_,containerId:f,disabled:C,disableTransforms:x,items:h,overIndex:v,useDragOverlay:p,sortedRects:tn(h,l),strategy:a}),[_,f,C.draggable,C.droppable,x,h,v,l,p,a]);return i.createElement(mn.Provider,{value:w},t)}var gn=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return en(n,r,i).indexOf(t)},_n=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},vn={duration:200,easing:`ease`},yn=`transform`,bn=O.Transition.toString({property:yn,duration:0,easing:`linear`}),xn={roleDescription:`sortable`};function Sn(e){let{disabled:t,index:n,node:r,rect:a}=e,[o,s]=(0,i.useState)(null),c=(0,i.useRef)(n);return m(()=>{if(!t&&n!==c.current&&r.current){let e=a.current;if(e){let t=W(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&s(n)}}n!==c.current&&(c.current=n)},[t,n,r,a]),(0,i.useEffect)(()=>{o&&s(null)},[o]),o}function Cn(e){let{animateLayoutChanges:t=_n,attributes:n,disabled:r,data:o,getNewIndex:s=gn,id:c,strategy:l,resizeObserverConfig:u,transition:d=vn}=e,{items:f,containerId:p,activeIndex:m,disabled:h,disableTransforms:g,sortedRects:_,overIndex:v,useDragOverlay:y,strategy:b}=(0,i.useContext)(mn),x=wn(r,h),S=f.indexOf(c),C=(0,i.useMemo)(()=>({sortable:{containerId:p,index:S,items:f},...o}),[p,o,S,f]),w=(0,i.useMemo)(()=>f.slice(f.indexOf(c)),[f,c]),{rect:T,node:E,isOver:ee,setNodeRef:te}=$t({id:c,data:C,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:w,...u}}),{active:k,activatorEvent:A,activeNodeRect:ne,attributes:re,setNodeRef:j,listeners:ie,isDragging:ae,over:M,setActivatorNodeRef:oe,transform:se}=Yt({id:c,data:C,attributes:{...xn,...n},disabled:x.draggable}),ce=a(te,j),N=!!k,P=N&&!g&&nn(m)&&nn(v),F=!y&&ae,I=P?(F&&P?se:null)??(l??b)({rects:_,activeNodeRect:ne,activeIndex:m,overIndex:v,index:S}):null,L=nn(m)&&nn(v)?s({id:c,items:f,activeIndex:m,overIndex:v}):S,R=k?.id,z=(0,i.useRef)({activeId:R,items:f,newIndex:L,containerId:p}),le=f!==z.current.items,ue=t({active:k,containerId:p,isDragging:ae,isSorting:N,id:c,index:S,items:f,newIndex:z.current.newIndex,previousItems:z.current.items,previousContainerId:z.current.containerId,transition:d,wasDragging:z.current.activeId!=null}),de=Sn({disabled:!ue,index:S,node:E,rect:T});return(0,i.useEffect)(()=>{N&&z.current.newIndex!==L&&(z.current.newIndex=L),p!==z.current.containerId&&(z.current.containerId=p),f!==z.current.items&&(z.current.items=f)},[N,L,p,f]),(0,i.useEffect)(()=>{if(R===z.current.activeId)return;if(R!=null&&z.current.activeId==null){z.current.activeId=R;return}let e=setTimeout(()=>{z.current.activeId=R},50);return()=>clearTimeout(e)},[R]),{active:k,activeIndex:m,attributes:re,data:C,rect:T,index:S,newIndex:L,items:f,isOver:ee,isSorting:N,isDragging:ae,listeners:ie,node:E,overIndex:v,over:M,setNodeRef:ce,setActivatorNodeRef:oe,setDroppableNodeRef:te,setDraggableNodeRef:j,transform:de??I,transition:fe()};function fe(){if(de||le&&z.current.newIndex===S)return bn;if(!(F&&!D(A)||!d)&&(N||ue))return O.Transition.toString({...d,property:yn})}}function wn(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function Tn(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var En=[Q.Down,Q.Right,Q.Up,Q.Left],Dn=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(En.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case Q.Down:r.top<a.top&&t.push(n);break;case Q.Up:r.top>a.top&&t.push(n);break;case Q.Left:r.left>a.left&&t.push(n);break;case Q.Right:r.left<a.left&&t.push(n);break}});let c=V({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=fe(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=we(c).some((e,t)=>s[t]!==e),i=On(e,t),a=kn(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:T(u,l)}}}};function On(e,t){return!Tn(e)||!Tn(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function kn(e,t){return!Tn(e)||!Tn(t)||!On(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}export{Cn as a,Q as c,pe as d,Xt as f,O as h,Dn as i,We as l,L as m,en as n,dn as o,I as p,sn as r,Gt as s,hn as t,Ye as u};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./utils-CPqDy6Hr.js";import{h as r,r as i,t as a}from"./agent-visibility-DooA6q6Y.js";import{Pt as o}from"./dist-CLzUuFWF2.js";import{t as s}from"./createLucideIcon-DihYAFEK.js";import{c,d as l,m as u}from"./sortable.esm-DR5PU-kX.js";var d=s(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),f=s(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),p=e(t(),1),m={},h=new Set;function g(){return m}function ee(e){m={...m,...e};for(let e of h)e()}function te(e){return h.add(e),()=>{h.delete(e)}}function _(){return(0,p.useSyncExternalStore)(te,g,g)}var v=null,y=new Set;function b(e,t){return e===null||t===null?e===t:e.id!==t.id||e.kind!==t.kind||e.label!==t.label?!1:e.kind===`thread`&&t.kind===`thread`?e.agentId===t.agentId&&e.iconUrl===t.iconUrl:e.kind===`terminal`&&t.kind===`terminal`?e.cli===t.cli:!1}function x(e){if(!b(v,e)){v=e;for(let e of y)e()}}function S(){return v}function C(e){return y.add(e),()=>{y.delete(e)}}function w(){return(0,p.useSyncExternalStore)(C,S,T)}function T(){return null}var E=`ok-ask-ai-agent-v2`,D=`ok-ask-ai-default-agent-v1`,O=`ok-preferred-agent-v1`,k=`terminal-cli`;function A(e){return`${k}:${e}`}var j=`in-app-thread`;function M(e){return`${j}:${e.source}:${e.id}`}function N(e){if(e===null)return null;if(e===`in-app-thread`)return{kind:`default`};let t=`${j}:`;if(!e.startsWith(t))return null;let n=e.slice(t.length),r=n.indexOf(`:`);if(r<=0)return null;let i=n.slice(0,r),a=n.slice(r+1);return i!==`registry`&&i!==`custom`||a===``?null:{kind:`concrete`,source:i,id:a}}function P(e){return e===null?null:e===`terminal-cli`?`claude`:o.find(t=>e===A(t))??null}function F(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function I(e){let t=F(e);if(!t)return null;try{let e=t.getItem(E);return e===null?t.getItem(D)??t.getItem(O):e}catch{return null}}function L(e,t){let n=F(t);if(n)try{n.setItem(E,e)}catch(e){console.warn(`[ask-ai] Failed to persist default agent:`,e)}for(let e of R)e()}var R=new Set;function z(){return I()}function B(){for(let e of R)e()}typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`storage`,e=>{(e.key===`ok-ask-ai-agent-v2`||e.key===null)&&B()});function V(e){return R.add(e),()=>R.delete(e)}function ne(){return(0,p.useSyncExternalStore)(V,z,z)}function H(e,t){return o.filter(n=>i(e,n,t))}function U(e){return r.filter(t=>a(e,t.id)).map(e=>e.id)}function W(e){let{sticky:t,effectiveThreadAgent:n,enabledClis:r,enabledDesktopTargets:i,installedClis:a,terminalAvailable:o,threadsAvailable:s,desktopSelectable:c,preferBareTerminal:l,bareTerminalFallback:u}=e;if(l&&o)return{kind:`terminal`};if(s&&N(t)!==null&&n!==null)return{kind:`thread`,agent:n};if(o){let e=P(t);if(e!==null&&r.includes(e))return{kind:`cli`,cli:e}}return c&&t!==null&&i.includes(t)?{kind:`desktop`,target:t}:s&&n!==null?{kind:`thread`,agent:n}:o&&r.length>0?{kind:`cli`,cli:r.find(e=>a[e]===!0)??r[0]}:c&&i.length>0?{kind:`desktop`,target:i[0]}:u&&o?{kind:`terminal`}:{kind:`none`}}var G=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50`,K=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,q={start:[c.Space],cancel:[c.Esc],end:[c.Space,c.Enter]};function J(e){return n(G,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function Y(e){return e?void 0:-1}function X({className:e,isDragging:t}){return n(e,t&&K)}function Z(e){return e.code===c.Enter&&e.target===e.currentTarget}function re({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&Z(e)?`activate-tab`:`delegate-sortable`}function ie({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:u.Transform.toString(r?{...r,scaleX:1,scaleY:1}:null),transition:i,flexBasis:a??n?.flexBasis,maxWidth:a??n?.maxWidth,minWidth:a??n?.minWidth,opacity:n?.opacity,width:a??n?.width,zIndex:t?20:n?.zIndex}}function ae(e,t){let n=e?.querySelectorAll(t)??[],r=1/0,i=-1/0;for(let e of n){let t=e.getBoundingClientRect();r=Math.min(r,t.left),i=Math.max(i,t.right)}return Number.isFinite(r)&&Number.isFinite(i)?{left:r,right:i}:null}function oe(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}var se=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return l(e)};function ce(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}var Q=`open-knowledge:new-preferred-session`;function le(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(Q))}function ue(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(Q,n),()=>t.removeEventListener(Q,n)}var $=`open-knowledge:terminal-launch`;function de(e,t,n,r=typeof window>`u`?new EventTarget:window){r.dispatchEvent(new CustomEvent($,{detail:{prompt:e,cli:t,stage:n?.stage===!0}}))}function fe(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.prompt==`string`&&e(n.prompt,n.cli,{stage:n.stage===!0})};return t.addEventListener($,n),()=>t.removeEventListener($,n)}export{d as A,M as C,ee as D,w as E,_ as O,A as S,x as T,W as _,ce as a,P as b,X as c,J as d,Y as f,H as g,U as h,ue as i,f as k,re as l,se as m,fe as n,q as o,ae as p,le as r,oe as s,de as t,ie as u,j as v,ne as w,L as x,I as y};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{t as n}from"./utils-CPqDy6Hr.js";import{h as r,r as i,t as a}from"./agent-visibility-DooA6q6Y.js";import{Pt as o}from"./dist-CLzUuFWF2.js";import{t as s}from"./createLucideIcon-DihYAFEK.js";import{c,d as l,h as u}from"./sortable.esm-lATz1Hrd.js";var d=s(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),f=s(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),p=e(t(),1),m={},h=new Set;function g(){return m}function ee(e){m={...m,...e};for(let e of h)e()}function te(e){return h.add(e),()=>{h.delete(e)}}function _(){return(0,p.useSyncExternalStore)(te,g,g)}var v=null,y=new Set;function b(e,t){return e===null||t===null?e===t:e.id!==t.id||e.kind!==t.kind||e.label!==t.label?!1:e.kind===`thread`&&t.kind===`thread`?e.agentId===t.agentId&&e.iconUrl===t.iconUrl:e.kind===`terminal`&&t.kind===`terminal`?e.cli===t.cli:!1}function x(e){if(!b(v,e)){v=e;for(let e of y)e()}}function S(){return v}function C(e){return y.add(e),()=>{y.delete(e)}}function w(){return(0,p.useSyncExternalStore)(C,S,T)}function T(){return null}var E=`ok-ask-ai-agent-v2`,D=`ok-ask-ai-default-agent-v1`,O=`ok-preferred-agent-v1`,k=`terminal-cli`;function A(e){return`${k}:${e}`}var j=`in-app-thread`;function M(e){return`${j}:${e.source}:${e.id}`}function N(e){if(e===null)return null;if(e===`in-app-thread`)return{kind:`default`};let t=`${j}:`;if(!e.startsWith(t))return null;let n=e.slice(t.length),r=n.indexOf(`:`);if(r<=0)return null;let i=n.slice(0,r),a=n.slice(r+1);return i!==`registry`&&i!==`custom`||a===``?null:{kind:`concrete`,source:i,id:a}}function P(e){return e===null?null:e===`terminal-cli`?`claude`:o.find(t=>e===A(t))??null}function F(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function I(e){let t=F(e);if(!t)return null;try{let e=t.getItem(E);return e===null?t.getItem(D)??t.getItem(O):e}catch{return null}}function L(e,t){let n=F(t);if(n)try{n.setItem(E,e)}catch(e){console.warn(`[ask-ai] Failed to persist default agent:`,e)}for(let e of R)e()}var R=new Set;function z(){return I()}function B(){for(let e of R)e()}typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`storage`,e=>{(e.key===`ok-ask-ai-agent-v2`||e.key===null)&&B()});function V(e){return R.add(e),()=>R.delete(e)}function ne(){return(0,p.useSyncExternalStore)(V,z,z)}function H(e,t){return o.filter(n=>i(e,n,t))}function U(e){return r.filter(t=>a(e,t.id)).map(e=>e.id)}function W(e){let{sticky:t,effectiveThreadAgent:n,enabledClis:r,enabledDesktopTargets:i,installedClis:a,terminalAvailable:o,threadsAvailable:s,desktopSelectable:c,preferBareTerminal:l,bareTerminalFallback:u}=e;if(l&&o)return{kind:`terminal`};if(s&&N(t)!==null&&n!==null)return{kind:`thread`,agent:n};if(o){let e=P(t);if(e!==null&&r.includes(e))return{kind:`cli`,cli:e}}return c&&t!==null&&i.includes(t)?{kind:`desktop`,target:t}:s&&n!==null?{kind:`thread`,agent:n}:o&&r.length>0?{kind:`cli`,cli:r.find(e=>a[e]===!0)??r[0]}:c&&i.length>0?{kind:`desktop`,target:i[0]}:u&&o?{kind:`terminal`}:{kind:`none`}}var G=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50`,K=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,q={start:[c.Space],cancel:[c.Esc],end:[c.Space,c.Enter]};function J(e){return n(G,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function Y(e){return e?void 0:-1}function X({className:e,isDragging:t}){return n(e,t&&K)}function Z(e){return e.code===c.Enter&&e.target===e.currentTarget}function re({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&Z(e)?`activate-tab`:`delegate-sortable`}function ie({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:u.Transform.toString(r?{...r,scaleX:1,scaleY:1}:null),transition:i,flexBasis:a??n?.flexBasis,maxWidth:a??n?.maxWidth,minWidth:a??n?.minWidth,opacity:n?.opacity,width:a??n?.width,zIndex:t?20:n?.zIndex}}function ae(e,t){let n=e?.querySelectorAll(t)??[],r=1/0,i=-1/0;for(let e of n){let t=e.getBoundingClientRect();r=Math.min(r,t.left),i=Math.max(i,t.right)}return Number.isFinite(r)&&Number.isFinite(i)?{left:r,right:i}:null}function oe(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}var se=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return l(e)};function ce(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}var Q=`open-knowledge:new-preferred-session`;function le(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(Q))}function ue(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(Q,n),()=>t.removeEventListener(Q,n)}var $=`open-knowledge:terminal-launch`;function de(e,t,n,r=typeof window>`u`?new EventTarget:window){r.dispatchEvent(new CustomEvent($,{detail:{prompt:e,cli:t,stage:n?.stage===!0}}))}function fe(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.prompt==`string`&&e(n.prompt,n.cli,{stage:n.stage===!0})};return t.addEventListener($,n),()=>t.removeEventListener($,n)}export{d as A,M as C,ee as D,w as E,_ as O,A as S,x as T,W as _,ce as a,P as b,X as c,J as d,Y as f,H as g,U as h,ue as i,f as k,re as l,se as m,fe as n,q as o,ae as p,le as r,oe as s,de as t,ie as u,j as v,ne as w,L as x,I as y};
@@ -70,7 +70,7 @@
70
70
  -->
71
71
  <script>(() => { const isMode = (v) => v === 'light' || v === 'dark' || v === 'system'; const isThemeId = (v) => typeof v === 'string' && /^[a-z0-9-]{1,32}$/.test(v); let pref = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (isMode(r)) pref = r; } catch {} let slots = null; try { const raw = localStorage.getItem('ok-color-theme-pair-v1'); if (raw) { const o = JSON.parse(raw); if (o?.light && o?.dark) { slots = o; if (isMode(o.pref)) pref = o.pref; } } } catch {} let dark = pref === 'dark'; if (pref === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } let ct = null; if (slots) { const slot = dark ? slots.dark : slots.light; if (isThemeId(slot?.id)) { dark = !!slot.dark; if (slot.id !== 'default') ct = slot.id; } } else { try { const c = localStorage.getItem('ok-color-theme-v1'); if (isThemeId(c) && c !== 'default') ct = c; } catch {} } let customCss = null; if (ct === 'custom') { try { const raw = localStorage.getItem('ok-custom-theme-v1'); if (raw) { const o = JSON.parse(raw); if (o?.css) { customCss = o.css; dark = !!o.dark; } } } catch {} if (!customCss) ct = null; } if (dark) document.documentElement.classList.add('dark'); if (ct) document.documentElement.setAttribute('data-color-theme', ct); if (customCss) { const s = document.createElement('style'); s.id = 'ok-custom-theme'; s.textContent = customCss; document.head.appendChild(s); } if (window.okDesktop) { document.documentElement.classList.add('electron-mode'); document.documentElement.classList.add(`electron-platform-${window.okDesktop.platform}`); } })();</script>
72
72
  <style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
73
- <script type="module" crossorigin src="./assets/index-gkgpssO7.js"></script>
73
+ <script type="module" crossorigin src="./assets/index-5hvjqRxk.js"></script>
74
74
  <link rel="modulepreload" crossorigin href="./assets/chunk-CYidjpOJ.js">
75
75
  <link rel="modulepreload" crossorigin href="./assets/dist-CpRBr-Ct.js">
76
76
  <link rel="modulepreload" crossorigin href="./assets/react-f2sANaYj.js">
@@ -97,7 +97,7 @@
97
97
  <link rel="modulepreload" crossorigin href="./assets/dist-DYeLFwEq.js">
98
98
  <link rel="modulepreload" crossorigin href="./assets/dist-PQ5KMVDh.js">
99
99
  <link rel="modulepreload" crossorigin href="./assets/DiffView-by44lBMn.js">
100
- <link rel="modulepreload" crossorigin href="./assets/sortable.esm-DR5PU-kX.js">
100
+ <link rel="modulepreload" crossorigin href="./assets/sortable.esm-lATz1Hrd.js">
101
101
  <link rel="modulepreload" crossorigin href="./assets/floating-ui.dom-C0wusa09.js">
102
102
  <link rel="modulepreload" crossorigin href="./assets/trace-api-DzbWkWNJ.js">
103
103
  <link rel="modulepreload" crossorigin href="./assets/lib-oSGqv0ZH.js">
@@ -177,7 +177,7 @@
177
177
  <link rel="modulepreload" crossorigin href="./assets/lint-config-client-5M2PwjWj.js">
178
178
  <link rel="modulepreload" crossorigin href="./assets/selection-context-e4f29ln_.js">
179
179
  <link rel="modulepreload" crossorigin href="./assets/use-skills-DrxE5iKU.js">
180
- <link rel="modulepreload" crossorigin href="./assets/ManagedArtifactProperties-BKmB2Biq.js">
180
+ <link rel="modulepreload" crossorigin href="./assets/ManagedArtifactProperties-olm0bTI0.js">
181
181
  <link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-wfbNMORg.js">
182
182
  <link rel="modulepreload" crossorigin href="./assets/cursor-W0skD8YU.js">
183
183
  <link rel="modulepreload" crossorigin href="./assets/RegisteredAgentIcon-MOyQ-5gc.js">
@@ -189,7 +189,7 @@
189
189
  <link rel="modulepreload" crossorigin href="./assets/use-open-skill-CItHgrjr.js">
190
190
  <link rel="modulepreload" crossorigin href="./assets/use-settings-route-DzedD2vL.js">
191
191
  <link rel="modulepreload" crossorigin href="./assets/clipboard-adapter-DPkNOslT.js">
192
- <link rel="modulepreload" crossorigin href="./assets/skill-actions-BRtvvjCU.js">
192
+ <link rel="modulepreload" crossorigin href="./assets/skill-actions-BFg9EzmY.js">
193
193
  <link rel="modulepreload" crossorigin href="./assets/arrow-up-right-CxtRAecj.js">
194
194
  <link rel="modulepreload" crossorigin href="./assets/case-sensitive-DjnVZ1Bg.js">
195
195
  <link rel="modulepreload" crossorigin href="./assets/chevron-left-B-obKYha.js">
@@ -204,7 +204,7 @@
204
204
  <link rel="modulepreload" crossorigin href="./assets/auth-state-cache-UtyGZJkf.js">
205
205
  <link rel="modulepreload" crossorigin href="./assets/miss-dialog-store-BGDBpPYJ.js">
206
206
  <link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-Biw1Epvx.js">
207
- <link rel="modulepreload" crossorigin href="./assets/terminal-launch-events-BBXOhZSh.js">
207
+ <link rel="modulepreload" crossorigin href="./assets/terminal-launch-events-D3RRaYEw.js">
208
208
  <link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-CD2IVH49.js">
209
209
  <link rel="modulepreload" crossorigin href="./assets/use-skill-directory-zc2nSEYt.js">
210
210
  <link rel="modulepreload" crossorigin href="./assets/panel-right-open-DuqyjMS8.js">
@@ -1,2 +1,2 @@
1
- import{t as e}from"./launch-json-removal--78GOuKl.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`||o.kind===`removed-file`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
2
- //# sourceMappingURL=repair-launch-json-DXxrE4q1.mjs.map
1
+ import{t as e}from"./launch-json-removal-BfBphAFi.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`||o.kind===`removed-file`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
2
+ //# sourceMappingURL=repair-launch-json-CJpyPmD0.mjs.map
@@ -1,2 +1,2 @@
1
- import{b as e,d as t,l as n}from"./write-project-skill-DpGXCFNK.mjs";import{d as r,v as i}from"./init-BqXcwHZr.mjs";import{t as a}from"./mcp-migrate-event-CWx0WLdE.mjs";import{homedir as o}from"node:os";function s(e){let r=e.logger??u,i=e.home??o(),a=[];if(e.reclaimDisableEnv===`1`)return r({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of n){let n=t[o],s=c(()=>n.configPath(``,i));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:n,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),n.projectConfigPath){let t=n.projectConfigPath,i=c(()=>t(e.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:n,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:r}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(t){let n={scope:t.scope,editorId:t.editorId,configPath:t.configPath},o=r(t.target,t.cwd,t.home,t.configPathOverride);if(o===null)return{...n,outcome:`no-entry`};if(e(o))return{...n,outcome:`canonical`};t.logger(a({scope:t.scope,surface:`cli-repair`,editorId:t.editorId,configPath:t.configPath,priorEntry:o}));let s=i(t.target,t.cwd,{mode:`published`,skipAvailabilityCheck:!0},t.home,t.configPathOverride);if(s.action===`failed`){let e=s.error??`unknown write failure`;return t.logger({event:`mcp-config-repair-write-failed`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,error:e}),{...n,outcome:`write-failed`,error:e}}return s.action===`declined`?(t.logger({event:`mcp-config-repair-declined`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:s.declineReason}),{...n,outcome:`declined`}):{...n,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
2
- //# sourceMappingURL=repair-mcp-configs-CJYHrV-m.mjs.map
1
+ import{b as e,d as t,l as n}from"./write-project-skill-DpGXCFNK.mjs";import{d as r,v as i}from"./init-BAn_74tu.mjs";import{t as a}from"./mcp-migrate-event-CWx0WLdE.mjs";import{homedir as o}from"node:os";function s(e){let r=e.logger??u,i=e.home??o(),a=[];if(e.reclaimDisableEnv===`1`)return r({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of n){let n=t[o],s=c(()=>n.configPath(``,i));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:n,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),n.projectConfigPath){let t=n.projectConfigPath,i=c(()=>t(e.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:n,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:r}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(t){let n={scope:t.scope,editorId:t.editorId,configPath:t.configPath},o=r(t.target,t.cwd,t.home,t.configPathOverride);if(o===null)return{...n,outcome:`no-entry`};if(e(o))return{...n,outcome:`canonical`};t.logger(a({scope:t.scope,surface:`cli-repair`,editorId:t.editorId,configPath:t.configPath,priorEntry:o}));let s=i(t.target,t.cwd,{mode:`published`,skipAvailabilityCheck:!0},t.home,t.configPathOverride);if(s.action===`failed`){let e=s.error??`unknown write failure`;return t.logger({event:`mcp-config-repair-write-failed`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,error:e}),{...n,outcome:`write-failed`,error:e}}return s.action===`declined`?(t.logger({event:`mcp-config-repair-declined`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:s.declineReason}),{...n,outcome:`declined`}):{...n,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
2
+ //# sourceMappingURL=repair-mcp-configs-CWnhMNts.mjs.map