@inkeep/open-knowledge 0.16.0 → 0.16.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +6 -6
- package/dist/constants-BG21qkwQ.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/{init-DkpslbhQ.mjs → init-BMMu5BcO.mjs} +3 -3
- package/dist/init-C0KhRWTF.mjs +1 -0
- package/dist/loader-B6Y12liH.mjs +1 -0
- package/dist/{loader-MW55y84t.mjs → loader-qSWystsO.mjs} +2 -2
- package/dist/{preview-hHaiN9fv.mjs → preview-BGWTw8Hu.mjs} +2 -2
- package/dist/preview-uVWB0EMr.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-BYzNZP-E.js → ActivityModeContent-CGpGpoNJ.js} +1 -1
- package/dist/public/assets/{ConsentDialogBody-C3cfuPKS.js → ConsentDialogBody-DOf6_QiW.js} +1 -1
- package/dist/public/assets/{DocumentContext-COLJhbxu.js → DocumentContext-CJWIkwAG.js} +1 -1
- package/dist/public/assets/{GraphPanel-_FO8Dj1z.js → GraphPanel-C6eExsX4.js} +1 -1
- package/dist/public/assets/{McpConsentDialogBody-CG9ncDqv.js → McpConsentDialogBody-stteh15-.js} +1 -1
- package/dist/public/assets/{OpenInAgentMenuRequestContext-DgbNofgM.js → OpenInAgentMenuRequestContext-CMr9VfoW.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-Im-nZuQD.js → SettingsDialogBody-DzH36gmM.js} +1 -1
- package/dist/public/assets/{SourceEditor-jEv8YtjM.js → SourceEditor-B_TP4DPb.js} +1 -1
- package/dist/public/assets/{TerminalPanel-BmOjKfef.js → TerminalPanel-CWe8EYvn.js} +3 -3
- package/dist/public/assets/{agent-presence-CarzuseD.js → agent-presence-DYKkeiBZ.js} +1 -1
- package/dist/public/assets/{button-CNAPefQE.js → button-CmLxDlCv.js} +1 -1
- package/dist/public/assets/{checkbox-LNtTTZgr.js → checkbox-BlEgF5ZV.js} +1 -1
- package/dist/public/assets/{collapsible-CiYR1NR5.js → collapsible-BzkAcCLq.js} +1 -1
- package/dist/public/assets/{config-validation-events-B7gv45uC.js → config-validation-events-D8FXxNcc.js} +1 -1
- package/dist/public/assets/{dialog-CtMCOb1V.js → dialog-uOgi9SAD.js} +1 -1
- package/dist/public/assets/{dist-CUqyztDT.js → dist-CSynDsuh.js} +1 -1
- package/dist/public/assets/{dist-qcpgtxJO.js → dist-C_giuVsx.js} +1 -1
- package/dist/public/assets/{dist-rFfpDyC7.js → dist-DuNRfJxD.js} +1 -1
- package/dist/public/assets/{index-BmwXZ8xM.js → index-C2PYE0X-.js} +96 -96
- package/dist/public/assets/index-GNAYzOUb.css +1 -0
- package/dist/public/assets/{panel-B_EgE6h3.js → panel-BQ1weDcE.js} +1 -1
- package/dist/public/assets/{project-paths-By95zyI0.js → project-paths-lA0ULe1F.js} +1 -1
- package/dist/public/assets/{prop-types-6by4K8X_.js → prop-types-rzyIIae9.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-Dn_E8zR8.js → target-navigation-intent-BoX1aQk3.js} +1 -1
- package/dist/public/assets/{telemetry-impl-B69NnnZ-.js → telemetry-impl-DMS50lWu.js} +1 -1
- package/dist/public/assets/{textarea-BeqA3EKD.js → textarea-DV1qaluU.js} +1 -1
- package/dist/public/assets/{toggle-group-Df7XaPvr.js → toggle-group-oSLn0Q3B.js} +1 -1
- package/dist/public/assets/{tooltip-Bp4cM4E8.js → tooltip-DjrmDp0P.js} +1 -1
- package/dist/public/index.html +20 -20
- package/dist/{repair-launch-json-DSGotwZz.mjs → repair-launch-json-6xIm32Zo.mjs} +2 -2
- package/dist/{repair-mcp-configs-DyxMTxFK.mjs → repair-mcp-configs-Dkm4l6uH.mjs} +2 -2
- package/dist/{src-ZJC5dF92.mjs → src-BLymKhjc.mjs} +2 -2
- package/dist/start-Dx6fBnt_.mjs +1 -0
- package/dist/{start-C7mMJgYI.mjs → start-lBoQ1MZl.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-BB8OuOYZ.mjs +0 -2
- package/dist/init-BNVs1xkp.mjs +0 -1
- package/dist/loader-DtUzpiqj.mjs +0 -1
- package/dist/preview-CCPEAWcn.mjs +0 -1
- package/dist/public/assets/index-Ch1_o2WE.css +0 -1
- package/dist/start-BF89k0Ti.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,o as n,t as r}from"./compiler-runtime-Cs91PcD2.js";import{c as i,l as a,u as o}from"./button-
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,o as n,t as r}from"./compiler-runtime-Cs91PcD2.js";import{c as i,l as a,u as o}from"./button-CmLxDlCv.js";import{d as s,f as c,l,s as u}from"./dist-CSynDsuh.js";import{b as d}from"./tooltip-DjrmDp0P.js";import{n as f,r as p,t as m}from"./dist-C_giuVsx.js";var h=o(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),g=e(t(),1),_=n(),v=`Toggle`,y=g.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=u({prop:n,onChange:i,defaultProp:r??!1,caller:v});return(0,_.jsx)(c.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:l(e.onClick,()=>{e.disabled||s(!o)})})});y.displayName=v;var b=y,x=`ToggleGroup`,[S,C]=s(x,[p]),w=p(),T=g.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,_.jsx)(O,{...r,ref:t});if(n===`multiple`)return(0,_.jsx)(k,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${x}\``)});T.displayName=x;var[E,D]=S(x),O=g.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=u({prop:n,defaultProp:r??``,onChange:i,caller:x});return(0,_.jsx)(E,{scope:e.__scopeToggleGroup,type:`single`,value:g.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:g.useCallback(()=>s(``),[s]),children:(0,_.jsx)(M,{...a,ref:t})})}),k=g.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=u({prop:n,defaultProp:r??[],onChange:i,caller:x}),c=g.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=g.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,_.jsx)(E,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,_.jsx)(M,{...a,ref:t})})});T.displayName=x;var[A,j]=S(x),M=g.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...l}=e,u=w(n),p=d(o),m={role:`group`,dir:p,...l};return(0,_.jsx)(A,{scope:n,rovingFocus:i,disabled:r,children:i?(0,_.jsx)(f,{asChild:!0,...u,orientation:a,dir:p,loop:s,children:(0,_.jsx)(c.div,{...m,ref:t})}):(0,_.jsx)(c.div,{...m,ref:t})})}),N=`ToggleGroupItem`,P=g.forwardRef((e,t)=>{let n=D(N,e.__scopeToggleGroup),r=j(N,e.__scopeToggleGroup),i=w(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=g.useRef(null);return r.rovingFocus?(0,_.jsx)(m,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,_.jsx)(F,{...s,ref:t})}):(0,_.jsx)(F,{...s,ref:t})});P.displayName=N;var F=g.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=D(N,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,_.jsx)(y,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),I=T,L=P,R=r(),z=i(`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`}});function B(e){let t=(0,R.c)(14),n,r,i,o;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4]):({className:n,variant:i,size:o,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o);let s=i===void 0?`default`:i,c=o===void 0?`default`:o,l;t[5]!==n||t[6]!==c||t[7]!==s?(l=a(z({variant:s,size:c,className:n})),t[5]=n,t[6]=c,t[7]=s,t[8]=l):l=t[8];let u;return t[9]!==r||t[10]!==c||t[11]!==l||t[12]!==s?(u=(0,_.jsx)(b,{"data-slot":`toggle`,"data-variant":s,"data-size":c,className:l,...r}),t[9]=r,t[10]=c,t[11]=l,t[12]=s,t[13]=u):u=t[13],u}var V=g.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function H(e){let t=(0,R.c)(29),n,r,i,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4],s=t[5],c=t[6],l=t[7]):({className:r,variant:l,size:o,spacing:s,orientation:c,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,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=a(`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]!==o||t[14]!==u||t[15]!==l?(h={variant:l,size:o,spacing:u,orientation:d},t[12]=d,t[13]=o,t[14]=u,t[15]=l,t[16]=h):h=t[16];let g;t[17]!==n||t[18]!==h?(g=(0,_.jsx)(V.Provider,{value:h,children:n}),t[17]=n,t[18]=h,t[19]=g):g=t[19];let v;return t[20]!==d||t[21]!==i||t[22]!==o||t[23]!==u||t[24]!==p||t[25]!==m||t[26]!==g||t[27]!==l?(v=(0,_.jsx)(I,{"data-slot":`toggle-group`,"data-variant":l,"data-size":o,"data-spacing":u,"data-orientation":d,style:p,className:m,...i,children:g}),t[20]=d,t[21]=i,t[22]=o,t[23]=u,t[24]=p,t[25]=m,t[26]=g,t[27]=l,t[28]=v):v=t[28],v}function U(e){let t=(0,R.c)(19),n,r,i,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4],s=t[5]):({className:r,children:n,variant:o,size:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s);let c=o===void 0?`default`:o,l=s===void 0?`default`:s,u=g.use(V),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=a(`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 text-muted-foreground data-[state=on]:text-foreground`,z({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,_.jsx)(L,{"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{h as i,U as n,B as r,H as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,o as n,t as r}from"./compiler-runtime-Cs91PcD2.js";import{a as i,d as a,i as o,l as s,s as c}from"./button-CNAPefQE.js";import{a as l,c as u,d,f,i as p,l as m,n as h,o as g,r as _,s as v,t as y}from"./dist-CUqyztDT.js";var b=e(a(),1),x=e(t(),1),S=n(),C=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`}),w=`VisuallyHidden`,T=x.forwardRef((e,t)=>(0,S.jsx)(f.span,{...e,ref:t,style:{...C,...e.style}}));T.displayName=w;var E=T;function D(e){let t=e+`CollectionProvider`,[n,r]=d(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=e=>{let{scope:t,children:n}=e,r=x.useRef(null),a=x.useRef(new Map).current;return(0,S.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};s.displayName=t;let l=e+`CollectionSlot`,u=o(l),f=x.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,S.jsx)(u,{ref:c(t,a(l,n).collectionRef),children:r})});f.displayName=l;let p=e+`CollectionItemSlot`,m=`data-radix-collection-item`,h=o(p),g=x.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=x.useRef(null),s=c(t,o),l=a(p,n);return x.useEffect(()=>(l.itemMap.set(o,{ref:o,...i}),()=>void l.itemMap.delete(o))),(0,S.jsx)(h,{[m]:``,ref:s,children:r})});g.displayName=p;function _(t){let n=a(e+`CollectionConsumer`,t);return x.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${m}]`));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:s,Slot:f,ItemSlot:g},_,r]}var O=x.createContext(void 0);function k(e){let t=x.useContext(O);return e||t||`ltr`}var A=[`top`,`right`,`bottom`,`left`],j=[`start`,`end`],M=A.reduce((e,t)=>e.concat(t,t+`-`+j[0],t+`-`+j[1]),[]),N=Math.min,P=Math.max,F=Math.round,I=Math.floor,L=e=>({x:e,y:e}),ee={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function te(e,t,n){return P(e,N(t,n))}function R(e,t){return typeof e==`function`?e(t):e}function z(e){return e.split(`-`)[0]}function B(e){return e.split(`-`)[1]}function ne(e){return e===`x`?`y`:`x`}function re(e){return e===`y`?`height`:`width`}function V(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ie(e){return ne(V(e))}function ae(e,t,n){n===void 0&&(n=!1);let r=B(e),i=ie(e),a=re(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=me(o)),[o,me(o)]}function oe(e){let t=me(e);return[se(e),t,se(t)]}function se(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ce=[`left`,`right`],le=[`right`,`left`],ue=[`top`,`bottom`],de=[`bottom`,`top`];function fe(e,t,n){switch(e){case`top`:case`bottom`:return n?t?le:ce:t?ce:le;case`left`:case`right`:return t?ue:de;default:return[]}}function pe(e,t,n,r){let i=B(e),a=fe(z(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(se)))),a}function me(e){let t=z(e);return ee[t]+e.slice(t.length)}function he(e){return{top:0,right:0,bottom:0,left:0,...e}}function ge(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:he(e)}function H(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function _e(e,t,n){let{reference:r,floating:i}=e,a=V(t),o=ie(t),s=re(o),c=z(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(B(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function ve(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=R(t,e),p=ge(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=H(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=H(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ye=50,be=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ve},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=_e(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ye&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=_e(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},xe=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=R(e,t)||{};if(l==null)return{};let d=ge(u),f={x:n,y:r},p=ie(i),m=re(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=N(d[_],T),D=N(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=te(O,A,k),M=!c.arrow&&B(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,P=M?A<O?A-O:A-k:0;return{[p]:f[p]+P,data:{[p]:j,centerOffset:A-j-P,...M&&{alignmentOffset:P}},reset:M}}});function Se(e,t,n){return(e?[...n.filter(t=>B(t)===e),...n.filter(t=>B(t)!==e)]:n.filter(e=>z(e)===e)).filter(n=>e?B(n)===e||(t?se(n)!==n:!1):!0)}var Ce=function(e){return e===void 0&&(e={}),{name:`autoPlacement`,options:e,async fn(t){let{rects:n,middlewareData:r,placement:i,platform:a,elements:o}=t,{crossAxis:s=!1,alignment:c,allowedPlacements:l=M,autoAlignment:u=!0,...d}=R(e,t),f=c!==void 0||l===M?Se(c||null,u,l):l,p=await a.detectOverflow(t,d),m=r.autoPlacement?.index||0,h=f[m];if(h==null)return{};let g=ae(h,n,await(a.isRTL==null?void 0:a.isRTL(o.floating)));if(i!==h)return{reset:{placement:f[0]}};let _=[p[z(h)],p[g[0]],p[g[1]]],v=[...r.autoPlacement?.overflows||[],{placement:h,overflows:_}],y=f[m+1];if(y)return{data:{index:m+1,overflows:v},reset:{placement:y}};let b=v.map(e=>{let t=B(e.placement);return[e.placement,t&&s?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),x=b.filter(e=>e[2].slice(0,B(e[0])?2:3).every(e=>e<=0))[0]?.[0]||b[0][0];return x===i?{}:{data:{index:m+1,overflows:v},reset:{placement:x}}}}},we=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=R(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=z(r),_=V(o),v=z(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[me(o)]:oe(o)),x=p!==`none`;!d&&x&&b.push(...pe(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ae(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==V(t))||T.every(e=>V(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=V(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Te(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ee(e){return A.some(t=>e[t]>=0)}var De=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=R(e,t);switch(i){case`referenceHidden`:{let e=Te(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ee(e)}}}case`escaped`:{let e=Te(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ee(e)}}}default:return{}}}}};function Oe(e){let t=N(...e.map(e=>e.left)),n=N(...e.map(e=>e.top)),r=P(...e.map(e=>e.right)),i=P(...e.map(e=>e.bottom));return{x:t,y:n,width:r-t,height:i-n}}function ke(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;e<t.length;e++){let i=t[e];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>H(Oe(e)))}var Ae=function(e){return e===void 0&&(e={}),{name:`inline`,options:e,async fn(t){let{placement:n,elements:r,rects:i,platform:a,strategy:o}=t,{padding:s=2,x:c,y:l}=R(e,t),u=Array.from(await(a.getClientRects==null?void 0:a.getClientRects(r.reference))||[]),d=ke(u),f=H(Oe(u)),p=ge(s);function m(){if(d.length===2&&d[0].left>d[1].right&&c!=null&&l!=null)return d.find(e=>c>e.left-p.left&&c<e.right+p.right&&l>e.top-p.top&&l<e.bottom+p.bottom)||f;if(d.length>=2){if(V(n)===`y`){let e=d[0],t=d[d.length-1],r=z(n)===`top`,i=e.top,a=t.bottom,o=r?e.left:t.left,s=r?e.right:t.right;return{top:i,bottom:a,left:o,right:s,width:s-o,height:a-i,x:o,y:i}}let e=z(n)===`left`,t=P(...d.map(e=>e.right)),r=N(...d.map(e=>e.left)),i=d.filter(n=>e?n.left===r:n.right===t),a=i[0].top,o=i[i.length-1].bottom,s=r,c=t;return{top:a,bottom:o,left:s,right:c,width:c-s,height:o-a,x:s,y:a}}return f}let h=await a.getElementRects({reference:{getBoundingClientRect:m},floating:r.floating,strategy:o});return i.reference.x!==h.reference.x||i.reference.y!==h.reference.y||i.reference.width!==h.reference.width||i.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},je=new Set([`left`,`top`]);async function Me(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=z(n),s=B(n),c=V(n)===`y`,l=je.has(o)?-1:1,u=a&&c?-1:1,d=R(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Ne=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Me(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Pe=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=R(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=V(z(i)),p=ne(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=te(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=te(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Fe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=R(e,t),u={x:n,y:r},d=V(i),f=ne(d),p=u[f],m=u[d],h=R(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=je.has(z(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ie=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=R(e,t),u=await o.detectOverflow(t,l),d=z(i),f=B(i),p=V(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=N(h-u[g],v),x=N(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=P(u.left,0),t=P(u.right,0),n=P(u.top,0),r=P(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:P(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:P(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Le(){return typeof window<`u`}function U(e){return Re(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function G(e){return((Re(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Re(e){return Le()?e instanceof Node||e instanceof W(e).Node:!1}function K(e){return Le()?e instanceof Element||e instanceof W(e).Element:!1}function q(e){return Le()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function ze(e){return!Le()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}function Be(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=X(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ve(e){return/^(table|td|th)$/.test(U(e))}function He(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ue=/transform|translate|scale|rotate|perspective|filter/,We=/paint|layout|strict|content/,J=e=>!!e&&e!==`none`,Ge;function Ke(e){let t=K(e)?X(e):e;return J(t.transform)||J(t.translate)||J(t.scale)||J(t.rotate)||J(t.perspective)||!Je()&&(J(t.backdropFilter)||J(t.filter))||Ue.test(t.willChange||``)||We.test(t.contain||``)}function qe(e){let t=Z(e);for(;q(t)&&!Y(t);){if(Ke(t))return t;if(He(t))return null;t=Z(t)}return null}function Je(){return Ge??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Ge}function Y(e){return/^(html|body|#document)$/.test(U(e))}function X(e){return W(e).getComputedStyle(e)}function Ye(e){return K(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Z(e){if(U(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ze(e)&&e.host||G(e);return ze(t)?t.host:t}function Xe(e){let t=Z(e);return Y(t)?e.ownerDocument?e.ownerDocument.body:e.body:q(t)&&Be(t)?t:Xe(t)}function Ze(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Xe(e),i=r===e.ownerDocument?.body,a=W(r);if(i){let e=Qe(a);return t.concat(a,a.visualViewport||[],Be(r)?r:[],e&&n?Ze(e):[])}else return t.concat(r,Ze(r,[],n))}function Qe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $e(e){let t=X(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=q(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=F(n)!==a||F(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function et(e){return K(e)?e:e.contextElement}function Q(e){let t=et(e);if(!q(t))return L(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=$e(t),o=(a?F(n.width):n.width)/r,s=(a?F(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var tt=L(0);function nt(e){let t=W(e);return!Je()||!t.visualViewport?tt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function rt(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function $(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=et(e),o=L(1);t&&(r?K(r)&&(o=Q(r)):o=Q(e));let s=rt(a,n,r)?nt(a):L(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=W(a),t=r&&K(r)?W(r):r,n=e,i=Qe(n);for(;i&&r&&t!==n;){let e=Q(i),t=i.getBoundingClientRect(),r=X(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=W(i),i=Qe(n)}}return H({width:u,height:d,x:c,y:l})}function it(e,t){let n=Ye(e).scrollLeft;return t?t.left+n:$(G(e)).left+n}function at(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-it(e,n),y:n.top+t.scrollTop}}function ot(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=G(r),s=t?He(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=L(1),u=L(0),d=q(r);if((d||!d&&!a)&&((U(r)!==`body`||Be(o))&&(c=Ye(r)),d)){let e=$(r);l=Q(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?at(o,c):L(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function st(e){return Array.from(e.getClientRects())}function ct(e){let t=G(e),n=Ye(e),r=e.ownerDocument.body,i=P(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=P(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+it(e),s=-n.scrollTop;return X(r).direction===`rtl`&&(o+=P(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var lt=25;function ut(e,t){let n=W(e),r=G(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Je();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=it(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=lt&&(a-=o)}else l<=lt&&(a+=l);return{width:a,height:o,x:s,y:c}}function dt(e,t){let n=$(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=q(e)?Q(e):L(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ft(e,t,n){let r;if(t===`viewport`)r=ut(e,n);else if(t===`document`)r=ct(G(e));else if(K(t))r=dt(t,n);else{let n=nt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return H(r)}function pt(e,t){let n=Z(e);return n===t||!K(n)||Y(n)?!1:X(n).position===`fixed`||pt(n,t)}function mt(e,t){let n=t.get(e);if(n)return n;let r=Ze(e,[],!1).filter(e=>K(e)&&U(e)!==`body`),i=null,a=X(e).position===`fixed`,o=a?Z(e):e;for(;K(o)&&!Y(o);){let t=X(o),n=Ke(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Be(o)&&!n&&pt(e,o))?r=r.filter(e=>e!==o):i=t,o=Z(o)}return t.set(e,r),r}function ht(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?He(t)?[]:mt(t,this._c):[].concat(n),r],o=ft(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=ft(t,a[e],i);s=P(n.top,s),c=N(n.right,c),l=N(n.bottom,l),u=P(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function gt(e){let{width:t,height:n}=$e(e);return{width:t,height:n}}function _t(e,t,n){let r=q(t),i=G(t),a=n===`fixed`,o=$(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=L(0);function l(){c.x=it(i)}if(r||!r&&!a)if((U(t)!==`body`||Be(i))&&(s=Ye(t)),r){let e=$(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?at(i,s):L(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function vt(e){return X(e).position===`static`}function yt(e,t){if(!q(e)||X(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return G(e)===n&&(n=n.ownerDocument.body),n}function bt(e,t){let n=W(e);if(He(e))return n;if(!q(e)){let t=Z(e);for(;t&&!Y(t);){if(K(t)&&!vt(t))return t;t=Z(t)}return n}let r=yt(e,t);for(;r&&Ve(r)&&vt(r);)r=yt(r,t);return r&&Y(r)&&vt(r)&&!Ke(r)?n:r||qe(e)||n}var xt=async function(e){let t=this.getOffsetParent||bt,n=this.getDimensions,r=await n(e.floating);return{reference:_t(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function St(e){return X(e).direction===`rtl`}var Ct={convertOffsetParentRelativeRectToViewportRelativeRect:ot,getDocumentElement:G,getClippingRect:ht,getOffsetParent:bt,getElementRects:xt,getClientRects:st,getDimensions:gt,getScale:Q,isElement:K,isRTL:St};function wt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Tt(e,t){let n=null,r,i=G(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=I(d),h=I(i.clientWidth-(u+f)),g=I(i.clientHeight-(d+p)),_=I(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:P(0,N(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!wt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Et(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=et(e),u=i||a?[...l?Ze(l):[],...t?Ze(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Tt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?$(e):null;c&&g();function g(){let t=$(e);h&&!wt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Dt=Ne,Ot=Ce,kt=Pe,At=we,jt=Ie,Mt=De,Nt=xe,Pt=Ae,Ft=Fe,It=(e,t,n)=>{let r=new Map,i={platform:Ct,...n},a={...i.platform,_c:r};return be(e,t,{...i,platform:a})},Lt=typeof document<`u`?x.useLayoutEffect:function(){};function Rt(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(!Rt(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)&&!Rt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function zt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bt(e,t){let n=zt(e);return Math.round(t*n)/n}function Vt(e){let t=x.useRef(e);return Lt(()=>{t.current=e}),t}function Ht(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,[u,d]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=x.useState(r);Rt(f,r)||p(r);let[m,h]=x.useState(null),[g,_]=x.useState(null),v=x.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),y=x.useCallback(e=>{e!==T.current&&(T.current=e,_(e))},[]),S=a||m,C=o||g,w=x.useRef(null),T=x.useRef(null),E=x.useRef(u),D=c!=null,O=Vt(c),k=Vt(i),A=Vt(l),j=x.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),It(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Rt(E.current,t)&&(E.current=t,b.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);Lt(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=x.useRef(!1);Lt(()=>(M.current=!0,()=>{M.current=!1}),[]),Lt(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=x.useMemo(()=>({reference:w,floating:T,setReference:v,setFloating:y}),[v,y]),P=x.useMemo(()=>({reference:S,floating:C}),[S,C]),F=x.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Bt(P.floating,u.x),r=Bt(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...zt(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var Ut=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?{}:Nt({element:r.current,padding:i}).fn(n):r?Nt({element:r,padding:i}).fn(n):{}}}},Wt=(e,t)=>{let n=Dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gt=(e,t)=>{let n=kt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kt=(e,t)=>({fn:Ft(e).fn,options:[e,t]}),qt=(e,t)=>{let n=At(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jt=(e,t)=>{let n=jt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yt=(e,t)=>{let n=Mt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xt=(e,t)=>{let n=Ut(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zt=`Arrow`,Qt=x.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,S.jsx)(f.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,S.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Qt.displayName=Zt;var $t=Qt,en=`Popper`,[tn,nn]=d(en),[rn,an]=tn(en),on=e=>{let{__scopePopper:t,children:n}=e,[r,i]=x.useState(null);return(0,S.jsx)(rn,{scope:t,anchor:r,onAnchorChange:i,children:n})};on.displayName=en;var sn=`PopperAnchor`,cn=x.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=an(sn,n),o=x.useRef(null),s=c(t,o),l=x.useRef(null);return x.useEffect(()=>{let e=l.current;l.current=r?.current||o.current,e!==l.current&&a.onAnchorChange(l.current)}),r?null:(0,S.jsx)(f.div,{...i,ref:s})});cn.displayName=sn;var ln=`PopperContent`,[un,dn]=tn(ln),fn=x.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:l=!0,collisionBoundary:d=[],collisionPadding:m=0,sticky:h=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:_=`optimized`,onPlaced:v,...b}=e,C=an(ln,n),[w,T]=x.useState(null),E=c(t,e=>T(e)),[D,O]=x.useState(null),k=y(D),A=k?.width??0,j=k?.height??0,M=r+(a===`center`?``:`-`+a),N=typeof m==`number`?m:{top:0,right:0,bottom:0,left:0,...m},P=Array.isArray(d)?d:[d],F=P.length>0,I={padding:N,boundary:P.filter(gn),altBoundary:F},{refs:L,floatingStyles:ee,placement:te,isPositioned:R,middlewareData:z}=Ht({strategy:`fixed`,placement:M,whileElementsMounted:(...e)=>Et(...e,{animationFrame:_===`always`}),elements:{reference:C.anchor},middleware:[Wt({mainAxis:i+j,alignmentAxis:o}),l&&Gt({mainAxis:!0,crossAxis:!1,limiter:h===`partial`?Kt():void 0,...I}),l&&qt({...I}),Jt({...I,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`)}}),D&&Xt({element:D,padding:s}),_n({arrowWidth:A,arrowHeight:j}),g&&Yt({strategy:`referenceHidden`,...I})]}),[B,ne]=vn(te),re=p(v);u(()=>{R&&re?.()},[R,re]);let V=z.arrow?.x,ie=z.arrow?.y,ae=z.arrow?.centerOffset!==0,[oe,se]=x.useState();return u(()=>{w&&se(window.getComputedStyle(w).zIndex)},[w]),(0,S.jsx)(`div`,{ref:L.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:R?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,S.jsx)(un,{scope:n,placedSide:B,onArrowChange:O,arrowX:V,arrowY:ie,shouldHideArrow:ae,children:(0,S.jsx)(f.div,{"data-side":B,"data-align":ne,...b,ref:E,style:{...b.style,animation:R?void 0:`none`}})})})});fn.displayName=ln;var pn=`PopperArrow`,mn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},hn=x.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=dn(pn,n),a=mn[i.placedSide];return(0,S.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,S.jsx)($t,{...r,ref:t,style:{...r.style,display:`block`}})})});hn.displayName=pn;function gn(e){return e!==null}var _n=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]=vn(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 vn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var yn=on,bn=cn,xn=fn,Sn=hn,[Cn,wn]=d(`Tooltip`,[nn]),Tn=nn(),En=`TooltipProvider`,Dn=700,On=`tooltip.open`,[kn,An]=Cn(En),jn=e=>{let{__scopeTooltip:t,delayDuration:n=Dn,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=x.useRef(!0),s=x.useRef(!1),c=x.useRef(0);return x.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,S.jsx)(kn,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:x.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};jn.displayName=En;var Mn=`Tooltip`,[Nn,Pn]=Cn(Mn),Fn=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=An(Mn,e.__scopeTooltip),u=Tn(t),[d,f]=x.useState(null),p=l(),m=x.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=x.useRef(!1),[y,b]=v({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(On))):c.onClose(),a?.(e)},caller:Mn}),C=x.useMemo(()=>y?_.current?`delayed-open`:`instant-open`:`closed`,[y]),w=x.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,b(!0)},[b]),T=x.useCallback(()=>{window.clearTimeout(m.current),m.current=0,b(!1)},[b]),E=x.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,b(!0),m.current=0},g)},[g,b]);return x.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,S.jsx)(yn,{...u,children:(0,S.jsx)(Nn,{scope:t,contentId:p,open:y,stateAttribute:C,trigger:d,onTriggerChange:f,onTriggerEnter:x.useCallback(()=>{c.isOpenDelayedRef.current?E():w()},[c.isOpenDelayedRef,E,w]),onTriggerLeave:x.useCallback(()=>{h?T():(window.clearTimeout(m.current),m.current=0)},[T,h]),onOpen:w,onClose:T,disableHoverableContent:h,children:n})})};Fn.displayName=Mn;var In=`TooltipTrigger`,Ln=x.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Pn(In,n),a=An(In,n),o=Tn(n),s=c(t,x.useRef(null),i.onTriggerChange),l=x.useRef(!1),u=x.useRef(!1),d=x.useCallback(()=>l.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,S.jsx)(bn,{asChild:!0,...o,children:(0,S.jsx)(f.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:m(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:m(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:m(e.onPointerDown,()=>{i.open&&i.onClose(),l.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:m(e.onFocus,()=>{l.current||i.onOpen()}),onBlur:m(e.onBlur,i.onClose),onClick:m(e.onClick,i.onClose)})})});Ln.displayName=In;var Rn=`TooltipPortal`,[zn,Bn]=Cn(Rn,{forceMount:void 0}),Vn=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Pn(Rn,t);return(0,S.jsx)(zn,{scope:t,forceMount:n,children:(0,S.jsx)(g,{present:n||a.open,children:(0,S.jsx)(h,{asChild:!0,container:i,children:r})})})};Vn.displayName=Rn;var Hn=`TooltipContent`,Un=x.forwardRef((e,t)=>{let n=Bn(Hn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Pn(Hn,e.__scopeTooltip);return(0,S.jsx)(g,{present:r||o.open,children:o.disableHoverableContent?(0,S.jsx)(Jn,{side:i,...a,ref:t}):(0,S.jsx)(Wn,{side:i,...a,ref:t})})}),Wn=x.forwardRef((e,t)=>{let n=Pn(Hn,e.__scopeTooltip),r=An(Hn,e.__scopeTooltip),i=x.useRef(null),a=c(t,i),[o,s]=x.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=x.useCallback(()=>{s(null),f(!1)},[f]),m=x.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Qn(r,Zn(r,n.getBoundingClientRect())),a=$n(t.getBoundingClientRect());s(tr([...i,...a])),f(!0)},[f]);return x.useEffect(()=>()=>p(),[p]),x.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),x.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!er(n,o);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,o,u,p]),(0,S.jsx)(Jn,{...e,ref:a})}),[Gn,Kn]=Cn(Mn,{isInside:!1}),qn=i(`TooltipContent`),Jn=x.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Pn(Hn,n),l=Tn(n),{onClose:u}=c;return x.useEffect(()=>(document.addEventListener(On,u),()=>document.removeEventListener(On,u)),[u]),x.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,S.jsx)(_,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,S.jsxs)(xn,{"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,S.jsx)(qn,{children:r}),(0,S.jsx)(Gn,{scope:n,isInside:!0,children:(0,S.jsx)(E,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Un.displayName=Hn;var Yn=`TooltipArrow`,Xn=x.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Tn(n);return Kn(Yn,n).isInside?null:(0,S.jsx)(Sn,{...i,...r,ref:t})});Xn.displayName=Yn;function Zn(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 Qn(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 $n(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 er(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 tr(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)),nr(t)}function nr(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 rr=jn,ir=Fn,ar=Ln,or=Vn,sr=Un,cr=Xn,lr=r();function ur(e){let t=(0,lr.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,S.jsx)(rr,{"data-slot":`tooltip-provider`,delayDuration:i,...n}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}function dr(e){let t=(0,lr.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,S.jsx)(ir,{"data-slot":`tooltip`,...n}),t[2]=n,t[3]=r),r}function fr(e){let t=(0,lr.c)(8),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({asChild:n,type:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=n?i:i??`button`,o;return t[4]!==n||t[5]!==r||t[6]!==a?(o=(0,S.jsx)(ar,{"data-slot":`tooltip-trigger`,asChild:n,type:a,...r}),t[4]=n,t[5]=r,t[6]=a,t[7]=o):o=t[7],o}function pr(e){let t=(0,lr.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 o=a===void 0?0:a,c;t[5]===r?c=t[6]:(c=s(`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-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm 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=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 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:data-[state=delayed-open]:animate-none motion-reduce:duration-0`,r),t[5]=r,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,S.jsx)(cr,{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]!==o||t[11]!==c?(u=(0,S.jsx)(or,{children:(0,S.jsxs)(sr,{"data-slot":`tooltip-content`,sideOffset:o,className:c,...i,children:[n,l]})}),t[8]=n,t[9]=i,t[10]=o,t[11]=c,t[12]=u):u=t[12],u}export{C as S,Dt as _,bn as a,k as b,yn as c,Ot as d,Et as f,Pt as g,Mt as h,fr as i,nn as l,At as m,pr as n,Sn as o,It as p,ur as r,xn as s,dr as t,Nt as u,kt as v,D as x,jt as y};
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,o as n,t as r}from"./compiler-runtime-Cs91PcD2.js";import{a as i,d as a,i as o,l as s,s as c}from"./button-CmLxDlCv.js";import{a as l,c as u,d,f,i as p,l as m,n as h,o as g,r as _,s as v,t as y}from"./dist-CSynDsuh.js";var b=e(a(),1),x=e(t(),1),S=n(),C=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`}),w=`VisuallyHidden`,T=x.forwardRef((e,t)=>(0,S.jsx)(f.span,{...e,ref:t,style:{...C,...e.style}}));T.displayName=w;var E=T;function D(e){let t=e+`CollectionProvider`,[n,r]=d(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=e=>{let{scope:t,children:n}=e,r=x.useRef(null),a=x.useRef(new Map).current;return(0,S.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};s.displayName=t;let l=e+`CollectionSlot`,u=o(l),f=x.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,S.jsx)(u,{ref:c(t,a(l,n).collectionRef),children:r})});f.displayName=l;let p=e+`CollectionItemSlot`,m=`data-radix-collection-item`,h=o(p),g=x.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=x.useRef(null),s=c(t,o),l=a(p,n);return x.useEffect(()=>(l.itemMap.set(o,{ref:o,...i}),()=>void l.itemMap.delete(o))),(0,S.jsx)(h,{[m]:``,ref:s,children:r})});g.displayName=p;function _(t){let n=a(e+`CollectionConsumer`,t);return x.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${m}]`));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:s,Slot:f,ItemSlot:g},_,r]}var O=x.createContext(void 0);function k(e){let t=x.useContext(O);return e||t||`ltr`}var A=[`top`,`right`,`bottom`,`left`],j=[`start`,`end`],M=A.reduce((e,t)=>e.concat(t,t+`-`+j[0],t+`-`+j[1]),[]),N=Math.min,P=Math.max,F=Math.round,I=Math.floor,L=e=>({x:e,y:e}),ee={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function te(e,t,n){return P(e,N(t,n))}function R(e,t){return typeof e==`function`?e(t):e}function z(e){return e.split(`-`)[0]}function B(e){return e.split(`-`)[1]}function ne(e){return e===`x`?`y`:`x`}function re(e){return e===`y`?`height`:`width`}function V(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ie(e){return ne(V(e))}function ae(e,t,n){n===void 0&&(n=!1);let r=B(e),i=ie(e),a=re(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=me(o)),[o,me(o)]}function oe(e){let t=me(e);return[se(e),t,se(t)]}function se(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ce=[`left`,`right`],le=[`right`,`left`],ue=[`top`,`bottom`],de=[`bottom`,`top`];function fe(e,t,n){switch(e){case`top`:case`bottom`:return n?t?le:ce:t?ce:le;case`left`:case`right`:return t?ue:de;default:return[]}}function pe(e,t,n,r){let i=B(e),a=fe(z(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(se)))),a}function me(e){let t=z(e);return ee[t]+e.slice(t.length)}function he(e){return{top:0,right:0,bottom:0,left:0,...e}}function ge(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:he(e)}function H(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function _e(e,t,n){let{reference:r,floating:i}=e,a=V(t),o=ie(t),s=re(o),c=z(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(B(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function ve(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=R(t,e),p=ge(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=H(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=H(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ye=50,be=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ve},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=_e(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ye&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=_e(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},xe=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=R(e,t)||{};if(l==null)return{};let d=ge(u),f={x:n,y:r},p=ie(i),m=re(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=N(d[_],T),D=N(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=te(O,A,k),M=!c.arrow&&B(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,P=M?A<O?A-O:A-k:0;return{[p]:f[p]+P,data:{[p]:j,centerOffset:A-j-P,...M&&{alignmentOffset:P}},reset:M}}});function Se(e,t,n){return(e?[...n.filter(t=>B(t)===e),...n.filter(t=>B(t)!==e)]:n.filter(e=>z(e)===e)).filter(n=>e?B(n)===e||(t?se(n)!==n:!1):!0)}var Ce=function(e){return e===void 0&&(e={}),{name:`autoPlacement`,options:e,async fn(t){let{rects:n,middlewareData:r,placement:i,platform:a,elements:o}=t,{crossAxis:s=!1,alignment:c,allowedPlacements:l=M,autoAlignment:u=!0,...d}=R(e,t),f=c!==void 0||l===M?Se(c||null,u,l):l,p=await a.detectOverflow(t,d),m=r.autoPlacement?.index||0,h=f[m];if(h==null)return{};let g=ae(h,n,await(a.isRTL==null?void 0:a.isRTL(o.floating)));if(i!==h)return{reset:{placement:f[0]}};let _=[p[z(h)],p[g[0]],p[g[1]]],v=[...r.autoPlacement?.overflows||[],{placement:h,overflows:_}],y=f[m+1];if(y)return{data:{index:m+1,overflows:v},reset:{placement:y}};let b=v.map(e=>{let t=B(e.placement);return[e.placement,t&&s?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),x=b.filter(e=>e[2].slice(0,B(e[0])?2:3).every(e=>e<=0))[0]?.[0]||b[0][0];return x===i?{}:{data:{index:m+1,overflows:v},reset:{placement:x}}}}},we=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=R(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=z(r),_=V(o),v=z(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[me(o)]:oe(o)),x=p!==`none`;!d&&x&&b.push(...pe(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ae(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==V(t))||T.every(e=>V(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=V(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Te(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ee(e){return A.some(t=>e[t]>=0)}var De=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=R(e,t);switch(i){case`referenceHidden`:{let e=Te(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ee(e)}}}case`escaped`:{let e=Te(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ee(e)}}}default:return{}}}}};function Oe(e){let t=N(...e.map(e=>e.left)),n=N(...e.map(e=>e.top)),r=P(...e.map(e=>e.right)),i=P(...e.map(e=>e.bottom));return{x:t,y:n,width:r-t,height:i-n}}function ke(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;e<t.length;e++){let i=t[e];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>H(Oe(e)))}var Ae=function(e){return e===void 0&&(e={}),{name:`inline`,options:e,async fn(t){let{placement:n,elements:r,rects:i,platform:a,strategy:o}=t,{padding:s=2,x:c,y:l}=R(e,t),u=Array.from(await(a.getClientRects==null?void 0:a.getClientRects(r.reference))||[]),d=ke(u),f=H(Oe(u)),p=ge(s);function m(){if(d.length===2&&d[0].left>d[1].right&&c!=null&&l!=null)return d.find(e=>c>e.left-p.left&&c<e.right+p.right&&l>e.top-p.top&&l<e.bottom+p.bottom)||f;if(d.length>=2){if(V(n)===`y`){let e=d[0],t=d[d.length-1],r=z(n)===`top`,i=e.top,a=t.bottom,o=r?e.left:t.left,s=r?e.right:t.right;return{top:i,bottom:a,left:o,right:s,width:s-o,height:a-i,x:o,y:i}}let e=z(n)===`left`,t=P(...d.map(e=>e.right)),r=N(...d.map(e=>e.left)),i=d.filter(n=>e?n.left===r:n.right===t),a=i[0].top,o=i[i.length-1].bottom,s=r,c=t;return{top:a,bottom:o,left:s,right:c,width:c-s,height:o-a,x:s,y:a}}return f}let h=await a.getElementRects({reference:{getBoundingClientRect:m},floating:r.floating,strategy:o});return i.reference.x!==h.reference.x||i.reference.y!==h.reference.y||i.reference.width!==h.reference.width||i.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},je=new Set([`left`,`top`]);async function Me(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=z(n),s=B(n),c=V(n)===`y`,l=je.has(o)?-1:1,u=a&&c?-1:1,d=R(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Ne=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Me(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Pe=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=R(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=V(z(i)),p=ne(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=te(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=te(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Fe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=R(e,t),u={x:n,y:r},d=V(i),f=ne(d),p=u[f],m=u[d],h=R(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=je.has(z(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ie=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=R(e,t),u=await o.detectOverflow(t,l),d=z(i),f=B(i),p=V(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=N(h-u[g],v),x=N(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=P(u.left,0),t=P(u.right,0),n=P(u.top,0),r=P(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:P(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:P(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Le(){return typeof window<`u`}function U(e){return Re(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function G(e){return((Re(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Re(e){return Le()?e instanceof Node||e instanceof W(e).Node:!1}function K(e){return Le()?e instanceof Element||e instanceof W(e).Element:!1}function q(e){return Le()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function ze(e){return!Le()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}function Be(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=X(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ve(e){return/^(table|td|th)$/.test(U(e))}function He(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ue=/transform|translate|scale|rotate|perspective|filter/,We=/paint|layout|strict|content/,J=e=>!!e&&e!==`none`,Ge;function Ke(e){let t=K(e)?X(e):e;return J(t.transform)||J(t.translate)||J(t.scale)||J(t.rotate)||J(t.perspective)||!Je()&&(J(t.backdropFilter)||J(t.filter))||Ue.test(t.willChange||``)||We.test(t.contain||``)}function qe(e){let t=Z(e);for(;q(t)&&!Y(t);){if(Ke(t))return t;if(He(t))return null;t=Z(t)}return null}function Je(){return Ge??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Ge}function Y(e){return/^(html|body|#document)$/.test(U(e))}function X(e){return W(e).getComputedStyle(e)}function Ye(e){return K(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Z(e){if(U(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ze(e)&&e.host||G(e);return ze(t)?t.host:t}function Xe(e){let t=Z(e);return Y(t)?e.ownerDocument?e.ownerDocument.body:e.body:q(t)&&Be(t)?t:Xe(t)}function Ze(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Xe(e),i=r===e.ownerDocument?.body,a=W(r);if(i){let e=Qe(a);return t.concat(a,a.visualViewport||[],Be(r)?r:[],e&&n?Ze(e):[])}else return t.concat(r,Ze(r,[],n))}function Qe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $e(e){let t=X(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=q(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=F(n)!==a||F(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function et(e){return K(e)?e:e.contextElement}function Q(e){let t=et(e);if(!q(t))return L(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=$e(t),o=(a?F(n.width):n.width)/r,s=(a?F(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var tt=L(0);function nt(e){let t=W(e);return!Je()||!t.visualViewport?tt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function rt(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function $(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=et(e),o=L(1);t&&(r?K(r)&&(o=Q(r)):o=Q(e));let s=rt(a,n,r)?nt(a):L(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=W(a),t=r&&K(r)?W(r):r,n=e,i=Qe(n);for(;i&&r&&t!==n;){let e=Q(i),t=i.getBoundingClientRect(),r=X(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=W(i),i=Qe(n)}}return H({width:u,height:d,x:c,y:l})}function it(e,t){let n=Ye(e).scrollLeft;return t?t.left+n:$(G(e)).left+n}function at(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-it(e,n),y:n.top+t.scrollTop}}function ot(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=G(r),s=t?He(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=L(1),u=L(0),d=q(r);if((d||!d&&!a)&&((U(r)!==`body`||Be(o))&&(c=Ye(r)),d)){let e=$(r);l=Q(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?at(o,c):L(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function st(e){return Array.from(e.getClientRects())}function ct(e){let t=G(e),n=Ye(e),r=e.ownerDocument.body,i=P(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=P(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+it(e),s=-n.scrollTop;return X(r).direction===`rtl`&&(o+=P(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var lt=25;function ut(e,t){let n=W(e),r=G(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Je();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=it(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=lt&&(a-=o)}else l<=lt&&(a+=l);return{width:a,height:o,x:s,y:c}}function dt(e,t){let n=$(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=q(e)?Q(e):L(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ft(e,t,n){let r;if(t===`viewport`)r=ut(e,n);else if(t===`document`)r=ct(G(e));else if(K(t))r=dt(t,n);else{let n=nt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return H(r)}function pt(e,t){let n=Z(e);return n===t||!K(n)||Y(n)?!1:X(n).position===`fixed`||pt(n,t)}function mt(e,t){let n=t.get(e);if(n)return n;let r=Ze(e,[],!1).filter(e=>K(e)&&U(e)!==`body`),i=null,a=X(e).position===`fixed`,o=a?Z(e):e;for(;K(o)&&!Y(o);){let t=X(o),n=Ke(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Be(o)&&!n&&pt(e,o))?r=r.filter(e=>e!==o):i=t,o=Z(o)}return t.set(e,r),r}function ht(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?He(t)?[]:mt(t,this._c):[].concat(n),r],o=ft(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=ft(t,a[e],i);s=P(n.top,s),c=N(n.right,c),l=N(n.bottom,l),u=P(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function gt(e){let{width:t,height:n}=$e(e);return{width:t,height:n}}function _t(e,t,n){let r=q(t),i=G(t),a=n===`fixed`,o=$(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=L(0);function l(){c.x=it(i)}if(r||!r&&!a)if((U(t)!==`body`||Be(i))&&(s=Ye(t)),r){let e=$(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?at(i,s):L(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function vt(e){return X(e).position===`static`}function yt(e,t){if(!q(e)||X(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return G(e)===n&&(n=n.ownerDocument.body),n}function bt(e,t){let n=W(e);if(He(e))return n;if(!q(e)){let t=Z(e);for(;t&&!Y(t);){if(K(t)&&!vt(t))return t;t=Z(t)}return n}let r=yt(e,t);for(;r&&Ve(r)&&vt(r);)r=yt(r,t);return r&&Y(r)&&vt(r)&&!Ke(r)?n:r||qe(e)||n}var xt=async function(e){let t=this.getOffsetParent||bt,n=this.getDimensions,r=await n(e.floating);return{reference:_t(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function St(e){return X(e).direction===`rtl`}var Ct={convertOffsetParentRelativeRectToViewportRelativeRect:ot,getDocumentElement:G,getClippingRect:ht,getOffsetParent:bt,getElementRects:xt,getClientRects:st,getDimensions:gt,getScale:Q,isElement:K,isRTL:St};function wt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Tt(e,t){let n=null,r,i=G(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=I(d),h=I(i.clientWidth-(u+f)),g=I(i.clientHeight-(d+p)),_=I(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:P(0,N(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!wt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Et(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=et(e),u=i||a?[...l?Ze(l):[],...t?Ze(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Tt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?$(e):null;c&&g();function g(){let t=$(e);h&&!wt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Dt=Ne,Ot=Ce,kt=Pe,At=we,jt=Ie,Mt=De,Nt=xe,Pt=Ae,Ft=Fe,It=(e,t,n)=>{let r=new Map,i={platform:Ct,...n},a={...i.platform,_c:r};return be(e,t,{...i,platform:a})},Lt=typeof document<`u`?x.useLayoutEffect:function(){};function Rt(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(!Rt(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)&&!Rt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function zt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bt(e,t){let n=zt(e);return Math.round(t*n)/n}function Vt(e){let t=x.useRef(e);return Lt(()=>{t.current=e}),t}function Ht(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,[u,d]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=x.useState(r);Rt(f,r)||p(r);let[m,h]=x.useState(null),[g,_]=x.useState(null),v=x.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),y=x.useCallback(e=>{e!==T.current&&(T.current=e,_(e))},[]),S=a||m,C=o||g,w=x.useRef(null),T=x.useRef(null),E=x.useRef(u),D=c!=null,O=Vt(c),k=Vt(i),A=Vt(l),j=x.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),It(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Rt(E.current,t)&&(E.current=t,b.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);Lt(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=x.useRef(!1);Lt(()=>(M.current=!0,()=>{M.current=!1}),[]),Lt(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=x.useMemo(()=>({reference:w,floating:T,setReference:v,setFloating:y}),[v,y]),P=x.useMemo(()=>({reference:S,floating:C}),[S,C]),F=x.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Bt(P.floating,u.x),r=Bt(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...zt(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var Ut=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?{}:Nt({element:r.current,padding:i}).fn(n):r?Nt({element:r,padding:i}).fn(n):{}}}},Wt=(e,t)=>{let n=Dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gt=(e,t)=>{let n=kt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kt=(e,t)=>({fn:Ft(e).fn,options:[e,t]}),qt=(e,t)=>{let n=At(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jt=(e,t)=>{let n=jt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yt=(e,t)=>{let n=Mt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xt=(e,t)=>{let n=Ut(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zt=`Arrow`,Qt=x.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,S.jsx)(f.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,S.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Qt.displayName=Zt;var $t=Qt,en=`Popper`,[tn,nn]=d(en),[rn,an]=tn(en),on=e=>{let{__scopePopper:t,children:n}=e,[r,i]=x.useState(null);return(0,S.jsx)(rn,{scope:t,anchor:r,onAnchorChange:i,children:n})};on.displayName=en;var sn=`PopperAnchor`,cn=x.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=an(sn,n),o=x.useRef(null),s=c(t,o),l=x.useRef(null);return x.useEffect(()=>{let e=l.current;l.current=r?.current||o.current,e!==l.current&&a.onAnchorChange(l.current)}),r?null:(0,S.jsx)(f.div,{...i,ref:s})});cn.displayName=sn;var ln=`PopperContent`,[un,dn]=tn(ln),fn=x.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:l=!0,collisionBoundary:d=[],collisionPadding:m=0,sticky:h=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:_=`optimized`,onPlaced:v,...b}=e,C=an(ln,n),[w,T]=x.useState(null),E=c(t,e=>T(e)),[D,O]=x.useState(null),k=y(D),A=k?.width??0,j=k?.height??0,M=r+(a===`center`?``:`-`+a),N=typeof m==`number`?m:{top:0,right:0,bottom:0,left:0,...m},P=Array.isArray(d)?d:[d],F=P.length>0,I={padding:N,boundary:P.filter(gn),altBoundary:F},{refs:L,floatingStyles:ee,placement:te,isPositioned:R,middlewareData:z}=Ht({strategy:`fixed`,placement:M,whileElementsMounted:(...e)=>Et(...e,{animationFrame:_===`always`}),elements:{reference:C.anchor},middleware:[Wt({mainAxis:i+j,alignmentAxis:o}),l&&Gt({mainAxis:!0,crossAxis:!1,limiter:h===`partial`?Kt():void 0,...I}),l&&qt({...I}),Jt({...I,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`)}}),D&&Xt({element:D,padding:s}),_n({arrowWidth:A,arrowHeight:j}),g&&Yt({strategy:`referenceHidden`,...I})]}),[B,ne]=vn(te),re=p(v);u(()=>{R&&re?.()},[R,re]);let V=z.arrow?.x,ie=z.arrow?.y,ae=z.arrow?.centerOffset!==0,[oe,se]=x.useState();return u(()=>{w&&se(window.getComputedStyle(w).zIndex)},[w]),(0,S.jsx)(`div`,{ref:L.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:R?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,S.jsx)(un,{scope:n,placedSide:B,onArrowChange:O,arrowX:V,arrowY:ie,shouldHideArrow:ae,children:(0,S.jsx)(f.div,{"data-side":B,"data-align":ne,...b,ref:E,style:{...b.style,animation:R?void 0:`none`}})})})});fn.displayName=ln;var pn=`PopperArrow`,mn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},hn=x.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=dn(pn,n),a=mn[i.placedSide];return(0,S.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,S.jsx)($t,{...r,ref:t,style:{...r.style,display:`block`}})})});hn.displayName=pn;function gn(e){return e!==null}var _n=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]=vn(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 vn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var yn=on,bn=cn,xn=fn,Sn=hn,[Cn,wn]=d(`Tooltip`,[nn]),Tn=nn(),En=`TooltipProvider`,Dn=700,On=`tooltip.open`,[kn,An]=Cn(En),jn=e=>{let{__scopeTooltip:t,delayDuration:n=Dn,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=x.useRef(!0),s=x.useRef(!1),c=x.useRef(0);return x.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,S.jsx)(kn,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:x.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};jn.displayName=En;var Mn=`Tooltip`,[Nn,Pn]=Cn(Mn),Fn=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=An(Mn,e.__scopeTooltip),u=Tn(t),[d,f]=x.useState(null),p=l(),m=x.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=x.useRef(!1),[y,b]=v({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(On))):c.onClose(),a?.(e)},caller:Mn}),C=x.useMemo(()=>y?_.current?`delayed-open`:`instant-open`:`closed`,[y]),w=x.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,b(!0)},[b]),T=x.useCallback(()=>{window.clearTimeout(m.current),m.current=0,b(!1)},[b]),E=x.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,b(!0),m.current=0},g)},[g,b]);return x.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,S.jsx)(yn,{...u,children:(0,S.jsx)(Nn,{scope:t,contentId:p,open:y,stateAttribute:C,trigger:d,onTriggerChange:f,onTriggerEnter:x.useCallback(()=>{c.isOpenDelayedRef.current?E():w()},[c.isOpenDelayedRef,E,w]),onTriggerLeave:x.useCallback(()=>{h?T():(window.clearTimeout(m.current),m.current=0)},[T,h]),onOpen:w,onClose:T,disableHoverableContent:h,children:n})})};Fn.displayName=Mn;var In=`TooltipTrigger`,Ln=x.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Pn(In,n),a=An(In,n),o=Tn(n),s=c(t,x.useRef(null),i.onTriggerChange),l=x.useRef(!1),u=x.useRef(!1),d=x.useCallback(()=>l.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,S.jsx)(bn,{asChild:!0,...o,children:(0,S.jsx)(f.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:m(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:m(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:m(e.onPointerDown,()=>{i.open&&i.onClose(),l.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:m(e.onFocus,()=>{l.current||i.onOpen()}),onBlur:m(e.onBlur,i.onClose),onClick:m(e.onClick,i.onClose)})})});Ln.displayName=In;var Rn=`TooltipPortal`,[zn,Bn]=Cn(Rn,{forceMount:void 0}),Vn=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Pn(Rn,t);return(0,S.jsx)(zn,{scope:t,forceMount:n,children:(0,S.jsx)(g,{present:n||a.open,children:(0,S.jsx)(h,{asChild:!0,container:i,children:r})})})};Vn.displayName=Rn;var Hn=`TooltipContent`,Un=x.forwardRef((e,t)=>{let n=Bn(Hn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Pn(Hn,e.__scopeTooltip);return(0,S.jsx)(g,{present:r||o.open,children:o.disableHoverableContent?(0,S.jsx)(Jn,{side:i,...a,ref:t}):(0,S.jsx)(Wn,{side:i,...a,ref:t})})}),Wn=x.forwardRef((e,t)=>{let n=Pn(Hn,e.__scopeTooltip),r=An(Hn,e.__scopeTooltip),i=x.useRef(null),a=c(t,i),[o,s]=x.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=x.useCallback(()=>{s(null),f(!1)},[f]),m=x.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Qn(r,Zn(r,n.getBoundingClientRect())),a=$n(t.getBoundingClientRect());s(tr([...i,...a])),f(!0)},[f]);return x.useEffect(()=>()=>p(),[p]),x.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),x.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!er(n,o);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,o,u,p]),(0,S.jsx)(Jn,{...e,ref:a})}),[Gn,Kn]=Cn(Mn,{isInside:!1}),qn=i(`TooltipContent`),Jn=x.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Pn(Hn,n),l=Tn(n),{onClose:u}=c;return x.useEffect(()=>(document.addEventListener(On,u),()=>document.removeEventListener(On,u)),[u]),x.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,S.jsx)(_,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,S.jsxs)(xn,{"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,S.jsx)(qn,{children:r}),(0,S.jsx)(Gn,{scope:n,isInside:!0,children:(0,S.jsx)(E,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Un.displayName=Hn;var Yn=`TooltipArrow`,Xn=x.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Tn(n);return Kn(Yn,n).isInside?null:(0,S.jsx)(Sn,{...i,...r,ref:t})});Xn.displayName=Yn;function Zn(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 Qn(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 $n(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 er(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 tr(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)),nr(t)}function nr(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 rr=jn,ir=Fn,ar=Ln,or=Vn,sr=Un,cr=Xn,lr=r();function ur(e){let t=(0,lr.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,S.jsx)(rr,{"data-slot":`tooltip-provider`,delayDuration:i,...n}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}function dr(e){let t=(0,lr.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,S.jsx)(ir,{"data-slot":`tooltip`,...n}),t[2]=n,t[3]=r),r}function fr(e){let t=(0,lr.c)(8),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({asChild:n,type:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=n?i:i??`button`,o;return t[4]!==n||t[5]!==r||t[6]!==a?(o=(0,S.jsx)(ar,{"data-slot":`tooltip-trigger`,asChild:n,type:a,...r}),t[4]=n,t[5]=r,t[6]=a,t[7]=o):o=t[7],o}function pr(e){let t=(0,lr.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 o=a===void 0?0:a,c;t[5]===r?c=t[6]:(c=s(`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-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm 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=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 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:data-[state=delayed-open]:animate-none motion-reduce:duration-0`,r),t[5]=r,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,S.jsx)(cr,{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]!==o||t[11]!==c?(u=(0,S.jsx)(or,{children:(0,S.jsxs)(sr,{"data-slot":`tooltip-content`,sideOffset:o,className:c,...i,children:[n,l]})}),t[8]=n,t[9]=i,t[10]=o,t[11]=c,t[12]=u):u=t[12],u}export{C as S,Dt as _,bn as a,k as b,yn as c,Ot as d,Et as f,Pt as g,Mt as h,fr as i,nn as l,At as m,pr as n,Sn as o,It as p,ur as r,xn as s,dr as t,Nt as u,kt as v,D as x,jt as y};
|
package/dist/public/index.html
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
-->
|
|
49
49
|
<script>(() => { let t = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (r === 'light' || r === 'dark' || r === 'system') t = r; } catch {} let dark = t === 'dark'; if (t === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } if (dark) document.documentElement.classList.add('dark'); if (window.okDesktop) document.documentElement.classList.add('electron-mode'); })();</script>
|
|
50
50
|
<style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
|
|
51
|
-
<script type="module" crossorigin src="./assets/index-
|
|
51
|
+
<script type="module" crossorigin src="./assets/index-C2PYE0X-.js"></script>
|
|
52
52
|
<link rel="modulepreload" crossorigin href="./assets/chunk-CFjPhJqf.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-2ej06EnG.js">
|
|
54
54
|
<link rel="modulepreload" crossorigin href="./assets/w3c-keyname-nBRha8PK.js">
|
|
@@ -63,32 +63,32 @@
|
|
|
63
63
|
<link rel="modulepreload" crossorigin href="./assets/dist-pSQcUvmU.js">
|
|
64
64
|
<link rel="modulepreload" crossorigin href="./assets/stex-CGHNatva.js">
|
|
65
65
|
<link rel="modulepreload" crossorigin href="./assets/compiler-runtime-Cs91PcD2.js">
|
|
66
|
-
<link rel="modulepreload" crossorigin href="./assets/button-
|
|
67
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
68
|
-
<link rel="modulepreload" crossorigin href="./assets/tooltip-
|
|
66
|
+
<link rel="modulepreload" crossorigin href="./assets/button-CmLxDlCv.js">
|
|
67
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-CSynDsuh.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="./assets/tooltip-DjrmDp0P.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="./assets/trace-api-DPMyR1_m.js">
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/dist-CP3jvVRS.js">
|
|
71
|
-
<link rel="modulepreload" crossorigin href="./assets/prop-types-
|
|
71
|
+
<link rel="modulepreload" crossorigin href="./assets/prop-types-rzyIIae9.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/propagation-api-qAYD7s-v.js">
|
|
73
|
-
<link rel="modulepreload" crossorigin href="./assets/collapsible-
|
|
74
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
75
|
-
<link rel="modulepreload" crossorigin href="./assets/dialog-
|
|
76
|
-
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-
|
|
77
|
-
<link rel="modulepreload" crossorigin href="./assets/panel-
|
|
78
|
-
<link rel="modulepreload" crossorigin href="./assets/OpenInAgentMenuRequestContext-
|
|
79
|
-
<link rel="modulepreload" crossorigin href="./assets/checkbox-
|
|
80
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
81
|
-
<link rel="modulepreload" crossorigin href="./assets/textarea-
|
|
82
|
-
<link rel="modulepreload" crossorigin href="./assets/toggle-group-
|
|
83
|
-
<link rel="modulepreload" crossorigin href="./assets/config-validation-events-
|
|
84
|
-
<link rel="modulepreload" crossorigin href="./assets/agent-presence-
|
|
85
|
-
<link rel="modulepreload" crossorigin href="./assets/project-paths-
|
|
86
|
-
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-
|
|
73
|
+
<link rel="modulepreload" crossorigin href="./assets/collapsible-BzkAcCLq.js">
|
|
74
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-DuNRfJxD.js">
|
|
75
|
+
<link rel="modulepreload" crossorigin href="./assets/dialog-uOgi9SAD.js">
|
|
76
|
+
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-CJWIkwAG.js">
|
|
77
|
+
<link rel="modulepreload" crossorigin href="./assets/panel-BQ1weDcE.js">
|
|
78
|
+
<link rel="modulepreload" crossorigin href="./assets/OpenInAgentMenuRequestContext-CMr9VfoW.js">
|
|
79
|
+
<link rel="modulepreload" crossorigin href="./assets/checkbox-BlEgF5ZV.js">
|
|
80
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-C_giuVsx.js">
|
|
81
|
+
<link rel="modulepreload" crossorigin href="./assets/textarea-DV1qaluU.js">
|
|
82
|
+
<link rel="modulepreload" crossorigin href="./assets/toggle-group-oSLn0Q3B.js">
|
|
83
|
+
<link rel="modulepreload" crossorigin href="./assets/config-validation-events-D8FXxNcc.js">
|
|
84
|
+
<link rel="modulepreload" crossorigin href="./assets/agent-presence-DYKkeiBZ.js">
|
|
85
|
+
<link rel="modulepreload" crossorigin href="./assets/project-paths-lA0ULe1F.js">
|
|
86
|
+
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-BoX1aQk3.js">
|
|
87
87
|
<link rel="modulepreload" crossorigin href="./assets/terminal-theme-BhdZI3O9.js">
|
|
88
88
|
<link rel="modulepreload" crossorigin href="./assets/keyboard-shortcuts-AGKmTzB4.js">
|
|
89
89
|
<link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-BmlKYN7O.js">
|
|
90
90
|
<link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
|
|
91
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
91
|
+
<link rel="stylesheet" crossorigin href="./assets/index-GNAYzOUb.css">
|
|
92
92
|
</head>
|
|
93
93
|
|
|
94
94
|
<body class="antialiased">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{h as e,n as t}from"./init-
|
|
2
|
-
//# sourceMappingURL=repair-launch-json-
|
|
1
|
+
import{h as e,n as t}from"./init-BMMu5BcO.mjs";import{t as n}from"./is-object-Cg453afR.mjs";import{existsSync as r,readFileSync as i}from"node:fs";import{join as a}from"node:path";const o=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],t];function s(e){if(e.runtimeExecutable===`/bin/sh`&&Array.isArray(e.runtimeArgs)){let t=e.runtimeArgs[2];if(typeof t==`string`){if(t.includes(`# ok-ui-v1`))return`canonical`;if(/# ok-ui-v\d+/.test(t))return`legacy-bare`}return`preserved`}if(e.runtimeExecutable===`npx`&&Array.isArray(e.runtimeArgs)){for(let t of o)if(c(e.runtimeArgs,t))return`legacy-bare`}return`preserved`}function c(e,t){if(e.length!==t.length)return!1;for(let n=0;n<t.length;n++)if(e[n]!==t[n])return!1;return!0}function l(t){let o=t.logger??u,c=a(t.projectDir,`.claude`,`launch.json`);if(t.reclaimDisableEnv===`1`)return o({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:c,outcome:`skipped-reclaim-disabled`},repairedCount:0};if(!r(c))return{outcome:{configPath:c,outcome:`no-file`},repairedCount:0};let l;try{let e=i(c,`utf-8`).trim();l=e?JSON.parse(e):{}}catch(e){let t=e instanceof Error?e.message:String(e);return o({event:`launch-json-repair-read-failed`,configPath:c,error:t}),{outcome:{configPath:c,outcome:`read-failed`,error:t},repairedCount:0}}if(!n(l)){let e=`launch.json root is not an object`;return o({event:`launch-json-repair-read-failed`,configPath:c,error:e}),{outcome:{configPath:c,outcome:`read-failed`,error:e},repairedCount:0}}let d=l.configurations;if(!Array.isArray(d))return{outcome:{configPath:c,outcome:`no-entry`},repairedCount:0};let f=d.find(e=>n(e)&&e.name===`open-knowledge-ui`);if(!f)return{outcome:{configPath:c,outcome:`no-entry`},repairedCount:0};let p=s(f);if(p===`canonical`)return{outcome:{configPath:c,outcome:`canonical`},repairedCount:0};if(p===`preserved`)return{outcome:{configPath:c,outcome:`preserved`},repairedCount:0};let m=e(t.projectDir,{mode:`published`});if(m.action===`failed`){let e=m.error??`unknown write failure`;return o({event:`launch-json-repair-write-failed`,configPath:c,error:e}),{outcome:{configPath:c,outcome:`write-failed`,error:e},repairedCount:0}}return o({event:`launch-json-repair-applied`,configPath:c}),{outcome:{configPath:c,outcome:`repaired`},repairedCount:1}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{l as repairLaunchJson};
|
|
2
|
+
//# sourceMappingURL=repair-launch-json-6xIm32Zo.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as e,g as t}from"./init-
|
|
2
|
-
//# sourceMappingURL=repair-mcp-configs-
|
|
1
|
+
import{d as e,g as t}from"./init-BMMu5BcO.mjs";import{c as n,o as r,r as i}from"./write-project-skill-B6sZCIWR.mjs";import{t as a}from"./mcp-migrate-event-D0NrGjvc.mjs";import{homedir as o}from"node:os";function s(e){let t=e.logger??u,n=e.home??o(),a=[];if(e.reclaimDisableEnv===`1`)return t({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of i){let i=r[o],s=c(()=>i.configPath(``,n));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:i,home:n,cwd:``,configPath:s,configPathOverride:void 0,logger:t})),i.projectConfigPath){let n=i.projectConfigPath,r=c(()=>n(e.projectDir));r!==null&&a.push(l({scope:`project`,editorId:o,target:i,home:void 0,cwd:e.projectDir,configPath:r,configPathOverride:r,logger:t}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(r){let i={scope:r.scope,editorId:r.editorId,configPath:r.configPath},o=e(r.target,r.cwd,r.home,r.configPathOverride);if(o===null)return{...i,outcome:`no-entry`};if(n(o))return{...i,outcome:`canonical`};r.logger(a({scope:r.scope,surface:`cli-repair`,editorId:r.editorId,configPath:r.configPath,priorEntry:o}));let s=t(r.target,r.cwd,{mode:`published`,skipAvailabilityCheck:!0},r.home,r.configPathOverride);if(s.action===`failed`){let e=s.error??`unknown write failure`;return r.logger({event:`mcp-config-repair-write-failed`,scope:r.scope,editorId:r.editorId,configPath:r.configPath,error:e}),{...i,outcome:`write-failed`,error:e}}return{...i,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
|
|
2
|
+
//# sourceMappingURL=repair-mcp-configs-Dkm4l6uH.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{s as e}from"./chunk-C94x7I9S.mjs";import{t}from"./esm-BLMtE3s6.mjs";import{c as n,l as r,s as i}from"./server-lock-BpjJj3OD-DieV1RDy.mjs";import"./gh-detect-DnwA-B1z.mjs";import{Ur as a,vn as o}from"./dist-Br1AQTZl.mjs";import{g as s,h as c}from"./init-
|
|
1
|
+
import{s as e}from"./chunk-C94x7I9S.mjs";import{t}from"./esm-BLMtE3s6.mjs";import{c as n,l as r,s as i}from"./server-lock-BpjJj3OD-DieV1RDy.mjs";import"./gh-detect-DnwA-B1z.mjs";import{Ur as a,vn as o}from"./dist-Br1AQTZl.mjs";import{g as s,h as c}from"./init-BMMu5BcO.mjs";import{n as l,o as u}from"./write-project-skill-B6sZCIWR.mjs";import"./loader-qSWystsO.mjs";import{c as d}from"./colors-CBY1ibtz.mjs";import"./preview-BGWTw8Hu.mjs";import{spawnSync as f}from"node:child_process";import{existsSync as p,lstatSync as m,readFileSync as h,readdirSync as g,statSync as ee}from"node:fs";import{basename as te,dirname as _,isAbsolute as v,join as y,relative as b,resolve as x}from"node:path";import{hostname as ne}from"node:os";import{readFile as S,realpath as C}from"node:fs/promises";function w(e,t,a={}){let o=r(e,t);if(!p(o))return{status:`missing`,lockPath:o};let s;try{s=JSON.parse(h(o,`utf-8`))}catch{return{status:`corrupt`,lockPath:o}}if(!s||typeof s!=`object`||!n(s.pid))return{status:`corrupt`,lockPath:o};let c=s;if(!(a.isAlive??i)(c.pid))return{status:`dead-pid`,lockPath:o,lock:c};let l=a.host??ne();return c.hostname===l?{status:`alive`,lockPath:o,lock:c}:{status:`foreign-host`,lockPath:o,lock:c}}function T(e){return e.replace(/:\d+$/,``)}function E(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:T(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:T(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:T(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.-]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function D(e){let t;try{t=new URL(e)}catch{return null}if(t.hostname!==`github.com`&&t.hostname!==`www.github.com`)return null;let n=t.pathname.split(`/`).filter(e=>e.length>0);if(n.length<5||n[2]!==`blob`)return null;let r,i,a,o;try{r=decodeURIComponent(n[0]),i=decodeURIComponent(n[1]),a=decodeURIComponent(n[3]),o=n.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!r||!i||!a||o.length===0||o.some(e=>e.length===0)?null:{owner:r,repo:i,branch:a,path:o.join(`/`)}}function O(e){let t;try{t=new URL(e)}catch{return null}if(t.hostname!==`github.com`&&t.hostname!==`www.github.com`)return null;let n=t.pathname.split(`/`);if(n.length<5||n[0]!==``||n[3]!==`tree`)return null;let r=n.slice(5);r.length===1&&r[0]===``&&r.pop();let i,a,o,s;try{i=decodeURIComponent(n[1]),a=decodeURIComponent(n[2]),o=decodeURIComponent(n[4]),s=r.map(e=>decodeURIComponent(e))}catch{return null}return!i||!a||!o||s.some(e=>e.length===0)?null:{owner:i,repo:a,branch:o,path:s.join(`/`)}}function k(e){let t=D(e);if(t)return{kind:`doc`,...t};let n=O(e);return n?{kind:`folder`,...n}:null}const A=2e3,j=2e3,re=[/cli\.mjs/,/(^|[\s/])(open-knowledge|ok)\s+(start|mcp|ui)(\s|$)/,/Open Knowledge(?:\.app| Helper)/,/(^|[\s/])bun([\s/]).*?(run dev|packages\/app|vite|hocuspocus)/,/(^|[\s/])node([\s/]).*?(packages\/(cli|app)|vite|hocuspocus)/,/(^|\s)--ok-lock-dir-b64=/,/(^|\s)--ok-project-path=/];function M(e){return re.some(t=>t.test(e))}function ie(e){let t=e.trim().split(/\s+/).find(e=>e.startsWith(`--ok-lock-dir-b64=`));if(t==null)return null;let n=t.slice(18);if(!n)return null;try{let e=Buffer.from(n,`base64url`).toString(`utf8`);return v(e)?e:null}catch{return null}}function ae(e){let t=e.indexOf(`--ok-project-path=`);if(t===-1)return null;let n=t+18,r=e.slice(n),i=r.search(/\s--/),a=(i===-1?r:r.slice(0,i)).trim();return a&&v(a)?a:null}function oe(e){let t=[];for(let n of e.split(`
|
|
2
2
|
`)){let e=n.trim();if(!e)continue;let r=e.indexOf(` `);if(r===-1)continue;let i=e.slice(0,r),a=e.slice(r+1),o=Number.parseInt(i,10);!Number.isNaN(o)&&M(a)&&t.push({pid:o,command:a})}return t}function se(e){let t=[],n=e.split(`
|
|
3
3
|
`);for(let e=1;e<n.length;e++){let r=n[e]?.trim();if(!r)continue;let i=r.indexOf(` `);if(i===-1)continue;let a=r.slice(0,i),o=r.slice(i+1).trim(),s=Number.parseInt(a,10);!Number.isNaN(s)&&M(o)&&t.push({pid:s,command:o})}return t}async function ce(){let e=f(`pgrep`,[`-a`,`-f`,`cli\\.mjs|open-knowledge|Open Knowledge(\\.app| Helper)|--ok-lock-dir-b64=|--ok-project-path=|(^|[ /])ok[ ]+(start|mcp|ui)([ ]|$)|packages/(cli|app)|hocuspocus|vite`],{encoding:`utf-8`,timeout:A});if(!(e.error!=null&&e.error.code===`ENOENT`)){let t=e.stdout??``,n=oe(t);if(n.length>0||t.trim()===``)return n}let t=f(`ps`,[`-axo`,`pid,command`],{encoding:`utf-8`,timeout:A});return t.error!=null||!t.stdout?[]:se(t.stdout)}function le(e){let t=e.trim().split(/\s+/).filter(Boolean);for(let e of t){if(e.startsWith(`@`))continue;let t=te(e);if(t===`open-knowledge`||t===`ok`||e.endsWith(`/packages/cli/src/cli.ts`)||e.endsWith(`/packages/cli/dist/cli.mjs`)||t===`cli.mjs`||t===`cli.ts`)return e}return null}function N(e){let t=f(`ps`,[`-p`,String(e),`-o`,`command=`],{encoding:`utf-8`,timeout:A});return t.error!=null||!t.stdout?null:t.stdout.trim()||null}function P(e){let t=f(`ps`,[`-p`,String(e),`-o`,`%cpu=,%mem=`],{encoding:`utf-8`,timeout:A});if(t.error!=null||!t.stdout)return null;let[n,r]=t.stdout.trim().split(/\s+/),i=Number.parseFloat(n??``),a=Number.parseFloat(r??``);return Number.isNaN(i)||Number.isNaN(a)?null:{cpuPercent:i,memPercent:a}}async function F(e){let t=f(`lsof`,[`-p`,String(e),`-a`,`-d`,`cwd`,`-Fn`],{encoding:`utf-8`,timeout:A});if(t.error!=null)return null;let n=t.stdout??``;for(let e of n.split(`
|
|
4
4
|
`))if(e.startsWith(`n`)&&e.length>1)return e.slice(1);return null}function I(e){let t=[],n=e.split(`
|
|
5
5
|
`);for(let e=1;e<n.length;e++){let r=n[e]?.trim();if(!r)continue;let i=r.split(/\s+/);if(i.length<2)continue;let a=Number.parseInt(i[1]??``,10);Number.isNaN(a)||t.push(a)}return[...new Set(t)]}function L(e){return p(y(e,`server.lock`))||p(y(e,`ui.lock`))}function R(e,t){for(let n of[y(t,`.ok`,`local`),y(t,`.ok`)])p(n)&&L(n)&&e.add(n)}function z(e,t){let n=0,r=(t,i)=>{if(n>=j||(n++,R(e,t),i>=3))return;let a;try{a=g(t)}catch{return}for(let e of a){if(n>=j)return;if(e===`node_modules`||e===`.git`||e===`Library`||e.startsWith(`.`)&&e!==`.ok`)continue;let a=y(t,e),o=!1;try{o=m(a).isDirectory()}catch{continue}o&&r(a,i+1)}};r(t,0)}async function B(){let e=new Set,t=await ce(),n=t.map(e=>F(e.pid)),r=await Promise.all(n);for(let n of t){let t=ie(n.command);t!=null&&p(t)&&e.add(t);let r=ae(n.command);r!=null&&R(e,r)}for(let t of r)t!=null&&R(e,t);let i=f(`lsof`,[`-iTCP`,`-sTCP:LISTEN`,`-nP`],{encoding:`utf-8`,timeout:A});if(i.error==null&&i.stdout){let n=I(i.stdout),r=new Set(t.map(e=>e.pid)),a=n.filter(e=>!r.has(e)).map(e=>F(e)),o=await Promise.all(a);for(let t of o)t!=null&&R(e,t)}(e.size===0||r.some(e=>e===`/`))&&z(e,process.cwd());let a=new Map;for(let t of e)try{let e=await C(t);a.set(e,e)}catch{a.set(t,t)}return[...a.values()]}var V=e(d(),1);function H(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function U(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function W(e,t,n,r,i,a){if(t.status===`missing`||t.status===`corrupt`)return null;let o=t.lock,s=null;if(n.status!==`missing`&&n.status!==`corrupt`){let e=n.lock;s={port:e.port,status:n.status,pid:e.pid,startedAt:e.startedAt,usage:a}}return{directory:o.worktreeRoot,server:{port:o.port,status:t.status,pid:o.pid,startedAt:o.startedAt,usage:i},ui:s,hostname:o.hostname,lockPath:t.lockPath,binary:r==null?null:le(r),command:r,isDesktop:H(r)}}function ue(e){return e.ui==null?!1:e.ui.status===`alive`||e.ui.status===`foreign-host`}function G(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:t===`dead-pid`&&ue(e)?`ui-orphan`:`stale`}const de=new Set([`running`,`desktop`,`foreign`,`ui-orphan`]);function fe(e){switch(e){case`running`:return V.default.green(e);case`desktop`:return V.default.blue(e);case`foreign`:return V.default.cyan(e);case`ui-orphan`:return V.default.magenta(e);case`stale`:return V.default.yellow(e)}}function K(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function pe(e){return`${K(e.server.usage)} | ${K(e.ui?.usage??null)}`}function me(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null||e.ui.status===`dead-pid`?`—`:String(e.ui.port)}`}function he(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>{let t=G(e),n=t===`ui-orphan`&&e.ui!=null?e.ui.pid:e.server.pid;return[e.directory,me(e),pe(e),t,String(n),U(e.server.startedAt),e.binary??`—`]}),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=fe(G(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=V.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
|
|
6
6
|
`)}async function q(e={}){let t=e.discover??B,n=e.inspect??w,r=e.log??(e=>console.log(e)),i=e.resolveCommand??N,a=e.resolveUsage??P,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=n(e,`ui`),o=W(e,t,r,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid),r.status===`missing`||r.status===`corrupt`?null:a(r.lock.pid));o!=null&&s.push(o)}if(e.json){let e=s.map(e=>({...e,displayStatus:G(e)}));r(JSON.stringify(e,null,2));return}r(he(e.all?s:s.filter(e=>de.has(G(e)))))}function ge(){return new t(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await q({all:t.all===!0||e===`all`,json:t.json===!0})})}const _e=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`]);function ve(e,t,n=o){if(e!==void 0&&!_e.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let J=null;function ye(e){J=e}function be(){return J??process.cwd()}function xe(e,t,n={}){let r=n.isAlive??i,a=[];for(let[n,i]of[[`server`,e],[`ui`,t]])(i.status===`alive`||i.status===`foreign-host`&&r(i.lock.pid))&&a.push({name:n,pid:i.lock.pid,port:i.lock.port});return{targets:a}}function Y(e){let t=e.inspect??(t=>w(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=xe(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function X(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function Se(e,t=i){let n=await B(),r=null;for(let i of n){let n=w(i,`server`),a=w(i,`ui`);if(X(n,t)&&n.lock.port===e||X(a,t)&&a.lock.port===e)return i;r===null&&(X(n,t)&&n.lock.pid===e||X(a,t)&&a.lock.pid===e)&&(r=i)}return r}function Z(e){let t=Y({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function Ce(e){return new t(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=Y({lockDir:a(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await q({});return}if(n===`all`){let e=await B();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=w(n,`server`),r=w(n,`ui`);!X(e,i)&&!X(r,i)||(Z(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await Se(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}Z(t);return}Z(a(x(be(),n)))})}async function we(e,t){let n,r;try{n=await C(x(e)),r=await C(x(_(e)))}catch{return{kind:`not-git`}}if(!$(n,r))return{kind:`symlink-escape`};let i=y(n,`.git`),a;try{a=ee(i)}catch{return{kind:`not-git`}}let o;if(a.isDirectory()){let e;try{e=await C(i)}catch{return{kind:`not-git`}}if(!$(e,n))return{kind:`symlink-escape`};o=e}else if(a.isFile()){let e;try{e=await S(i,`utf-8`)}catch{return{kind:`not-git`}}let t=/^gitdir:\s*(.+)$/m.exec(e.trim());if(!t)return{kind:`not-git`};let r=t[1].trim(),a=v(r)?r:x(n,r);try{o=await C(a)}catch{return{kind:`not-git`}}}else return{kind:`not-git`};let s=y(await Q(o),`config`),c;try{c=await S(s,`utf-8`)}catch{return{kind:`not-git`}}let l=Ee(c);if(l===null)return{kind:`no-origin`};let u=E(l);if(u===null||u.hostname!==`github.com`)return{kind:`non-github`};let d=u.owner.toLowerCase()===t.owner.toLowerCase(),f=u.name.toLowerCase()===t.repo.toLowerCase();return!d||!f?{kind:`wrong-repo`,actualOwner:u.owner,actualRepo:u.name}:{kind:`ok`,gitRemoteUrl:`https://github.com/${u.owner}/${u.name}.git`}}async function Q(e){let t;try{t=(await S(y(e,`commondir`),`utf-8`)).trim()}catch{return e}if(t.length===0)return e;let n=v(t)?t:x(e,t);try{return await C(n)}catch{return n}}function $(e,t){if(e===t)return!0;let n=b(t,e);return n.length>0&&!n.startsWith(`..`)&&!v(n)}function Te(e){let t=e.indexOf(`#`),n=e.indexOf(`;`),r=-1;return t>=0&&n>=0?r=Math.min(t,n):t>=0?r=t:n>=0&&(r=n),(r===-1?e:e.slice(0,r)).trim()}function Ee(e){let t=!1;for(let n of e.split(/\r?\n/)){let e=Te(n);if(e.length===0)continue;if(e.startsWith(`[`)){t=/^\[\s*remote\s+["']origin["']\s*\]$/.test(e);continue}if(!t)continue;let r=/^url\s*=\s*(.+)$/.exec(e);if(r)return De(r[1])}return null}function De(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}const Oe=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=s(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let n=l(e,t);return{integration:`project-skill`,editorId:e.id,action:n.action,...n.path?{path:n.path}:{},...n.error?{error:n.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function ke(e,t,n={},r=Oe){let i=[];for(let a of t){let t=u[a];for(let a of r)i.push(a.write(t,e,n))}return i}function Ae(e,t,n={}){return{integrations:ke(e,t,n),claudeLaunchJson:t.includes(`claude`)?c(e,n):void 0}}export{ye as a,B as c,D as d,k as f,w as h,Ce as i,N as l,E as m,we as n,ve as o,O as p,Y as r,ge as s,Ae as t,P as u};
|
|
7
|
-
//# sourceMappingURL=src-
|
|
7
|
+
//# sourceMappingURL=src-BLymKhjc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,f as t,r as n}from"./start-lBoQ1MZl.mjs";export{n as bootStartServer,t as resolveHost,e as startCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e,t}from"./esm-BLMtE3s6.mjs";import{bn as n,ft as r}from"./server-lock-BpjJj3OD-DieV1RDy.mjs";import{i,t as a}from"./gh-detect-DnwA-B1z.mjs";import{$n as o,br as s,ur as c}from"./dist-Br1AQTZl.mjs";import{n as l}from"./constants-BB8OuOYZ.mjs";import{spawn as u}from"node:child_process";import{closeSync as d,existsSync as f,mkdirSync as p,openSync as m,statSync as h}from"node:fs";import{basename as g,dirname as _,join as v}from"node:path";import{homedir as y}from"node:os";import{setTimeout as b}from"node:timers/promises";const x=`Open Knowledge.app`,S=`/Applications/${x}`;function C(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return h(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function w(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(T(e,S))return S;let t=v(e.homeDir??y(),`Applications`,x);return T(e,t)?t:null}function T(e,t){try{let n=v(t,`Contents`,`MacOS`,`Open Knowledge`),r=e.statSync(n);return r&&typeof r.isFile==`function`?r.isFile():!1}catch{return!1}}function E(e){if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`};if(e.platform!==`darwin`)return{available:!1,reason:`darwin-only`};let t;try{t=w(e)}catch{return{available:!1,reason:`stat-error`}}return t?e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,bundlePath:t}:e.isTTY!==!0||e.env.SSH_CONNECTION||e.env.SSH_TTY?{available:!1,reason:`headless`,bundlePath:t}:{available:!0,reason:`available`,bundlePath:t}:{available:!1,reason:`no-bundle`}}function D(e){(e.log??(e=>console.error(e)))("Launching Open Knowledge desktop (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)");let t={...process.env};delete t.ELECTRON_RUN_AS_NODE,e.spawn(`open`,[`-b`,`com.inkeep.open-knowledge`],{detached:!0,stdio:`ignore`,env:t}).unref()}function O(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found at ${S}. Install via DMG, or omit --mode for browser mode.`;case`darwin-only`:return`Desktop app is macOS-only on this release. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect desktop bundle at ${S} (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available at ${S} but launch dispatch did not fire (caller bug).`}}function k(e){return v(_(e),`..`,`Frameworks`,`Open Knowledge Server.app`,`Contents`,`MacOS`,`Open Knowledge Helper`)}const A=/\/[^/]+\.app\/Contents\/MacOS\/[^/]+$/;function j(e){if(e.platform!==`darwin`||!A.test(e.execPath))return null;let t=k(e.execPath);return e.exists(t)?t:null}function M(e={}){let t=e.execPath??process.execPath,n=e.platform??process.platform,r=e.argv??process.argv,i=e.exists??f,a=r[1];return a?{command:j({execPath:t,platform:n,exists:i})??t,prefixArgs:[a]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx -y @inkeep/open-knowledge@latest\`. This re-introduces the registry-fetch surface that re-exec was fixing. Observed argv: ${JSON.stringify(r)}`),{command:`npx`,prefixArgs:[`-y`,`@inkeep/open-knowledge@latest`]})}function N(e,t){return e.host??t.HOST??`localhost`}function P(e){let t=g(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var F=class extends Error{cwd;constructor(e){super("This directory isn't set up yet. Run `ok init` first, then `ok start` again."),this.name=`OkDirMissingError`,this.cwd=e}};function I(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 L(e){f(e.lockDir)||p(e.lockDir,{recursive:!0});let t=m(v(e.lockDir,n),`w`),r=e.spawn??u,{PORT:i,...a}=process.env,o=M();try{let n=r(o.command,[...o.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:{...a,ELECTRON_RUN_AS_NODE:`1`}});return n.unref(),n}finally{try{d(t)}catch{}}}function R(e,t,n){return e??(n===void 0?t:void 0)}function z(e,t){return e!==void 0&&t!==null&&t.port>0}function B(e,t,n){return e??(t!=null&&!n?1:0)}async function V(e){let t=e.spawn??u,n=M(),{PORT:r,...i}=process.env,a=t(n.command,[...n.prefixArgs,`ui`,`--port`,String(e.uiPort)],{cwd:e.cwd,stdio:`inherit`,env:{...i,ELECTRON_RUN_AS_NODE:`1`}}),o=!1,s=e=>{o=!0;try{a.kill(e)}catch{}},c=()=>s(`SIGINT`),l=()=>s(`SIGTERM`);process.once(`SIGINT`,c),process.once(`SIGTERM`,l),await new Promise(e=>{a.on(`exit`,(t,n)=>{process.exitCode=B(t,n,o),e()}),a.on(`error`,t=>{console.error(`[start] connect fallback: failed to spawn ok ui — ${t instanceof Error?t.message:String(t)}`),process.exitCode=1,e()})}),process.removeListener(`SIGINT`,c),process.removeListener(`SIGTERM`,l)}async function H(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}const U=r;function W(e){let t=e.sigtermGraceMs??U,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>b(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 G(e){let{config:t,cwd:n,host:r}=e,l=e.skipAutoInit??!1,u=e.skipUiAutoSpawn??!1,d=e.idleThresholdMs??18e5,{existsSync:f,mkdirSync:p}=await import(`node:fs`),{basename:m,dirname:h}=await import(`node:path`),{bootServer:g,getLogger:_,isProcessAlive:v,readUiLock:y,resolveContentDir:x}=await import(`./dist--S8onIrO.mjs`),S=e.log??_(`start`),C=e.singleFile!==void 0,w=e.projectDir??n,T=C?s(e.singleFile).canonicalFilePath:void 0,E=T?h(T):void 0,D=T?m(T):void 0;if(!C){if(!l&&!o(n))throw new F(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{let t=typeof e.event==`string`?e.event:``;(t.endsWith(`-failed`)||t.endsWith(`-error`)||t.endsWith(`-missing`))&&S.warn({event:e},`[start] reclaim sweep reported a problem`)};try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-DyxMTxFK.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){S.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-DSGotwZz.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){S.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-Bv7y6ZgO.mjs`)).repairSkills)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){S.warn({err:e},`[start] skill repair sweep failed; continuing`)}}let O=E??x(t,n);!C&&!f(O)&&(p(O,{recursive:!0}),S.info({contentDir:O},`Created content directory`));let k=null,A=async({lockDir:t})=>{if(k=I({uiLock:y(t),isAlive:v}),k.action===`spawn`&&!u)try{let r=e.uiPort===void 0?void 0:[`ui`,`--port`,String(e.uiPort)];L({lockDir:t,cwd:n,spawn:e.spawn,args:r}),S.info({reason:k.reason,uiPort:e.uiPort},`[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 k.action===`skip`&&S.info({port:k.port,pid:k.pid},`UI already running at port ${k.port}`)},j=e.reactShellDistDir===void 0,M=i(),N=c(),P=await g({config:t,contentDir:O,projectDir:C?w:n,contentRoot:C?void 0:t.content.dir,port:e.port,host:r,quiet:!1,detectGh:a,tokenStore:M,embeddingsKeyStore:N,...C?{ephemeral:!0,singleDocRelPath:D,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:j,idleShutdownMs:d,skipAutoInit:!0,...j?{spawnUiSiblingFn:A}:{},idleShutdownHandler:e=>W({readUiLock:()=>y(P.lockDir),isAlive:v,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:S}),log:S,...e.serveContentAssets?{serveContentAssets:!0}:{},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});k||={action:`skip`,reason:`alive`,pid:0,port:0};let R=k,z=null;if(R.action===`skip`)z=R.port>0?R.port:null;else if(!u){let t=e.uiBindTimeoutMs??3e3;z=await H({readUiLock:()=>y(P.lockDir),now:Date.now,sleep:e=>b(e),timeoutMs:t,pollIntervalMs:50}),z===null&&S.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:P.httpServer,destroy:P.destroy,lockDir:P.lockDir,contentDir:O,port:P.port,ready:P.ready,degraded:P.degraded,uiSpawnDecision:k,resolvedUiPort:z}}function K(t){if(t===`browser`||t===`app`)return t;throw new e(`--mode must be 'browser' or 'app'`)}function q(t){let n=Number.parseInt(t,10);if(Number.isNaN(n)||n<1||n>65535)throw new e(`--ui-port must be a port number between 1 and 65535`);return n}function J(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function Y(e){let t=[`Stopping Open Knowledge…`,`Saving pending changes and releasing the server lock — this can take a few seconds.`];return e===`SIGINT`&&t.push(`Press Ctrl+C again to force quit.`),t}async function X(e,t){let n=J(process.env);n!==null&&(process.env.OK_CONSOLE_LEVEL=n);let{renderBanner:r}=await import(`./banner-DBiyrzNA.mjs`),{accent:i,dim:a,error:o,warning:s}=await import(`./colors-BktTaA1t.mjs`),c=process.cwd(),u=e;process.title=P(c);let d=N(t,process.env),f=t.port===void 0?void 0:Number(t.port),p=process.env.PORT?Number(process.env.PORT):void 0,m=t.uiPort===void 0?void 0:Number(t.uiPort),h=R(f,p,m);if(m!==void 0){let{readServerLock:e,resolveLockDir:t}=await import(`./dist--S8onIrO.mjs`);if(z(m,e(t(c)))){await V({cwd:c,uiPort:m});return}}let g;try{g=await G({config:u,cwd:c,host:d,port:h,...m===void 0?{}:{uiPort:m},...t.serveContentAssets?{serveContentAssets:!0}:{},...t.reactShellDistDir?{reactShellDistDir:t.reactShellDistDir}:{},...t.singleFile?{singleFile:t.singleFile}:{},...t.projectDir?{projectDir:t.projectDir}:{}})}catch(e){e instanceof F&&(console.error(o(e.message)),process.exit(1));let t=await import(`./dist--S8onIrO.mjs`);if((e instanceof t.GitNotAvailableError||e instanceof t.GitTooOldError)&&process.exit(78),(e instanceof t.SingleFileNotFoundError||e instanceof t.SingleFileNotAFileError||e instanceof t.SingleFileNotMarkdownError)&&(console.error(o(e.message)),process.exit(1)),m!==void 0&&Z(e,t)){await V({cwd:c,uiPort:m});return}let n=Q(e,c,t);n!==null&&(console.error(o(n)),process.exit(1)),console.error(`${o(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let _=!1,v=async e=>{if(_)return;_=!0;let[t,...n]=Y(e);console.log(i(`\n${t}`));for(let e of n)console.log(a(` ${e}`));try{await g.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`,()=>{v(`SIGINT`)}),process.once(`SIGTERM`,()=>{v(`SIGTERM`)});let y=`http://${d}:${g.port}`,b=d===`0.0.0.0`||d===`::`?`http://0.0.0.0:${g.port}`:void 0,x=g.resolvedUiPort,S=x!==null&&x>0?`http://${d}:${x}`:y;console.log(r({name:`open-knowledge`,version:l,localUrl:S,apiUrl:S===y?void 0:y,networkUrl:b,nextSteps:[`Open the Editor URL in your browser to start editing.`]}));let C={"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`};g.ready.then(async()=>{if(g.degraded.length>0){console.log();for(let e of g.degraded){let t=C[e]??`${e} (check server logs for details)`;console.warn(` ${s(`⚠`)} ${s(e)}: ${a(t)}`)}console.log()}if(t.open){let{openBrowser:e}=await import(`./open-browser-DHTbHSqx.mjs`);e(S)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function Z(e,t){let n=t.ServerLockCollisionError;return n!==void 0&&e instanceof n}function Q(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=v(t,`.ok`),r=n.readServerLock(e);return r?r.kind===`interactive`?`Open Knowledge desktop is currently running on this project. Quit it or use --cwd to point elsewhere.`:r.kind===`mcp-spawned`?"An MCP-spawned server holds this lock; it should release on idle-shutdown (~30 min). Or run `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function $(e){return new t(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`--ui-port <port>`,`Pin the ok ui sibling to <port> and connect (not exit) if a server already runs here — the worktree-preview recipe path`,q).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,K).option(`--serve-content-assets`,`Serve content assets from this server`).option(`--react-shell-dist-dir <path>`,`Serve React shell from <path> (suppresses ok ui sibling)`).option(`--single-file <path>`,`No-project ephemeral single-file mode: scope the server to one markdown file (git + MCP off)`).option(`--project-dir <dir>`,`Throwaway project root for --single-file (where ephemeral .ok/ state lives)`).action(async t=>{let n=e();if(t.mode===`app`){t.open&&(process.stderr.write(`error: option '--mode=app' cannot be combined with '--open' (--open opens a browser tab against the local server, which app mode does not boot)
|
|
1
|
+
import{n as e,t}from"./esm-BLMtE3s6.mjs";import{bn as n,ft as r}from"./server-lock-BpjJj3OD-DieV1RDy.mjs";import{i,t as a}from"./gh-detect-DnwA-B1z.mjs";import{$n as o,br as s,ur as c}from"./dist-Br1AQTZl.mjs";import{n as l}from"./constants-BG21qkwQ.mjs";import{spawn as u}from"node:child_process";import{closeSync as d,existsSync as f,mkdirSync as p,openSync as m,statSync as h}from"node:fs";import{basename as g,dirname as _,join as v}from"node:path";import{homedir as y}from"node:os";import{setTimeout as b}from"node:timers/promises";const x=`Open Knowledge.app`,S=`/Applications/${x}`;function C(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return h(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function w(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(T(e,S))return S;let t=v(e.homeDir??y(),`Applications`,x);return T(e,t)?t:null}function T(e,t){try{let n=v(t,`Contents`,`MacOS`,`Open Knowledge`),r=e.statSync(n);return r&&typeof r.isFile==`function`?r.isFile():!1}catch{return!1}}function E(e){if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`};if(e.platform!==`darwin`)return{available:!1,reason:`darwin-only`};let t;try{t=w(e)}catch{return{available:!1,reason:`stat-error`}}return t?e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,bundlePath:t}:e.isTTY!==!0||e.env.SSH_CONNECTION||e.env.SSH_TTY?{available:!1,reason:`headless`,bundlePath:t}:{available:!0,reason:`available`,bundlePath:t}:{available:!1,reason:`no-bundle`}}function D(e){(e.log??(e=>console.error(e)))("Launching Open Knowledge desktop (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)");let t={...process.env};delete t.ELECTRON_RUN_AS_NODE,e.spawn(`open`,[`-b`,`com.inkeep.open-knowledge`],{detached:!0,stdio:`ignore`,env:t}).unref()}function O(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found at ${S}. Install via DMG, or omit --mode for browser mode.`;case`darwin-only`:return`Desktop app is macOS-only on this release. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect desktop bundle at ${S} (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available at ${S} but launch dispatch did not fire (caller bug).`}}function k(e){return v(_(e),`..`,`Frameworks`,`Open Knowledge Server.app`,`Contents`,`MacOS`,`Open Knowledge Helper`)}const A=/\/[^/]+\.app\/Contents\/MacOS\/[^/]+$/;function j(e){if(e.platform!==`darwin`||!A.test(e.execPath))return null;let t=k(e.execPath);return e.exists(t)?t:null}function M(e={}){let t=e.execPath??process.execPath,n=e.platform??process.platform,r=e.argv??process.argv,i=e.exists??f,a=r[1];return a?{command:j({execPath:t,platform:n,exists:i})??t,prefixArgs:[a]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx -y @inkeep/open-knowledge@latest\`. This re-introduces the registry-fetch surface that re-exec was fixing. Observed argv: ${JSON.stringify(r)}`),{command:`npx`,prefixArgs:[`-y`,`@inkeep/open-knowledge@latest`]})}function N(e,t){return e.host??t.HOST??`localhost`}function P(e){let t=g(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var F=class extends Error{cwd;constructor(e){super("This directory isn't set up yet. Run `ok init` first, then `ok start` again."),this.name=`OkDirMissingError`,this.cwd=e}};function I(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 L(e){f(e.lockDir)||p(e.lockDir,{recursive:!0});let t=m(v(e.lockDir,n),`w`),r=e.spawn??u,{PORT:i,...a}=process.env,o=M();try{let n=r(o.command,[...o.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:{...a,ELECTRON_RUN_AS_NODE:`1`}});return n.unref(),n}finally{try{d(t)}catch{}}}function R(e,t,n){return e??(n===void 0?t:void 0)}function z(e,t){return e!==void 0&&t!==null&&t.port>0}function B(e,t,n){return e??(t!=null&&!n?1:0)}async function V(e){let t=e.spawn??u,n=M(),{PORT:r,...i}=process.env,a=t(n.command,[...n.prefixArgs,`ui`,`--port`,String(e.uiPort)],{cwd:e.cwd,stdio:`inherit`,env:{...i,ELECTRON_RUN_AS_NODE:`1`}}),o=!1,s=e=>{o=!0;try{a.kill(e)}catch{}},c=()=>s(`SIGINT`),l=()=>s(`SIGTERM`);process.once(`SIGINT`,c),process.once(`SIGTERM`,l),await new Promise(e=>{a.on(`exit`,(t,n)=>{process.exitCode=B(t,n,o),e()}),a.on(`error`,t=>{console.error(`[start] connect fallback: failed to spawn ok ui — ${t instanceof Error?t.message:String(t)}`),process.exitCode=1,e()})}),process.removeListener(`SIGINT`,c),process.removeListener(`SIGTERM`,l)}async function H(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}const U=r;function W(e){let t=e.sigtermGraceMs??U,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>b(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 G(e){let{config:t,cwd:n,host:r}=e,l=e.skipAutoInit??!1,u=e.skipUiAutoSpawn??!1,d=e.idleThresholdMs??18e5,{existsSync:f,mkdirSync:p}=await import(`node:fs`),{basename:m,dirname:h}=await import(`node:path`),{bootServer:g,getLogger:_,isProcessAlive:v,readUiLock:y,resolveContentDir:x}=await import(`./dist--S8onIrO.mjs`),S=e.log??_(`start`),C=e.singleFile!==void 0,w=e.projectDir??n,T=C?s(e.singleFile).canonicalFilePath:void 0,E=T?h(T):void 0,D=T?m(T):void 0;if(!C){if(!l&&!o(n))throw new F(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{let t=typeof e.event==`string`?e.event:``;(t.endsWith(`-failed`)||t.endsWith(`-error`)||t.endsWith(`-missing`))&&S.warn({event:e},`[start] reclaim sweep reported a problem`)};try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-Dkm4l6uH.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){S.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-6xIm32Zo.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){S.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-Bv7y6ZgO.mjs`)).repairSkills)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){S.warn({err:e},`[start] skill repair sweep failed; continuing`)}}let O=E??x(t,n);!C&&!f(O)&&(p(O,{recursive:!0}),S.info({contentDir:O},`Created content directory`));let k=null,A=async({lockDir:t})=>{if(k=I({uiLock:y(t),isAlive:v}),k.action===`spawn`&&!u)try{let r=e.uiPort===void 0?void 0:[`ui`,`--port`,String(e.uiPort)];L({lockDir:t,cwd:n,spawn:e.spawn,args:r}),S.info({reason:k.reason,uiPort:e.uiPort},`[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 k.action===`skip`&&S.info({port:k.port,pid:k.pid},`UI already running at port ${k.port}`)},j=e.reactShellDistDir===void 0,M=i(),N=c(),P=await g({config:t,contentDir:O,projectDir:C?w:n,contentRoot:C?void 0:t.content.dir,port:e.port,host:r,quiet:!1,detectGh:a,tokenStore:M,embeddingsKeyStore:N,...C?{ephemeral:!0,singleDocRelPath:D,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:j,idleShutdownMs:d,skipAutoInit:!0,...j?{spawnUiSiblingFn:A}:{},idleShutdownHandler:e=>W({readUiLock:()=>y(P.lockDir),isAlive:v,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:S}),log:S,...e.serveContentAssets?{serveContentAssets:!0}:{},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});k||={action:`skip`,reason:`alive`,pid:0,port:0};let R=k,z=null;if(R.action===`skip`)z=R.port>0?R.port:null;else if(!u){let t=e.uiBindTimeoutMs??3e3;z=await H({readUiLock:()=>y(P.lockDir),now:Date.now,sleep:e=>b(e),timeoutMs:t,pollIntervalMs:50}),z===null&&S.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:P.httpServer,destroy:P.destroy,lockDir:P.lockDir,contentDir:O,port:P.port,ready:P.ready,degraded:P.degraded,uiSpawnDecision:k,resolvedUiPort:z}}function K(t){if(t===`browser`||t===`app`)return t;throw new e(`--mode must be 'browser' or 'app'`)}function q(t){let n=Number.parseInt(t,10);if(Number.isNaN(n)||n<1||n>65535)throw new e(`--ui-port must be a port number between 1 and 65535`);return n}function J(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function Y(e){let t=[`Stopping Open Knowledge…`,`Saving pending changes and releasing the server lock — this can take a few seconds.`];return e===`SIGINT`&&t.push(`Press Ctrl+C again to force quit.`),t}async function X(e,t){let n=J(process.env);n!==null&&(process.env.OK_CONSOLE_LEVEL=n);let{renderBanner:r}=await import(`./banner-DBiyrzNA.mjs`),{accent:i,dim:a,error:o,warning:s}=await import(`./colors-BktTaA1t.mjs`),c=process.cwd(),u=e;process.title=P(c);let d=N(t,process.env),f=t.port===void 0?void 0:Number(t.port),p=process.env.PORT?Number(process.env.PORT):void 0,m=t.uiPort===void 0?void 0:Number(t.uiPort),h=R(f,p,m);if(m!==void 0){let{readServerLock:e,resolveLockDir:t}=await import(`./dist--S8onIrO.mjs`);if(z(m,e(t(c)))){await V({cwd:c,uiPort:m});return}}let g;try{g=await G({config:u,cwd:c,host:d,port:h,...m===void 0?{}:{uiPort:m},...t.serveContentAssets?{serveContentAssets:!0}:{},...t.reactShellDistDir?{reactShellDistDir:t.reactShellDistDir}:{},...t.singleFile?{singleFile:t.singleFile}:{},...t.projectDir?{projectDir:t.projectDir}:{}})}catch(e){e instanceof F&&(console.error(o(e.message)),process.exit(1));let t=await import(`./dist--S8onIrO.mjs`);if((e instanceof t.GitNotAvailableError||e instanceof t.GitTooOldError)&&process.exit(78),(e instanceof t.SingleFileNotFoundError||e instanceof t.SingleFileNotAFileError||e instanceof t.SingleFileNotMarkdownError)&&(console.error(o(e.message)),process.exit(1)),m!==void 0&&Z(e,t)){await V({cwd:c,uiPort:m});return}let n=Q(e,c,t);n!==null&&(console.error(o(n)),process.exit(1)),console.error(`${o(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let _=!1,v=async e=>{if(_)return;_=!0;let[t,...n]=Y(e);console.log(i(`\n${t}`));for(let e of n)console.log(a(` ${e}`));try{await g.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`,()=>{v(`SIGINT`)}),process.once(`SIGTERM`,()=>{v(`SIGTERM`)});let y=`http://${d}:${g.port}`,b=d===`0.0.0.0`||d===`::`?`http://0.0.0.0:${g.port}`:void 0,x=g.resolvedUiPort,S=x!==null&&x>0?`http://${d}:${x}`:y;console.log(r({name:`open-knowledge`,version:l,localUrl:S,apiUrl:S===y?void 0:y,networkUrl:b,nextSteps:[`Open the Editor URL in your browser to start editing.`]}));let C={"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`};g.ready.then(async()=>{if(g.degraded.length>0){console.log();for(let e of g.degraded){let t=C[e]??`${e} (check server logs for details)`;console.warn(` ${s(`⚠`)} ${s(e)}: ${a(t)}`)}console.log()}if(t.open){let{openBrowser:e}=await import(`./open-browser-DHTbHSqx.mjs`);e(S)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function Z(e,t){let n=t.ServerLockCollisionError;return n!==void 0&&e instanceof n}function Q(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=v(t,`.ok`),r=n.readServerLock(e);return r?r.kind===`interactive`?`Open Knowledge desktop is currently running on this project. Quit it or use --cwd to point elsewhere.`:r.kind===`mcp-spawned`?"An MCP-spawned server holds this lock; it should release on idle-shutdown (~30 min). Or run `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function $(e){return new t(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`--ui-port <port>`,`Pin the ok ui sibling to <port> and connect (not exit) if a server already runs here — the worktree-preview recipe path`,q).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,K).option(`--serve-content-assets`,`Serve content assets from this server`).option(`--react-shell-dist-dir <path>`,`Serve React shell from <path> (suppresses ok ui sibling)`).option(`--single-file <path>`,`No-project ephemeral single-file mode: scope the server to one markdown file (git + MCP off)`).option(`--project-dir <dir>`,`Throwaway project root for --single-file (where ephemeral .ok/ state lives)`).action(async t=>{let n=e();if(t.mode===`app`){t.open&&(process.stderr.write(`error: option '--mode=app' cannot be combined with '--open' (--open opens a browser tab against the local server, which app mode does not boot)
|
|
2
2
|
`),process.exit(2));let e=[];if(t.port!==void 0&&e.push(`--port`),t.uiPort!==void 0&&e.push(`--ui-port`),t.host!==void 0&&e.push(`--host`),e.length>0){let t=process.env.OK_LOG_LEVEL??`info`;(t===`debug`||t===`trace`)&&console.error(`--mode=app: ignoring ${e.join(`, `)}`)}let n=E(C());if(n.available){D({spawn:u});return}console.error(O(n.reason)),process.exit(1)}await X(n,t)})}export{D as S,$ as _,B as a,C as b,P as c,R as d,N as f,L as g,z as h,W as i,Y as l,X as m,H as n,V as o,J as p,G as r,I as s,F as t,Z as u,Q as v,E as x,M as y};
|
|
3
|
-
//# sourceMappingURL=start-
|
|
3
|
+
//# sourceMappingURL=start-lBoQ1MZl.mjs.map
|
package/package.json
CHANGED
package/dist/init-BNVs1xkp.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as e}from"./init-DkpslbhQ.mjs";export{e as runInit};
|
package/dist/loader-DtUzpiqj.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./loader-MW55y84t.mjs";export{e as loadConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./preview-hHaiN9fv.mjs";export{t as formatPreviewBlock,e as previewContent};
|