@inkeep/open-knowledge 0.4.0-beta.23 → 0.4.0-beta.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/THIRD_PARTY_NOTICES.md +5 -5
- package/dist/assets/skills/open-knowledge/SKILL.md +1 -1
- package/dist/cli.mjs +38 -37
- package/dist/constants-Dlyng5m6.mjs +2 -0
- package/dist/{dist-IguRFGXq.mjs → dist-Cl_t5NRm.mjs} +14 -14
- package/dist/dist-DVNDjpnz.mjs +1 -0
- package/dist/{dist-DSb6dRAy.mjs → dist-JNaknvi7.mjs} +7 -7
- package/dist/index.mjs +1 -1
- package/dist/init-BKrp4NZQ.mjs +1 -0
- package/dist/{init-ngbjAPEx.mjs → init-uWmRmgCA.mjs} +4 -4
- package/dist/loader-DqxqwNEe.mjs +1 -0
- package/dist/loader-hjhxvSRP.mjs +4 -0
- package/dist/preview-CpmoA4SU.mjs +1 -0
- package/dist/{preview-g-B-YX9w.mjs → preview-vq_EvsiP.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-DXTQGJYg.js → ActivityModeContent-C-OqZ3Ro.js} +1 -1
- package/dist/public/assets/{ConsentDialogBody-BPEdQGkb.js → ConsentDialogBody-Ch5CwNgh.js} +1 -1
- package/dist/public/assets/DocumentContext-Ccj8qLzP.js +37 -0
- package/dist/public/assets/{GraphPanel-Bpz5FkWv.js → GraphPanel-BKsp7Crh.js} +2 -2
- package/dist/public/assets/{McpConsentDialogBody-bOHJX0J3.js → McpConsentDialogBody-8EQrQlPS.js} +1 -1
- package/dist/public/assets/OutlinePanel-DP5j1Wq1.js +2 -0
- package/dist/public/assets/SettingsDialog-C9FPnh00.js +11 -0
- package/dist/public/assets/{SourceEditor-BX2bkk3k.js → SourceEditor-mNodigv_.js} +2 -2
- package/dist/public/assets/{agent-presence-Ds2n3U5P.js → agent-presence-BrTlNKmt.js} +1 -1
- package/dist/public/assets/{checkbox-DRtAIYeh.js → checkbox-DBLbPikY.js} +1 -1
- package/dist/public/assets/config-validation-events-BJEehccy.js +10 -0
- package/dist/public/assets/{dialog-CKgDyF3E.js → dialog-BFN-ujuF.js} +1 -1
- package/dist/public/assets/{dist-ClFYZdbN.js → dist-Bej94Urx.js} +1 -1
- package/dist/public/assets/{dist-1cEl720w.js → dist-Cg-Qaqw_.js} +1 -1
- package/dist/public/assets/{dist-Dy1vgWd7.js → dist-OTL8-1C2.js} +1 -1
- package/dist/public/assets/{doc-hash-Bch8gJGz.js → doc-hash-C9Z2AnUu.js} +99 -99
- package/dist/public/assets/index-BDj01myg.js +1853 -0
- package/dist/public/assets/index-BzPHdvNz.css +1 -0
- package/dist/public/assets/{input-CK6fFyb4.js → input-BOmkuBId.js} +1 -1
- package/dist/public/assets/{label-DsL9nuZ1.js → label-Dv_9VZWz.js} +1 -1
- package/dist/public/assets/{panel-BgMqDESF.js → panel-8fydlQgn.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-7oKUkgn7.js → target-navigation-intent-FPPCIJIk.js} +1 -1
- package/dist/public/assets/{textarea-DeHOTn8t.js → textarea-57j4gLcZ.js} +1 -1
- package/dist/public/assets/{toggle-group-B9AHQBy6.js → toggle-group-CP96D5oH.js} +1 -1
- package/dist/public/assets/{tooltip-CONp_Pmy.js → tooltip-qQkwljHf.js} +1 -1
- package/dist/public/index.html +20 -20
- package/dist/{src-BlDqmpar.mjs → src-jO7GzWRA.mjs} +2 -2
- package/dist/{start-CzXb9OWd.mjs → start-BnicFP1K.mjs} +2 -2
- package/dist/start-CNyWXmFb.mjs +1 -0
- package/package.json +1 -1
- package/dist/constants-D-Kk6PDS.mjs +0 -2
- package/dist/dist-BT7_1SJl.mjs +0 -1
- package/dist/init-DsKniKF7.mjs +0 -1
- package/dist/loader-BKJCUkvm.mjs +0 -1
- package/dist/loader-CJa2PwIk.mjs +0 -4
- package/dist/preview-CFScUs-A.mjs +0 -1
- package/dist/public/assets/DocumentContext-CKzRBTvD.js +0 -37
- package/dist/public/assets/OutlinePanel-l_cN_l_u.js +0 -2
- package/dist/public/assets/SettingsDialog-CAOM5xyh.js +0 -11
- package/dist/public/assets/config-validation-events-C-i-gTpF.js +0 -10
- package/dist/public/assets/index-Cit-_pfo.js +0 -1853
- package/dist/public/assets/index-rvXPVXkP.css +0 -1
- package/dist/start-Cjd_Q-tt.mjs +0 -1
- /package/dist/public/assets/{button-BsFpqlpT.js → button-C1nwPVFQ.js} +0 -0
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{$ as i,C as a,Fr as o,Gt as s,I as c,In as l,L as u,Nr as d,Q as f,S as p,T as m,Ut as h,b as g,et as _,p as v,tt as y,w as b,x,yn as S}from"./doc-hash-Bch8gJGz.js";import{C,S as w,a as T,b as E,c as D,f as O,g as k,h as A,l as j,m as M,o as N,r as P,s as F,t as I,u as L,v as ee,w as te,x as R}from"./button-BsFpqlpT.js";import{$ as ne,It as z,Wt as re,an as B,n as ie,yt as V}from"./DocumentContext-CKzRBTvD.js";import{n as ae,t as oe}from"./dist-ClFYZdbN.js";import{c as se,d as ce,l as le,m as ue,p as de,u as fe}from"./dist-Dy1vgWd7.js";import{t as pe}from"./dist-1cEl720w.js";import{a as me,i as he,r as ge}from"./toggle-group-B9AHQBy6.js";import{t as _e}from"./label-DsL9nuZ1.js";import{a as ve,c as H,i as ye,n as be,o as xe,r as Se,s as Ce,t as we}from"./dialog-CKgDyF3E.js";import{t as Te}from"./input-CK6fFyb4.js";import{t as Ee}from"./textarea-DeHOTn8t.js";var De=C(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Oe=C(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),ke=C(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Ae=C(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),je=C(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Me=C(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),Ne=C(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),U=r(),W=e(t(),1);function Pe(){let e=(0,U.c)(4),[t,n]=(0,W.useState)(null),r=(0,W.useRef)(!1),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=typeof window<`u`?window.okDesktop:void 0;if(!e)return;let t=e.onChannelChanged(e=>{let{channel:t}=e;r.current=!0,n(t)});return e.state.query().then(e=>{r.current||n(e.channel)}).catch(Ie),t},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,W.useEffect)(i,a);let o;return e[2]===t?o=e[3]:(o={channel:t,setChannel:Fe},e[2]=t,e[3]=o),o}async function Fe(e){let t=typeof window<`u`?window.okDesktop:void 0;if(!t)throw Error(`useUpdateChannel.setChannel called without desktop bridge`);await t.update.setChannel(e)}function Ie(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}var G=n(),Le=e(te());function Re(e,t){let n=window.okDesktop?.shell?.openExternal;n&&(e.preventDefault(),n(t))}var ze=[`Enter`,` `],Be=[`ArrowDown`,`PageUp`,`Home`],Ve=[`ArrowUp`,`PageDown`,`End`],He=[...Be,...Ve],Ue={ltr:[...ze,`ArrowRight`],rtl:[...ze,`ArrowLeft`]},We={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Ge=`Menu`,[Ke,qe,Je]=u(Ge),[Ye,Xe]=M(Ge,[Je,m,me]),Ze=m(),Qe=me(),[$e,et]=Ye(Ge),[tt,nt]=Ye(Ge),rt=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Ze(t),[l,u]=W.useState(null),d=W.useRef(!1),f=F(a),p=c(i);return W.useEffect(()=>{let e=()=>{d.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>d.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,G.jsx)(b,{...s,children:(0,G.jsx)($e,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:u,children:(0,G.jsx)(tt,{scope:t,onClose:W.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:p,modal:o,children:r})})})};rt.displayName=Ge;var it=`MenuAnchor`,at=W.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Ze(n);return(0,G.jsx)(x,{...i,...r,ref:t})});at.displayName=it;var ot=`MenuPortal`,[st,ct]=Ye(ot,{forceMount:void 0}),lt=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=et(ot,t);return(0,G.jsx)(st,{scope:t,forceMount:n,children:(0,G.jsx)(j,{present:n||a.open,children:(0,G.jsx)(T,{asChild:!0,container:i,children:r})})})};lt.displayName=ot;var K=`MenuContent`,[ut,dt]=Ye(K),ft=W.forwardRef((e,t)=>{let n=ct(K,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=et(K,e.__scopeMenu),o=nt(K,e.__scopeMenu);return(0,G.jsx)(Ke.Provider,{scope:e.__scopeMenu,children:(0,G.jsx)(j,{present:r||a.open,children:(0,G.jsx)(Ke.Slot,{scope:e.__scopeMenu,children:o.modal?(0,G.jsx)(pt,{...i,ref:t}):(0,G.jsx)(mt,{...i,ref:t})})})})}),pt=W.forwardRef((e,t)=>{let n=et(K,e.__scopeMenu),r=W.useRef(null),i=R(t,r);return W.useEffect(()=>{let e=r.current;if(e)return se(e)},[]),(0,G.jsx)(gt,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:O(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),mt=W.forwardRef((e,t)=>{let n=et(K,e.__scopeMenu);return(0,G.jsx)(gt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ht=ee(`MenuContent.ScrollLock`),gt=W.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:m,disableOutsideScroll:h,...g}=e,_=et(K,n),v=nt(K,n),y=Ze(n),b=Qe(n),x=qe(n),[S,C]=W.useState(null),w=W.useRef(null),T=R(t,w,_.onContentChange),E=W.useRef(0),D=W.useRef(``),k=W.useRef(0),A=W.useRef(null),j=W.useRef(`right`),M=W.useRef(0),P=h?le:W.Fragment,F=h?{as:ht,allowPinchZoom:!0}:void 0,I=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=en(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};W.useEffect(()=>()=>window.clearTimeout(E.current),[]),fe();let L=W.useCallback(e=>j.current===A.current?.side&&nn(e,A.current?.area),[]);return(0,G.jsx)(ut,{scope:n,searchRef:D,onItemEnter:W.useCallback(e=>{L(e)&&e.preventDefault()},[L]),onItemLeave:W.useCallback(e=>{L(e)||(w.current?.focus(),C(null))},[L]),onTriggerLeave:W.useCallback(e=>{L(e)&&e.preventDefault()},[L]),pointerGraceTimerRef:k,onPointerGraceIntentChange:W.useCallback(e=>{A.current=e},[]),children:(0,G.jsx)(P,{...F,children:(0,G.jsx)(ce,{asChild:!0,trapped:i,onMountAutoFocus:O(o,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,G.jsx)(N,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:p,onDismiss:m,children:(0,G.jsx)(he,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:O(l,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,G.jsx)(a,{role:`menu`,"aria-orientation":`vertical`,"data-state":Yt(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:T,style:{outline:`none`,...g.style},onKeyDown:O(g.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&I(e.key));let i=w.current;if(e.target!==i||!He.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Ve.includes(e.key)&&a.reverse(),Qt(a)}),onBlur:O(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:O(e.onPointerMove,rn(e=>{let t=e.target,n=M.current!==e.clientX;e.currentTarget.contains(t)&&n&&(j.current=e.clientX>M.current?`right`:`left`,M.current=e.clientX)}))})})})})})})});ft.displayName=K;var _t=`MenuGroup`,vt=W.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,G.jsx)(A.div,{role:`group`,...r,ref:t})});vt.displayName=_t;var yt=`MenuLabel`,bt=W.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,G.jsx)(A.div,{...r,ref:t})});bt.displayName=yt;var xt=`MenuItem`,St=`menu.itemSelect`,Ct=W.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=W.useRef(null),o=nt(xt,e.__scopeMenu),s=dt(xt,e.__scopeMenu),c=R(t,a),l=W.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(St,{bubbles:!0,cancelable:!0});e.addEventListener(St,e=>r?.(e),{once:!0}),k(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,G.jsx)(wt,{...i,ref:c,disabled:n,onClick:O(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:O(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:O(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||ze.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Ct.displayName=xt;var wt=W.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=dt(xt,n),s=Qe(n),c=W.useRef(null),l=R(t,c),[u,d]=W.useState(!1),[f,p]=W.useState(``);return W.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,G.jsx)(Ke.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,G.jsx)(ge,{asChild:!0,...s,focusable:!r,children:(0,G.jsx)(A.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:O(e.onPointerMove,rn(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:O(e.onPointerLeave,rn(e=>o.onItemLeave(e))),onFocus:O(e.onFocus,()=>d(!0)),onBlur:O(e.onBlur,()=>d(!1))})})})}),Tt=`MenuCheckboxItem`,Et=W.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,G.jsx)(Pt,{scope:e.__scopeMenu,checked:n,children:(0,G.jsx)(Ct,{role:`menuitemcheckbox`,"aria-checked":Xt(n)?`mixed`:n,...i,ref:t,"data-state":Zt(n),onSelect:O(i.onSelect,()=>r?.(Xt(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Et.displayName=Tt;var Dt=`MenuRadioGroup`,[Ot,kt]=Ye(Dt,{value:void 0,onValueChange:()=>{}}),At=W.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=F(r);return(0,G.jsx)(Ot,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,G.jsx)(vt,{...i,ref:t})})});At.displayName=Dt;var jt=`MenuRadioItem`,Mt=W.forwardRef((e,t)=>{let{value:n,...r}=e,i=kt(jt,e.__scopeMenu),a=n===i.value;return(0,G.jsx)(Pt,{scope:e.__scopeMenu,checked:a,children:(0,G.jsx)(Ct,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Zt(a),onSelect:O(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Mt.displayName=jt;var Nt=`MenuItemIndicator`,[Pt,Ft]=Ye(Nt,{checked:!1}),It=W.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Ft(Nt,n);return(0,G.jsx)(j,{present:r||Xt(a.checked)||a.checked===!0,children:(0,G.jsx)(A.span,{...i,ref:t,"data-state":Zt(a.checked)})})});It.displayName=Nt;var Lt=`MenuSeparator`,Rt=W.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,G.jsx)(A.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Rt.displayName=Lt;var zt=`MenuArrow`,Bt=W.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Ze(n);return(0,G.jsx)(p,{...i,...r,ref:t})});Bt.displayName=zt;var Vt=`MenuSub`,[Ht,Ut]=Ye(Vt),Wt=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=et(Vt,t),o=Ze(t),[s,c]=W.useState(null),[l,u]=W.useState(null),d=F(i);return W.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,G.jsx)(b,{...o,children:(0,G.jsx)($e,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,G.jsx)(Ht,{scope:t,contentId:D(),triggerId:D(),trigger:s,onTriggerChange:c,children:n})})})};Wt.displayName=Vt;var Gt=`MenuSubTrigger`,Kt=W.forwardRef((e,t)=>{let n=et(Gt,e.__scopeMenu),r=nt(Gt,e.__scopeMenu),i=Ut(Gt,e.__scopeMenu),a=dt(Gt,e.__scopeMenu),o=W.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=W.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return W.useEffect(()=>u,[u]),W.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,G.jsx)(at,{asChild:!0,...l,children:(0,G.jsx)(wt,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Yt(n.open),...e,ref:E(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:O(e.onPointerMove,rn(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:O(e.onPointerLeave,rn(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:O(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Ue[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Kt.displayName=Gt;var qt=`MenuSubContent`,Jt=W.forwardRef((e,t)=>{let n=ct(K,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=et(K,e.__scopeMenu),o=nt(K,e.__scopeMenu),s=Ut(qt,e.__scopeMenu),c=W.useRef(null),l=R(t,c);return(0,G.jsx)(Ke.Provider,{scope:e.__scopeMenu,children:(0,G.jsx)(j,{present:r||a.open,children:(0,G.jsx)(Ke.Slot,{scope:e.__scopeMenu,children:(0,G.jsx)(gt,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:O(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:O(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:O(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=We[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Jt.displayName=qt;function Yt(e){return e?`open`:`closed`}function Xt(e){return e===`indeterminate`}function Zt(e){return Xt(e)?`indeterminate`:e?`checked`:`unchecked`}function Qt(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function $t(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function en(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=$t(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function tn(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function nn(e,t){return t?tn({x:e.clientX,y:e.clientY},t):!1}function rn(e){return t=>t.pointerType===`mouse`?e(t):void 0}var an=rt,on=at,sn=lt,cn=ft,ln=vt,un=bt,dn=Ct,fn=Et,pn=At,mn=Mt,hn=It,gn=Rt,_n=Bt,vn=Wt,yn=Kt,bn=Jt,xn=`DropdownMenu`,[Sn,Cn]=M(xn,[Xe]),q=Xe(),[wn,Tn]=Sn(xn),En=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=q(t),l=W.useRef(null),[u,d]=L({prop:i,defaultProp:a??!1,onChange:o,caller:xn});return(0,G.jsx)(wn,{scope:t,triggerId:D(),triggerRef:l,contentId:D(),open:u,onOpenChange:d,onOpenToggle:W.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,G.jsx)(an,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};En.displayName=xn;var Dn=`DropdownMenuTrigger`,On=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Tn(Dn,n),o=q(n);return(0,G.jsx)(on,{asChild:!0,...o,children:(0,G.jsx)(A.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:E(t,a.triggerRef),onPointerDown:O(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:O(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});On.displayName=Dn;var kn=`DropdownMenuPortal`,An=e=>{let{__scopeDropdownMenu:t,...n}=e,r=q(t);return(0,G.jsx)(sn,{...r,...n})};An.displayName=kn;var jn=`DropdownMenuContent`,Mn=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Tn(jn,n),a=q(n),o=W.useRef(!1);return(0,G.jsx)(cn,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:O(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:O(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Mn.displayName=jn;var Nn=`DropdownMenuGroup`,Pn=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=q(n);return(0,G.jsx)(ln,{...i,...r,ref:t})});Pn.displayName=Nn;var Fn=`DropdownMenuLabel`,In=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=q(n);return(0,G.jsx)(un,{...i,...r,ref:t})});In.displayName=Fn;var Ln=`DropdownMenuItem`,Rn=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=q(n);return(0,G.jsx)(dn,{...i,...r,ref:t})});Rn.displayName=Ln;var zn=`DropdownMenuCheckboxItem`,Bn=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=q(n);return(0,G.jsx)(fn,{...i,...r,ref:t})});Bn.displayName=zn;var Vn=`DropdownMenuRadioGroup`,Hn=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=q(n);return(0,G.jsx)(pn,{...i,...r,ref:t})});Hn.displayName=Vn;var Un=`DropdownMenuRadioItem`,Wn=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=q(n);return(0,G.jsx)(mn,{...i,...r,ref:t})});Wn.displayName=Un;var Gn=`DropdownMenuItemIndicator`,Kn=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=q(n);return(0,G.jsx)(hn,{...i,...r,ref:t})});Kn.displayName=Gn;var qn=`DropdownMenuSeparator`,Jn=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=q(n);return(0,G.jsx)(gn,{...i,...r,ref:t})});Jn.displayName=qn;var Yn=`DropdownMenuArrow`,Xn=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=q(n);return(0,G.jsx)(_n,{...i,...r,ref:t})});Xn.displayName=Yn;var Zn=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=q(t),[s,c]=L({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,G.jsx)(vn,{...o,open:s,onOpenChange:c,children:n})},Qn=`DropdownMenuSubTrigger`,$n=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=q(n);return(0,G.jsx)(yn,{...i,...r,ref:t})});$n.displayName=Qn;var er=`DropdownMenuSubContent`,tr=W.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=q(n);return(0,G.jsx)(bn,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});tr.displayName=er;var nr=En,rr=On,ir=An,ar=Mn,or=In,sr=Rn,cr=Hn,lr=Wn,ur=Kn,dr=Jn,fr=Zn,pr=$n,mr=tr,hr=`Radio`,[gr,_r]=M(hr),[vr,yr]=gr(hr),br=W.forwardRef((e,t)=>{let{__scopeRadio:n,name:r,checked:i=!1,required:a,disabled:o,value:s=`on`,onCheck:c,form:l,...u}=e,[d,f]=W.useState(null),p=R(t,e=>f(e)),m=W.useRef(!1),h=d?l||!!d.closest(`form`):!0;return(0,G.jsxs)(vr,{scope:n,checked:i,disabled:o,children:[(0,G.jsx)(A.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Tr(i),"data-disabled":o?``:void 0,disabled:o,value:s,...u,ref:p,onClick:O(e.onClick,e=>{i||c?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})}),h&&(0,G.jsx)(wr,{control:d,bubbles:!m.current,name:r,value:s,checked:i,required:a,disabled:o,form:l,style:{transform:`translateX(-100%)`}})]})});br.displayName=hr;var xr=`RadioIndicator`,Sr=W.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=yr(xr,n);return(0,G.jsx)(j,{present:r||a.checked,children:(0,G.jsx)(A.span,{"data-state":Tr(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});Sr.displayName=xr;var Cr=`RadioBubbleInput`,wr=W.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=W.useRef(null),s=R(o,a),c=oe(n),l=pe(t);return W.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,G.jsx)(A.input,{type:`radio`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});wr.displayName=Cr;function Tr(e){return e?`checked`:`unchecked`}var Er=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Dr=`RadioGroup`,[Or,kr]=M(Dr,[me,_r]),Ar=me(),jr=_r(),[Mr,Nr]=Or(Dr),Pr=W.forwardRef((e,t)=>{let{__scopeRadioGroup:n,name:r,defaultValue:i,value:a,required:o=!1,disabled:s=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...p}=e,m=Ar(n),h=c(u),[g,_]=L({prop:a,defaultProp:i??null,onChange:f,caller:Dr});return(0,G.jsx)(Mr,{scope:n,name:r,required:o,disabled:s,value:g,onValueChange:_,children:(0,G.jsx)(he,{asChild:!0,...m,orientation:l,dir:h,loop:d,children:(0,G.jsx)(A.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":l,"data-disabled":s?``:void 0,dir:h,...p,ref:t})})})});Pr.displayName=Dr;var Fr=`RadioGroupItem`,Ir=W.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...i}=e,a=Nr(Fr,n),o=a.disabled||r,s=Ar(n),c=jr(n),l=W.useRef(null),u=R(t,l),d=a.value===i.value,f=W.useRef(!1);return W.useEffect(()=>{let e=e=>{Er.includes(e.key)&&(f.current=!0)},t=()=>f.current=!1;return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,G.jsx)(ge,{asChild:!0,...s,focusable:!o,active:d,children:(0,G.jsx)(br,{disabled:o,required:a.required,checked:d,...c,...i,name:a.name,ref:u,onCheck:()=>a.onValueChange(i.value),onKeyDown:O(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:O(i.onFocus,()=>{f.current&&l.current?.click()})})})});Ir.displayName=Fr;var Lr=`RadioGroupIndicator`,Rr=W.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,G.jsx)(Sr,{...jr(n),...r,ref:t})});Rr.displayName=Lr;var zr=Pr,Br=Ir,Vr=Rr,Hr=`Separator`,Ur=`horizontal`,Wr=[`horizontal`,`vertical`],Gr=W.forwardRef((e,t)=>{let{decorative:n,orientation:r=Ur,...i}=e,a=Kr(r)?r:Ur,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,G.jsx)(A.div,{"data-orientation":a,...o,...i,ref:t})});Gr.displayName=Hr;function Kr(e){return Wr.includes(e)}var qr=Gr;function Jr(e){let t=(0,U.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=P(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`skeleton`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Yr(e){let t=(0,U.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=P(`grid w-full gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(zr,{"data-slot":`radio-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Xr(e){let t=(0,U.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=P(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsx)(Vr,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,G.jsx)(Br,{"data-slot":`radio-group-item`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function Zr(e){let t=(0,U.c)(9),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,W.useState)(n),[a,o]=(0,W.useState)(0),s;t[1]===e?s=t[2]:(s=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then($r).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:`Server returned an incomplete folder response.`});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null,frontmatterSources:e.frontmatter_sources??{}}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[1]=e,t[2]=s);let c;t[3]!==e||t[4]!==a?(c=[e,a],t[3]=e,t[4]=a,t[5]=c):c=t[5],(0,W.useEffect)(s,c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(Qr),t[6]=l):l=t[6];let u;return t[7]===r?u=t[8]:(u={state:r,refresh:l},t[7]=r,t[8]=u),u}function Qr(e){return e+1}async function $r(e){if(!e.ok){let t=await e.json().catch(ei);throw Error(g(t)??`HTTP ${e.status}`)}return e.json()}function ei(){return null}function ti(e,t,n){let r=(0,U.c)(6),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={status:`idle`},r[0]=i):i=r[0];let[a,o]=(0,W.useState)(i),s,c;return r[1]!==e||r[2]!==t||r[3]!==n?(s=()=>{if(!t){o({status:`idle`});return}if(n!==`user`&&e===null){o({status:`idle`});return}let r=!1;o({status:`loading`});let i=`?folder=${encodeURIComponent(n===`user`?``:e??``)}&name=${encodeURIComponent(t)}`;return n!==void 0&&(i+=`&target=${encodeURIComponent(n)}`),fetch(`/api/template${i}`).then(ni).then(e=>{if(!r){if(!e||typeof e!=`object`||!e.template){o({status:`error`,message:`Server returned an incomplete template response.`});return}o({status:`ready`,data:e.template})}}).catch(e=>{r||o({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{r=!0}},c=[e,t,n],r[1]=e,r[2]=t,r[3]=n,r[4]=s,r[5]=c):(s=r[4],c=r[5]),(0,W.useEffect)(s,c),a}async function ni(e){if(!e.ok){let t=await e.json().catch(ri);throw Error(g(t)??`HTTP ${e.status}`)}return e.json()}function ri(){return null}async function ii(){try{let e=await fetch(`/api/sync/status`);return e.ok?{status:await e.json()}:{status:null,error:`server`}}catch{return{status:null,error:`network`}}}function ai(){return oi().status}function oi(){let e=(0,U.c)(8),[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(){ii().then(e=>{let{status:t,error:r}=e;i(r??null),t&&n(t)})},e[0]=a):a=e[0];let o=a,s,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o()},c=[],e[1]=s,e[2]=c):(s=e[1],c=e[2]),(0,W.useEffect)(s,c);let l,u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>v(e=>{e.includes(`sync-status`)&&o()}),u=[],e[3]=l,e[4]=u):(l=e[3],u=e[4]),(0,W.useEffect)(l,u);let d;return e[5]!==r||e[6]!==t?(d={status:t,fetchError:r},e[5]=r,e[6]=t,e[7]=d):d=e[7],d}var si=(0,W.createContext)(null);function ci(e,t,n){let r=new V,i=new ne({url:e,name:t,document:r}),a=h(i,n);return{binding:a,config:a.current(),cleanup:()=>{a.dispose(),i.destroy(),r.destroy()}}}function li(e){let t=new V,n=new ne({url:e,name:f,document:t}),r=s(n);return{binding:r,provider:n,cleanup:()=>{r.dispose(),n.destroy(),t.destroy()}}}function ui(e){let t=(0,U.c)(25),{children:n}=e,{collabUrl:r}=ie(),[a,s]=(0,W.useState)(null),[c,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(null),[p,m]=(0,W.useState)(null),h,g;t[0]===r?(h=t[1],g=t[2]):(h=()=>{if(r===null)return;let e=ci(r,y,`user`),t=ci(r,i,`project`),n=ci(r,_,`project-local`),a=li(r);s({binding:e.binding,config:e.config}),u({binding:t.binding,config:t.config}),f({binding:n.binding,config:n.config,synced:n.binding.hasSynced()}),m({binding:a.binding,synced:!1});let o=e.binding.subscribe(t=>{s(n=>n?.binding===e.binding?{...n,config:t}:n)}),c=t.binding.subscribe(e=>{u(n=>n?.binding===t.binding?{...n,config:e}:n)}),l=n.binding.subscribe(e=>{f(t=>t?.binding===n.binding?{...t,config:e}:t)}),d=n.binding.subscribeSynced(()=>{f(e=>e?.binding===n.binding?{...e,synced:!0}:e)}),p=()=>{m(e=>e?.binding===a.binding?{...e,synced:!0}:e)};return a.provider.on(`synced`,p),()=>{o(),c(),l(),d(),a.provider.off(`synced`,p),e.cleanup(),t.cleanup(),n.cleanup(),a.cleanup(),s(t=>t?.binding===e.binding?null:t),u(e=>e?.binding===t.binding?null:e),f(e=>e?.binding===n.binding?null:e),m(e=>e?.binding===a.binding?null:e)}},g=[r],t[0]=r,t[1]=h,t[2]=g),(0,W.useEffect)(h,g);let v;t[3]!==d?.config||t[4]!==c||t[5]!==a?(v=a&&c?l(a.config,c.config,d?.config):null,t[3]=d?.config,t[4]=c,t[5]=a,t[6]=v):v=t[6];let b=v,{setTheme:x}=o(),S=b?.appearance?.theme,C,w;t[7]!==x||t[8]!==S?(C=()=>{(S===`light`||S===`dark`||S===`system`)&&x(S)},w=[S,x],t[7]=x,t[8]=S,t[9]=C,t[10]=w):(C=t[9],w=t[10]),(0,W.useEffect)(C,w);let T=a?.binding??null,E=c?.binding??null,D=d?.binding??null,O=p?.binding??null,k=p?.synced??!1,A=a?.config??null,j=c?.config??null,M=d?.config??null,N=d?.synced??!1,P;t[11]!==b||t[12]!==k||t[13]!==A||t[14]!==j||t[15]!==M||t[16]!==N||t[17]!==T||t[18]!==E||t[19]!==D||t[20]!==O?(P={userBinding:T,projectBinding:E,projectLocalBinding:D,okignoreBinding:O,okignoreSynced:k,userConfig:A,projectConfig:j,projectLocalConfig:M,projectLocalSynced:N,merged:b},t[11]=b,t[12]=k,t[13]=A,t[14]=j,t[15]=M,t[16]=N,t[17]=T,t[18]=E,t[19]=D,t[20]=O,t[21]=P):P=t[21];let F=P,I;return t[22]!==n||t[23]!==F?(I=(0,G.jsx)(si,{value:F,children:n}),t[22]=n,t[23]=F,t[24]=I):I=t[24],I}function di(){let e=(0,W.use)(si);if(e===null)throw Error(`useConfigContext must be used within <ConfigProvider />`);return e}function fi(){let e=(0,U.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(H,{children:`Enable git auto-sync?`}),(0,G.jsx)(ve,{children:`Auto-sync periodically fetches, pulls, and pushes commits to your remote git repository so your edits stay in sync across machines.`})]}),e[0]=t):t=e[0],t}function pi(){let e=(0,U.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:`Before you enable it:`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsxs)(G.Fragment,{children:[t,(0,G.jsxs)(`ul`,{className:`list-disc space-y-1.5 pl-5 text-sm text-muted-foreground`,children:[(0,G.jsx)(`li`,{children:`Pulls may overwrite uncommitted local file changes.`}),(0,G.jsx)(`li`,{children:`If you do not want automatic commits in your git history, you should not enable auto-sync.`})]})]}),e[1]=n):n=e[1],n}function mi(){let e=(0,U.c)(2),{projectLocalBinding:t}=di();if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=e=>{let n=t.patch({autoSync:{enabled:e}});return n.ok?{ok:!0}:{ok:!1,error:S(n.error)}},e[0]=t,e[1]=n),n}function hi(e){let t=(0,U.c)(10),[n,r]=(0,W.useState)(!1),i;t[0]===e?i=t[1]:(i=function(t){if(e===null)return de.error(`Sync settings not yet loaded — try again in a moment`),!1;let n=e(t);return n.ok?!0:(console.error(`[sync] toggle failed:`,n.error),de.error(`Failed to ${t?`enable`:`disable`} sync — ${n.error}`),!1)},t[0]=e,t[1]=i);let a=i,o;t[2]===a?o=t[3]:(o=function(e){if(e){r(!0);return}a(!1)},t[2]=a,t[3]=o);let s=o,c;t[4]===a?c=t[5]:(c=function(){a(!0)&&r(!1)},t[4]=a,t[5]=c);let l=c,u;return t[6]!==n||t[7]!==l||t[8]!==s?(u={confirmOpen:n,setConfirmOpen:r,onToggleRequest:s,onConfirm:l},t[6]=n,t[7]=l,t[8]=s,t[9]=u):u=t[9],u}function gi(e){let t=(0,U.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,orientation:i,decorative:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`horizontal`:i,s=a===void 0?!0:a,c;t[5]===n?c=t[6]:(c=P(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==c?(l=(0,G.jsx)(qr,{"data-slot":`separator`,decorative:s,orientation:o,className:c,...r}),t[7]=s,t[8]=o,t[9]=r,t[10]=c,t[11]=l):l=t[11],l}function _i(e){let t=(0,U.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=P(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`field-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var vi=w(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function yi(e){let t=(0,U.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]!==n||t[5]!==a?(o=P(vi({orientation:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,G.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":a,className:o,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function bi(e){let t=(0,U.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=P(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`field-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xi(e){let t=(0,U.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=P(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(_e,{"data-slot":`field-label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Si(e){let t=(0,U.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=P(`flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{"data-slot":`field-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ci(e){let t=(0,U.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=P(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`p`,{"data-slot":`field-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function wi(e){let t=(0,U.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,errors:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;bb0:{if(n){o=n;break bb0}if(!i?.length){o=null;break bb0}let e;t[5]===i?e=t[6]:(e=[...new Map(i.map(Ei)).values()],t[5]=i,t[6]=e);let r=e;if(r?.length===1){o=r[0]?.message;break bb0}let a;t[7]===r?a=t[8]:(a=(0,G.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:r.map(Ti)}),t[7]=r,t[8]=a),o=a}let s=o;if(!s)return null;let c;t[9]===r?c=t[10]:(c=P(`text-sm font-normal text-destructive`,r),t[9]=r,t[10]=c);let l;return t[11]!==s||t[12]!==a||t[13]!==c?(l=(0,G.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:c,...a,children:s}),t[11]=s,t[12]=a,t[13]=c,t[14]=l):l=t[14],l}function Ti(e){return e?.message&&(0,G.jsx)(`li`,{children:e.message},e.message)}function Ei(e){return[e?.message,e]}function Di(){var e=[...arguments];return(0,W.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var Oi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function ki(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Ai(e){return`nodeType`in e}function J(e){return e?ki(e)?e:Ai(e)?e.ownerDocument?.defaultView??window:window:window}function ji(e){let{Document:t}=J(e);return e instanceof t}function Mi(e){return ki(e)?!1:e instanceof J(e).HTMLElement}function Ni(e){return e instanceof J(e).SVGElement}function Pi(e){return e?ki(e)?e.document:Ai(e)?ji(e)?e:Mi(e)||Ni(e)?e.ownerDocument:document:document:document}var Fi=Oi?W.useLayoutEffect:W.useEffect;function Ii(e){let t=(0,W.useRef)(e);return Fi(()=>{t.current=e}),(0,W.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Li(){let e=(0,W.useRef)(null);return[(0,W.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,W.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Ri(e,t){t===void 0&&(t=[e]);let n=(0,W.useRef)(e);return Fi(()=>{n.current!==e&&(n.current=e)},t),n}function zi(e,t){let n=(0,W.useRef)();return(0,W.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Bi(e){let t=Ii(e),n=(0,W.useRef)(null);return[n,(0,W.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Vi(e){let t=(0,W.useRef)();return(0,W.useEffect)(()=>{t.current=e},[e]),t.current}var Hi={};function Ui(e,t){return(0,W.useMemo)(()=>{if(t)return t;let n=Hi[e]==null?0:Hi[e]+1;return Hi[e]=n,e+`-`+n},[e,t])}function Wi(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Gi=Wi(1),Ki=Wi(-1);function qi(e){return`clientX`in e&&`clientY`in e}function Ji(e){if(!e)return!1;let{KeyboardEvent:t}=J(e.target);return t&&e instanceof t}function Yi(e){if(!e)return!1;let{TouchEvent:t}=J(e.target);return t&&e instanceof t}function Xi(e){if(Yi(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return qi(e)?{x:e.clientX,y:e.clientY}:null}var Zi=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[Zi.Translate.toString(e),Zi.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Qi=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function $i(e){return e.matches(Qi)?e:e.querySelector(Qi)}var ea={display:`none`};function ta(e){let{id:t,value:n}=e;return W.createElement(`div`,{id:t,style:ea},n)}function na(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return W.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function ra(){let[e,t]=(0,W.useState)(``);return{announce:(0,W.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var ia=(0,W.createContext)(null);function aa(e){let t=(0,W.useContext)(ia);(0,W.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function oa(){let[e]=(0,W.useState)(()=>new Set),t=(0,W.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,W.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var sa={draggable:`
|
|
2
|
-
To pick up a draggable item, press the space bar.
|
|
3
|
-
While dragging, use the arrow keys to move the item.
|
|
4
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
5
|
-
`},ca={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 la(e){let{announcements:t=ca,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=sa}=e,{announce:a,announcement:o}=ra(),s=Ui(`DndLiveRegion`),[c,l]=(0,W.useState)(!1);if((0,W.useEffect)(()=>{l(!0)},[]),aa((0,W.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=W.createElement(W.Fragment,null,W.createElement(ta,{id:r,value:i.draggable}),W.createElement(na,{id:s,announcement:o}));return n?(0,Le.createPortal)(u,n):u}var Y;(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`})(Y||={});function ua(){}function da(e,t){return(0,W.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function fa(){var e=[...arguments];return(0,W.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var X=Object.freeze({x:0,y:0});function pa(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function ma(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ha(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ga(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 _a(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function va(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 ya=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=va(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=pa(va(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(ma)},ba=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=ga(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=ga(r),o=i.reduce((e,t,r)=>e+pa(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(ma)};function xa(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 Sa=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=xa(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(ha)};function Ca(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function wa(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:X}function Ta(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 Ea=Ta(1);function Da(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 Oa(e,t,n){let r=Da(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 ka={ignoreTransform:!1};function Aa(e,t){t===void 0&&(t=ka);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=J(e).getComputedStyle(e);t&&(n=Oa(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 ja(e){return Aa(e,{ignoreTransform:!0})}function Ma(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Na(e,t){return t===void 0&&(t=J(e).getComputedStyle(e)),t.position===`fixed`}function Pa(e,t){t===void 0&&(t=J(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 Fa(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(ji(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Mi(i)||Ni(i)||n.includes(i))return n;let a=J(e).getComputedStyle(i);return i!==e&&Pa(i,a)&&n.push(i),Na(i,a)?n:r(i.parentNode)}return e?r(e):n}function Ia(e){let[t]=Fa(e,1);return t??null}function La(e){return!Oi||!e?null:ki(e)?e:Ai(e)?ji(e)||e===Pi(e).scrollingElement?window:Mi(e)?e:null:null}function Ra(e){return ki(e)?e.scrollX:e.scrollLeft}function za(e){return ki(e)?e.scrollY:e.scrollTop}function Ba(e){return{x:Ra(e),y:za(e)}}var Z;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Z||={});function Va(e){return!Oi||!e?!1:e===document.scrollingElement}function Ha(e){let t={x:0,y:0},n=Va(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 Ua={x:.2,y:.2};function Wa(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Ua);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Ha(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=Z.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Z.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Z.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Z.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Ga(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 Ka(e){return e.reduce((e,t)=>Gi(e,Ba(t)),X)}function qa(e){return e.reduce((e,t)=>e+Ra(t),0)}function Ja(e){return e.reduce((e,t)=>e+za(t),0)}function Ya(e,t){if(t===void 0&&(t=Aa),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Ia(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Xa=[[`x`,[`left`,`right`],qa],[`y`,[`top`,`bottom`],Ja]],Za=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=Fa(t),r=Ka(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Xa)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})}},Qa=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 $a(e){let{EventTarget:t}=J(e);return e instanceof t?e:Pi(e)}function eo(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 Q;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Q||={});function to(e){e.preventDefault()}function no(e){e.stopPropagation()}var $;(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`})($||={});var ro={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},io=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},ao=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 Qa(Pi(t)),this.windowListeners=new Qa(J(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Q.Resize,this.handleCancel),this.windowListeners.add(Q.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Q.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Ya(n),t(X)}handleKeyDown(e){if(Ji(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=ro,coordinateGetter:a=io,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}:X;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Ki(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}=Ha(n),p=Ga(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===$.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===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Gi(Ki(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()}};ao.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=ro,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 oo(e){return!!(e&&`distance`in e)}function so(e){return!!(e&&`delay`in e)}var co=class{constructor(e,t,n){n===void 0&&(n=$a(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=Pi(i),this.documentListeners=new Qa(this.document),this.listeners=new Qa(n),this.windowListeners=new Qa(J(i)),this.initialCoordinates=Xi(r)??X,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(Q.Resize,this.handleCancel),this.windowListeners.add(Q.DragStart,to),this.windowListeners.add(Q.VisibilityChange,this.handleCancel),this.windowListeners.add(Q.ContextMenu,to),this.documentListeners.add(Q.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(so(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(oo(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(Q.Click,no,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Q.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=Xi(e)??X,s=Ki(n,o);if(!t&&a){if(oo(a)){if(a.tolerance!=null&&eo(s,a.tolerance))return this.handleCancel();if(eo(s,a.distance))return this.handleStart()}if(so(a)&&eo(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===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},lo={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},uo=class extends co{constructor(e){let{event:t}=e,n=Pi(t.target);super(e,lo,n)}};uo.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 fo={move:{name:`mousemove`},end:{name:`mouseup`}},po;(function(e){e[e.RightClick=2]=`RightClick`})(po||={});var mo=class extends co{constructor(e){super(e,fo,Pi(e.event.target))}};mo.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===po.RightClick?!1:(r?.({event:n}),!0)}}];var ho={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},go=class extends co{constructor(e){super(e,ho)}static setup(){return window.addEventListener(ho.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(ho.move.name,e)};function e(){}}};go.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 _o;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(_o||={});var vo;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(vo||={});function yo(e){let{acceleration:t,activator:n=_o.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=vo.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=xo({delta:d,disabled:!a}),[m,h]=Li(),g=(0,W.useRef)({x:0,y:0}),_=(0,W.useRef)({x:0,y:0}),v=(0,W.useMemo)(()=>{switch(n){case _o.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case _o.DraggableRect:return i}},[n,i,c]),y=(0,W.useRef)(null),b=(0,W.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,W.useMemo)(()=>s===vo.TreeOrder?[...l].reverse():l,[s,l]);(0,W.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=Wa(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var bo={x:{[Z.Backward]:!1,[Z.Forward]:!1},y:{[Z.Backward]:!1,[Z.Forward]:!1}};function xo(e){let{delta:t,disabled:n}=e,r=Vi(t);return zi(e=>{if(n||!r||!e)return bo;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Z.Backward]:e.x[Z.Backward]||i.x===-1,[Z.Forward]:e.x[Z.Forward]||i.x===1},y:{[Z.Backward]:e.y[Z.Backward]||i.y===-1,[Z.Forward]:e.y[Z.Forward]||i.y===1}}},[n,t,r])}function So(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return zi(e=>t==null?null:r??e??null,[r,t])}function Co(e,t){return(0,W.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 wo;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(wo||={});var To;(function(e){e.Optimized=`optimized`})(To||={});var Eo=new Map;function Do(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,W.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,W.useRef)(e),d=g(),f=Ri(d),p=(0,W.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,W.useRef)(null),h=zi(t=>{if(d&&!n)return Eo;if(!t||t===Eo||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Za(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,W.useEffect)(()=>{u.current=e},[e]),(0,W.useEffect)(()=>{d||p()},[n,d]),(0,W.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,W.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case wo.Always:return!1;case wo.BeforeDragging:return n;default:return!n}}}function Oo(e,t){return zi(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function ko(e,t){return Oo(e,t)}function Ao(e){let{callback:t,disabled:n}=e,r=Ii(t),i=(0,W.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,W.useEffect)(()=>()=>i?.disconnect(),[i]),i}function jo(e){let{callback:t,disabled:n}=e,r=Ii(t),i=(0,W.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,W.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Mo(e){return new Za(Aa(e),e)}function No(e,t,n){t===void 0&&(t=Mo);let[r,i]=(0,W.useState)(null);function a(){i(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 o=Ao({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=jo({callback:a});return Fi(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Po(e){return wa(e,Oo(e))}var Fo=[];function Io(e){let t=(0,W.useRef)(e),n=zi(n=>e?n&&n!==Fo&&e&&t.current&&e.parentNode===t.current.parentNode?n:Fa(e):Fo,[e]);return(0,W.useEffect)(()=>{t.current=e},[e]),n}function Lo(e){let[t,n]=(0,W.useState)(null),r=(0,W.useRef)(e),i=(0,W.useCallback)(e=>{let t=La(e.target);t&&n(e=>e?(e.set(t,Ba(t)),new Map(e)):null)},[]);return(0,W.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=La(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Ba(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{La(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,W.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Gi(e,t),X):Ka(e):X,[e,t])}function Ro(e,t){t===void 0&&(t=[]);let n=(0,W.useRef)(null);return(0,W.useEffect)(()=>{n.current=null},t),(0,W.useEffect)(()=>{let t=e!==X;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Ki(e,n.current):X}function zo(e){(0,W.useEffect)(()=>{if(!Oi)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 Bo(e,t){return(0,W.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Vo(e){return(0,W.useMemo)(()=>e?Ma(e):null,[e])}var Ho=[];function Uo(e,t){t===void 0&&(t=Aa);let[n]=e,r=Vo(n?J(n):null),[i,a]=(0,W.useState)(Ho);function o(){a(()=>e.length?e.map(e=>Va(e)?r:new Za(t(e),e)):Ho)}let s=jo({callback:o});return Fi(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Wo(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Mi(t)?t:e}function Go(e){let{measure:t}=e,[n,r]=(0,W.useState)(null),i=jo({callback:(0,W.useCallback)(e=>{for(let{target:n}of e)if(Mi(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Bi((0,W.useCallback)(e=>{let n=Wo(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,W.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Ko=[{sensor:uo,options:{}},{sensor:ao,options:{}}],qo={current:{}},Jo={draggable:{measure:ja},droppable:{measure:ja,strategy:wo.WhileDragging,frequency:To.Optimized},dragOverlay:{measure:Aa}},Yo=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}},Xo={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Yo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ua},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Jo,measureDroppableContainers:ua,windowRect:null,measuringScheduled:!1},Zo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:ua,draggableNodes:new Map,over:null,measureDroppableContainers:ua},Qo=(0,W.createContext)(Zo),$o=(0,W.createContext)(Xo);function es(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Yo}}}function ts(e,t){switch(t.type){case Y.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Y.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 Y.DragEnd:case Y.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Y.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Yo(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Y.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 Yo(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case Y.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Yo(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function ns(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,W.useContext)(Qo),a=Vi(r),o=Vi(n?.id);return(0,W.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Ji(a)||document.activeElement===a.target)return;let e=i.get(o);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=$i(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function rs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function is(e){return(0,W.useMemo)(()=>({draggable:{...Jo.draggable,...e?.draggable},droppable:{...Jo.droppable,...e?.droppable},dragOverlay:{...Jo.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function as(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,W.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Fi(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=wa(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=Ia(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var os=(0,W.createContext)({...X,scaleX:1,scaleY:1}),ss;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(ss||={});var cs=(0,W.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Ko,collisionDetection:o=Sa,measuring:s,modifiers:c,...l}=e,[u,d]=(0,W.useReducer)(ts,void 0,es),[f,p]=oa(),[m,h]=(0,W.useState)(ss.Uninitialized),g=m===ss.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,W.useRef)({initial:null,translated:null}),C=(0,W.useMemo)(()=>_==null?null:{id:_,data:x?.data??qo,rect:S},[_,x]),w=(0,W.useRef)(null),[T,E]=(0,W.useState)(null),[D,O]=(0,W.useState)(null),k=Ri(l,Object.values(l)),A=Ui(`DndDescribedBy`,t),j=(0,W.useMemo)(()=>b.getEnabled(),[b]),M=is(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:F}=Do(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),I=So(v,_),L=(0,W.useMemo)(()=>D?Xi(D):null,[D]),ee=Ee(),te=ko(I,M.draggable.measure);as({activeNode:_==null?null:v.get(_),config:ee.layoutShiftCompensation,initialRect:te,measure:M.draggable.measure});let R=No(I,M.draggable.measure,te),ne=No(I?I.parentElement:null),z=(0,W.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=b.getNodeFor(z.current.over?.id),B=Go({measure:M.dragOverlay.measure}),ie=B.nodeRef.current??I,V=g?B.rect??R:null,ae=!!(B.nodeRef.current&&B.rect),oe=Po(ae?null:R),se=Vo(ie?J(ie):null),ce=Io(g?re??I:null),le=Uo(ce),ue=rs(c,{transform:{x:y.x-oe.x,y:y.y-oe.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:R,containerNodeRect:ne,draggingNodeRect:V,over:z.current.over,overlayNodeRect:B.rect,scrollableAncestors:ce,scrollableAncestorRects:le,windowRect:se}),de=L?Gi(L,y):null,fe=Lo(ce),pe=Ro(fe),me=Ro(fe,[R]),he=Gi(ue,pe),ge=V?Ea(V,ue):null,_e=C&&ge?o({active:C,collisionRect:ge,droppableRects:N,droppableContainers:j,pointerCoordinates:de}):null,ve=_a(_e,`id`),[H,ye]=(0,W.useState)(null),be=Ca(ae?ue:Gi(ue,me),H?.rect??null,R),xe=(0,W.useRef)(null),Se=(0,W.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;xe.current=new n({active:w.current,activeNode:i,event:a,options:r,context:z,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,Le.unstable_batchedUpdates)(()=>{r?.(i),h(ss.Initializing),d({type:Y.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(xe.current),O(a)})},onMove(e){d({type:Y.DragMove,coordinates:e})},onEnd:o(Y.DragEnd),onCancel:o(Y.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=z.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===Y.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=Y.DragCancel)}w.current=null,(0,Le.unstable_batchedUpdates)(()=>{d({type:e}),h(ss.Uninitialized),ye(null),E(null),O(null),xe.current=null;let t=e===Y.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ce=Co(a,(0,W.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Se(n,t))},[v,Se]));zo(a),Fi(()=>{R&&m===ss.Initializing&&h(ss.Initialized)},[R,m]),(0,W.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=z.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:he.x,y:he.y},over:i};(0,Le.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[he.x,he.y]),(0,W.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=z.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(ve),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Le.unstable_batchedUpdates)(()=>{ye(s),a?.(c),f({type:`onDragOver`,event:c})})},[ve]),Fi(()=>{z.current={activatorEvent:D,active:C,activeNode:I,collisionRect:ge,collisions:_e,droppableRects:N,draggableNodes:v,draggingNode:ie,draggingNodeRect:V,droppableContainers:b,over:H,scrollableAncestors:ce,scrollAdjustedTranslate:he},S.current={initial:V,translated:ge}},[C,I,_e,ge,v,ie,V,N,b,H,ce,he]),yo({...ee,delta:y,draggingRect:ge,pointerCoordinates:de,scrollableAncestors:ce,scrollableAncestorRects:le});let we=(0,W.useMemo)(()=>({active:C,activeNode:I,activeNodeRect:R,activatorEvent:D,collisions:_e,containerNodeRect:ne,dragOverlay:B,draggableNodes:v,droppableContainers:b,droppableRects:N,over:H,measureDroppableContainers:P,scrollableAncestors:ce,scrollableAncestorRects:le,measuringConfiguration:M,measuringScheduled:F,windowRect:se}),[C,I,R,D,_e,ne,B,v,b,N,H,P,ce,le,M,F,se]),Te=(0,W.useMemo)(()=>({activatorEvent:D,activators:Ce,active:C,activeNodeRect:R,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:H,measureDroppableContainers:P}),[D,Ce,C,R,d,A,v,H,P]);return W.createElement(ia.Provider,{value:p},W.createElement(Qo.Provider,{value:Te},W.createElement($o.Provider,{value:we},W.createElement(os.Provider,{value:be},i)),W.createElement(ns,{disabled:n?.restoreFocus===!1})),W.createElement(la,{...n,hiddenTextDescribedById:A}));function Ee(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),ls=(0,W.createContext)(null),us=`button`,ds=`Draggable`;function fs(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Ui(ds),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,W.useContext)(Qo),{role:p=us,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,W.useContext)(g?os:ls),[v,y]=Bi(),[b,x]=Bi(),S=Bo(o,t),C=Ri(n);return Fi(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,W.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===us?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function ps(){return(0,W.useContext)($o)}var ms=`Droppable`,hs={timeout:25};function gs(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Ui(ms),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,W.useContext)(Qo),u=(0,W.useRef)({disabled:n}),d=(0,W.useRef)(!1),f=(0,W.useRef)(null),p=(0,W.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...hs,...i},_=Ri(h??r),v=jo({callback:(0,W.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=Bi((0,W.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=Ri(t);return(0,W.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,W.useEffect)(()=>(s({type:Y.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:Y.UnregisterDroppable,key:a,id:r})),[r]),(0,W.useEffect)(()=>{n!==u.current.disabled&&(s({type:Y.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function _s(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function vs(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function ys(e){return e!==null&&e>=0}function bs(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 xs(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var Ss=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=_s(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}},Cs={scaleX:1,scaleY:1},ws=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,...Cs}:null}let s=Ts(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...Cs}:r<t&&r>=a?{x:0,y:o.height+s,...Cs}:{x:0,y:0,...Cs}};function Ts(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 Es=`Sortable`,Ds=W.createContext({activeIndex:-1,containerId:Es,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ss,disabled:{draggable:!1,droppable:!1}});function Os(e){let{children:t,id:n,items:r,strategy:i=Ss,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=ps(),d=Ui(Es,n),f=s.rect!==null,p=(0,W.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,W.useRef)(p),v=!bs(p,_.current),y=g!==-1&&h===-1||v,b=xs(a);Fi(()=>{v&&m&&u(p)},[v,p,m,u]),(0,W.useEffect)(()=>{_.current=p},[p]);let x=(0,W.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:vs(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return W.createElement(Ds.Provider,{value:x},t)}var ks=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return _s(n,r,i).indexOf(t)},As=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},js={duration:200,easing:`ease`},Ms=`transform`,Ns=Zi.Transition.toString({property:Ms,duration:0,easing:`linear`}),Ps={roleDescription:`sortable`};function Fs(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,W.useState)(null),s=(0,W.useRef)(n);return Fi(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=Aa(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)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,W.useEffect)(()=>{a&&o(null)},[a]),a}function Is(e){let{animateLayoutChanges:t=As,attributes:n,disabled:r,data:i,getNewIndex:a=ks,id:o,strategy:s,resizeObserverConfig:c,transition:l=js}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,W.useContext)(Ds),y=Ls(r,p),b=u.indexOf(o),x=(0,W.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,W.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=gs({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:P,setActivatorNodeRef:F,transform:I}=fs({id:o,data:x,attributes:{...Ps,...n},disabled:y.draggable}),L=Di(E,j),ee=!!D,te=ee&&!m&&ys(f)&&ys(g),R=!_&&N,ne=te?(R&&te?I:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,z=ys(f)&&ys(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,re=D?.id,B=(0,W.useRef)({activeId:re,items:u,newIndex:z,containerId:d}),ie=u!==B.current.items,V=t({active:D,containerId:d,isDragging:N,isSorting:ee,id:o,index:b,items:u,newIndex:B.current.newIndex,previousItems:B.current.items,previousContainerId:B.current.containerId,transition:l,wasDragging:B.current.activeId!=null}),ae=Fs({disabled:!V,index:b,node:w,rect:C});return(0,W.useEffect)(()=>{ee&&B.current.newIndex!==z&&(B.current.newIndex=z),d!==B.current.containerId&&(B.current.containerId=d),u!==B.current.items&&(B.current.items=u)},[ee,z,d,u]),(0,W.useEffect)(()=>{if(re===B.current.activeId)return;if(re!=null&&B.current.activeId==null){B.current.activeId=re;return}let e=setTimeout(()=>{B.current.activeId=re},50);return()=>clearTimeout(e)},[re]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:z,items:u,isOver:T,isSorting:ee,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:L,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:ae??ne,transition:oe()};function oe(){if(ae||ie&&B.current.newIndex===b)return Ns;if(!(R&&!Ji(O)||!l)&&(ee||V))return Zi.Transition.toString({...l,property:Ms})}}function Ls(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function Rs(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 zs=[$.Down,$.Right,$.Up,$.Left],Bs=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(zs.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 $.Down:r.top<a.top&&t.push(n);break;case $.Up:r.top>a.top&&t.push(n);break;case $.Left:r.left>a.left&&t.push(n);break;case $.Right:r.left<a.left&&t.push(n);break}});let c=ba({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=_a(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=Fa(c).some((e,t)=>s[t]!==e),i=Vs(e,t),a=Hs(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:Ki(u,l)}}}};function Vs(e,t){return!Rs(e)||!Rs(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Hs(e,t){return!Rs(e)||!Rs(t)||!Vs(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Us(e){let t=(0,U.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(nr,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function Ws(e){let t=(0,U.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(rr,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function Gs(e){let t=(0,U.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`start`:i,s=a===void 0?4:a,c;t[5]===n?c=t[6]:(c=P(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n),t[5]=n,t[6]=c);let l;return t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(l=(0,G.jsx)(ir,{children:(0,G.jsx)(ar,{"data-slot":`dropdown-menu-content`,sideOffset:s,align:o,className:c,...r})}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Ks(e){let t=(0,U.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=P(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,G.jsx)(sr,{"data-slot":`dropdown-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function qs(e){let t=(0,U.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(cr,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function Js(e){let t=(0,U.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,inset:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=P(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,G.jsx)(ur,{children:(0,G.jsx)(ae,{})})}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,G.jsxs)(lr,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:o,...a,children:[s,n]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Ys(e){let t=(0,U.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=P(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,G.jsx)(or,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function Xs(e){let t=(0,U.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=P(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(dr,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Zs(e){let t=(0,U.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(fr,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function Qs(e){let t=(0,U.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=P(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(B,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,G.jsxs)(pr,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function $s(e){let t=(0,U.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=P(`z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(mr,{"data-slot":`dropdown-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function ec(e){return g(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function tc(e,t){try{let n=await fetch(`/api/folder-config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,frontmatter:t})});return n.ok?{ok:!0}:{ok:!1,error:await ec(n)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function nc(e){try{let t=await fetch(`/api/template`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await ec(t)};let n=await t.json().catch(()=>null);return{ok:!0,created:n?.created??!1,warnings:n?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function rc(e,t,n){try{let r=`?folder=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`;n!==void 0&&(r+=`&target=${encodeURIComponent(n)}`);let i=await fetch(`/api/template${r}`,{method:`DELETE`});return i.ok?{ok:!0,existed:(await i.json().catch(()=>null))?.existed??!1}:{ok:!1,error:await ec(i)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function ic(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function ac(e,t){return e===``?`.ok/templates/${t}.md`:`${e}/.ok/templates/${t}.md`}function oc(e){let t=(0,U.c)(22),{itemName:n,isSubmitting:r,onDelete:i,customTitle:a,customDescription:o,children:s}=e,c=n===void 0?`this item`:n,l=a??`Delete ${c}`,u;t[0]===l?u=t[1]:(u=(0,G.jsx)(H,{children:l}),t[0]=l,t[1]=u);let d=o??`Are you sure you want to delete ${c}? This action cannot be undone.`,f;t[2]===d?f=t[3]:(f=(0,G.jsx)(ve,{className:`whitespace-pre-wrap`,children:d}),t[2]=d,t[3]=f);let p;t[4]===s?p=t[5]:(p=s?(0,G.jsx)(be,{children:s}):null,t[4]=s,t[5]=p);let m;t[6]===r?m=t[7]:(m=(0,G.jsx)(Se,{asChild:!0,children:(0,G.jsx)(I,{variant:`outline`,disabled:r,children:`Cancel`})}),t[6]=r,t[7]=m);let h;t[8]===r?h=t[9]:(h=r?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(re,{className:`size-4 animate-spin`}),` Deleting...`]}):`Delete`,t[8]=r,t[9]=h);let g;t[10]!==r||t[11]!==i||t[12]!==h?(g=(0,G.jsx)(I,{variant:`destructive`,onClick:i,disabled:r,children:h}),t[10]=r,t[11]=i,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==m||t[15]!==g?(_=(0,G.jsxs)(xe,{children:[m,g]}),t[14]=m,t[15]=g,t[16]=_):_=t[16];let v;return t[17]!==_||t[18]!==u||t[19]!==f||t[20]!==p?(v=(0,G.jsxs)(ye,{children:[u,f,p,_]}),t[17]=_,t[18]=u,t[19]=f,t[20]=p,t[21]=v):v=t[21],v}function sc(e){let t=(0,U.c)(40),{value:n,onChange:r,onBlur:i,placeholder:a,id:o,disabled:s,"aria-describedby":c,"aria-invalid":l,ref:u}=e,d=a===void 0?`Add tag…`:a,[f,p]=(0,W.useState)(``),m;t[0]!==r||t[1]!==n?(m=e=>{let t=e.trim();if(t){if(n.includes(t)){p(``);return}r([...n,t]),p(``)}},t[0]=r,t[1]=n,t[2]=m):m=t[2];let h=m,g;t[3]!==r||t[4]!==n?(g=e=>{r(n.filter((t,n)=>n!==e))},t[3]=r,t[4]=n,t[5]=g):g=t[5];let _=g,v=s&&`pointer-events-none opacity-60`,y;t[6]===v?y=t[7]:(y=P(`flex min-h-8 w-full flex-wrap items-center gap-1.5 rounded-lg border border-input bg-transparent px-2 py-1 text-sm transition-colors`,`focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20`,`dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,v),t[6]=v,t[7]=y);let b;if(t[8]!==s||t[9]!==_||t[10]!==n){let e;t[12]!==s||t[13]!==_?(e=(e,t)=>(0,G.jsxs)(z,{variant:`secondary`,className:`gap-1 pl-2 pr-1`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>_(t),"aria-label":`Remove ${e}`,className:`rounded-sm p-0.5 hover:bg-background/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,disabled:s,children:(0,G.jsx)(ue,{className:`size-3`,"aria-hidden":`true`})})]},e),t[12]=s,t[13]=_,t[14]=e):e=t[14],b=n.map(e),t[8]=s,t[9]=_,t[10]=n,t[11]=b}else b=t[11];let x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>p(e.target.value),t[15]=x):x=t[15];let S;t[16]!==h||t[17]!==f||t[18]!==_||t[19]!==n.length?(S=e=>{e.key===`Enter`?f.trim()&&(e.preventDefault(),h(f)):e.key===`,`?(e.preventDefault(),f.trim()&&h(f)):e.key===`Tab`?f.trim()&&(e.preventDefault(),h(f)):e.key===`Backspace`&&f===``&&n.length>0&&(e.preventDefault(),_(n.length-1))},t[16]=h,t[17]=f,t[18]=_,t[19]=n.length,t[20]=S):S=t[20];let C;t[21]!==h||t[22]!==f||t[23]!==i?(C=()=>{f.trim()&&h(f),i?.()},t[21]=h,t[22]=f,t[23]=i,t[24]=C):C=t[24];let w=n.length===0?d:``,T;t[25]!==c||t[26]!==l||t[27]!==s||t[28]!==f||t[29]!==o||t[30]!==u||t[31]!==w||t[32]!==S||t[33]!==C?(T=(0,G.jsx)(`input`,{id:o,ref:u,type:`text`,value:f,onChange:x,onKeyDown:S,onBlur:C,placeholder:w,"aria-describedby":c,"aria-invalid":l,disabled:s,className:`min-w-[8ch] flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed`}),t[25]=c,t[26]=l,t[27]=s,t[28]=f,t[29]=o,t[30]=u,t[31]=w,t[32]=S,t[33]=C,t[34]=T):T=t[34];let E;return t[35]!==l||t[36]!==T||t[37]!==y||t[38]!==b?(E=(0,G.jsxs)(`div`,{"data-slot":`tag-pill-input`,"aria-invalid":l,className:y,children:[b,T]}),t[35]=l,t[36]=T,t[37]=y,t[38]=b,t[39]=E):E=t[39],E}function cc(e){let t=(0,U.c)(49),{title:n,description:r,tags:i,onTitleChange:a,onDescriptionChange:o,onTagsChange:s,requireTitle:c,disabled:l}=e,u=c===void 0?!1:c,d=l===void 0?!1:l,f=(0,W.useId)(),p=(0,W.useId)(),m=(0,W.useId)(),[h,g]=(0,W.useState)(!1),_;t[0]!==u||t[1]!==n?(_=u&&n.trim()===``,t[0]=u,t[1]=n,t[2]=_):_=t[2];let v=_&&h,y;t[3]===u?y=t[4]:(y=u?(0,G.jsx)(`span`,{className:`text-destructive`,children:`*`}):null,t[3]=u,t[4]=y);let b;t[5]!==y||t[6]!==f?(b=(0,G.jsxs)(xi,{htmlFor:f,children:[`Title`,y]}),t[5]=y,t[6]=f,t[7]=b):b=t[7];let x;t[8]===a?x=t[9]:(x=e=>a(e.target.value),t[8]=a,t[9]=x);let S;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>g(!0),t[10]=S):S=t[10];let C;t[11]!==d||t[12]!==v||t[13]!==x||t[14]!==n||t[15]!==f?(C=(0,G.jsx)(Te,{id:f,value:n,onChange:x,onBlur:S,disabled:d,"aria-invalid":v}),t[11]=d,t[12]=v,t[13]=x,t[14]=n,t[15]=f,t[16]=C):C=t[16];let w;t[17]===v?w=t[18]:(w=v?(0,G.jsx)(wi,{children:`Required — title is the agent menu surface.`}):null,t[17]=v,t[18]=w);let T;t[19]!==b||t[20]!==C||t[21]!==w?(T=(0,G.jsxs)(yi,{children:[b,C,w]}),t[19]=b,t[20]=C,t[21]=w,t[22]=T):T=t[22];let E;t[23]===p?E=t[24]:(E=(0,G.jsx)(xi,{htmlFor:p,children:`Description`}),t[23]=p,t[24]=E);let D;t[25]===o?D=t[26]:(D=e=>o(e.target.value),t[25]=o,t[26]=D);let O;t[27]!==r||t[28]!==p||t[29]!==d||t[30]!==D?(O=(0,G.jsx)(Ee,{id:p,value:r,onChange:D,disabled:d,rows:2}),t[27]=r,t[28]=p,t[29]=d,t[30]=D,t[31]=O):O=t[31];let k;t[32]!==E||t[33]!==O?(k=(0,G.jsxs)(yi,{children:[E,O]}),t[32]=E,t[33]=O,t[34]=k):k=t[34];let A;t[35]===m?A=t[36]:(A=(0,G.jsx)(xi,{htmlFor:m,children:`Tags`}),t[35]=m,t[36]=A);let j;t[37]!==d||t[38]!==s||t[39]!==i||t[40]!==m?(j=(0,G.jsx)(sc,{id:m,value:i,onChange:s,disabled:d}),t[37]=d,t[38]=s,t[39]=i,t[40]=m,t[41]=j):j=t[41];let M;t[42]!==A||t[43]!==j?(M=(0,G.jsxs)(yi,{children:[A,j]}),t[42]=A,t[43]=j,t[44]=M):M=t[44];let N;return t[45]!==T||t[46]!==k||t[47]!==M?(N=(0,G.jsxs)(G.Fragment,{children:[T,k,M]}),t[45]=T,t[46]=k,t[47]=M,t[48]=N):N=t[48],N}function lc(e){let t={},n=e.title.trim();n&&(t.title=n);let r=e.description.trim();r&&(t.description=r);let i=e.tags.map(e=>e.trim()).filter(e=>e.length>0);return i.length>0&&(t.tags=i),t}function uc(e){let t=(0,U.c)(17),{value:n,onChange:r,disabled:i,placeholder:a,rows:o}=e,s=i===void 0?!1:i,c=o===void 0?12:o,l=(0,W.useId)(),u;t[0]===l?u=t[1]:(u=(0,G.jsx)(xi,{htmlFor:l,children:`Body`}),t[0]=l,t[1]=u);let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,G.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/70`,children:[`Allowed substitutions: `,`{{date}}`,`, `,`{{user}}`]}),t[2]=d):d=t[2];let f;t[3]===u?f=t[4]:(f=(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[u,d]}),t[3]=u,t[4]=f);let p;t[5]===r?p=t[6]:(p=e=>r(e.target.value),t[5]=r,t[6]=p);let m;t[7]!==s||t[8]!==l||t[9]!==a||t[10]!==c||t[11]!==p||t[12]!==n?(m=(0,G.jsx)(Ee,{id:l,value:n,onChange:p,disabled:s,rows:c,spellCheck:!1,placeholder:a,className:`font-mono text-xs leading-relaxed min-h-72`}),t[7]=s,t[8]=l,t[9]=a,t[10]=c,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==f||t[15]!==m?(h=(0,G.jsxs)(yi,{children:[f,m]}),t[14]=f,t[15]=m,t[16]=h):h=t[16],h}var dc=/^[A-Za-z0-9_-]+$/;function fc(e){let t=(0,U.c)(36),{mode:n,folderPath:r,initial:i,existingNames:a,onCommitted:o,target:s}=e,[c,l]=(0,W.useState)(i.name),[u,d]=(0,W.useState)(i.title),[f,p]=(0,W.useState)(i.description),[m,h]=(0,W.useState)(i.tags),[g,_]=(0,W.useState)(i.body),[v,y]=(0,W.useState)(!1),b,x,S,C;if(t[0]!==a||t[1]!==n||t[2]!==c||t[3]!==u){S=c.trim();let e;t[8]===u?e=t[9]:(e=u.trim(),t[8]=u,t[9]=e),C=e,b=n===`create`&&(S===``||!dc.test(S)),x=n===`create`&&!b&&(a?.has(S)??!1),t[0]=a,t[1]=n,t[2]=c,t[3]=u,t[4]=b,t[5]=x,t[6]=S,t[7]=C}else b=t[4],x=t[5],S=t[6],C=t[7];let w=x,T=!v&&!b&&C!==``,E;t[10]!==g||t[11]!==T||t[12]!==f||t[13]!==r||t[14]!==i.name||t[15]!==n||t[16]!==o||t[17]!==m||t[18]!==s||t[19]!==u||t[20]!==S?(E=async function(){if(!T)return;y(!0);let e=lc({title:u,description:f,tags:m}),t={folder:r,name:n===`create`?S:i.name,frontmatter:e,body:g};s!==void 0&&(t.target=s);let a=await nc(t);if(y(!1),!a.ok){de.error(`${n===`create`?`Create`:`Save`} failed: ${a.error}`);return}a.warnings.length>0?de.warning(a.warnings.join(` `)):n===`create`?de.success(`Template "${S}" created`):de.success(`Template saved`),o()},t[10]=g,t[11]=T,t[12]=f,t[13]=r,t[14]=i.name,t[15]=n,t[16]=o,t[17]=m,t[18]=s,t[19]=u,t[20]=S,t[21]=E):E=t[21];let D=E,O=s??`project`,k;return t[22]!==g||t[23]!==T||t[24]!==f||t[25]!==n||t[26]!==c||t[27]!==b||t[28]!==w||t[29]!==v||t[30]!==D||t[31]!==O||t[32]!==m||t[33]!==u||t[34]!==S?(k={mode:n,name:c,title:u,description:f,tags:m,body:g,setName:l,setTitle:d,setDescription:p,setTags:h,setBody:_,isSaving:v,canSubmit:T,nameInvalid:b,nameShadows:w,trimmedName:S,target:O,submit:D},t[22]=g,t[23]=T,t[24]=f,t[25]=n,t[26]=c,t[27]=b,t[28]=w,t[29]=v,t[30]=D,t[31]=O,t[32]=m,t[33]=u,t[34]=S,t[35]=k):k=t[35],k}function pc(e){let t=(0,U.c)(21),{form:n,bodyPlaceholder:r}=e,i=(0,W.useId)(),a=n.mode===`create`&&n.trimmedName!==``&&n.nameInvalid,o;t[0]!==n||t[1]!==i||t[2]!==a?(o=n.mode===`create`?(0,G.jsxs)(yi,{children:[(0,G.jsxs)(xi,{htmlFor:i,children:[`Name`,(0,G.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,G.jsx)(Te,{id:i,value:n.name,onChange:e=>n.setName(e.target.value),placeholder:`article`,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":a}),a?(0,G.jsxs)(wi,{children:[`Letters, digits, `,(0,G.jsx)(`code`,{className:`font-mono`,children:`_`}),`,`,` `,(0,G.jsx)(`code`,{className:`font-mono`,children:`-`}),` only — no slashes, dots, spaces, or`,` `,(0,G.jsx)(`code`,{className:`font-mono`,children:`.md`}),`.`]}):n.nameShadows?(0,G.jsx)(Ci,{className:`text-yellow-600 dark:text-yellow-500`,children:n.target===`user`?(0,G.jsxs)(G.Fragment,{children:[`A template named `,(0,G.jsx)(`code`,{className:`font-mono`,children:n.trimmedName}),` already exists in your user scope. Saving overwrites it. Project or folder templates with the same name will continue to shadow this one in their respective scopes.`]}):(0,G.jsxs)(G.Fragment,{children:[`A template named `,(0,G.jsx)(`code`,{className:`font-mono`,children:n.trimmedName}),` already resolves here (likely inherited). Saving creates a`,` `,(0,G.jsx)(`code`,{className:`font-mono`,children:`local`}),` shadow that supersedes it for this folder.`]})}):null]}):null,t[0]=n,t[1]=i,t[2]=a,t[3]=o):o=t[3];let s;t[4]!==n.description||t[5]!==n.isSaving||t[6]!==n.setDescription||t[7]!==n.setTags||t[8]!==n.setTitle||t[9]!==n.tags||t[10]!==n.title?(s=(0,G.jsx)(cc,{title:n.title,description:n.description,tags:n.tags,onTitleChange:n.setTitle,onDescriptionChange:n.setDescription,onTagsChange:n.setTags,requireTitle:!0,disabled:n.isSaving}),t[4]=n.description,t[5]=n.isSaving,t[6]=n.setDescription,t[7]=n.setTags,t[8]=n.setTitle,t[9]=n.tags,t[10]=n.title,t[11]=s):s=t[11];let c;t[12]!==r||t[13]!==n.body||t[14]!==n.isSaving||t[15]!==n.setBody?(c=(0,G.jsx)(uc,{value:n.body,onChange:n.setBody,disabled:n.isSaving,placeholder:r}),t[12]=r,t[13]=n.body,t[14]=n.isSaving,t[15]=n.setBody,t[16]=c):c=t[16];let l;return t[17]!==o||t[18]!==s||t[19]!==c?(l=(0,G.jsxs)(_i,{children:[o,s,c]}),t[17]=o,t[18]=s,t[19]=c,t[20]=l):l=t[20],l}var mc={name:``,title:``,description:``,tags:[],body:``},hc=`## Summary
|
|
6
|
-
|
|
7
|
-
(One-paragraph summary. Edit later via edit_document.)
|
|
8
|
-
`;function gc(e){let t=(0,U.c)(13),{folderPath:n,existingNames:r,open:i,onOpenChange:a,onCreated:o,target:s}=e,c;t[0]!==r||t[1]!==n||t[2]!==o||t[3]!==a||t[4]!==i||t[5]!==s?(c=i?(0,G.jsx)(_c,{folderPath:n,existingNames:r,onOpenChange:a,onCreated:o,target:s}):null,t[0]=r,t[1]=n,t[2]=o,t[3]=a,t[4]=i,t[5]=s,t[6]=c):c=t[6];let l;t[7]===c?l=t[8]:(l=(0,G.jsx)(ye,{className:`sm:max-w-3xl max-h-[85vh] flex flex-col`,children:c}),t[7]=c,t[8]=l);let u;return t[9]!==a||t[10]!==i||t[11]!==l?(u=(0,G.jsx)(we,{open:i,onOpenChange:a,children:l}),t[9]=a,t[10]=i,t[11]=l,t[12]=u):u=t[12],u}function _c(e){let t=(0,U.c)(43),{folderPath:n,existingNames:r,onOpenChange:i,onCreated:a,target:o}=e,s=o===`user`,c;t[0]!==n||t[1]!==s?(c=s?`~/.ok/templates/<name>.md`:ac(n,`<name>`),t[0]=n,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]!==a||t[4]!==i?(u=()=>{a(),i(!1)},t[3]=a,t[4]=i,t[5]=u):u=t[5];let d;t[6]===o?d=t[7]:(d=o===void 0?{}:{target:o},t[6]=o,t[7]=d);let f;t[8]!==r||t[9]!==n||t[10]!==u||t[11]!==d?(f={mode:`create`,folderPath:n,initial:mc,existingNames:r,onCommitted:u,...d},t[8]=r,t[9]=n,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=fc(f),m=s?`New user template`:`New template`,h;t[13]===m?h=t[14]:(h=(0,G.jsx)(H,{children:m}),t[13]=m,t[14]=h);let g;t[15]===l?g=t[16]:(g=(0,G.jsx)(`code`,{className:`font-mono`,children:l}),t[15]=l,t[16]=g);let _=s?`Available across every OK project you open with this user account.`:`Agents resolve it via leaf → root walk-up — closest-wins on filename collision.`,v;t[17]!==g||t[18]!==_?(v=(0,G.jsxs)(ve,{children:[`Lands at `,g,`.`,` `,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==h||t[21]!==v?(y=(0,G.jsxs)(Ce,{children:[h,v]}),t[20]=h,t[21]=v,t[22]=y):y=t[22];let b;t[23]===p?b=t[24]:(b=(0,G.jsx)(be,{children:(0,G.jsx)(pc,{form:p,bodyPlaceholder:hc})}),t[23]=p,t[24]=b);let x;t[25]===i?x=t[26]:(x=()=>i(!1),t[25]=i,t[26]=x);let S;t[27]!==p.isSaving||t[28]!==x?(S=(0,G.jsx)(I,{variant:`outline`,className:`font-mono uppercase`,onClick:x,disabled:p.isSaving,children:`Cancel`}),t[27]=p.isSaving,t[28]=x,t[29]=S):S=t[29];let C;t[30]===p?C=t[31]:(C=()=>void p.submit(),t[30]=p,t[31]=C);let w=!p.canSubmit,T=p.isSaving?`Creating…`:`Create template`,E;t[32]!==C||t[33]!==w||t[34]!==T?(E=(0,G.jsx)(I,{onClick:C,disabled:w,children:T}),t[32]=C,t[33]=w,t[34]=T,t[35]=E):E=t[35];let D;t[36]!==S||t[37]!==E?(D=(0,G.jsxs)(xe,{children:[S,E]}),t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;return t[39]!==y||t[40]!==b||t[41]!==D?(O=(0,G.jsxs)(G.Fragment,{children:[y,b,D]}),t[39]=y,t[40]=b,t[41]=D,t[42]=O):O=t[42],O}function vc(e){let t=(0,U.c)(33),{folderPath:n,template:r,onOpenChange:i,onSaved:a,target:o}=e,s=r!==null,c;t[0]===i?c=t[1]:(c=function(){i(!1)},t[0]=i,t[1]=c);let l=c,u;t[2]!==l||t[3]!==a?(u=function(){a(),l()},t[2]=l,t[3]=a,t[4]=u):u=t[4];let d=u,f;t[5]===l?f=t[6]:(f=e=>e?null:l(),t[5]=l,t[6]=f);let p=r?.title??r?.name??`Template`,m;t[7]===r?.scope?m=t[8]:(m=r?.scope===`inherited`?(0,G.jsx)(z,{variant:`gray`,className:`text-2xs`,children:`inherited`}):null,t[7]=r?.scope,t[8]=m);let h;t[9]===r?.scope?h=t[10]:(h=r?.scope===`user`?(0,G.jsx)(z,{variant:`primary`,className:`text-2xs`,children:`user`}):null,t[9]=r?.scope,t[10]=h);let g;t[11]!==p||t[12]!==m||t[13]!==h?(g=(0,G.jsxs)(H,{className:`flex items-center gap-2`,children:[`Edit `,p,m,h]}),t[11]=p,t[12]=m,t[13]=h,t[14]=g):g=t[14];let _=r?.description??`Edit template`,v;t[15]===_?v=t[16]:(v=(0,G.jsx)(ve,{className:`sr-only`,children:_}),t[15]=_,t[16]=v);let y;t[17]!==g||t[18]!==v?(y=(0,G.jsxs)(Ce,{children:[g,v]}),t[17]=g,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==n||t[21]!==l||t[22]!==d||t[23]!==o||t[24]!==r?(b=r?(0,G.jsx)(yc,{folderPath:n,template:r,onCancel:l,onSaved:d,target:o},`${r.source_folder}::${r.name}`):null,t[20]=n,t[21]=l,t[22]=d,t[23]=o,t[24]=r,t[25]=b):b=t[25];let x;t[26]!==y||t[27]!==b?(x=(0,G.jsxs)(ye,{className:`sm:max-w-3xl max-h-[85vh] flex flex-col`,children:[y,b]}),t[26]=y,t[27]=b,t[28]=x):x=t[28];let S;return t[29]!==s||t[30]!==x||t[31]!==f?(S=(0,G.jsx)(we,{open:s,onOpenChange:f,children:x}),t[29]=s,t[30]=x,t[31]=f,t[32]=S):S=t[32],S}function yc(e){let t=(0,U.c)(8),{folderPath:n,template:r,onCancel:i,onSaved:a,target:o}=e,s=ti(n,r.name,o);if(s.status===`loading`||s.status===`idle`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(be,{className:`overflow-y-auto subtle-scrollbar`,children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(Jr,{className:`h-32 w-full`}),(0,G.jsx)(Jr,{className:`h-48 w-full`})]})}),t[0]=e):e=t[0],e}if(s.status===`error`){let e;return t[1]===s.message?e=t[2]:(e=(0,G.jsx)(be,{className:`overflow-y-auto subtle-scrollbar`,children:(0,G.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Failed to load template: `,s.message]})}),t[1]=s.message,t[2]=e),e}let c;return t[3]!==i||t[4]!==a||t[5]!==s.data||t[6]!==o?(c=(0,G.jsx)(bc,{detail:s.data,onCancel:i,onSaved:a,target:o}),t[3]=i,t[4]=a,t[5]=s.data,t[6]=o,t[7]=c):c=t[7],c}function bc(e){let t=(0,U.c)(42),{detail:n,onCancel:r,onSaved:i,target:a}=e,o=n.frontmatter,s=typeof o.title==`string`?o.title:``,c=typeof o.description==`string`?o.description:``,l;t[0]===o.tags?l=t[1]:(l=Array.isArray(o.tags)?o.tags.filter(xc):[],t[0]=o.tags,t[1]=l);let u;t[2]!==n.body||t[3]!==n.name||t[4]!==s||t[5]!==c||t[6]!==l?(u={name:n.name,title:s,description:c,tags:l,body:n.body},t[2]=n.body,t[3]=n.name,t[4]=s,t[5]=c,t[6]=l,t[7]=u):u=t[7];let d;t[8]===a?d=t[9]:(d=a===void 0?{}:{target:a},t[8]=a,t[9]=d);let f;t[10]!==n.folder||t[11]!==i||t[12]!==u||t[13]!==d?(f={mode:`edit`,folderPath:n.folder,initial:u,onCommitted:i,...d},t[10]=n.folder,t[11]=i,t[12]=u,t[13]=d,t[14]=f):f=t[14];let p=fc(f),m;t[15]===n.name?m=t[16]:(m=(0,G.jsxs)(`code`,{className:`font-mono`,children:[`write_document({ template: "`,n.name,`" })`]}),t[15]=n.name,t[16]=m);let h;t[17]===n.path?h=t[18]:(h=(0,G.jsx)(`code`,{className:`font-mono`,children:n.path}),t[17]=n.path,t[18]=h);let g;t[19]!==m||t[20]!==h?(g=(0,G.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Instantiate as`,` `,m,`. This template is located at `,h,`.`]}),t[19]=m,t[20]=h,t[21]=g):g=t[21];let _;t[22]===p?_=t[23]:(_=(0,G.jsx)(pc,{form:p}),t[22]=p,t[23]=_);let v;t[24]!==_||t[25]!==g?(v=(0,G.jsx)(be,{className:`overflow-y-auto subtle-scrollbar`,children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[g,_]})}),t[24]=_,t[25]=g,t[26]=v):v=t[26];let y;t[27]!==p.isSaving||t[28]!==r?(y=(0,G.jsx)(I,{variant:`outline`,className:`font-mono uppercase`,onClick:r,disabled:p.isSaving,children:`Cancel`}),t[27]=p.isSaving,t[28]=r,t[29]=y):y=t[29];let b;t[30]===p?b=t[31]:(b=()=>void p.submit(),t[30]=p,t[31]=b);let x=!p.canSubmit,S=p.isSaving?`Saving…`:`Save`,C;t[32]!==b||t[33]!==x||t[34]!==S?(C=(0,G.jsx)(I,{onClick:b,disabled:x,children:S}),t[32]=b,t[33]=x,t[34]=S,t[35]=C):C=t[35];let w;t[36]!==y||t[37]!==C?(w=(0,G.jsxs)(xe,{children:[y,C]}),t[36]=y,t[37]=C,t[38]=w):w=t[38];let T;return t[39]!==v||t[40]!==w?(T=(0,G.jsxs)(G.Fragment,{children:[v,w]}),t[39]=v,t[40]=w,t[41]=T):T=t[41],T}function xc(e){return typeof e==`string`}var Sc=`npx @inkeep/open-knowledge install-skill`,Cc=`https://inkeep.github.io/open-knowledge/guides/install-claude-cowork`;function wc(){return typeof window<`u`&&typeof window.okDesktop?.skill==`object`}function Tc(e){let t=(0,U.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,G.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 font-mono text-[0.85em]`,children:n}),t[0]=n,t[1]=r),r}function Ec(e){let t=(0,U.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=P(`font-mono tracking-wide uppercase text-primary font-medium text-xs`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,G.jsx)(`p`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function Dc(e){let t=(0,U.c)(4),{n}=e,r;t[0]===n?r=t[1]:(r=n.toString().padStart(2,`0`),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-5 w-5 shrink-0 items-center justify-center text-xs font-medium text-muted-foreground font-mono tabular-nums`,children:r}),t[2]=r,t[3]=i),i}function Oc(){let e=(0,U.c)(17),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(Ec,{children:`In the Claude Desktop App`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(Dc,{n:1}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,G.jsx)(`strong`,{className:`font-medium`,children:`Customize`}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsx)(De,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsxs)(`li`,{className:`flex gap-3`,children:[n,(0,G.jsxs)(`span`,{children:[`Open `,r,` in the sidebar`,` `,i,` `,(0,G.jsx)(`strong`,{className:`font-medium`,children:`Skills`}),`.`]})]}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(Dc,{n:2}),e[5]=o):o=e[5];let s;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(`span`,{className:`inline-flex items-center justify-center font-medium border h-5 w-5 rounded-md text-xs`,children:`+`}),e[6]=s):s=e[6];let c;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,G.jsx)(De,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[7]=c):c=e[7];let l;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,G.jsx)(`strong`,{className:`font-medium`,children:`Create skill`}),e[8]=l):l=e[8];let u;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,G.jsx)(De,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[9]=u):u=e[9];let d;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,G.jsxs)(`li`,{className:`flex gap-3`,children:[o,(0,G.jsxs)(`span`,{children:[`Click`,` `,s,` `,c,` `,l,` `,u,` `,(0,G.jsx)(`strong`,{className:`font-medium`,children:`Upload skill`}),`.`]})]}),e[10]=d):d=e[10];let f;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,G.jsx)(Dc,{n:3}),e[11]=f):f=e[11];let p;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,G.jsx)(Tc,{children:`openknowledge.skill`}),e[12]=p):p=e[12];let m;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,G.jsxs)(`ol`,{className:`flex flex-col gap-4 text-sm`,children:[a,d,(0,G.jsxs)(`li`,{className:`flex gap-3`,children:[f,(0,G.jsxs)(`span`,{children:[`Pick `,p,` from your`,` `,(0,G.jsx)(`strong`,{className:`font-medium`,children:`Downloads`}),` folder. It enables automatically.`]})]})]}),e[13]=m):m=e[13];let h;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,G.jsx)(`strong`,{className:`font-medium`,children:`Skills`}),e[14]=h):h=e[14];let g;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,G.jsx)(De,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[15]=g):g=e[15];let _;return e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t,m,(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-4`,children:[`Don't see `,h,`? Enable`,` `,(0,G.jsxs)(`strong`,{className:`font-medium`,children:[`Settings`,` `,g,` `,`Capabilities`,` `,(0,G.jsx)(De,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),` Code execution and file creation`]}),` `,`first.`]})]}),e[16]=_):_=e[16],_}function kc(e){let t=(0,U.c)(61),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={kind:`idle`},t[0]=i):i=t[0];let[a,o]=(0,W.useState)(i),[s,c]=(0,W.useState)(!1),l,u;t[1]===n?(l=t[2],u=t[3]):(l=()=>{n||(o({kind:`idle`}),c(!1))},u=[n],t[1]=n,t[2]=l,t[3]=u),(0,W.useEffect)(l,u);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=async function(){o({kind:`downloading`});let e=window.okDesktop?.skill;if(!e){o({kind:`error`,message:`Electron bridge unavailable. Refresh and try again.`});return}let t=await e.buildAndOpen();if(t.ok)o({kind:`handed-off`,path:t.path});else{let e=t.message??t.reason;de.error(`Install handoff failed: ${e}`),o({kind:`error`,message:t.reason===`open-failed`?`The Claude Desktop App didn't open the file. Is it installed? (${e})`:`${t.reason}: ${e}`})}},t[4]=f):f=t[4];let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=async function(){try{await navigator.clipboard.writeText(Sc),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){let t=e;de.error(`Couldn't copy: ${t instanceof Error?t.message:String(t)}`)}},t[5]=m):m=t[5];let h=m,g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=wc(),t[6]=g):g=t[6];let _=g,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,G.jsxs)(H,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ke,{"aria-hidden":`true`,className:`h-4 w-4`}),`Install for Claude Chat & Cowork`]}),t[7]=v):v=t[7];let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,G.jsxs)(Ce,{children:[v,(0,G.jsxs)(ve,{children:[`Adds the Open Knowledge skill to the`,` `,(0,G.jsx)(`strong`,{className:`font-medium text-foreground`,children:`Claude Desktop App`}),` so it's available in Chat and Cowork sessions.`]})]}),t[8]=y):y=t[8];let b;t[9]===a.kind?b=t[10]:(b=a.kind===`idle`&&_&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(Ec,{className:`text-muted-foreground`,children:`Automatic`}),(0,G.jsxs)(`p`,{className:`text-sm`,children:[`We'll build `,(0,G.jsx)(Tc,{children:`openknowledge.skill`}),`, save it to`,` `,(0,G.jsx)(Tc,{children:`~/Downloads`}),`, and open the Claude Desktop App for you.`]})]}),(0,G.jsx)(Oc,{})]}),t[9]=a.kind,t[10]=b);let x;t[11]!==s||t[12]!==a.kind?(x=a.kind===`idle`&&!_&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(Ec,{children:`Run this in your terminal`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border bg-muted/40 p-2`,children:[(0,G.jsx)(`code`,{className:`flex-1 font-mono text-xs`,children:Sc}),(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:h,"aria-label":`Copy command`,className:`h-7 gap-1`,children:s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(d,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copied`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Oe,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copy`]})})]}),(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Saves the file to `,(0,G.jsx)(Tc,{children:`~/Downloads/openknowledge.skill`}),` and opens the Claude Desktop App. Requires Node.js or Bun on your PATH.`]})]}),(0,G.jsx)(Oc,{})]}),t[11]=s,t[12]=a.kind,t[13]=x):x=t[13];let S;t[14]===a.kind?S=t[15]:(S=a.kind===`downloading`&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(re,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Building `,(0,G.jsx)(Tc,{children:`openknowledge.skill`}),` and opening the Claude Desktop App…`]}),t[14]=a.kind,t[15]=S);let C;t[16]!==a.kind||t[17]!==a.path?(C=a.kind===`handed-off`&&_&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,G.jsx)(d,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`File saved & Claude Desktop App opened`}),(0,G.jsx)(`code`,{className:`font-mono text-xs text-muted-foreground`,children:a.path??`~/Downloads/openknowledge.skill`})]})]}),(0,G.jsx)(Oc,{})]}),t[16]=a.kind,t[17]=a.path,t[18]=C):C=t[18];let w;t[19]===a.kind?w=t[20]:(w=a.kind===`handed-off`&&!_&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,G.jsx)(d,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`Download started`}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`File saves to `,(0,G.jsx)(Tc,{children:`~/Downloads/openknowledge.skill`}),`.`]})]})]}),(0,G.jsx)(Oc,{})]}),t[19]=a.kind,t[20]=w);let T;t[21]!==a.kind||t[22]!==a.message?(T=a.kind===`error`&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,G.jsx)(`span`,{className:`text-destructive`,children:a.message}),(0,G.jsx)(`a`,{href:Cc,target:`_blank`,rel:`noopener noreferrer`,onClick:Nc,onAuxClick:Mc,className:`text-xs underline underline-offset-2 hover:text-foreground`,children:`See the full install guide`})]}),t[21]=a.kind,t[22]=a.message,t[23]=T):T=t[23];let E;t[24]!==x||t[25]!==S||t[26]!==C||t[27]!==w||t[28]!==T||t[29]!==b?(E=(0,G.jsx)(be,{children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-6 py-2`,children:[b,x,S,C,w,T]})}),t[24]=x,t[25]=S,t[26]=C,t[27]=w,t[28]=T,t[29]=b,t[30]=E):E=t[30];let D;t[31]===a.kind?D=t[32]:(D=a.kind!==`error`&&(0,G.jsxs)(`a`,{href:Cc,target:`_blank`,rel:`noopener noreferrer`,onClick:jc,onAuxClick:Ac,className:`inline-flex items-center gap-1 self-center text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground sm:mr-auto font-mono tracking-wide uppercase`,children:[`Full guide`,(0,G.jsx)(Me,{"aria-hidden":`true`,className:`h-3 w-3`})]}),t[31]=a.kind,t[32]=D);let O;t[33]!==r||t[34]!==a.kind?(O=a.kind===`idle`&&_&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(I,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,G.jsxs)(I,{onClick:p,children:[(0,G.jsx)(ke,{"aria-hidden":`true`,className:`h-4 w-4`}),`Install`]})]}),t[33]=r,t[34]=a.kind,t[35]=O):O=t[35];let k;t[36]!==r||t[37]!==a.kind?(k=a.kind===`idle`&&!_&&(0,G.jsx)(I,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Close`}),t[36]=r,t[37]=a.kind,t[38]=k):k=t[38];let A;t[39]!==r||t[40]!==a.kind?(A=a.kind===`error`&&_&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(I,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,G.jsxs)(I,{onClick:p,children:[(0,G.jsx)(ke,{"aria-hidden":`true`,className:`h-4 w-4`}),`Try again`]})]}),t[39]=r,t[40]=a.kind,t[41]=A):A=t[41];let j;t[42]===a.kind?j=t[43]:(j=a.kind===`downloading`&&(0,G.jsxs)(I,{disabled:!0,children:[(0,G.jsx)(re,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Installing…`]}),t[42]=a.kind,t[43]=j);let M;t[44]!==r||t[45]!==a.kind?(M=a.kind===`handed-off`&&(0,G.jsx)(I,{onClick:()=>r(!1),children:`Done`}),t[44]=r,t[45]=a.kind,t[46]=M):M=t[46];let N;t[47]!==D||t[48]!==O||t[49]!==k||t[50]!==A||t[51]!==j||t[52]!==M?(N=(0,G.jsxs)(xe,{children:[D,O,k,A,j,M]}),t[47]=D,t[48]=O,t[49]=k,t[50]=A,t[51]=j,t[52]=M,t[53]=N):N=t[53];let P;t[54]!==E||t[55]!==N?(P=(0,G.jsxs)(ye,{className:`sm:max-w-lg`,"data-ok-layer-spawned":``,children:[y,E,N]}),t[54]=E,t[55]=N,t[56]=P):P=t[56];let F;return t[57]!==r||t[58]!==n||t[59]!==P?(F=(0,G.jsx)(we,{open:n,onOpenChange:r,children:P}),t[57]=r,t[58]=n,t[59]=P,t[60]=F):F=t[60],F}function Ac(e){return Re(e,Cc)}function jc(e){return Re(e,Cc)}function Mc(e){return Re(e,Cc)}function Nc(e){return Re(e,Cc)}function Pc(e){let t=(0,U.c)(9),{open:n,onOpenChange:r,onConfirm:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsx)(Ce,{children:(0,G.jsx)(fi,{})}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(be,{children:(0,G.jsx)(pi,{})}),t[1]=o):o=t[1];let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(Se,{asChild:!0,children:(0,G.jsx)(I,{variant:`outline`,children:`Cancel`})}),t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,G.jsxs)(ye,{children:[a,o,(0,G.jsxs)(xe,{children:[s,(0,G.jsx)(I,{onClick:i,children:`Enable auto-sync`})]})]}),t[3]=i,t[4]=c);let l;return t[5]!==r||t[6]!==n||t[7]!==c?(l=(0,G.jsx)(we,{open:n,onOpenChange:r,children:c}),t[5]=r,t[6]=n,t[7]=c,t[8]=l):l=t[8],l}function Fc(e){let t=e.trim();return t.length===0?{kind:`blank`,raw:e}:t.startsWith(`#`)?{kind:`comment`,raw:e}:{kind:`pattern`,raw:e,text:t}}function Ic(e){return{lines:e.split(`
|
|
9
|
-
`).map(Fc)}}function Lc(e){return e.lines.map(e=>e.raw).join(`
|
|
10
|
-
`)}function Rc(e){return e.lines.filter(e=>e.kind===`pattern`)}function zc(e,t){let n=t.trim();if(n.length===0)return e;let r={kind:`pattern`,raw:n,text:n},i=e.lines.slice(),a=i[i.length-1];return a&&a.kind===`blank`&&a.raw===``?i.splice(i.length-1,0,r):i.push(r,{kind:`blank`,raw:``}),{lines:i}}function Bc(e,t,n){let r=n.trim();if(r.length===0)return Vc(e,t);let i=Uc(e,t);if(i<0)return e;let a=e.lines.slice();return a[i]={kind:`pattern`,raw:r,text:r},{lines:a}}function Vc(e,t){let n=Uc(e,t);if(n<0)return e;let r=e.lines.slice();return r.splice(n,1),{lines:r}}function Hc(e,t,n){if(t===n)return e;let r=[],i=[];if(e.lines.forEach((e,t)=>{e.kind===`pattern`&&(r.push(t),i.push(e))}),t<0||t>=i.length||n<0||n>=i.length)return e;let a=i.slice(),[o]=a.splice(t,1);if(!o)return e;a.splice(n,0,o);let s=e.lines.slice();return r.forEach((e,t)=>{let n=a[t];n&&(s[e]=n)}),{lines:s}}function Uc(e,t){if(t<0)return-1;let n=0;for(let r=0;r<e.lines.length;r++)if(e.lines[r]?.kind===`pattern`){if(n===t)return r;n++}return-1}var Wc=new Set;function Gc(e){for(let t of Wc)try{t(e)}catch(e){console.warn(`[config-ignore-nested-error-events] listener threw:`,e)}}function Kc(e){return Wc.add(e),()=>{Wc.delete(e)}}var qc=new Set;function Jc(e){for(let t of qc)try{t(e)}catch(e){console.warn(`[config-validation-events] listener threw:`,e)}}function Yc(e){return qc.add(e),()=>{qc.delete(e)}}export{di as $,Ws as A,fa as B,Ys as C,Zs as D,Xs as E,cs as F,xi as G,yi as H,ao as I,hi as J,Si as K,uo as L,Bs as M,Is as N,$s as O,ws as P,ui as Q,ya as R,Ks as S,Js as T,bi as U,Zi as V,Ci as W,fi as X,mi as Y,pi as Z,ic as _,zc as a,Jr as at,Us as b,Ic as c,Ne as ct,Lc as d,ke as dt,ai as et,Pc as f,Oe as ft,oc as g,gc as h,Kc as i,Xr as it,Os as j,Qs as k,Vc as l,je as lt,vc as m,Yc as n,Zr as nt,Bc as o,Re as ot,kc as p,De as pt,gi as q,Gc as r,Yr as rt,Rc as s,Pe as st,Jc as t,oi as tt,Hc as u,Ae as ut,rc as v,qs as w,Gs as x,tc as y,da as z};
|