@inkeep/open-knowledge 0.0.0-dev-20260422170822 → 0.0.0-dev-20260422173457

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/cli.mjs +52 -52
  2. package/dist/constants-CuXFpexA.mjs +2 -0
  3. package/dist/index.mjs +1 -1
  4. package/dist/{init-BgeEWrPp.mjs → init-B-dtqUrZ.mjs} +2 -2
  5. package/dist/init-CLNeDBhu.mjs +1 -0
  6. package/dist/{init-C8s_H_Jn.mjs → init-DZ9zW_3F.mjs} +3 -3
  7. package/dist/{init-CQS2vHfN.mjs → init-DwAB_xuh.mjs} +1 -1
  8. package/dist/loader-C2Oc8j2H.mjs +1 -0
  9. package/dist/{loader-CXtBFptF.mjs → loader-CnFGM2kz.mjs} +2 -2
  10. package/dist/{paths-BKRpw-ZW.mjs → paths-BvevnJPJ.mjs} +2 -2
  11. package/dist/paths-DHfVldLe.mjs +1 -0
  12. package/dist/preview-BlqAxZW9.mjs +1 -0
  13. package/dist/{preview-DN07vRaX.mjs → preview-Mt4N85Jg.mjs} +2 -2
  14. package/dist/public/assets/GraphPanel-DqKpB1Tz.js +46 -0
  15. package/dist/public/assets/SourceEditor-CV7AqTwb.js +3 -0
  16. package/dist/public/assets/clipboard-D_fdmuyh.js +80 -0
  17. package/dist/public/assets/dist-BXy0xauE.js +1 -0
  18. package/dist/public/assets/dist-BZpbe8U5.js +1 -0
  19. package/dist/public/assets/dist-C0ssNH5f.js +9 -0
  20. package/dist/public/assets/dist-C5cYj6hk.js +1 -0
  21. package/dist/public/assets/dist-CYCPSCCQ.js +1 -0
  22. package/dist/public/assets/dist-CtX4SukE.js +13 -0
  23. package/dist/public/assets/dist-ztaVC3x4.js +1 -0
  24. package/dist/public/assets/index-D8ykkCB-.js +17 -0
  25. package/dist/public/assets/panel-DFRQJTBG.js +240 -0
  26. package/dist/public/assets/toggle-group-D4a_dmpa.js +1 -0
  27. package/dist/public/assets/w3c-keyname-DLDSJn4E.js +1 -0
  28. package/dist/public/index.html +8 -5
  29. package/dist/src-Cen38OjE.mjs +1 -0
  30. package/dist/start-C1PBejcl.mjs +1 -0
  31. package/dist/{start-BrwFvIYz.mjs → start-CUVYCY6u.mjs} +2 -2
  32. package/package.json +1 -1
  33. package/dist/constants-QGsi0aki.mjs +0 -2
  34. package/dist/init-BJwzXGcN.mjs +0 -1
  35. package/dist/loader-BN_JgcQQ.mjs +0 -1
  36. package/dist/paths-DJDfLPHe.mjs +0 -1
  37. package/dist/preview-CLZwbbTr.mjs +0 -1
  38. package/dist/public/assets/SourceEditor-BC0JRP-J.js +0 -3
  39. package/dist/public/assets/clipboard-DFzn1L1E.js +0 -319
  40. package/dist/public/assets/dist-BDx1Uw8h.js +0 -1
  41. package/dist/public/assets/dist-BeYy-qqT.js +0 -1
  42. package/dist/public/assets/dist-CFGINClQ.js +0 -1
  43. package/dist/public/assets/dist-CHq8nQz4.js +0 -1
  44. package/dist/public/assets/dist-D7-FnRC2.js +0 -9
  45. package/dist/public/assets/dist-DV5qRphm.js +0 -13
  46. package/dist/public/assets/dist-DhpMli6k.js +0 -1
  47. package/dist/public/assets/dist-qs1kHQVK.js +0 -1
  48. package/dist/public/assets/index-DnuxZjIi.js +0 -62
  49. package/dist/src-BEMXUtiB.mjs +0 -1
  50. package/dist/start-CU3TpA63.mjs +0 -1
  51. /package/dist/public/assets/{go-3sjGQ41x.js → go-IODVg4Ok.js} +0 -0
  52. /package/dist/public/assets/{shell-rWub3t0s.js → shell-COsTRxlr.js} +0 -0
@@ -0,0 +1 @@
1
+ import{$t as e,Bt as t,Gt as n,Ht as r,Jt as i,Kt as a,Lt as o,Qt as s,Rt as c,Ut as l,Vt as u,Wn as d,Xt as f,Yt as p,Z as m,Zt as h,an as g,bn as _,cn as v,dn as y,en as b,fn as x,in as S,ln as C,mn as w,nn as T,pn as E,qt as D,st as O,tn as k,xn as A}from"./panel-DFRQJTBG.js";var j=x(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),M=x(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),N=x(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),P=d(w(),1),F=d(A(),1),I=_(),ee=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),te=`VisuallyHidden`,ne=F.forwardRef((e,t)=>(0,I.jsx)(g.span,{...e,ref:t,style:{...ee,...e.style}}));ne.displayName=te;var L=ne;function R(e){let t=e+`CollectionProvider`,[n,r]=S(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=F.useRef(null),a=F.useRef(new Map).current;return(0,I.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=v(s),l=F.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,I.jsx)(c,{ref:y(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=v(u),p=F.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=F.useRef(null),s=y(t,o),c=a(u,n);return F.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,I.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return F.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var re=F.createContext(void 0);function z(e){let t=F.useContext(re);return e||t||`ltr`}function ie(e){let[t,n]=F.useState(void 0);return k(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var B=typeof document<`u`?F.useLayoutEffect:function(){};function V(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!V(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!V(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ae(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function oe(e,t){let n=ae(e);return Math.round(t*n)/n}function H(e){let t=F.useRef(e);return B(()=>{t.current=e}),t}function se(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[d,f]=F.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=F.useState(r);V(p,r)||m(r);let[h,g]=F.useState(null),[_,v]=F.useState(null),y=F.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=F.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=F.useRef(null),w=F.useRef(null),T=F.useRef(d),E=c!=null,D=H(c),O=H(i),k=H(l),A=F.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:p};O.current&&(e.platform=O.current),u(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!V(T.current,t)&&(T.current=t,P.flushSync(()=>{f(t)}))})},[p,t,n,O,k]);B(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[l]);let j=F.useRef(!1);B(()=>(j.current=!0,()=>{j.current=!1}),[]),B(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=F.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=F.useMemo(()=>({reference:x,floating:S}),[x,S]),I=F.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=oe(N.floating,d.x),r=oe(N.floating,d.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ae(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,d.x,d.y]);return F.useMemo(()=>({...d,update:A,refs:M,elements:N,floatingStyles:I}),[d,A,M,N,I])}var ce=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:c({element:r.current,padding:i}).fn(n):r?c({element:r,padding:i}).fn(n):{}}}},le=(e,t)=>{let n=a(e);return{name:n.name,fn:n.fn,options:[e,t]}},ue=(e,t)=>{let n=D(e);return{name:n.name,fn:n.fn,options:[e,t]}},de=(e,t)=>({fn:n(e).fn,options:[e,t]}),fe=(e,t)=>{let n=r(e);return{name:n.name,fn:n.fn,options:[e,t]}},pe=(e,t)=>{let n=i(e);return{name:n.name,fn:n.fn,options:[e,t]}},me=(e,t)=>{let n=l(e);return{name:n.name,fn:n.fn,options:[e,t]}},he=(e,t)=>{let n=ce(e);return{name:n.name,fn:n.fn,options:[e,t]}},ge=`Arrow`,_e=F.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,I.jsx)(g.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,I.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});_e.displayName=ge;var ve=_e,ye=`Popper`,[be,xe]=S(ye),[Se,Ce]=be(ye),we=e=>{let{__scopePopper:t,children:n}=e,[r,i]=F.useState(null);return(0,I.jsx)(Se,{scope:t,anchor:r,onAnchorChange:i,children:n})};we.displayName=ye;var Te=`PopperAnchor`,Ee=F.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Ce(Te,n),o=F.useRef(null),s=y(t,o),c=F.useRef(null);return F.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,I.jsx)(g.div,{...i,ref:s})});Ee.displayName=Te;var U=`PopperContent`,[De,Oe]=be(U),ke=F.forwardRef((e,n)=>{let{__scopePopper:r,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f=`partial`,hideWhenDetached:p=!1,updatePositionStrategy:m=`optimized`,onPlaced:_,...v}=e,b=Ce(U,r),[x,S]=F.useState(null),C=y(n,e=>S(e)),[w,T]=F.useState(null),E=ie(w),D=E?.width??0,O=E?.height??0,A=i+(o===`center`?``:`-`+o),j=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},M=Array.isArray(u)?u:[u],N=M.length>0,P={padding:j,boundary:M.filter(Ne),altBoundary:N},{refs:ee,floatingStyles:te,placement:ne,isPositioned:L,middlewareData:R}=se({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>t(...e,{animationFrame:m===`always`}),elements:{reference:b.anchor},middleware:[le({mainAxis:a+O,alignmentAxis:s}),l&&ue({mainAxis:!0,crossAxis:!1,limiter:f===`partial`?de():void 0,...P}),l&&fe({...P}),pe({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),w&&he({element:w,padding:c}),Pe({arrowWidth:D,arrowHeight:O}),p&&me({strategy:`referenceHidden`,...P})]}),[re,z]=Fe(ne),B=h(_);k(()=>{L&&B?.()},[L,B]);let V=R.arrow?.x,ae=R.arrow?.y,oe=R.arrow?.centerOffset!==0,[H,ce]=F.useState();return k(()=>{x&&ce(window.getComputedStyle(x).zIndex)},[x]),(0,I.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:L?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:H,"--radix-popper-transform-origin":[R.transformOrigin?.x,R.transformOrigin?.y].join(` `),...R.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,I.jsx)(De,{scope:r,placedSide:re,onArrowChange:T,arrowX:V,arrowY:ae,shouldHideArrow:oe,children:(0,I.jsx)(g.div,{"data-side":re,"data-align":z,...v,ref:C,style:{...v.style,animation:L?void 0:`none`}})})})});ke.displayName=U;var Ae=`PopperArrow`,je={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Me=F.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Oe(Ae,n),a=je[i.placedSide];return(0,I.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,I.jsx)(ve,{...r,ref:t,style:{...r.style,display:`block`}})})});Me.displayName=Ae;function Ne(e){return e!==null}var Pe=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Fe(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Fe(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Ie=we,Le=Ee,Re=ke,ze=Me,W=`rovingFocusGroup.onEntryFocus`,Be={bubbles:!1,cancelable:!0},G=`RovingFocusGroup`,[Ve,He,Ue]=R(G),[We,Ge]=S(G,[Ue]),[Ke,qe]=We(G),Je=F.forwardRef((e,t)=>(0,I.jsx)(Ve.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,I.jsx)(Ve.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,I.jsx)(Ye,{...e,ref:t})})}));Je.displayName=G;var Ye=F.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=F.useRef(null),p=y(t,f),m=z(a),[_,v]=b({prop:o,defaultProp:s??null,onChange:c,caller:G}),[x,S]=F.useState(!1),C=h(l),w=He(n),E=F.useRef(!1),[D,O]=F.useState(0);return F.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(W,C),()=>e.removeEventListener(W,C)},[C]),(0,I.jsx)(Ke,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:_,onItemFocus:F.useCallback(e=>v(e),[v]),onItemShiftTab:F.useCallback(()=>S(!0),[]),onFocusableItemAdd:F.useCallback(()=>O(e=>e+1),[]),onFocusableItemRemove:F.useCallback(()=>O(e=>e-1),[]),children:(0,I.jsx)(g.div,{tabIndex:x||D===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:T(e.onMouseDown,()=>{E.current=!0}),onFocus:T(e.onFocus,e=>{let t=!E.current;if(e.target===e.currentTarget&&t&&!x){let t=new CustomEvent(W,Be);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=w().filter(e=>e.focusable);tt([e.find(e=>e.active),e.find(e=>e.id===_),...e].filter(Boolean).map(e=>e.ref.current),u)}}E.current=!1}),onBlur:T(e.onBlur,()=>S(!1))})})}),Xe=`RovingFocusGroupItem`,Ze=F.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...c}=e,l=s(),u=a||l,d=qe(Xe,n),f=d.currentTabStopId===u,p=He(n),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:_}=d;return F.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),(0,I.jsx)(Ve.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:(0,I.jsx)(g.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...c,ref:t,onMouseDown:T(e.onMouseDown,e=>{r?d.onItemFocus(u):e.preventDefault()}),onFocus:T(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:T(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){d.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=et(e,d.orientation,d.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=p().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=d.loop?nt(n,r+1):n.slice(r+1)}setTimeout(()=>tt(n))}}),children:typeof o==`function`?o({isCurrentTabStop:f,hasTabStop:_!=null}):o})})});Ze.displayName=Xe;var Qe={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function $e(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function et(e,t,n){let r=$e(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Qe[r]}function tt(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function nt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var rt=Je,it=Ze,at=`Toggle`,ot=F.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=b({prop:n,onChange:i,defaultProp:r??!1,caller:at});return(0,I.jsx)(g.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:T(e.onClick,()=>{e.disabled||s(!o)})})});ot.displayName=at;var K=`ToggleGroup`,[st,ct]=S(K,[Ge]),lt=Ge(),ut=F.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,I.jsx)(pt,{...r,ref:t});if(n===`multiple`)return(0,I.jsx)(mt,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${K}\``)});ut.displayName=K;var[dt,ft]=st(K),pt=F.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=b({prop:n,defaultProp:r??``,onChange:i,caller:K});return(0,I.jsx)(dt,{scope:e.__scopeToggleGroup,type:`single`,value:F.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:F.useCallback(()=>s(``),[s]),children:(0,I.jsx)(_t,{...a,ref:t})})}),mt=F.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=b({prop:n,defaultProp:r??[],onChange:i,caller:K}),c=F.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=F.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,I.jsx)(dt,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,I.jsx)(_t,{...a,ref:t})})});ut.displayName=K;var[ht,gt]=st(K),_t=F.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=lt(n),u=z(o),d={role:`group`,dir:u,...c};return(0,I.jsx)(ht,{scope:n,rovingFocus:i,disabled:r,children:i?(0,I.jsx)(rt,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,I.jsx)(g.div,{...d,ref:t})}):(0,I.jsx)(g.div,{...d,ref:t})})}),q=`ToggleGroupItem`,vt=F.forwardRef((e,t)=>{let n=ft(q,e.__scopeToggleGroup),r=gt(q,e.__scopeToggleGroup),i=lt(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=F.useRef(null);return r.rovingFocus?(0,I.jsx)(it,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,I.jsx)(yt,{...s,ref:t})}):(0,I.jsx)(yt,{...s,ref:t})});vt.displayName=q;var yt=F.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=ft(q,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,I.jsx)(ot,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),bt=ut,xt=vt,[J,St]=S(`Tooltip`,[xe]),Y=xe(),Ct=`TooltipProvider`,wt=700,Tt=`tooltip.open`,[Et,Dt]=J(Ct),Ot=e=>{let{__scopeTooltip:t,delayDuration:n=wt,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=F.useRef(!0),s=F.useRef(!1),c=F.useRef(0);return F.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,I.jsx)(Et,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:F.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:F.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:F.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Ot.displayName=Ct;var X=`Tooltip`,[kt,Z]=J(X),At=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:c}=e,l=Dt(X,e.__scopeTooltip),u=Y(t),[d,f]=F.useState(null),p=s(),m=F.useRef(0),h=o??l.disableHoverableContent,g=c??l.delayDuration,_=F.useRef(!1),[v,y]=b({prop:r,defaultProp:i??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(Tt))):l.onClose(),a?.(e)},caller:X}),x=F.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),S=F.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,y(!0)},[y]),C=F.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),w=F.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,y(!0),m.current=0},g)},[g,y]);return F.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,I.jsx)(Ie,{...u,children:(0,I.jsx)(kt,{scope:t,contentId:p,open:v,stateAttribute:x,trigger:d,onTriggerChange:f,onTriggerEnter:F.useCallback(()=>{l.isOpenDelayedRef.current?w():S()},[l.isOpenDelayedRef,w,S]),onTriggerLeave:F.useCallback(()=>{h?C():(window.clearTimeout(m.current),m.current=0)},[C,h]),onOpen:S,onClose:C,disableHoverableContent:h,children:n})})};At.displayName=X;var jt=`TooltipTrigger`,Mt=F.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Z(jt,n),a=Dt(jt,n),o=Y(n),s=y(t,F.useRef(null),i.onTriggerChange),c=F.useRef(!1),l=F.useRef(!1),u=F.useCallback(()=>c.current=!1,[]);return F.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,I.jsx)(Le,{asChild:!0,...o,children:(0,I.jsx)(g.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:T(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:T(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:T(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:T(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:T(e.onBlur,i.onClose),onClick:T(e.onClick,i.onClose)})})});Mt.displayName=jt;var Nt=`TooltipPortal`,[Pt,Ft]=J(Nt,{forceMount:void 0}),It=t=>{let{__scopeTooltip:n,forceMount:r,children:i,container:a}=t,o=Z(Nt,n);return(0,I.jsx)(Pt,{scope:n,forceMount:r,children:(0,I.jsx)(e,{present:r||o.open,children:(0,I.jsx)(p,{asChild:!0,container:a,children:i})})})};It.displayName=Nt;var Q=`TooltipContent`,Lt=F.forwardRef((t,n)=>{let r=Ft(Q,t.__scopeTooltip),{forceMount:i=r.forceMount,side:a=`top`,...o}=t,s=Z(Q,t.__scopeTooltip);return(0,I.jsx)(e,{present:i||s.open,children:s.disableHoverableContent?(0,I.jsx)(Ht,{side:a,...o,ref:n}):(0,I.jsx)(Rt,{side:a,...o,ref:n})})}),Rt=F.forwardRef((e,t)=>{let n=Z(Q,e.__scopeTooltip),r=Dt(Q,e.__scopeTooltip),i=F.useRef(null),a=y(t,i),[o,s]=F.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=F.useCallback(()=>{s(null),d(!1)},[d]),p=F.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Kt(r,Gt(r,n.getBoundingClientRect())),a=qt(t.getBoundingClientRect());s(Yt([...i,...a])),d(!0)},[d]);return F.useEffect(()=>()=>f(),[f]),F.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),F.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Jt(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,I.jsx)(Ht,{...e,ref:a})}),[zt,Bt]=J(X,{isInside:!1}),Vt=C(`TooltipContent`),Ht=F.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Z(Q,n),l=Y(n),{onClose:u}=c;return F.useEffect(()=>(document.addEventListener(Tt,u),()=>document.removeEventListener(Tt,u)),[u]),F.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,I.jsx)(f,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,I.jsxs)(Re,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,I.jsx)(Vt,{children:r}),(0,I.jsx)(zt,{scope:n,isInside:!0,children:(0,I.jsx)(L,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Lt.displayName=Q;var Ut=`TooltipArrow`,Wt=F.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Y(n);return Bt(Ut,n).isInside?null:(0,I.jsx)(ze,{...i,...r,ref:t})});Wt.displayName=Ut;function Gt(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Kt(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function qt(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Jt(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 Yt(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Xt(t)}function Xt(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Zt=Ot,Qt=At,$t=Mt,en=It,tn=Lt,nn=Wt,$=E();function rn(e){let t=(0,$.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({delayDuration:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=r===void 0?0:r,a;return t[3]!==i||t[4]!==n?(a=(0,I.jsx)(Zt,{"data-slot":`tooltip-provider`,delayDuration:i,...n}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}function an(e){let t=(0,$.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,I.jsx)(Qt,{"data-slot":`tooltip`,...n}),t[2]=n,t[3]=r),r}function on(e){let t=(0,$.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,I.jsx)($t,{"data-slot":`tooltip-trigger`,...n}),t[2]=n,t[3]=r),r}function sn(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,sideOffset:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let s=a===void 0?0:a,c;t[5]===r?c=t[6]:(c=o(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 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-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 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`,r),t[5]=r,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,I.jsx)(nn,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`}),t[7]=l):l=t[7];let u;return t[8]!==n||t[9]!==i||t[10]!==s||t[11]!==c?(u=(0,I.jsx)(en,{children:(0,I.jsxs)(tn,{"data-slot":`tooltip-content`,sideOffset:s,className:c,...i,children:[n,l]})}),t[8]=n,t[9]=i,t[10]=s,t[11]=c,t[12]=u):u=t[12],u}function cn(e){switch(e.kind){case`doc`:return`doc`;case`folder`:case`folder-index`:return`folder`;case`missing`:return`missing`}}function ln(e,t){let n=m(e,t);return{resolvedTarget:n,hashDocName:n.target,displayState:cn(n)}}var un=O(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`,segmented:`text-muted-foreground hover:bg-muted-foreground/10 data-[state=on]:bg-background data-[state=on]:shadow-sm data-[state=on]:text-foreground dark:data-[state=on]:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),dn=F.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function fn(e){let t=(0,$.c)(29),n,r,i,a,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],c=t[6],l=t[7]):({className:r,variant:l,size:a,spacing:s,orientation:c,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=l);let u=s===void 0?0:s,d=c===void 0?`horizontal`:c,f;t[8]===u?f=t[9]:(f={"--gap":u},t[8]=u,t[9]=f);let p=f,m;t[10]===r?m=t[11]:(m=o(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,r),t[10]=r,t[11]=m);let h;t[12]!==d||t[13]!==a||t[14]!==u||t[15]!==l?(h={variant:l,size:a,spacing:u,orientation:d},t[12]=d,t[13]=a,t[14]=u,t[15]=l,t[16]=h):h=t[16];let g;t[17]!==n||t[18]!==h?(g=(0,I.jsx)(dn.Provider,{value:h,children:n}),t[17]=n,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==d||t[21]!==i||t[22]!==a||t[23]!==u||t[24]!==p||t[25]!==m||t[26]!==g||t[27]!==l?(_=(0,I.jsx)(bt,{"data-slot":`toggle-group`,"data-variant":l,"data-size":a,"data-spacing":u,"data-orientation":d,style:p,className:m,...i,children:g}),t[20]=d,t[21]=i,t[22]=a,t[23]=u,t[24]=p,t[25]=m,t[26]=g,t[27]=l,t[28]=_):_=t[28],_}function pn(e){let t=(0,$.c)(19),n,r,i,a,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5]):({className:r,children:n,variant:a,size:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s);let c=a===void 0?`default`:a,l=s===void 0?`default`:s,u=F.use(dn),d=u.variant||c,f=u.size||l,p=u.spacing,m;t[6]!==r||t[7]!==u.size||t[8]!==u.variant||t[9]!==l||t[10]!==c?(m=o(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,un({variant:u.variant||c,size:u.size||l}),r),t[6]=r,t[7]=u.size,t[8]=u.variant,t[9]=l,t[10]=c,t[11]=m):m=t[11];let h;return t[12]!==n||t[13]!==u.spacing||t[14]!==i||t[15]!==d||t[16]!==f||t[17]!==m?(h=(0,I.jsx)(xt,{"data-slot":`toggle-group-item`,"data-variant":d,"data-size":f,"data-spacing":p,className:m,...i,children:n}),t[12]=n,t[13]=u.spacing,t[14]=i,t[15]=d,t[16]=f,t[17]=m,t[18]=h):h=t[18],h}export{z as _,sn as a,M as b,it as c,Le as d,ze as f,ie as g,xe as h,an as i,rt as l,Ie as m,pn as n,rn as o,Re as p,ln as r,on as s,fn as t,Ge as u,R as v,j as x,N as y};
@@ -0,0 +1 @@
1
+ for(var e={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},t={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},n=typeof navigator<`u`&&/Mac/.test(navigator.platform),r=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),i=0;i<10;i++)e[48+i]=e[96+i]=String(i);for(var i=1;i<=24;i++)e[i+111]=`F`+i;for(var i=65;i<=90;i++)e[i]=String.fromCharCode(i+32),t[i]=String.fromCharCode(i);for(var a in e)t.hasOwnProperty(a)||(t[a]=e[a]);function o(i){var a=!(n&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||r&&i.shiftKey&&i.key&&i.key.length==1||i.key==`Unidentified`)&&i.key||(i.shiftKey?t:e)[i.keyCode]||i.key||`Unidentified`;return a==`Esc`&&(a=`Escape`),a==`Del`&&(a=`Delete`),a==`Left`&&(a=`ArrowLeft`),a==`Up`&&(a=`ArrowUp`),a==`Right`&&(a=`ArrowRight`),a==`Down`&&(a=`ArrowDown`),a}export{o as n,t as r,e as t};
@@ -7,11 +7,14 @@
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
8
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
9
9
  <title>Open Knowledge</title>
10
- <script type="module" crossorigin src="/assets/index-DnuxZjIi.js"></script>
11
- <link rel="modulepreload" crossorigin href="/assets/dist-DV5qRphm.js">
12
- <link rel="modulepreload" crossorigin href="/assets/dist-BDx1Uw8h.js">
13
- <link rel="modulepreload" crossorigin href="/assets/dist-DhpMli6k.js">
14
- <link rel="modulepreload" crossorigin href="/assets/clipboard-DFzn1L1E.js">
10
+ <script type="module" crossorigin src="/assets/index-D8ykkCB-.js"></script>
11
+ <link rel="modulepreload" crossorigin href="/assets/w3c-keyname-DLDSJn4E.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/panel-DFRQJTBG.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/dist-CtX4SukE.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/dist-C5cYj6hk.js">
15
+ <link rel="modulepreload" crossorigin href="/assets/dist-ztaVC3x4.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/clipboard-D_fdmuyh.js">
17
+ <link rel="modulepreload" crossorigin href="/assets/toggle-group-D4a_dmpa.js">
15
18
  <link rel="stylesheet" crossorigin href="/assets/index-BMQfimy6.css">
16
19
  </head>
17
20
 
@@ -0,0 +1 @@
1
+ import"./loader-CnFGM2kz.mjs";export{};
@@ -0,0 +1 @@
1
+ import{a as e}from"./start-CUVYCY6u.mjs";export{e as startCommand};
@@ -1,2 +1,2 @@
1
- import{a as e}from"./constants-QGsi0aki.mjs";import{D as t}from"./src-CdcLi3q2.mjs";import{Command as n}from"commander";import{closeSync as r,existsSync as i,mkdirSync as a,openSync as o}from"node:fs";import{join as s}from"node:path";import{spawn as c}from"node:child_process";function l(){let e=process.execPath,t=process.argv[1];return t?{command:e,prefixArgs:[t]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx @inkeep/open-knowledge\`. This re-introduces the version-drift surface that re-exec was fixing. Observed argv: ${JSON.stringify(process.argv)}`),{command:`npx`,prefixArgs:[`@inkeep/open-knowledge`]})}function u(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function d(e){i(e.lockDir)||a(e.lockDir,{recursive:!0});let t=o(s(e.lockDir,`last-spawn-error.log`),`w`),n=e.spawn??c,{PORT:u,...d}=process.env,f=l();try{let r=n(f.command,[...f.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:d});return r.unref(),r}finally{try{r(t)}catch{}}}function f(e){let t=e.sigtermGraceMs??1e4,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>new Promise(t=>setTimeout(t,e)));return async()=>{try{let i=e.readUiLock();if(i&&e.isAlive(i.pid))try{e.killPid(i.pid,`SIGTERM`),e.log?.info({pid:i.pid,port:i.port},`idle-shutdown: SIGTERM UI sibling`);let a=Date.now()+t;for(;Date.now()<a&&e.isAlive(i.pid);)await r(n);if(e.isAlive(i.pid))try{e.killPid(i.pid,`SIGKILL`),e.log?.warn({pid:i.pid,graceMs:t},`idle-shutdown: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: SIGKILL failed`)}}catch(t){e.log?.warn({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t instanceof Error?t.message:String(t)},`idle-shutdown: UI lookup failed; proceeding with destroy`)}await e.destroy()}}async function p(e){let{config:n,cwd:r}=e,i=e.skipAutoInit??!1,a=e.skipUiAutoSpawn??!1,o=e.idleThresholdMs??18e5,{existsSync:s,mkdirSync:c}=await import(`node:fs`),{resolve:l}=await import(`node:path`),{bootServer:p,ensureProjectGit:m,getLogger:h,isProcessAlive:g,readUiLock:_}=await import(`./src-DRRh4faC.mjs`),{resolveContentDir:v}=await import(`./paths-DJDfLPHe.mjs`),y=e.log??h(`start`),b=v(n,r);s(b)||(c(b,{recursive:!0}),y.info({contentDir:b},`Created content directory`));let x=!s(l(r,t)),S=i?void 0:async()=>{try{let{initContent:e}=await import(`./init-CQS2vHfN.mjs`),t=e(r);return x||t.created.length>0}catch(e){return console.warn(`Auto-init failed:`,e instanceof Error?e.message:e),!1}},C=!1,w=l(b,t),T=n.server.openOnAgentEdit?()=>{if(C)return;let e=_(w);if(!e||e.port<=0||!g(e.pid))return;C=!0;let t=`http://localhost:${e.port}`;import(`./open-browser-CfwaLBtR.mjs`).then(({openBrowser:e})=>e(t)).catch(()=>{})}:void 0,E=null,D=await p({contentDir:b,projectDir:r,contentRoot:n.content.dir,port:n.server.port,host:n.server.host,quiet:!1,debounce:n.persistence.debounceMs,maxDebounce:n.persistence.maxDebounceMs,includePatterns:n.content.include,excludePatterns:n.content.exclude,onAgentWrite:T,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:!0,idleShutdownMs:o,skipAutoInit:i,autoInitFn:S,ensureProjectGitFn:i?void 0:()=>m(r),spawnUiSiblingFn:async({lockDir:t})=>{if(E=u({uiLock:_(t),isAlive:g}),E.action===`spawn`&&!a)try{d({lockDir:t,cwd:r,spawn:e.spawn}),y.info({reason:E.reason},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else E.action===`skip`&&y.info({port:E.port,pid:E.pid},`UI already running at port ${E.port}`)},idleShutdownHandler:e=>f({readUiLock:()=>_(D.lockDir),isAlive:g,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:y}),log:y});return E||={action:`skip`,reason:`alive`,pid:0,port:0},{httpServer:D.httpServer,destroy:D.destroy,lockDir:D.lockDir,contentDir:b,port:D.port,ready:D.ready,degraded:D.degraded,uiSpawnDecision:E,didAutoInit:D.didAutoInit,didGitInit:D.didGitInit}}function m(r){return new n(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--no-init`,`Skip auto-scaffolding of ${t}/`).action(async n=>{let{renderBanner:i}=await import(`./banner-sRCRfb7A.mjs`),{dim:a,error:o,info:s,warning:c}=await import(`./colors-BNRrOlZZ.mjs`),l=r(),u=process.cwd();n.port!==void 0&&(l.server.port=Number(n.port)),n.host!==void 0&&(l.server.host=n.host);let d;try{d=await p({config:l,cwd:u,skipAutoInit:n.init===!1})}catch(e){let{ProjectGitInitError:t}=await import(`./src-DRRh4faC.mjs`);e instanceof t&&(console.error(o(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.`)),e.stderr&&console.error(a(e.stderr.trim())),process.exit(1)),console.error(`${o(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let f=!1,m=async e=>{if(!f){f=!0,console.log(a(`\nShutting down (${e})...`));try{await d.destroy()}catch(e){console.error(`${o(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{m(`SIGINT`)}),process.once(`SIGTERM`,()=>{m(`SIGTERM`)});let h=`http://${l.server.host}:${d.port}`,g=l.server.host===`0.0.0.0`||l.server.host===`::`?`http://0.0.0.0:${d.port}`:void 0,_=d.uiSpawnDecision,v=_.action===`skip`?_.port:3e3,y=v>0?`http://${l.server.host}:${v}`:h;console.log(i({name:`open-knowledge`,version:e,localUrl:y,apiUrl:y===h?void 0:h,networkUrl:g})),d.didAutoInit&&(console.log(` ${s(`✓`)} Scaffolded ${t}/ (first run)`),console.log(` ${a("Tip: Run `open-knowledge init` to register MCP tools for Claude Code")}\n`));let b={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};d.ready.then(async()=>{if(d.degraded.length>0){console.log();for(let e of d.degraded){let t=b[e]??`${e} (check server logs for details)`;console.warn(` ${c(`⚠`)} ${c(e)}: ${a(t)}`)}console.log()}if(d.didAutoInit||d.didGitInit)if(d.didGitInit&&console.log(`\n ${s(`✓`)} Initialized git repo at ${u}/.git/ (default branch: main)`),d.didAutoInit)try{let{previewContent:e,formatPreviewBlock:t}=await import(`./preview-CLZwbbTr.mjs`),n=e({projectDir:u,contentDir:d.contentDir,include:l.content.include,exclude:l.content.exclude});console.log(`\n${t(n,u)}\n`)}catch(e){console.warn(`Content preview unavailable: ${e instanceof Error?e.message:String(e)}`)}else console.log();if(n.open){let{openBrowser:e}=await import(`./open-browser-CfwaLBtR.mjs`);e(y)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})})}export{m as a,d as i,f as n,l as o,u as r,p as t};
2
- //# sourceMappingURL=start-BrwFvIYz.mjs.map
1
+ import{a as e}from"./constants-CuXFpexA.mjs";import{D as t}from"./src-CdcLi3q2.mjs";import{Command as n}from"commander";import{closeSync as r,existsSync as i,mkdirSync as a,openSync as o}from"node:fs";import{join as s}from"node:path";import{spawn as c}from"node:child_process";function l(){let e=process.execPath,t=process.argv[1];return t?{command:e,prefixArgs:[t]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx @inkeep/open-knowledge\`. This re-introduces the version-drift surface that re-exec was fixing. Observed argv: ${JSON.stringify(process.argv)}`),{command:`npx`,prefixArgs:[`@inkeep/open-knowledge`]})}function u(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function d(e){i(e.lockDir)||a(e.lockDir,{recursive:!0});let t=o(s(e.lockDir,`last-spawn-error.log`),`w`),n=e.spawn??c,{PORT:u,...d}=process.env,f=l();try{let r=n(f.command,[...f.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:d});return r.unref(),r}finally{try{r(t)}catch{}}}function f(e){let t=e.sigtermGraceMs??1e4,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>new Promise(t=>setTimeout(t,e)));return async()=>{try{let i=e.readUiLock();if(i&&e.isAlive(i.pid))try{e.killPid(i.pid,`SIGTERM`),e.log?.info({pid:i.pid,port:i.port},`idle-shutdown: SIGTERM UI sibling`);let a=Date.now()+t;for(;Date.now()<a&&e.isAlive(i.pid);)await r(n);if(e.isAlive(i.pid))try{e.killPid(i.pid,`SIGKILL`),e.log?.warn({pid:i.pid,graceMs:t},`idle-shutdown: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: SIGKILL failed`)}}catch(t){e.log?.warn({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t instanceof Error?t.message:String(t)},`idle-shutdown: UI lookup failed; proceeding with destroy`)}await e.destroy()}}async function p(e){let{config:n,cwd:r}=e,i=e.skipAutoInit??!1,a=e.skipUiAutoSpawn??!1,o=e.idleThresholdMs??18e5,{existsSync:s,mkdirSync:c}=await import(`node:fs`),{resolve:l}=await import(`node:path`),{bootServer:p,ensureProjectGit:m,getLogger:h,isProcessAlive:g,readUiLock:_}=await import(`./src-DRRh4faC.mjs`),{resolveContentDir:v}=await import(`./paths-DHfVldLe.mjs`),y=e.log??h(`start`),b=v(n,r);s(b)||(c(b,{recursive:!0}),y.info({contentDir:b},`Created content directory`));let x=!s(l(r,t)),S=i?void 0:async()=>{try{let{initContent:e}=await import(`./init-DwAB_xuh.mjs`),t=e(r);return x||t.created.length>0}catch(e){return console.warn(`Auto-init failed:`,e instanceof Error?e.message:e),!1}},C=!1,w=l(b,t),T=n.server.openOnAgentEdit?()=>{if(C)return;let e=_(w);if(!e||e.port<=0||!g(e.pid))return;C=!0;let t=`http://localhost:${e.port}`;import(`./open-browser-CfwaLBtR.mjs`).then(({openBrowser:e})=>e(t)).catch(()=>{})}:void 0,E=null,D=await p({contentDir:b,projectDir:r,contentRoot:n.content.dir,port:n.server.port,host:n.server.host,quiet:!1,debounce:n.persistence.debounceMs,maxDebounce:n.persistence.maxDebounceMs,includePatterns:n.content.include,excludePatterns:n.content.exclude,onAgentWrite:T,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:!0,idleShutdownMs:o,skipAutoInit:i,autoInitFn:S,ensureProjectGitFn:i?void 0:()=>m(r),spawnUiSiblingFn:async({lockDir:t})=>{if(E=u({uiLock:_(t),isAlive:g}),E.action===`spawn`&&!a)try{d({lockDir:t,cwd:r,spawn:e.spawn}),y.info({reason:E.reason},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else E.action===`skip`&&y.info({port:E.port,pid:E.pid},`UI already running at port ${E.port}`)},idleShutdownHandler:e=>f({readUiLock:()=>_(D.lockDir),isAlive:g,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:y}),log:y});return E||={action:`skip`,reason:`alive`,pid:0,port:0},{httpServer:D.httpServer,destroy:D.destroy,lockDir:D.lockDir,contentDir:b,port:D.port,ready:D.ready,degraded:D.degraded,uiSpawnDecision:E,didAutoInit:D.didAutoInit,didGitInit:D.didGitInit}}function m(r){return new n(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--no-init`,`Skip auto-scaffolding of ${t}/`).action(async n=>{let{renderBanner:i}=await import(`./banner-sRCRfb7A.mjs`),{dim:a,error:o,info:s,warning:c}=await import(`./colors-BNRrOlZZ.mjs`),l=r(),u=process.cwd();n.port!==void 0&&(l.server.port=Number(n.port)),n.host!==void 0&&(l.server.host=n.host);let d;try{d=await p({config:l,cwd:u,skipAutoInit:n.init===!1})}catch(e){let{ProjectGitInitError:t}=await import(`./src-DRRh4faC.mjs`);e instanceof t&&(console.error(o(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.`)),e.stderr&&console.error(a(e.stderr.trim())),process.exit(1)),console.error(`${o(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let f=!1,m=async e=>{if(!f){f=!0,console.log(a(`\nShutting down (${e})...`));try{await d.destroy()}catch(e){console.error(`${o(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{m(`SIGINT`)}),process.once(`SIGTERM`,()=>{m(`SIGTERM`)});let h=`http://${l.server.host}:${d.port}`,g=l.server.host===`0.0.0.0`||l.server.host===`::`?`http://0.0.0.0:${d.port}`:void 0,_=d.uiSpawnDecision,v=_.action===`skip`?_.port:3e3,y=v>0?`http://${l.server.host}:${v}`:h;console.log(i({name:`open-knowledge`,version:e,localUrl:y,apiUrl:y===h?void 0:h,networkUrl:g})),d.didAutoInit&&(console.log(` ${s(`✓`)} Scaffolded ${t}/ (first run)`),console.log(` ${a("Tip: Run `open-knowledge init` to register MCP tools for Claude Code")}\n`));let b={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};d.ready.then(async()=>{if(d.degraded.length>0){console.log();for(let e of d.degraded){let t=b[e]??`${e} (check server logs for details)`;console.warn(` ${c(`⚠`)} ${c(e)}: ${a(t)}`)}console.log()}if(d.didAutoInit||d.didGitInit)if(d.didGitInit&&console.log(`\n ${s(`✓`)} Initialized git repo at ${u}/.git/ (default branch: main)`),d.didAutoInit)try{let{previewContent:e,formatPreviewBlock:t}=await import(`./preview-BlqAxZW9.mjs`),n=e({projectDir:u,contentDir:d.contentDir,include:l.content.include,exclude:l.content.exclude});console.log(`\n${t(n,u)}\n`)}catch(e){console.warn(`Content preview unavailable: ${e instanceof Error?e.message:String(e)}`)}else console.log();if(n.open){let{openBrowser:e}=await import(`./open-browser-CfwaLBtR.mjs`);e(y)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})})}export{m as a,d as i,f as n,l as o,u as r,p as t};
2
+ //# sourceMappingURL=start-CUVYCY6u.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/open-knowledge",
3
- "version": "0.0.0-dev-20260422170822",
3
+ "version": "0.0.0-dev-20260422173457",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,2 +0,0 @@
1
- import"./src-CdcLi3q2.mjs";var e=`0.0.0-dev-20260422170822`;const t=`AGENTS.md`,n=`config.yml`,r=`cache`,i=e,a=`open-knowledge`;export{i as a,a as i,r as n,n as r,t};
2
- //# sourceMappingURL=constants-QGsi0aki.mjs.map
@@ -1 +0,0 @@
1
- import{a as e,i as t,n,r,t as i}from"./init-C8s_H_Jn.mjs";export{i as detectInstalledEditors,n as formatInitResult,r as initCommand,t as parseEditorFlag,e as runInit};
@@ -1 +0,0 @@
1
- import{n as e}from"./loader-CXtBFptF.mjs";export{e as loadConfig};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./paths-BKRpw-ZW.mjs";export{t as resolveContentDir,e as resolveLockDir};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./preview-DN07vRaX.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-BeYy-qqT.js","assets/dist-DV5qRphm.js","assets/dist-DhpMli6k.js","assets/dist-qs1kHQVK.js","assets/dist-D7-FnRC2.js","assets/dist-BDx1Uw8h.js","assets/dist-CHq8nQz4.js","assets/dist-CFGINClQ.js"])))=>i.map(i=>d[i]);
2
- import{$t as e,Ar as t,C as n,Dr as r,Fr as i,H as a,L as o,Mt as s,Nt as c,Pr as l,S as u,Sn as d,St as f,T as p,U as m,V as h,W as g,Zt as _,_ as v,a as ee,an as y,at as b,b as x,cn as S,dt as te,en as C,g as w,h as ne,in as T,it as E,jt as D,ln as O,m as re,nn as k,nt as ie,on as A,pt as ae,ri as oe,rn as j,rt as se,sn as M,t as ce,tn as N,v as le,vt as ue,w as de,x as fe,y as pe}from"./clipboard-DFzn1L1E.js";import{At as me,Gt as he,Jt as ge,Kt as P,Nt as _e,Qt as F,Vt as I,Y as L,Zt as ve,en as R,gt as z,mt as B,o as V,qt as ye,tn as be,vt as H,yt as xe}from"./dist-DV5qRphm.js";var U=oe(i(),1),Se=r(),Ce=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:T(this.yanchor),yhead:T(this.yhead)}}static fromJSON(t){return new e(k(t.yanchor),k(t.yhead))}},we=class{constructor(t,n){this.ytext=t,this.awareness=n,this.undoManager=new e(t)}toYPos(e,t=0){return j(this.ytext,e,t)}fromYPos(e){let t=N(k(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new Ce(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?P.cursor(n.pos,n.assoc):P.range(t.pos,n.pos)}},W=ge.define({combine(e){return e[e.length-1]}}),G=I.define(),Te=class{constructor(e){this.view=e,this.conf=e.state.facet(W),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[G.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(G)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
3
- `);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},Ee=H.fromClass(Te),De=z.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),Oe=I.define(),ke=class extends xe{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return y(`span`,[M(`class`,`cm-ySelectionCaret`),M(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[A(`⁠`),y(`div`,[M(`class`,`cm-ySelectionCaretDot`)]),A(`⁠`),y(`div`,[M(`class`,`cm-ySelectionInfo`)],[A(this.name)]),A(`⁠`)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},Ae=class{constructor(e){this.conf=e.state.facet(W),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[Oe.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=ve.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,n=t.doc,r=this.conf.awareness,i=[],a=this.conf.awareness.getLocalState();if(a!=null){let n=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=n?e.state.selection.main:null,o=a.cursor==null?null:k(a.cursor.anchor),s=a.cursor==null?null:k(a.cursor.head);if(i!=null){let e=j(t,i.anchor),n=j(t,i.head);(a.cursor==null||!C(o,e)||!C(s,n))&&r.setLocalStateField(`cursor`,{anchor:e,head:n})}else a.cursor!=null&&n&&r.setLocalStateField(`cursor`,null)}r.getStates().forEach((a,o)=>{if(o===r.doc.clientID)return;let s=a.cursor;if(s==null||s.anchor==null||s.head==null)return;let c=N(s.anchor,n),l=N(s.head,n);if(c==null||l==null||c.type!==t||l.type!==t)return;let{color:u=`#30bced`,name:d=`Anonymous`}=a.user||{},f=a.user&&a.user.colorLight||u+`33`,p=O(c.index,l.index),m=S(c.index,l.index),h=e.view.state.doc.lineAt(p),g=e.view.state.doc.lineAt(m);if(h.number===g.number)i.push({from:p,to:m,value:B.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})});else{i.push({from:p,to:h.from+h.length,value:B.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})}),i.push({from:g.from,to:m,value:B.mark({attributes:{style:`background-color: ${f}`},class:`cm-ySelection`})});for(let t=h.number+1;t<g.number;t++){let n=e.view.state.doc.line(t).from;i.push({from:n,to:n,value:B.line({attributes:{style:`background-color: ${f}`,class:`cm-yLineSelection`}})})}}i.push({from:l.index,to:l.index,value:B.widget({side:l.index-c.index>0?-1:1,block:!1,widget:new ke(u,d)})})}),this.decorations=B.set(i,!0)}},je=H.fromClass(Ae,{decorations:e=>e.decorations}),Me=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},K=ge.define({combine(e){return e[e.length-1]}});I.define();var Ne=class{constructor(e){this.view=e,this.conf=e.state.facet(K),this._undoManager=this.conf.undoManager,this.syncConf=e.state.facet(W),this._beforeChangeSelection=null,this._mux=_(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:t})=>{let n=t.meta.get(this);if(n){let t=this.syncConf.fromYRange(n);e.dispatch(e.state.update({selection:t,effects:[z.scrollIntoView(t)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(G)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},Pe=H.fromClass(Ne),Fe=({state:e,dispatch:t})=>e.facet(K).undo()||!0,Ie=({state:e,dispatch:t})=>e.facet(K).redo()||!0,Le=(t,n,{undoManager:r=new e(t)}={})=>{let i=new we(t,n),a=[W.of(i),Ee];return n&&a.push(De,je),r!==!1&&a.push(K.of(new Me(r)),Pe,z.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?Fe(t):e.inputType===`historyRedo`?Ie(t):!1}})),a},Re=[V.of({name:`javascript`,alias:[`js`,`jsx`],extensions:[`js`,`mjs`,`cjs`,`jsx`],load:async()=>fe({jsx:!0})}),V.of({name:`typescript`,alias:[`ts`,`tsx`],extensions:[`ts`,`mts`,`cts`,`tsx`],load:async()=>fe({typescript:!0,jsx:!0})}),V.of({name:`json`,alias:[`jsonc`],extensions:[`json`,`jsonc`],load:()=>d(()=>import(`./dist-BeYy-qqT.js`).then(e=>e.json()),__vite__mapDeps([0,1,2]))}),V.of({name:`yaml`,alias:[`yml`],extensions:[`yaml`,`yml`],load:()=>d(()=>import(`./dist-qs1kHQVK.js`).then(e=>e.yaml()),__vite__mapDeps([3,1,2]))}),V.of({name:`css`,alias:[`scss`,`less`],extensions:[`css`,`scss`,`less`],load:async()=>u()}),V.of({name:`html`,alias:[`htm`],extensions:[`html`,`htm`],load:async()=>x()}),V.of({name:`python`,alias:[`py`],extensions:[`py`,`pyw`],load:()=>d(()=>import(`./dist-D7-FnRC2.js`).then(e=>e.python()),__vite__mapDeps([4,5,1,2]))}),V.of({name:`rust`,alias:[`rs`],extensions:[`rs`],load:()=>d(()=>import(`./dist-CHq8nQz4.js`).then(e=>e.rust()),__vite__mapDeps([6,1,2]))}),V.of({name:`markdown`,alias:[`md`,`mdx`],extensions:[`md`,`mdx`,`markdown`],load:async()=>le()}),V.of({name:`bash`,alias:[`sh`,`shell`,`zsh`],extensions:[`sh`,`bash`,`zsh`],load:async()=>{let[{StreamLanguage:e,LanguageSupport:t},{shell:n}]=await Promise.all([d(()=>import(`./dist-CFGINClQ.js`),__vite__mapDeps([7,1])),d(()=>import(`./shell-rWub3t0s.js`),[])]);return new t(e.define(n))}}),V.of({name:`go`,alias:[`golang`],extensions:[`go`],load:async()=>{let[{StreamLanguage:e,LanguageSupport:t},{go:n}]=await Promise.all([d(()=>import(`./dist-CFGINClQ.js`),__vite__mapDeps([7,1])),d(()=>import(`./go-3sjGQ41x.js`),[])]);return new t(e.define(n))}})],ze=R.define(),Be=R.define(),Ve=B.line({class:`agent-flash`}),He=be.define({create(){return B.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)if(n.is(ze)){let{from:r,to:i}=n.value,a=[];for(let e=r;e<=i;){let n=t.state.doc.lineAt(e);a.push(Ve.range(n.from)),e=n.to+1}e=e.update({add:a,sort:!0})}else n.is(Be)&&(e=B.none);return e},provide:e=>z.decorations.from(e)});function Ue(e){let t=e.getMap(`activity`);return[He,H.define(e=>{let n=0,r=Date.now(),i=null,a=null,o=!1;function l(){let t=e.state.doc.length;t!==0&&(o||(e.dispatch({effects:ze.of({from:0,to:t})}),a&&clearTimeout(a),a=setTimeout(()=>{a=null,!o&&e.dispatch({effects:Be.of(null)})},D)))}let u=e=>{if(s(t),!c(t,r))return;r=Date.now();let a=Date.now();if(a-n<500){if(!i){let e=500-(a-n);i=setTimeout(()=>{i=null,n=Date.now(),l()},e)}return}n=a,l()};t.observe(u);let d=()=>{document.visibilityState===`visible`?c(t,r)&&(r=Date.now(),n=Date.now(),l()):r=Date.now()};return document.addEventListener(`visibilitychange`,d),{update(e){},destroy(){o=!0,t.unobserve(u),document.removeEventListener(`visibilitychange`,d),i&&=(clearTimeout(i),null),a&&=(clearTimeout(a),null)}}})]}var q=/\[([^\]\n]*)\]\((<[^>\n]+>|[^)\s\n]+)(?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?\)/g,We=B.mark({class:`cm-md-internal-link`});function Ge(e,t){return t>0&&e[t-1]===`!`}function Ke(e){let t=e[2]??``;return t.startsWith(`<`)&&t.endsWith(`>`)?t.slice(1,-1):t}function qe(e){let t=new F;for(let{from:n,to:r}of e.visibleRanges){let i=e.state.doc.sliceString(n,r);q.lastIndex=0;let a=q.exec(i);for(;a!==null;){let e=Ge(i,a.index)?null:ie(Ke(a));e&&e.kind!==`external`&&t.add(n+a.index,n+a.index+a[0].length,We),a=q.exec(i)}}return t.finish()}var Je=H.fromClass(class{decorations;constructor(e){this.decorations=qe(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=qe(e.view))}},{decorations:e=>e.decorations}),Ye=z.domEventHandlers({mousedown(e,t){if(!e.ctrlKey&&!e.metaKey)return!1;let n=t.posAtCoords({x:e.clientX,y:e.clientY});if(n===null)return!1;let r=t.state.doc.lineAt(n);q.lastIndex=0;let i=q.exec(r.text);for(;i!==null;){let t=r.from+i.index,a=t+i[0].length;if(n>=t&&n<=a){let t=Ge(r.text,i.index)?null:ie(Ke(i));if(t&&t.kind!==`external`)return e.preventDefault(),t.kind===`doc`&&b(e)?(E(t),!0):(se(t),!0)}i=q.exec(r.text)}return!1}}),Xe=z.theme({".cm-md-internal-link":{color:`oklch(52.7% 0.154 228.4)`,fontWeight:`500`},".cm-md-internal-link:hover":{textDecoration:`underline`,cursor:`pointer`}});function Ze(){return[Je,Ye,Xe]}var Qe=5e3,J=null,$e=0,et=null,Y=new Map;async function tt(){let e=Date.now();return J&&e-$e<Qe?J:(J=await a(),$e=e,et=ot(J),J)}async function nt(e){let t=Date.now(),n=Y.get(e);if(n!==void 0&&t-n.time<Qe)return n.headings;try{let n=await h(e);return Y.set(e,{headings:n,time:t}),n}catch(n){return console.warn(`[wiki-link-source] /api/page-headings fetch failed:`,n),Y.set(e,{headings:[],time:t}),[]}}var X=/\[\[[^\]]*?\]\]/g,rt=B.mark({class:`cm-wiki-link`}),it=B.mark({class:`cm-wiki-link cm-wiki-link-broken`});function at(e){let t=new Set;for(let n of e)t.add(n.docName.toLowerCase()),n.title&&t.add(n.title.toLowerCase());return t}function ot(e){let t=at(e);for(let n of e){let e=n.docName.split(`/`);e.pop();let r=``;for(let n of e)r=r?`${r}/${n}`:n,t.add(r.toLowerCase())}return t}function st(e){return e.split(/[#|]/)[0].trim().toLowerCase()}function ct(e){let t=new F,n=J?et:null;for(let{from:r,to:i}of e.visibleRanges){let a=e.state.doc.sliceString(r,i);X.lastIndex=0;let o=X.exec(a);for(;o!==null;){let e=rt;if(n){let t=st(o[0].slice(2,-2));t&&!n.has(t)&&(e=it)}t.add(r+o.index,r+o.index+o[0].length,e),o=X.exec(a)}}return t.finish()}var lt=H.fromClass(class{decorations;cacheWarmAtBuild;constructor(e){this.cacheWarmAtBuild=J!==null,this.decorations=ct(e),this.cacheWarmAtBuild||this.warmCache(e)}update(e){let t=J!==null;(e.docChanged||e.viewportChanged||!this.cacheWarmAtBuild&&t)&&(this.cacheWarmAtBuild=t,this.decorations=ct(e.view))}warmCache(e){tt().then(()=>{try{e.dispatch({})}catch{}}).catch(e=>{console.warn(`[wiki-link-source] warmCache fetch failed:`,e)})}},{decorations:e=>e.decorations}),Z=/\[\[([^[\]|#]+?)(?:#([^\]|]+?))?(?:\|([^\]]+?))?\]\]/g,ut=z.domEventHandlers({mousedown(e,t){if(!e.ctrlKey&&!e.metaKey)return!1;let n=t.posAtCoords({x:e.clientX,y:e.clientY});if(n===null)return!1;let r=t.state.doc.lineAt(n);Z.lastIndex=0;let i=Z.exec(r.text);for(;i!==null;){let t=r.from+i.index,a=t+i[0].length;if(n>=t&&n<=a){let t=i[1]?.trim(),n=i[2]?.trim()||null;if(t){let r=ue(t,n);if(!r)return!1;e.preventDefault(),r.kind===`external`?window.open(r.url,`_blank`,`noopener,noreferrer`):b(e)?E(r):window.location.hash=r.anchor?`#/${r.docName}?anchor=${encodeURIComponent(r.anchor)}`:`#/${r.docName}`}return!0}i=Z.exec(r.text)}return!1}});async function dt(e){let t=e.state.doc.sliceString(0,e.pos).match(/\[\[([^\]]*)$/);if(!t)return null;let n=t[1],r=e.pos-n.length,i=n.indexOf(`#`);if(i>0){let e=n.slice(0,i),t=n.slice(i+1),a=r+i+1,o=await nt(e);if(!o.length)return null;let s=m(o,t);return s.length?{from:a,filter:!1,options:s.map(e=>({label:e.text,detail:`H${e.level}`,apply(t,n,r,i){let a=t.state.doc.sliceString(i,i+2)===`]]`?``:`]]`;t.dispatch({changes:{from:r,to:i,insert:e.slug+a},selection:{anchor:r+e.slug.length+a.length}})}}))}:null}return{from:r,filter:!1,options:g(await tt().catch(e=>(console.warn(`[wiki-link-source] Failed to fetch pages:`,e),[])),n).map(e=>({label:e.title,detail:e.title===e.docName?void 0:e.docName,apply(t,n,r,i){let a=t.state.doc.sliceString(i,i+2)===`]]`?``:`]]`;t.dispatch({changes:{from:r,to:i,insert:e.docName+a},selection:{anchor:r+e.docName.length+a.length}})}}))}}var ft=z.theme({".cm-wiki-link":{color:`oklch(52.7% 0.154 228.4)`,fontWeight:`500`},".cm-wiki-link:hover":{textDecoration:`underline`,cursor:`pointer`}});function pt(){return[lt,ut,ft,pe.data.of({autocomplete:dt})]}var mt=B.mark({class:`cm-link-ref-broken`}),ht=/^\s{0,3}\[([^\]]+)\]:\s/,gt=/\[([^\]]*)\]\[([^\]]*)\]/g,_t=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function Q(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function vt(e){let t=[];return L(e).iterate({enter(e){if(_t.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function $(e){let t=new Set,n=[],r=e.doc,i=vt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(Q(n.from,i))continue;let a=ht.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!Q(t.from,i)&&!ht.test(t.text))for(gt.lastIndex=0;;){let e=gt.exec(t.text);if(!e)break;let r=t.from+e.index;if(Q(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(mt.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),B.set(a)}var yt=be.define({create(e){return $(e)},update(e,t){return t.docChanged?$(t.state):e},provide:e=>z.decorations.from(e)}),bt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,xt=B.mark({class:`cm-del`}),St=B.line({class:`cm-table-header`}),Ct=B.line({class:`cm-table-row`});function wt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function Tt(e,t){let n=[],r=L(e);for(let{from:i,to:a}of t)r.iterate({from:i,to:a,enter(t){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(xt.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=bt.exec(r.text),a=i?i[1].length:2,o=B.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=wt(r.text),a=B.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(St.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(Ct.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(Ct.range(r.from)),!1}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),B.set(n)}var Et=class{decorations;constructor(e){this.decorations=Tt(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||L(e.startState)!==L(e.state))&&(this.decorations=Tt(e.view.state,e.view.visibleRanges))}},Dt=H.fromClass(Et,{decorations:e=>e.decorations});function Ot(){return[Dt,yt]}var kt=l(),At=v({settings:{background:`var(--background)`,gutterBackground:`var(--background)`}}),jt=w({settings:{background:`var(--background)`,gutterBackground:`var(--background)`}}),Mt=new he,Nt=new he;function Pt(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&n.line(1).text===`---`){for(let e=2;e<=n.lines;e++)if(n.line(e).text===`---`){r=e+1;break}}let i=f(),a=0;for(let o=r;o<=n.lines;o++){let r=n.line(o);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(a===t.index){e.dispatch({selection:P.cursor(r.from),effects:z.scrollIntoView(r.from,{y:`start`})}),e.focus();return}a++}}}function Ft(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:P.cursor(r),effects:z.scrollIntoView(r,{y:`center`})}),e.focus()})}function It(e){let r=(0,Se.c)(29),{docName:i,ytext:a,provider:o,placeholder:s,isSourceModeActive:c}=e,l=(0,U.useRef)(null),u=(0,U.useRef)(null),[d,f]=(0,U.useState)(null);if(d)throw d;let{resolvedTheme:m}=t(),h;r[0]!==c||r[1]!==o.awareness?(h=()=>{let e=o.awareness;if(e)return e.setLocalStateField(`mode`,c?`source`:`wysiwyg`),()=>{e.setLocalStateField(`mode`,`wysiwyg`)}},r[0]=c,r[1]=o.awareness,r[2]=h):h=r[2];let g;r[3]!==c||r[4]!==o?(g=[o,c],r[3]=c,r[4]=o,r[5]=g):g=r[5],(0,U.useEffect)(h,g);let _=(0,U.useRef)(null),v;r[6]!==s||r[7]!==o||r[8]!==m||r[9]!==a?(v=()=>{let e=l.current;if(!e)return;let t=o.configuration.name??``,r,i=Lt;try{r=te({docName:t,container:e,sizeStats:{viewCount:0,bytes:a.length},factory:e=>{let t=ce({ydoc:o.document,ytext:a}),r=new z({state:ye.create({doc:a.toString(),extensions:[re,me.of([ne]),le({base:pe,extensions:[n],codeLanguages:Re}),Le(a,o.awareness),Ue(o.document),pt(),Ze(),Ot(),t,Mt.of(m===`dark`?At:jt),Nt.of(_e(s??``)),z.lineWrapping,z.theme({"&":{height:`100%`}})]}),parent:e}),c=r.contentDOM;return c.addEventListener(`keydown`,i),c.addEventListener(`paste`,i),c.addEventListener(`drop`,i),c.addEventListener(`cut`,i),{view:r,ydoc:o.document,ytext:a,provider:o}}}),_.current=r,u.current=r.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),_.current=null,u.current=null,f(t instanceof Error?t:Error(String(t)))}return()=>{let e=_.current;e&&ae(e),_.current=null,u.current=null}},r[6]=s,r[7]=o,r[8]=m,r[9]=a,r[10]=v):v=r[10];let y;r[11]!==o||r[12]!==a?(y=[a,o],r[11]=o,r[12]=a,r[13]=y):y=r[13],(0,U.useEffect)(v,y);let b,x;r[14]===m?(b=r[15],x=r[16]):(b=()=>{u.current&&u.current.dispatch({effects:Mt.reconfigure(m===`dark`?At:jt)})},x=[m],r[14]=m,r[15]=b,r[16]=x),(0,U.useEffect)(b,x);let S,C;r[17]===s?(S=r[18],C=r[19]):(S=()=>{u.current&&u.current.dispatch({effects:Nt.reconfigure(_e(s??``))})},C=[s],r[17]=s,r[18]=S,r[19]=C),(0,U.useEffect)(S,C);let w,T;r[20]!==i||r[21]!==c?(T=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!c)return;let n=u.current;n&&(Pt(n,t),de(i))};return window.addEventListener(ee,e),()=>window.removeEventListener(ee,e)},w=[i,c],r[20]=i,r[21]=c,r[22]=w,r[23]=T):(w=r[22],T=r[23]),(0,U.useEffect)(T,w);let E,D;r[24]!==i||r[25]!==c?(E=()=>{if(!c)return;let e=u.current;if(!e)return;let t=p(i);if(t){if(t.kind===`outline`){Pt(e,t.detail);return}Ft(e,t.detail)}},D=[i,c],r[24]=i,r[25]=c,r[26]=E,r[27]=D):(E=r[26],D=r[27]),(0,U.useEffect)(E,D);let O;return r[28]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,kt.jsx)(`div`,{ref:l,className:`source-editor h-full py-3`}),r[28]=O):O=r[28],O}function Lt(){return o()}export{It as SourceEditor};