kanna-code 0.34.3 → 0.34.4
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.
|
@@ -627,7 +627,7 @@ Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}
|
|
|
627
627
|
|
|
628
628
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
629
629
|
|
|
630
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},AG="DialogDescriptionWarning",NG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${CO(AG).contentName}}.`;return _.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},MG=dO,LG=pO,kO=mO,EO=gO,DG=bO,IG=yO,PG=SO;const df="data-focus-fallback-ignore",RO="data-allow-focus-retain",rv="kanna:restore-chat-input-focus",Hw="data-chat-input",iv="data-chat-selection-zone";function Ol(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function TO(e){var n;const t=e;return t!=null&&t.matches?t.matches("input:not([type='checkbox']):not([type='radio']):not([type='button']):not([type='submit']):not([type='reset']), textarea, select")||t.isContentEditable||((n=t.getAttribute)==null?void 0:n.call(t,"role"))==="textbox"?!0:Ol(e,RO):!1}function OG(e){const t=e;return t!=null&&t.matches?TO(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Ol(e,RO):!1}function LA(e){return!!e.querySelector(`[${df}][data-state='open']`)}function jG(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function zG(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${Hw}]`)).filter(o=>!o.disabled);if(n.length===0)return!1;const r=n.indexOf(e),i=r>=0?(r+1)%n.length:0,s=n[i];return s?(s.focus({preventScroll:!0}),!0):!1}function DA(e){const{activeElement:t,fallback:n,hasActiveOverlay:r}=e;if(!n||n.disabled||r||t===n)return"none";if(e.trigger==="escape")return e.defaultPrevented||Ol(t,Hw)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,u=s??i;return!o||!u||!o.contains(u)||Ol(u,df)||Ol(t,df)||l&&(Ol(i,iv)||Ol(u,iv))||TO(t)?"none":t&&t===u?"restore":OG(t)?"none":"restore"}const Jl=MG,BG=LG,AO=_.forwardRef(({className:e,...t},n)=>m.jsx(kO,{ref:n,className:ye("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));AO.displayName=kO.displayName;const FG={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},Ya=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>m.jsxs(BG,{children:[m.jsx(AO,{}),m.jsxs(EO,{ref:i,[df]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(rv)),(o=r.onCloseAutoFocus)==null||o.call(r,s)},className:ye("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","max-h-[85vh] flex flex-col",FG[n],e),...r,children:[t,m.jsxs(PG,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[m.jsx(nl,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ya.displayName=EO.displayName;function HG({className:e,...t}){return m.jsx("div",{className:ye("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function ec({className:e,...t}){return m.jsx(DG,{className:ye("text-lg font-medium leading-none tracking-tight",e),...t})}function u0({className:e,...t}){return m.jsx(IG,{className:ye("text-sm text-muted-foreground",e),...t})}function tc({className:e,...t}){return m.jsx("div",{className:ye("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function nc({className:e,...t}){return m.jsx("div",{className:ye("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function $G({className:e,...t}){return m.jsx("button",{className:ye("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground","disabled:pointer-events-none disabled:text-muted-foreground/50",e),...t})}const Yr=_.forwardRef(({className:e,type:t,...n},r)=>m.jsx("input",{ref:r,type:t,className:ye("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Yr.displayName="Input";const NO=_.createContext(null);function UG({children:e}){const[t,n]=_.useState(null),[r,i]=_.useState(""),s=_.useRef(null);_.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(i(t.options.initialValue??""),setTimeout(()=>{var b,y;(b=s.current)==null||b.focus(),(y=s.current)==null||y.select()},0))},[t]);const o=_.useCallback(()=>{n(null),i("")},[]),l=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.kind==="prompt"?t.resolve(null):t.resolve(),o())},[o,t]),u=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.kind==="prompt"?t.resolve(r.trim()||null):t.resolve(),o())},[o,t,r]),d=_.useCallback(b=>new Promise(y=>{n({kind:"confirm",options:b,resolve:y})}),[]),f=_.useCallback(b=>new Promise(y=>{n({kind:"prompt",options:b,resolve:y})}),[]),h=_.useCallback(b=>new Promise(y=>{n({kind:"alert",options:b,resolve:y})}),[]),g=_.useMemo(()=>({confirm:d,prompt:f,alert:h}),[h,d,f]);return m.jsxs(NO.Provider,{value:g,children:[e,m.jsx(Jl,{open:t!==null,onOpenChange:b=>{b||!t||l()},children:m.jsx(Ya,{size:"sm",onKeyDown:b=>{b.key!=="Enter"||b.shiftKey||!t||t.kind!=="confirm"||(b.preventDefault(),u())},children:t?m.jsxs(m.Fragment,{children:[m.jsxs(tc,{className:"space-y-4",children:[m.jsx(ec,{children:t.options.title}),t.options.description?m.jsx(u0,{children:t.options.description}):null,t.kind==="prompt"?m.jsx(Yr,{ref:s,type:"text",value:r,onChange:b=>i(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),u())},placeholder:t.options.placeholder}):null]}),m.jsxs(nc,{children:[m.jsx(st,{variant:"ghost",size:"sm",onClick:l,className:t.kind==="alert"?"hidden":void 0,children:"cancelLabel"in t.options?t.options.cancelLabel??"Cancel":"Cancel"}),m.jsx(st,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:u,disabled:t.kind==="prompt"&&!r.trim(),children:t.kind==="alert"?t.options.closeLabel??"OK":"confirmLabel"in t.options?t.options.confirmLabel??"Confirm":"Confirm"})]})]}):null})})]})}function $w(){const e=_.useContext(NO);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const Uw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("bg-card text-card-foreground",e),...t}));Uw.displayName="Card";const Vw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-2",e),...t}));Vw.displayName="CardHeader";const MO=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:ye("text-2xl font-semibold leading-none tracking-tight",e),...t}));MO.displayName="CardTitle";const LO=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:ye("text-sm text-muted-foreground",e),...t}));LO.displayName="CardDescription";const Ww=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("p-6 pt-0",e),...t}));Ww.displayName="CardContent";const VG=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",e),...t}));VG.displayName="CardFooter";const WG=["top","right","bottom","left"],Xa=Math.min,Mi=Math.max,sv=Math.round,Pm=Math.floor,no=e=>({x:e,y:e}),GG={left:"right",right:"left",bottom:"top",top:"bottom"};function gS(e,t,n){return Mi(e,Xa(t,n))}function Fo(e,t){return typeof e=="function"?e(t):e}function Ho(e){return e.split("-")[0]}function hd(e){return e.split("-")[1]}function Gw(e){return e==="x"?"y":"x"}function qw(e){return e==="y"?"height":"width"}function Qs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Kw(e){return Gw(Qs(e))}function qG(e,t,n){n===void 0&&(n=!1);const r=hd(e),i=Kw(e),s=qw(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=ov(o)),[o,ov(o)]}function KG(e){const t=ov(e);return[vS(e),t,vS(t)]}function vS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const IA=["left","right"],PA=["right","left"],YG=["top","bottom"],XG=["bottom","top"];function QG(e,t,n){switch(e){case"top":case"bottom":return n?t?PA:IA:t?IA:PA;case"left":case"right":return t?YG:XG;default:return[]}}function ZG(e,t,n,r){const i=hd(e);let s=QG(Ho(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(vS)))),s}function ov(e){const t=Ho(e);return GG[t]+e.slice(t.length)}function JG(e){return{top:0,right:0,bottom:0,left:0,...e}}function DO(e){return typeof e!="number"?JG(e):{top:e,right:e,bottom:e,left:e}}function av(e){const{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 OA(e,t,n){let{reference:r,floating:i}=e;const s=Qs(t),o=Kw(t),l=qw(o),u=Ho(t),d=s==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,g=r[l]/2-i[l]/2;let b;switch(u){case"top":b={x:f,y:r.y-i.height};break;case"bottom":b={x:f,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:h};break;case"left":b={x:r.x-i.width,y:h};break;default:b={x:r.x,y:r.y}}switch(hd(t)){case"start":b[o]-=g*(n&&d?-1:1);break;case"end":b[o]+=g*(n&&d?-1:1);break}return b}async function eq(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:u}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:g=!1,padding:b=0}=Fo(t,e),y=DO(b),w=l[g?h==="floating"?"reference":"floating":h],C=av(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:u})),R=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),T=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},A=av(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:R,offsetParent:E,strategy:u}):R);return{top:(C.top-A.top+y.top)/T.y,bottom:(A.bottom-C.bottom+y.bottom)/T.y,left:(C.left-A.left+y.left)/T.x,right:(A.right-C.right+y.right)/T.x}}const tq=50,nq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:eq},u=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:h}=OA(d,r,u),g=r,b=0;const y={};for(let x=0;x<s.length;x++){const w=s[x];if(!w)continue;const{name:C,fn:R}=w,{x:E,y:T,data:A,reset:N}=await R({x:f,y:h,initialPlacement:r,placement:g,strategy:i,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});f=E??f,h=T??h,y[C]={...y[C],...A},N&&b<tq&&(b++,typeof N=="object"&&(N.placement&&(g=N.placement),N.rects&&(d=N.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):N.rects),{x:f,y:h}=OA(d,g,u)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},rq=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:u}=t,{element:d,padding:f=0}=Fo(e,t)||{};if(d==null)return{};const h=DO(f),g={x:n,y:r},b=Kw(i),y=qw(b),x=await o.getDimensions(d),w=b==="y",C=w?"top":"left",R=w?"bottom":"right",E=w?"clientHeight":"clientWidth",T=s.reference[y]+s.reference[b]-g[b]-s.floating[y],A=g[b]-s.reference[b],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let L=N?N[E]:0;(!L||!await(o.isElement==null?void 0:o.isElement(N)))&&(L=l.floating[E]||s.floating[y]);const P=T/2-A/2,G=L/2-x[y]/2-1,O=Xa(h[C],G),B=Xa(h[R],G),H=O,j=L-x[y]-B,$=L/2-x[y]/2+P,V=gS(H,$,j),z=!u.arrow&&hd(i)!=null&&$!==V&&s.reference[y]/2-($<H?O:B)-x[y]/2<0,q=z?$<H?$-H:$-j:0;return{[b]:g[b]+q,data:{[b]:V,centerOffset:$-V-q,...z&&{alignmentOffset:q}},reset:z}}}),iq=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:u,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...w}=Fo(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=Ho(i),R=Qs(l),E=Ho(l)===l,T=await(u.isRTL==null?void 0:u.isRTL(d.floating)),A=g||(E||!x?[ov(l)]:KG(l)),N=y!=="none";!g&&N&&A.push(...ZG(l,x,y,T));const L=[l,...A],P=await u.detectOverflow(t,w),G=[];let O=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(P[C]),h){const $=qG(i,o,T);G.push(P[$[0]],P[$[1]])}if(O=[...O,{placement:i,overflows:G}],!G.every($=>$<=0)){var B,H;const $=(((B=s.flip)==null?void 0:B.index)||0)+1,V=L[$];if(V&&(!(h==="alignment"?R!==Qs(V):!1)||O.every(F=>Qs(F.placement)===R?F.overflows[0]>0:!0)))return{data:{index:$,overflows:O},reset:{placement:V}};let z=(H=O.filter(q=>q.overflows[0]<=0).sort((q,F)=>q.overflows[1]-F.overflows[1])[0])==null?void 0:H.placement;if(!z)switch(b){case"bestFit":{var j;const q=(j=O.filter(F=>{if(N){const Y=Qs(F.placement);return Y===R||Y==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(Y=>Y>0).reduce((Y,I)=>Y+I,0)]).sort((F,Y)=>F[1]-Y[1])[0])==null?void 0:j[0];q&&(z=q);break}case"initialPlacement":z=l;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function jA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zA(e){return WG.some(t=>e[t]>=0)}const sq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Fo(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=jA(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:zA(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=jA(o,n.floating);return{data:{escapedOffsets:l,escaped:zA(l)}}}default:return{}}}}},IO=new Set(["left","top"]);async function oq(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ho(n),l=hd(n),u=Qs(n)==="y",d=IO.has(o)?-1:1,f=s&&u?-1:1,h=Fo(t,e);let{mainAxis:g,crossAxis:b,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof y=="number"&&(b=l==="end"?y*-1:y),u?{x:b*f,y:g*d}:{x:g*d,y:b*f}}const aq=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=t,u=await oq(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:o}}}}},lq=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:u={fn:C=>{let{x:R,y:E}=C;return{x:R,y:E}}},...d}=Fo(e,t),f={x:n,y:r},h=await s.detectOverflow(t,d),g=Qs(Ho(i)),b=Gw(g);let y=f[b],x=f[g];if(o){const C=b==="y"?"top":"left",R=b==="y"?"bottom":"right",E=y+h[C],T=y-h[R];y=gS(E,y,T)}if(l){const C=g==="y"?"top":"left",R=g==="y"?"bottom":"right",E=x+h[C],T=x-h[R];x=gS(E,x,T)}const w=u.fn({...t,[b]:y,[g]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[b]:o,[g]:l}}}}}},cq=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:l=0,mainAxis:u=!0,crossAxis:d=!0}=Fo(e,t),f={x:n,y:r},h=Qs(i),g=Gw(h);let b=f[g],y=f[h];const x=Fo(l,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(u){const E=g==="y"?"height":"width",T=s.reference[g]-s.floating[E]+w.mainAxis,A=s.reference[g]+s.reference[E]-w.mainAxis;b<T?b=T:b>A&&(b=A)}if(d){var C,R;const E=g==="y"?"width":"height",T=IO.has(Ho(i)),A=s.reference[h]-s.floating[E]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:w.crossAxis),N=s.reference[h]+s.reference[E]+(T?0:((R=o.offset)==null?void 0:R[h])||0)-(T?w.crossAxis:0);y<A?y=A:y>N&&(y=N)}return{[g]:b,[h]:y}}}},uq=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:l}=t,{apply:u=()=>{},...d}=Fo(e,t),f=await o.detectOverflow(t,d),h=Ho(i),g=hd(i),b=Qs(i)==="y",{width:y,height:x}=s.floating;let w,C;h==="top"||h==="bottom"?(w=h,C=g===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,w=g==="end"?"top":"bottom");const R=x-f.top-f.bottom,E=y-f.left-f.right,T=Xa(x-f[w],R),A=Xa(y-f[C],E),N=!t.middlewareData.shift;let L=T,P=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=R),N&&!g){const O=Mi(f.left,0),B=Mi(f.right,0),H=Mi(f.top,0),j=Mi(f.bottom,0);b?P=y-2*(O!==0||B!==0?O+B:Mi(f.left,f.right)):L=x-2*(H!==0||j!==0?H+j:Mi(f.top,f.bottom))}await u({...t,availableWidth:P,availableHeight:L});const G=await o.getDimensions(l.floating);return y!==G.width||x!==G.height?{reset:{rects:!0}}:{}}}};function d0(){return typeof window<"u"}function fd(e){return PO(e)?(e.nodeName||"").toLowerCase():"#document"}function Di(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function oo(e){var t;return(t=(PO(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function PO(e){return d0()?e instanceof Node||e instanceof Di(e).Node:!1}function As(e){return d0()?e instanceof Element||e instanceof Di(e).Element:!1}function qo(e){return d0()?e instanceof HTMLElement||e instanceof Di(e).HTMLElement:!1}function BA(e){return!d0()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Di(e).ShadowRoot}function qf(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Ns(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function dq(e){return/^(table|td|th)$/.test(fd(e))}function h0(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const hq=/transform|translate|scale|rotate|perspective|filter/,fq=/paint|layout|strict|content/,Tl=e=>!!e&&e!=="none";let Ny;function Yw(e){const t=As(e)?Ns(e):e;return Tl(t.transform)||Tl(t.translate)||Tl(t.scale)||Tl(t.rotate)||Tl(t.perspective)||!Xw()&&(Tl(t.backdropFilter)||Tl(t.filter))||hq.test(t.willChange||"")||fq.test(t.contain||"")}function pq(e){let t=Qa(e);for(;qo(t)&&!qu(t);){if(Yw(t))return t;if(h0(t))return null;t=Qa(t)}return null}function Xw(){return Ny==null&&(Ny=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ny}function qu(e){return/^(html|body|#document)$/.test(fd(e))}function Ns(e){return Di(e).getComputedStyle(e)}function f0(e){return As(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qa(e){if(fd(e)==="html")return e;const t=e.assignedSlot||e.parentNode||BA(e)&&e.host||oo(e);return BA(t)?t.host:t}function OO(e){const t=Qa(e);return qu(t)?e.ownerDocument?e.ownerDocument.body:e.body:qo(t)&&qf(t)?t:OO(t)}function hf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=OO(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Di(i);if(s){const l=bS(o);return t.concat(o,o.visualViewport||[],qf(i)?i:[],l&&n?hf(l):[])}else return t.concat(i,hf(i,[],n))}function bS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function jO(e){const t=Ns(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=qo(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=sv(n)!==s||sv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function Qw(e){return As(e)?e:e.contextElement}function Ou(e){const t=Qw(e);if(!qo(t))return no(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=jO(t);let o=(s?sv(n.width):n.width)/r,l=(s?sv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const mq=no(0);function zO(e){const t=Di(e);return!Xw()||!t.visualViewport?mq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gq(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Di(e)?!1:t}function rc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=Qw(e);let o=no(1);t&&(r?As(r)&&(o=Ou(r)):o=Ou(e));const l=gq(s,n,r)?zO(s):no(0);let u=(i.left+l.x)/o.x,d=(i.top+l.y)/o.y,f=i.width/o.x,h=i.height/o.y;if(s){const g=Di(s),b=r&&As(r)?Di(r):r;let y=g,x=bS(y);for(;x&&r&&b!==y;){const w=Ou(x),C=x.getBoundingClientRect(),R=Ns(x),E=C.left+(x.clientLeft+parseFloat(R.paddingLeft))*w.x,T=C.top+(x.clientTop+parseFloat(R.paddingTop))*w.y;u*=w.x,d*=w.y,f*=w.x,h*=w.y,u+=E,d+=T,y=Di(x),x=bS(y)}}return av({width:f,height:h,x:u,y:d})}function p0(e,t){const n=f0(e).scrollLeft;return t?t.left+n:rc(oo(e)).left+n}function BO(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-p0(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function vq(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=oo(r),l=t?h0(t.floating):!1;if(r===o||l&&s)return n;let u={scrollLeft:0,scrollTop:0},d=no(1);const f=no(0),h=qo(r);if((h||!h&&!s)&&((fd(r)!=="body"||qf(o))&&(u=f0(r)),h)){const b=rc(r);d=Ou(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const g=o&&!h&&!s?BO(o,u):no(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+f.x+g.x,y:n.y*d.y-u.scrollTop*d.y+f.y+g.y}}function bq(e){return Array.from(e.getClientRects())}function _q(e){const t=oo(e),n=f0(e),r=e.ownerDocument.body,i=Mi(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Mi(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+p0(e);const l=-n.scrollTop;return Ns(r).direction==="rtl"&&(o+=Mi(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const FA=25;function yq(e,t){const n=Di(e),r=oo(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,u=0;if(i){s=i.width,o=i.height;const f=Xw();(!f||f&&t==="fixed")&&(l=i.offsetLeft,u=i.offsetTop)}const d=p0(r);if(d<=0){const f=r.ownerDocument,h=f.body,g=getComputedStyle(h),b=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-h.clientWidth-b);y<=FA&&(s-=y)}else d<=FA&&(s+=d);return{width:s,height:o,x:l,y:u}}function xq(e,t){const n=rc(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=qo(e)?Ou(e):no(1),o=e.clientWidth*s.x,l=e.clientHeight*s.y,u=i*s.x,d=r*s.y;return{width:o,height:l,x:u,y:d}}function HA(e,t,n){let r;if(t==="viewport")r=yq(e,n);else if(t==="document")r=_q(oo(e));else if(As(t))r=xq(t,n);else{const i=zO(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return av(r)}function FO(e,t){const n=Qa(e);return n===t||!As(n)||qu(n)?!1:Ns(n).position==="fixed"||FO(n,t)}function Sq(e,t){const n=t.get(e);if(n)return n;let r=hf(e,[],!1).filter(l=>As(l)&&fd(l)!=="body"),i=null;const s=Ns(e).position==="fixed";let o=s?Qa(e):e;for(;As(o)&&!qu(o);){const l=Ns(o),u=Yw(o);!u&&l.position==="fixed"&&(i=null),(s?!u&&!i:!u&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||qf(o)&&!u&&FO(e,o))?r=r.filter(f=>f!==o):i=l,o=Qa(o)}return t.set(e,r),r}function wq(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?h0(t)?[]:Sq(t,this._c):[].concat(n),r],l=HA(t,o[0],i);let u=l.top,d=l.right,f=l.bottom,h=l.left;for(let g=1;g<o.length;g++){const b=HA(t,o[g],i);u=Mi(b.top,u),d=Xa(b.right,d),f=Xa(b.bottom,f),h=Mi(b.left,h)}return{width:d-h,height:f-u,x:h,y:u}}function Cq(e){const{width:t,height:n}=jO(e);return{width:t,height:n}}function kq(e,t,n){const r=qo(t),i=oo(t),s=n==="fixed",o=rc(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=no(0);function d(){u.x=p0(i)}if(r||!r&&!s)if((fd(t)!=="body"||qf(i))&&(l=f0(t)),r){const b=rc(t,!0,s,t);u.x=b.x+t.clientLeft,u.y=b.y+t.clientTop}else i&&d();s&&!r&&i&&d();const f=i&&!r&&!s?BO(i,l):no(0),h=o.left+l.scrollLeft-u.x-f.x,g=o.top+l.scrollTop-u.y-f.y;return{x:h,y:g,width:o.width,height:o.height}}function My(e){return Ns(e).position==="static"}function $A(e,t){if(!qo(e)||Ns(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return oo(e)===n&&(n=n.ownerDocument.body),n}function HO(e,t){const n=Di(e);if(h0(e))return n;if(!qo(e)){let i=Qa(e);for(;i&&!qu(i);){if(As(i)&&!My(i))return i;i=Qa(i)}return n}let r=$A(e,t);for(;r&&dq(r)&&My(r);)r=$A(r,t);return r&&qu(r)&&My(r)&&!Yw(r)?n:r||pq(e)||n}const Eq=async function(e){const t=this.getOffsetParent||HO,n=this.getDimensions,r=await n(e.floating);return{reference:kq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Rq(e){return Ns(e).direction==="rtl"}const Tq={convertOffsetParentRelativeRectToViewportRelativeRect:vq,getDocumentElement:oo,getClippingRect:wq,getOffsetParent:HO,getElementRects:Eq,getClientRects:bq,getDimensions:Cq,getScale:Ou,isElement:As,isRTL:Rq};function $O(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Aq(e,t){let n=null,r;const i=oo(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),s();const d=e.getBoundingClientRect(),{left:f,top:h,width:g,height:b}=d;if(l||t(),!g||!b)return;const y=Pm(h),x=Pm(i.clientWidth-(f+g)),w=Pm(i.clientHeight-(h+b)),C=Pm(f),E={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:Mi(0,Xa(1,u))||1};let T=!0;function A(N){const L=N[0].intersectionRatio;if(L!==u){if(!T)return o();L?o(!1,L):r=setTimeout(()=>{o(!1,1e-7)},1e3)}L===1&&!$O(d,e.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(A,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(A,E)}n.observe(e)}return o(!0),s}function Nq(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,d=Qw(e),f=i||s?[...d?hf(d):[],...t?hf(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?Aq(d,n):null;let g=-1,b=null;o&&(b=new ResizeObserver(C=>{let[R]=C;R&&R.target===d&&b&&t&&(b.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=b)==null||E.observe(t)})),n()}),d&&!u&&b.observe(d),t&&b.observe(t));let y,x=u?rc(e):null;u&&w();function w(){const C=rc(e);x&&!$O(x,C)&&n(),x=C,y=requestAnimationFrame(w)}return n(),()=>{var C;f.forEach(R=>{i&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),h==null||h(),(C=b)==null||C.disconnect(),b=null,u&&cancelAnimationFrame(y)}}const Mq=aq,Lq=lq,Dq=iq,Iq=uq,Pq=sq,UA=rq,Oq=cq,jq=(e,t,n)=>{const r=new Map,i={platform:Tq,...n},s={...i.platform,_c:r};return nq(e,t,{...i,platform:s})};var zq=typeof document<"u",Bq=function(){},Ng=zq?_.useLayoutEffect:Bq;function lv(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(!lv(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;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!lv(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function UO(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function VA(e,t){const n=UO(e);return Math.round(t*n)/n}function Ly(e){const t=_.useRef(e);return Ng(()=>{t.current=e}),t}function Fq(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:u,open:d}=e,[f,h]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,b]=_.useState(r);lv(g,r)||b(r);const[y,x]=_.useState(null),[w,C]=_.useState(null),R=_.useCallback(F=>{F!==N.current&&(N.current=F,x(F))},[]),E=_.useCallback(F=>{F!==L.current&&(L.current=F,C(F))},[]),T=s||y,A=o||w,N=_.useRef(null),L=_.useRef(null),P=_.useRef(f),G=u!=null,O=Ly(u),B=Ly(i),H=Ly(d),j=_.useCallback(()=>{if(!N.current||!L.current)return;const F={placement:t,strategy:n,middleware:g};B.current&&(F.platform=B.current),jq(N.current,L.current,F).then(Y=>{const I={...Y,isPositioned:H.current!==!1};$.current&&!lv(P.current,I)&&(P.current=I,os.flushSync(()=>{h(I)}))})},[g,t,n,B,H]);Ng(()=>{d===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[d]);const $=_.useRef(!1);Ng(()=>($.current=!0,()=>{$.current=!1}),[]),Ng(()=>{if(T&&(N.current=T),A&&(L.current=A),T&&A){if(O.current)return O.current(T,A,j);j()}},[T,A,j,O,G]);const V=_.useMemo(()=>({reference:N,floating:L,setReference:R,setFloating:E}),[R,E]),z=_.useMemo(()=>({reference:T,floating:A}),[T,A]),q=_.useMemo(()=>{const F={position:n,left:0,top:0};if(!z.floating)return F;const Y=VA(z.floating,f.x),I=VA(z.floating,f.y);return l?{...F,transform:"translate("+Y+"px, "+I+"px)",...UO(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:I}},[n,l,z.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:j,refs:V,elements:z,floatingStyles:q}),[f,j,V,z,q])}const Hq=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?UA({element:r.current,padding:i}).fn(n):{}:r?UA({element:r,padding:i}).fn(n):{}}}},$q=(e,t)=>{const n=Mq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Uq=(e,t)=>{const n=Lq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vq=(e,t)=>({fn:Oq(e).fn,options:[e,t]}),Wq=(e,t)=>{const n=Dq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gq=(e,t)=>{const n=Iq(e);return{name:n.name,fn:n.fn,options:[e,t]}},qq=(e,t)=>{const n=Pq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kq=(e,t)=>{const n=Hq(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Yq="Arrow",VO=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Kt.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});VO.displayName=Yq;var Xq=VO;function Qq(e){const[t,n]=_.useState(void 0);return zr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,l;if("borderBoxSize"in s){const u=s.borderBoxSize,d=Array.isArray(u)?u[0]:u;o=d.inlineSize,l=d.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Zw="Popper",[WO,il]=Go(Zw),[Zq,GO]=WO(Zw),qO=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(Zq,{scope:t,anchor:r,onAnchorChange:i,children:n})};qO.displayName=Zw;var KO="PopperAnchor",YO=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=GO(KO,n),o=_.useRef(null),l=an(t,o),u=_.useRef(null);return _.useEffect(()=>{const d=u.current;u.current=(r==null?void 0:r.current)||o.current,d!==u.current&&s.onAnchorChange(u.current)}),r?null:m.jsx(Kt.div,{...i,ref:l})});YO.displayName=KO;var Jw="PopperContent",[Jq,eK]=WO(Jw),XO=_.forwardRef((e,t)=>{var re,pe,ce,ge,ue,ke;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:b="optimized",onPlaced:y,...x}=e,w=GO(Jw,n),[C,R]=_.useState(null),E=an(t,Ae=>R(Ae)),[T,A]=_.useState(null),N=Qq(T),L=(N==null?void 0:N.width)??0,P=(N==null?void 0:N.height)??0,G=r+(s!=="center"?"-"+s:""),O=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},B=Array.isArray(d)?d:[d],H=B.length>0,j={padding:O,boundary:B.filter(nK),altBoundary:H},{refs:$,floatingStyles:V,placement:z,isPositioned:q,middlewareData:F}=Fq({strategy:"fixed",placement:G,whileElementsMounted:(...Ae)=>Nq(...Ae,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[$q({mainAxis:i+P,alignmentAxis:o}),u&&Uq({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Vq():void 0,...j}),u&&Wq({...j}),Gq({...j,apply:({elements:Ae,rects:ze,availableWidth:Ge,availableHeight:Et})=>{const{width:zt,height:Ct}=ze.reference,Pe=Ae.floating.style;Pe.setProperty("--radix-popper-available-width",`${Ge}px`),Pe.setProperty("--radix-popper-available-height",`${Et}px`),Pe.setProperty("--radix-popper-anchor-width",`${zt}px`),Pe.setProperty("--radix-popper-anchor-height",`${Ct}px`)}}),T&&Kq({element:T,padding:l}),rK({arrowWidth:L,arrowHeight:P}),g&&qq({strategy:"referenceHidden",...j})]}),[Y,I]=JO(z),U=Ts(y);zr(()=>{q&&(U==null||U())},[q,U]);const X=(re=F.arrow)==null?void 0:re.x,D=(pe=F.arrow)==null?void 0:pe.y,te=((ce=F.arrow)==null?void 0:ce.centerOffset)!==0,[Q,ne]=_.useState();return zr(()=>{C&&ne(window.getComputedStyle(C).zIndex)},[C]),m.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:q?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[(ge=F.transformOrigin)==null?void 0:ge.x,(ue=F.transformOrigin)==null?void 0:ue.y].join(" "),...((ke=F.hide)==null?void 0:ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(Jq,{scope:n,placedSide:Y,onArrowChange:A,arrowX:X,arrowY:D,shouldHideArrow:te,children:m.jsx(Kt.div,{"data-side":Y,"data-align":I,...x,ref:E,style:{...x.style,animation:q?void 0:"none"}})})})});XO.displayName=Jw;var QO="PopperArrow",tK={top:"bottom",right:"left",bottom:"top",left:"right"},ZO=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=eK(QO,r),o=tK[s.placedSide];return m.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:m.jsx(Xq,{...i,ref:n,style:{...i.style,display:"block"}})})});ZO.displayName=QO;function nK(e){return e!==null}var rK=e=>({name:"transformOrigin",options:e,fn(t){var w,C,R;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,l=o?0:e.arrowWidth,u=o?0:e.arrowHeight,[d,f]=JO(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((C=i.arrow)==null?void 0:C.x)??0)+l/2,b=(((R=i.arrow)==null?void 0:R.y)??0)+u/2;let y="",x="";return d==="bottom"?(y=o?h:`${g}px`,x=`${-u}px`):d==="top"?(y=o?h:`${g}px`,x=`${r.floating.height+u}px`):d==="right"?(y=`${-u}px`,x=o?h:`${b}px`):d==="left"&&(y=`${r.floating.width+u}px`,x=o?h:`${b}px`),{data:{x:y,y:x}}}});function JO(e){const[t,n="center"]=e.split("-");return[t,n]}var m0=qO,Kf=YO,g0=XO,v0=ZO,e5=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"}),iK="VisuallyHidden",t5=_.forwardRef((e,t)=>m.jsx(Kt.span,{...e,ref:t,style:{...e5,...e.style}}));t5.displayName=iK;var sK=t5,[b0]=Go("Tooltip",[il]),_0=il(),n5="TooltipProvider",oK=700,_S="tooltip.open",[aK,eC]=b0(n5),r5=e=>{const{__scopeTooltip:t,delayDuration:n=oK,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=_.useRef(!0),l=_.useRef(!1),u=_.useRef(0);return _.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),m.jsx(aK,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(u.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:_.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:s})};r5.displayName=n5;var ff="Tooltip",[lK,Yf]=b0(ff),i5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,u=eC(ff,e.__scopeTooltip),d=_0(t),[f,h]=_.useState(null),g=zo(),b=_.useRef(0),y=o??u.disableHoverableContent,x=l??u.delayDuration,w=_.useRef(!1),[C,R]=Gu({prop:r,defaultProp:i??!1,onChange:L=>{L?(u.onOpen(),document.dispatchEvent(new CustomEvent(_S))):u.onClose(),s==null||s(L)},caller:ff}),E=_.useMemo(()=>C?w.current?"delayed-open":"instant-open":"closed",[C]),T=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,w.current=!1,R(!0)},[R]),A=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,R(!1)},[R]),N=_.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{w.current=!0,R(!0),b.current=0},x)},[x,R]);return _.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),m.jsx(m0,{...d,children:m.jsx(lK,{scope:t,contentId:g,open:C,stateAttribute:E,trigger:f,onTriggerChange:h,onTriggerEnter:_.useCallback(()=>{u.isOpenDelayedRef.current?N():T()},[u.isOpenDelayedRef,N,T]),onTriggerLeave:_.useCallback(()=>{y?A():(window.clearTimeout(b.current),b.current=0)},[A,y]),onOpen:T,onClose:A,disableHoverableContent:y,children:n})})};i5.displayName=ff;var yS="TooltipTrigger",s5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Yf(yS,n),s=eC(yS,n),o=_0(n),l=_.useRef(null),u=an(t,l,i.onTriggerChange),d=_.useRef(!1),f=_.useRef(!1),h=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(Kf,{asChild:!0,...o,children:m.jsx(Kt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:u,onPointerMove:Ve(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Ve(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Ve(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ve(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Ve(e.onBlur,i.onClose),onClick:Ve(e.onClick,i.onClose)})})});s5.displayName=yS;var tC="TooltipPortal",[cK,uK]=b0(tC,{forceMount:void 0}),o5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=Yf(tC,t);return m.jsx(cK,{scope:t,forceMount:n,children:m.jsx(ps,{present:n||s.open,children:m.jsx(dd,{asChild:!0,container:i,children:r})})})};o5.displayName=tC;var Ku="TooltipContent",a5=_.forwardRef((e,t)=>{const n=uK(Ku,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=Yf(Ku,e.__scopeTooltip);return m.jsx(ps,{present:r||o.open,children:o.disableHoverableContent?m.jsx(l5,{side:i,...s,ref:t}):m.jsx(dK,{side:i,...s,ref:t})})}),dK=_.forwardRef((e,t)=>{const n=Yf(Ku,e.__scopeTooltip),r=eC(Ku,e.__scopeTooltip),i=_.useRef(null),s=an(t,i),[o,l]=_.useState(null),{trigger:u,onClose:d}=n,f=i.current,{onPointerInTransitChange:h}=r,g=_.useCallback(()=>{l(null),h(!1)},[h]),b=_.useCallback((y,x)=>{const w=y.currentTarget,C={x:y.clientX,y:y.clientY},R=gK(C,w.getBoundingClientRect()),E=vK(C,R),T=bK(x.getBoundingClientRect()),A=yK([...E,...T]);l(A),h(!0)},[h]);return _.useEffect(()=>()=>g(),[g]),_.useEffect(()=>{if(u&&f){const y=w=>b(w,f),x=w=>b(w,u);return u.addEventListener("pointerleave",y),f.addEventListener("pointerleave",x),()=>{u.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",x)}}},[u,f,b,g]),_.useEffect(()=>{if(o){const y=x=>{const w=x.target,C={x:x.clientX,y:x.clientY},R=(u==null?void 0:u.contains(w))||(f==null?void 0:f.contains(w)),E=!_K(C,o);R?g():E&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[u,f,o,d,g]),m.jsx(l5,{...e,ref:s})}),[hK,fK]=b0(ff,{isInside:!1}),pK=hW("TooltipContent"),l5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,u=Yf(Ku,n),d=_0(n),{onClose:f}=u;return _.useEffect(()=>(document.addEventListener(_S,f),()=>document.removeEventListener(_S,f)),[f]),_.useEffect(()=>{if(u.trigger){const h=g=>{const b=g.target;b!=null&&b.contains(u.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,f]),m.jsx(ud,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs(g0,{"data-state":u.stateAttribute,...d,...l,ref:t,style:{...l.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:[m.jsx(pK,{children:r}),m.jsx(hK,{scope:n,isInside:!0,children:m.jsx(sK,{id:u.contentId,role:"tooltip",children:i||r})})]})})});a5.displayName=Ku;var c5="TooltipArrow",mK=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=_0(n);return fK(c5,n).isInside?null:m.jsx(v0,{...i,...r,ref:t})});mK.displayName=c5;function gK(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function vK(e,t,n=5){const 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 bK(e){const{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 _K(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const l=t[s],u=t[o],d=l.x,f=l.y,h=u.x,g=u.y;f>r!=g>r&&n<(h-d)*(r-f)/(g-f)+d&&(i=!i)}return i}function yK(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),xK(t)}function xK(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}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 SK=r5,u5=i5,d5=s5,h5=o5,nC=a5;function f5({className:e,...t}){return m.jsx("kbd",{className:ye("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",e),...t})}function wK({className:e,...t}){return m.jsx("span",{className:ye("inline-flex items-center gap-0.5",e),...t})}const CK="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 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",kK=SK,Za=u5,Ja=d5,$o=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(h5,{children:m.jsx(nC,{ref:r,sideOffset:t,className:ye("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 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",e),...n})}));$o.displayName=nC.displayName;const Oh=u5,jh=d5;function p5(e){return e.toUpperCase()}function EK(e){const t=e.split("+");return m.jsx(wK,{children:t.map((n,r)=>m.jsx(f5,{children:p5(n)},`${n}-${r}`))})}const Tu=_.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...i},s)=>{const o=r===void 0?null:Array.isArray(r)?r[0]??null:r;return m.jsx(h5,{children:m.jsx(nC,{ref:s,sideOffset:t,className:ye(CK,e),...i,children:o?EK(o):m.jsx("span",{children:typeof n=="string"?p5(n):n})})})});Tu.displayName="HotkeyTooltipContent";const RK="0.34.3",TK={version:RK},Bn="Kanna",WA="kanna",AK=".kanna",NK=".kanna-dev",MK="KANNA_RUNTIME_PROFILE",rC=`kanna/${TK.version}`,LK="[kanna]",DK=`~/${Bn}`;function y0(){var t;return(t=globalThis.process)==null?void 0:t.env}function IK(e=y0()){var t;return((t=e==null?void 0:e[MK])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function PK(e=y0()){return IK(e)==="dev"?NK:AK}function OK(e=y0()){return`~/${PK(e)}`}function jK(e=y0()){return`${OK(e)}/keybindings.json`}function Om(e){return e?`${WA} ${e}`:WA}const GA=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const g=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(b=>b(t,g))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d))},u=t=e(r,i,l);return l},zK=(e=>e?GA(e):GA),BK=e=>e;function FK(e,t=BK){const n=vn.useSyncExternalStore(e.subscribe,vn.useCallback(()=>t(e.getState()),[e,t]),vn.useCallback(()=>t(e.getInitialState()),[e,t]));return vn.useDebugValue(n),n}const HK=e=>{const t=zK(e),n=r=>FK(t,r);return Object.assign(n,t),n},gc=(e=>HK);function $K(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var s;const o=u=>u===null?null:JSON.parse(u,void 0),l=(s=n.getItem(i))!=null?s:null;return l instanceof Promise?l.then(o):o(l)},setItem:(i,s)=>n.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>n.removeItem(i)}}const xS=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return xS(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return xS(r)(n)}}}},UK=(e,t)=>(n,r,i)=>{let s={storage:$K(()=>window.localStorage),partialize:w=>w,version:0,merge:(w,C)=>({...C,...w}),...t},o=!1,l=0;const u=new Set,d=new Set;let f=s.storage;if(!f)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...w)},r,i);const h=()=>{const w=s.partialize({...r()});return f.setItem(s.name,{state:w,version:s.version})},g=i.setState;i.setState=(w,C)=>(g(w,C),h());const b=e((...w)=>(n(...w),h()),r,i);i.getInitialState=()=>b;let y;const x=()=>{var w,C;if(!f)return;const R=++l;o=!1,u.forEach(T=>{var A;return T((A=r())!=null?A:b)});const E=((C=s.onRehydrateStorage)==null?void 0:C.call(s,(w=r())!=null?w:b))||void 0;return xS(f.getItem.bind(f))(s.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==s.version){if(s.migrate){const A=s.migrate(T.state,T.version);return A instanceof Promise?A.then(N=>[!0,N]):[!0,A]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var A;if(R!==l)return;const[N,L]=T;if(y=s.merge(L,(A=r())!=null?A:b),n(y,!0),N)return h()}).then(()=>{R===l&&(E==null||E(y,void 0),y=r(),o=!0,d.forEach(T=>T(y)))}).catch(T=>{R===l&&(E==null||E(void 0,T))})};return i.persist={setOptions:w=>{s={...s,...w},w.storage&&(f=w.storage)},clearStorage:()=>{f==null||f.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>x(),hasHydrated:()=>o,onHydrate:w=>(u.add(w),()=>{u.delete(w)}),onFinishHydration:w=>(d.add(w),()=>{d.delete(w)})},s.skipHydration||x(),y||b},vc=UK,m5="always",g5="funk",VK=[{value:"blow",label:"Blow"},{value:"bottle",label:"Bottle"},{value:"frog",label:"Frog"},{value:"funk",label:"Funk"},{value:"glass",label:"Glass"},{value:"ping",label:"Ping"},{value:"pop",label:"Pop"},{value:"purr",label:"Purr"},{value:"tink",label:"Tink"}];function qA(e){switch(e){case"never":case"unfocused":case"always":return e;default:return m5}}function KA(e){switch(e){case"blow":case"bottle":case"frog":case"funk":case"glass":case"ping":case"pop":case"purr":case"tink":return e;default:return g5}}const Au=gc()(vc(e=>({chatSoundPreference:m5,chatSoundId:g5,setChatSoundPreference:t=>e({chatSoundPreference:qA(t)}),setChatSoundId:t=>e({chatSoundId:KA(t)})}),{name:"chat-sound-preferences",version:2,migrate:e=>{const t=e;return{chatSoundPreference:qA(t==null?void 0:t.chatSoundPreference),chatSoundId:KA(t==null?void 0:t.chatSoundId)}}})),WK={blow:"/chat-sounds/Blow.mp3",bottle:"/chat-sounds/Bottle.mp3",frog:"/chat-sounds/Frog.mp3",funk:"/chat-sounds/Funk.mp3",glass:"/chat-sounds/Glass.mp3",ping:"/chat-sounds/Ping.mp3",pop:"/chat-sounds/Pop.mp3",purr:"/chat-sounds/Purr.mp3",tink:"/chat-sounds/Tink.mp3"};function GK(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function qK(e){const t=new Audio(WK[e]);return t.preload="auto",t.play()}async function SS(e,t){if(t<=0)return;const n=Array.from({length:t},(r,i)=>new Promise(s=>{window.setTimeout(()=>{qK(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function KK(e,t=document){return e==="never"?!1:e==="always"?!0:GK(t)}function YK(e){return e.projectGroups.reduce((t,n)=>t+n.chats.reduce((r,i)=>r+(i.unread?1:0)+(i.status==="waiting_for_user"?1:0),0),0)}function YA(e){let t=0;const n=new Set;for(const r of e.projectGroups)for(const i of r.chats)i.unread&&(t+=1),i.status==="waiting_for_user"&&n.add(i.chatId);return{unreadCount:t,waitingChatIds:n}}function XK(e,t){if(!e)return 0;const n=YA(e),r=YA(t),i=Math.max(0,r.unreadCount-n.unreadCount);let s=0;for(const o of r.waitingChatIds)n.waitingChatIds.has(o)||(s+=1);return i+s}const pd=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...i})=>m.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:ye("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...i,children:e});function wS(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const QK=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function ZK(e){const t=e.trim();for(const n of QK){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function v5(e){return e.split("/").pop()||e}const JK=1440*6e4;function eY(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=JK,o=7*s;return n<r?"now":n<i?`${Math.floor(n/r)}m`:n<s?`${Math.floor(n/i)}h`:n<o?`${Math.floor(n/s)}d`:`${Math.floor(n/o)}w`}function tY(e){return e.lastMessageAt??e._creationTime}const nY=new Set(["starting","running"]);function rY({chat:e,activeChatId:t,nowMs:n,shortcutHint:r=null,showShortcutHint:i=!1,onSelectChat:s,onForkChat:o,onDeleteChat:l}){const u=eY(tY(e),n),d=i&&r?r:u,f=i&&!!r,h=rW(e.chatId);return m.jsxs("div",{"data-chat-id":h,className:ye("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg cursor-pointer border-border/0 hover:border-border hover:bg-muted/20 active:scale-[0.985] border transition-all",t===h?"bg-muted hover:bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>s(e.chatId),children:[nY.has(e.status)?m.jsx(Rn,{className:"size-3.5 flex-shrink-0 animate-spin text-logo"}):e.status==="waiting_for_user"?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):e.unread?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,m.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?m.jsx(pd,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.status!=="idle"||t===h||e.unread?m.jsx("span",{className:"",children:e.title}):m.jsx("span",{className:"text-slate-500 dark:text-slate-400",children:e.title})}),m.jsxs("div",{className:ye("relative h-7 mr-[2px] shrink-0",e.canFork?"w-12":"w-6"),children:[d?f?m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-0.5 text-[11px] text-foreground transition-opacity group-hover:opacity-0",children:m.jsx(f5,{className:"h-4 min-w-4 rounded-sm border-border/50 bg-transparent px-1 text-[10px]",children:r})}):m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-1 text-[11px] text-muted-foreground opacity-50 transition-opacity group-hover:opacity-0",children:d}):null,m.jsxs("div",{className:ye("absolute inset-0 flex items-center justify-end gap-0 opacity-100",d?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),children:[e.canFork?m.jsx(st,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:g=>{g.stopPropagation(),o(e.chatId)},title:"Fork chat",children:m.jsx(YU,{className:"size-3.5"})}):null,m.jsx(st,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:g=>{g.stopPropagation(),l(e.chatId)},title:"Delete chat",children:m.jsx(g$,{className:"size-3.5"})})]})]})]},e._id)}const iY=_.memo(rY);function sY(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const x0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function md(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function iC(e){return"nodeType"in e}function mi(e){var t,n;return e?md(e)?e:iC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function sC(e){const{Document:t}=mi(e);return e instanceof t}function Xf(e){return md(e)?!1:e instanceof mi(e).HTMLElement}function b5(e){return e instanceof mi(e).SVGElement}function gd(e){return e?md(e)?e.document:iC(e)?sC(e)?e:Xf(e)||b5(e)?e.ownerDocument:document:document:document}const io=x0?_.useLayoutEffect:_.useEffect;function oC(e){const t=_.useRef(e);return io(()=>{t.current=e}),_.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function oY(){const e=_.useRef(null),t=_.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function pf(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return io(()=>{n.current!==e&&(n.current=e)},t),n}function Qf(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function cv(e){const t=oC(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function CS(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let Dy={};function Zf(e,t){return _.useMemo(()=>{if(t)return t;const n=Dy[e]==null?0:Dy[e]+1;return Dy[e]=n,e+"-"+n},[e,t])}function _5(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const l=Object.entries(o);for(const[u,d]of l){const f=s[u];f!=null&&(s[u]=f+e*d)}return s},{...t})}}const ju=_5(1),uv=_5(-1);function aY(e){return"clientX"in e&&"clientY"in e}function aC(e){if(!e)return!1;const{KeyboardEvent:t}=mi(e.target);return t&&e instanceof t}function lY(e){if(!e)return!1;const{TouchEvent:t}=mi(e.target);return t&&e instanceof t}function kS(e){if(lY(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return aY(e)?{x:e.clientX,y:e.clientY}:null}const mf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[mf.Translate.toString(e),mf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),XA="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function cY(e){return e.matches(XA)?e:e.querySelector(XA)}const uY={display:"none"};function dY(e){let{id:t,value:n}=e;return vn.createElement("div",{id:t,style:uY},n)}function hY(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return vn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function fY(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const y5=_.createContext(null);function pY(e){const t=_.useContext(y5);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function mY(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:i,event:s}=r;e.forEach(o=>{var l;return(l=o[i])==null?void 0:l.call(o,s)})},[e]),t]}const gY={draggable:`
|
|
630
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},AG="DialogDescriptionWarning",NG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${CO(AG).contentName}}.`;return _.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},MG=dO,LG=pO,kO=mO,EO=gO,DG=bO,IG=yO,PG=SO;const df="data-focus-fallback-ignore",RO="data-allow-focus-retain",rv="kanna:restore-chat-input-focus",Hw="data-chat-input",iv="data-chat-selection-zone";function Ol(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function TO(e){var n;const t=e;return t!=null&&t.matches?t.matches("input:not([type='checkbox']):not([type='radio']):not([type='button']):not([type='submit']):not([type='reset']), textarea, select")||t.isContentEditable||((n=t.getAttribute)==null?void 0:n.call(t,"role"))==="textbox"?!0:Ol(e,RO):!1}function OG(e){const t=e;return t!=null&&t.matches?TO(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Ol(e,RO):!1}function LA(e){return!!e.querySelector(`[${df}][data-state='open']`)}function jG(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function zG(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${Hw}]`)).filter(o=>!o.disabled);if(n.length===0)return!1;const r=n.indexOf(e),i=r>=0?(r+1)%n.length:0,s=n[i];return s?(s.focus({preventScroll:!0}),!0):!1}function DA(e){const{activeElement:t,fallback:n,hasActiveOverlay:r}=e;if(!n||n.disabled||r||t===n)return"none";if(e.trigger==="escape")return e.defaultPrevented||Ol(t,Hw)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,u=s??i;return!o||!u||!o.contains(u)||Ol(u,df)||Ol(t,df)||l&&(Ol(i,iv)||Ol(u,iv))||TO(t)?"none":t&&t===u?"restore":OG(t)?"none":"restore"}const Jl=MG,BG=LG,AO=_.forwardRef(({className:e,...t},n)=>m.jsx(kO,{ref:n,className:ye("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));AO.displayName=kO.displayName;const FG={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},Ya=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>m.jsxs(BG,{children:[m.jsx(AO,{}),m.jsxs(EO,{ref:i,[df]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(rv)),(o=r.onCloseAutoFocus)==null||o.call(r,s)},className:ye("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","max-h-[85vh] flex flex-col",FG[n],e),...r,children:[t,m.jsxs(PG,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[m.jsx(nl,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ya.displayName=EO.displayName;function HG({className:e,...t}){return m.jsx("div",{className:ye("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function ec({className:e,...t}){return m.jsx(DG,{className:ye("text-lg font-medium leading-none tracking-tight",e),...t})}function u0({className:e,...t}){return m.jsx(IG,{className:ye("text-sm text-muted-foreground",e),...t})}function tc({className:e,...t}){return m.jsx("div",{className:ye("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function nc({className:e,...t}){return m.jsx("div",{className:ye("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function $G({className:e,...t}){return m.jsx("button",{className:ye("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground","disabled:pointer-events-none disabled:text-muted-foreground/50",e),...t})}const Yr=_.forwardRef(({className:e,type:t,...n},r)=>m.jsx("input",{ref:r,type:t,className:ye("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Yr.displayName="Input";const NO=_.createContext(null);function UG({children:e}){const[t,n]=_.useState(null),[r,i]=_.useState(""),s=_.useRef(null);_.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(i(t.options.initialValue??""),setTimeout(()=>{var b,y;(b=s.current)==null||b.focus(),(y=s.current)==null||y.select()},0))},[t]);const o=_.useCallback(()=>{n(null),i("")},[]),l=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.kind==="prompt"?t.resolve(null):t.resolve(),o())},[o,t]),u=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.kind==="prompt"?t.resolve(r.trim()||null):t.resolve(),o())},[o,t,r]),d=_.useCallback(b=>new Promise(y=>{n({kind:"confirm",options:b,resolve:y})}),[]),f=_.useCallback(b=>new Promise(y=>{n({kind:"prompt",options:b,resolve:y})}),[]),h=_.useCallback(b=>new Promise(y=>{n({kind:"alert",options:b,resolve:y})}),[]),g=_.useMemo(()=>({confirm:d,prompt:f,alert:h}),[h,d,f]);return m.jsxs(NO.Provider,{value:g,children:[e,m.jsx(Jl,{open:t!==null,onOpenChange:b=>{b||!t||l()},children:m.jsx(Ya,{size:"sm",onKeyDown:b=>{b.key!=="Enter"||b.shiftKey||!t||t.kind!=="confirm"||(b.preventDefault(),u())},children:t?m.jsxs(m.Fragment,{children:[m.jsxs(tc,{className:"space-y-4",children:[m.jsx(ec,{children:t.options.title}),t.options.description?m.jsx(u0,{children:t.options.description}):null,t.kind==="prompt"?m.jsx(Yr,{ref:s,type:"text",value:r,onChange:b=>i(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),u())},placeholder:t.options.placeholder}):null]}),m.jsxs(nc,{children:[m.jsx(st,{variant:"ghost",size:"sm",onClick:l,className:t.kind==="alert"?"hidden":void 0,children:"cancelLabel"in t.options?t.options.cancelLabel??"Cancel":"Cancel"}),m.jsx(st,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:u,disabled:t.kind==="prompt"&&!r.trim(),children:t.kind==="alert"?t.options.closeLabel??"OK":"confirmLabel"in t.options?t.options.confirmLabel??"Confirm":"Confirm"})]})]}):null})})]})}function $w(){const e=_.useContext(NO);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const Uw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("bg-card text-card-foreground",e),...t}));Uw.displayName="Card";const Vw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-2",e),...t}));Vw.displayName="CardHeader";const MO=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:ye("text-2xl font-semibold leading-none tracking-tight",e),...t}));MO.displayName="CardTitle";const LO=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:ye("text-sm text-muted-foreground",e),...t}));LO.displayName="CardDescription";const Ww=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("p-6 pt-0",e),...t}));Ww.displayName="CardContent";const VG=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",e),...t}));VG.displayName="CardFooter";const WG=["top","right","bottom","left"],Xa=Math.min,Mi=Math.max,sv=Math.round,Pm=Math.floor,no=e=>({x:e,y:e}),GG={left:"right",right:"left",bottom:"top",top:"bottom"};function gS(e,t,n){return Mi(e,Xa(t,n))}function Fo(e,t){return typeof e=="function"?e(t):e}function Ho(e){return e.split("-")[0]}function hd(e){return e.split("-")[1]}function Gw(e){return e==="x"?"y":"x"}function qw(e){return e==="y"?"height":"width"}function Qs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Kw(e){return Gw(Qs(e))}function qG(e,t,n){n===void 0&&(n=!1);const r=hd(e),i=Kw(e),s=qw(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=ov(o)),[o,ov(o)]}function KG(e){const t=ov(e);return[vS(e),t,vS(t)]}function vS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const IA=["left","right"],PA=["right","left"],YG=["top","bottom"],XG=["bottom","top"];function QG(e,t,n){switch(e){case"top":case"bottom":return n?t?PA:IA:t?IA:PA;case"left":case"right":return t?YG:XG;default:return[]}}function ZG(e,t,n,r){const i=hd(e);let s=QG(Ho(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(vS)))),s}function ov(e){const t=Ho(e);return GG[t]+e.slice(t.length)}function JG(e){return{top:0,right:0,bottom:0,left:0,...e}}function DO(e){return typeof e!="number"?JG(e):{top:e,right:e,bottom:e,left:e}}function av(e){const{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 OA(e,t,n){let{reference:r,floating:i}=e;const s=Qs(t),o=Kw(t),l=qw(o),u=Ho(t),d=s==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,g=r[l]/2-i[l]/2;let b;switch(u){case"top":b={x:f,y:r.y-i.height};break;case"bottom":b={x:f,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:h};break;case"left":b={x:r.x-i.width,y:h};break;default:b={x:r.x,y:r.y}}switch(hd(t)){case"start":b[o]-=g*(n&&d?-1:1);break;case"end":b[o]+=g*(n&&d?-1:1);break}return b}async function eq(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:u}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:g=!1,padding:b=0}=Fo(t,e),y=DO(b),w=l[g?h==="floating"?"reference":"floating":h],C=av(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:u})),R=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),T=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},A=av(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:R,offsetParent:E,strategy:u}):R);return{top:(C.top-A.top+y.top)/T.y,bottom:(A.bottom-C.bottom+y.bottom)/T.y,left:(C.left-A.left+y.left)/T.x,right:(A.right-C.right+y.right)/T.x}}const tq=50,nq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:eq},u=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:h}=OA(d,r,u),g=r,b=0;const y={};for(let x=0;x<s.length;x++){const w=s[x];if(!w)continue;const{name:C,fn:R}=w,{x:E,y:T,data:A,reset:N}=await R({x:f,y:h,initialPlacement:r,placement:g,strategy:i,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});f=E??f,h=T??h,y[C]={...y[C],...A},N&&b<tq&&(b++,typeof N=="object"&&(N.placement&&(g=N.placement),N.rects&&(d=N.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):N.rects),{x:f,y:h}=OA(d,g,u)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},rq=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:u}=t,{element:d,padding:f=0}=Fo(e,t)||{};if(d==null)return{};const h=DO(f),g={x:n,y:r},b=Kw(i),y=qw(b),x=await o.getDimensions(d),w=b==="y",C=w?"top":"left",R=w?"bottom":"right",E=w?"clientHeight":"clientWidth",T=s.reference[y]+s.reference[b]-g[b]-s.floating[y],A=g[b]-s.reference[b],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let L=N?N[E]:0;(!L||!await(o.isElement==null?void 0:o.isElement(N)))&&(L=l.floating[E]||s.floating[y]);const P=T/2-A/2,G=L/2-x[y]/2-1,O=Xa(h[C],G),B=Xa(h[R],G),H=O,j=L-x[y]-B,$=L/2-x[y]/2+P,V=gS(H,$,j),z=!u.arrow&&hd(i)!=null&&$!==V&&s.reference[y]/2-($<H?O:B)-x[y]/2<0,q=z?$<H?$-H:$-j:0;return{[b]:g[b]+q,data:{[b]:V,centerOffset:$-V-q,...z&&{alignmentOffset:q}},reset:z}}}),iq=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:u,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...w}=Fo(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=Ho(i),R=Qs(l),E=Ho(l)===l,T=await(u.isRTL==null?void 0:u.isRTL(d.floating)),A=g||(E||!x?[ov(l)]:KG(l)),N=y!=="none";!g&&N&&A.push(...ZG(l,x,y,T));const L=[l,...A],P=await u.detectOverflow(t,w),G=[];let O=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(P[C]),h){const $=qG(i,o,T);G.push(P[$[0]],P[$[1]])}if(O=[...O,{placement:i,overflows:G}],!G.every($=>$<=0)){var B,H;const $=(((B=s.flip)==null?void 0:B.index)||0)+1,V=L[$];if(V&&(!(h==="alignment"?R!==Qs(V):!1)||O.every(F=>Qs(F.placement)===R?F.overflows[0]>0:!0)))return{data:{index:$,overflows:O},reset:{placement:V}};let z=(H=O.filter(q=>q.overflows[0]<=0).sort((q,F)=>q.overflows[1]-F.overflows[1])[0])==null?void 0:H.placement;if(!z)switch(b){case"bestFit":{var j;const q=(j=O.filter(F=>{if(N){const Y=Qs(F.placement);return Y===R||Y==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(Y=>Y>0).reduce((Y,I)=>Y+I,0)]).sort((F,Y)=>F[1]-Y[1])[0])==null?void 0:j[0];q&&(z=q);break}case"initialPlacement":z=l;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function jA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zA(e){return WG.some(t=>e[t]>=0)}const sq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Fo(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=jA(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:zA(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=jA(o,n.floating);return{data:{escapedOffsets:l,escaped:zA(l)}}}default:return{}}}}},IO=new Set(["left","top"]);async function oq(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ho(n),l=hd(n),u=Qs(n)==="y",d=IO.has(o)?-1:1,f=s&&u?-1:1,h=Fo(t,e);let{mainAxis:g,crossAxis:b,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof y=="number"&&(b=l==="end"?y*-1:y),u?{x:b*f,y:g*d}:{x:g*d,y:b*f}}const aq=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=t,u=await oq(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:o}}}}},lq=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:u={fn:C=>{let{x:R,y:E}=C;return{x:R,y:E}}},...d}=Fo(e,t),f={x:n,y:r},h=await s.detectOverflow(t,d),g=Qs(Ho(i)),b=Gw(g);let y=f[b],x=f[g];if(o){const C=b==="y"?"top":"left",R=b==="y"?"bottom":"right",E=y+h[C],T=y-h[R];y=gS(E,y,T)}if(l){const C=g==="y"?"top":"left",R=g==="y"?"bottom":"right",E=x+h[C],T=x-h[R];x=gS(E,x,T)}const w=u.fn({...t,[b]:y,[g]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[b]:o,[g]:l}}}}}},cq=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:l=0,mainAxis:u=!0,crossAxis:d=!0}=Fo(e,t),f={x:n,y:r},h=Qs(i),g=Gw(h);let b=f[g],y=f[h];const x=Fo(l,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(u){const E=g==="y"?"height":"width",T=s.reference[g]-s.floating[E]+w.mainAxis,A=s.reference[g]+s.reference[E]-w.mainAxis;b<T?b=T:b>A&&(b=A)}if(d){var C,R;const E=g==="y"?"width":"height",T=IO.has(Ho(i)),A=s.reference[h]-s.floating[E]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:w.crossAxis),N=s.reference[h]+s.reference[E]+(T?0:((R=o.offset)==null?void 0:R[h])||0)-(T?w.crossAxis:0);y<A?y=A:y>N&&(y=N)}return{[g]:b,[h]:y}}}},uq=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:l}=t,{apply:u=()=>{},...d}=Fo(e,t),f=await o.detectOverflow(t,d),h=Ho(i),g=hd(i),b=Qs(i)==="y",{width:y,height:x}=s.floating;let w,C;h==="top"||h==="bottom"?(w=h,C=g===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,w=g==="end"?"top":"bottom");const R=x-f.top-f.bottom,E=y-f.left-f.right,T=Xa(x-f[w],R),A=Xa(y-f[C],E),N=!t.middlewareData.shift;let L=T,P=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=R),N&&!g){const O=Mi(f.left,0),B=Mi(f.right,0),H=Mi(f.top,0),j=Mi(f.bottom,0);b?P=y-2*(O!==0||B!==0?O+B:Mi(f.left,f.right)):L=x-2*(H!==0||j!==0?H+j:Mi(f.top,f.bottom))}await u({...t,availableWidth:P,availableHeight:L});const G=await o.getDimensions(l.floating);return y!==G.width||x!==G.height?{reset:{rects:!0}}:{}}}};function d0(){return typeof window<"u"}function fd(e){return PO(e)?(e.nodeName||"").toLowerCase():"#document"}function Di(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function oo(e){var t;return(t=(PO(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function PO(e){return d0()?e instanceof Node||e instanceof Di(e).Node:!1}function As(e){return d0()?e instanceof Element||e instanceof Di(e).Element:!1}function qo(e){return d0()?e instanceof HTMLElement||e instanceof Di(e).HTMLElement:!1}function BA(e){return!d0()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Di(e).ShadowRoot}function qf(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Ns(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function dq(e){return/^(table|td|th)$/.test(fd(e))}function h0(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const hq=/transform|translate|scale|rotate|perspective|filter/,fq=/paint|layout|strict|content/,Tl=e=>!!e&&e!=="none";let Ny;function Yw(e){const t=As(e)?Ns(e):e;return Tl(t.transform)||Tl(t.translate)||Tl(t.scale)||Tl(t.rotate)||Tl(t.perspective)||!Xw()&&(Tl(t.backdropFilter)||Tl(t.filter))||hq.test(t.willChange||"")||fq.test(t.contain||"")}function pq(e){let t=Qa(e);for(;qo(t)&&!qu(t);){if(Yw(t))return t;if(h0(t))return null;t=Qa(t)}return null}function Xw(){return Ny==null&&(Ny=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ny}function qu(e){return/^(html|body|#document)$/.test(fd(e))}function Ns(e){return Di(e).getComputedStyle(e)}function f0(e){return As(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qa(e){if(fd(e)==="html")return e;const t=e.assignedSlot||e.parentNode||BA(e)&&e.host||oo(e);return BA(t)?t.host:t}function OO(e){const t=Qa(e);return qu(t)?e.ownerDocument?e.ownerDocument.body:e.body:qo(t)&&qf(t)?t:OO(t)}function hf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=OO(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Di(i);if(s){const l=bS(o);return t.concat(o,o.visualViewport||[],qf(i)?i:[],l&&n?hf(l):[])}else return t.concat(i,hf(i,[],n))}function bS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function jO(e){const t=Ns(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=qo(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=sv(n)!==s||sv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function Qw(e){return As(e)?e:e.contextElement}function Ou(e){const t=Qw(e);if(!qo(t))return no(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=jO(t);let o=(s?sv(n.width):n.width)/r,l=(s?sv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const mq=no(0);function zO(e){const t=Di(e);return!Xw()||!t.visualViewport?mq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gq(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Di(e)?!1:t}function rc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=Qw(e);let o=no(1);t&&(r?As(r)&&(o=Ou(r)):o=Ou(e));const l=gq(s,n,r)?zO(s):no(0);let u=(i.left+l.x)/o.x,d=(i.top+l.y)/o.y,f=i.width/o.x,h=i.height/o.y;if(s){const g=Di(s),b=r&&As(r)?Di(r):r;let y=g,x=bS(y);for(;x&&r&&b!==y;){const w=Ou(x),C=x.getBoundingClientRect(),R=Ns(x),E=C.left+(x.clientLeft+parseFloat(R.paddingLeft))*w.x,T=C.top+(x.clientTop+parseFloat(R.paddingTop))*w.y;u*=w.x,d*=w.y,f*=w.x,h*=w.y,u+=E,d+=T,y=Di(x),x=bS(y)}}return av({width:f,height:h,x:u,y:d})}function p0(e,t){const n=f0(e).scrollLeft;return t?t.left+n:rc(oo(e)).left+n}function BO(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-p0(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function vq(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=oo(r),l=t?h0(t.floating):!1;if(r===o||l&&s)return n;let u={scrollLeft:0,scrollTop:0},d=no(1);const f=no(0),h=qo(r);if((h||!h&&!s)&&((fd(r)!=="body"||qf(o))&&(u=f0(r)),h)){const b=rc(r);d=Ou(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const g=o&&!h&&!s?BO(o,u):no(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+f.x+g.x,y:n.y*d.y-u.scrollTop*d.y+f.y+g.y}}function bq(e){return Array.from(e.getClientRects())}function _q(e){const t=oo(e),n=f0(e),r=e.ownerDocument.body,i=Mi(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Mi(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+p0(e);const l=-n.scrollTop;return Ns(r).direction==="rtl"&&(o+=Mi(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const FA=25;function yq(e,t){const n=Di(e),r=oo(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,u=0;if(i){s=i.width,o=i.height;const f=Xw();(!f||f&&t==="fixed")&&(l=i.offsetLeft,u=i.offsetTop)}const d=p0(r);if(d<=0){const f=r.ownerDocument,h=f.body,g=getComputedStyle(h),b=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-h.clientWidth-b);y<=FA&&(s-=y)}else d<=FA&&(s+=d);return{width:s,height:o,x:l,y:u}}function xq(e,t){const n=rc(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=qo(e)?Ou(e):no(1),o=e.clientWidth*s.x,l=e.clientHeight*s.y,u=i*s.x,d=r*s.y;return{width:o,height:l,x:u,y:d}}function HA(e,t,n){let r;if(t==="viewport")r=yq(e,n);else if(t==="document")r=_q(oo(e));else if(As(t))r=xq(t,n);else{const i=zO(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return av(r)}function FO(e,t){const n=Qa(e);return n===t||!As(n)||qu(n)?!1:Ns(n).position==="fixed"||FO(n,t)}function Sq(e,t){const n=t.get(e);if(n)return n;let r=hf(e,[],!1).filter(l=>As(l)&&fd(l)!=="body"),i=null;const s=Ns(e).position==="fixed";let o=s?Qa(e):e;for(;As(o)&&!qu(o);){const l=Ns(o),u=Yw(o);!u&&l.position==="fixed"&&(i=null),(s?!u&&!i:!u&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||qf(o)&&!u&&FO(e,o))?r=r.filter(f=>f!==o):i=l,o=Qa(o)}return t.set(e,r),r}function wq(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?h0(t)?[]:Sq(t,this._c):[].concat(n),r],l=HA(t,o[0],i);let u=l.top,d=l.right,f=l.bottom,h=l.left;for(let g=1;g<o.length;g++){const b=HA(t,o[g],i);u=Mi(b.top,u),d=Xa(b.right,d),f=Xa(b.bottom,f),h=Mi(b.left,h)}return{width:d-h,height:f-u,x:h,y:u}}function Cq(e){const{width:t,height:n}=jO(e);return{width:t,height:n}}function kq(e,t,n){const r=qo(t),i=oo(t),s=n==="fixed",o=rc(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=no(0);function d(){u.x=p0(i)}if(r||!r&&!s)if((fd(t)!=="body"||qf(i))&&(l=f0(t)),r){const b=rc(t,!0,s,t);u.x=b.x+t.clientLeft,u.y=b.y+t.clientTop}else i&&d();s&&!r&&i&&d();const f=i&&!r&&!s?BO(i,l):no(0),h=o.left+l.scrollLeft-u.x-f.x,g=o.top+l.scrollTop-u.y-f.y;return{x:h,y:g,width:o.width,height:o.height}}function My(e){return Ns(e).position==="static"}function $A(e,t){if(!qo(e)||Ns(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return oo(e)===n&&(n=n.ownerDocument.body),n}function HO(e,t){const n=Di(e);if(h0(e))return n;if(!qo(e)){let i=Qa(e);for(;i&&!qu(i);){if(As(i)&&!My(i))return i;i=Qa(i)}return n}let r=$A(e,t);for(;r&&dq(r)&&My(r);)r=$A(r,t);return r&&qu(r)&&My(r)&&!Yw(r)?n:r||pq(e)||n}const Eq=async function(e){const t=this.getOffsetParent||HO,n=this.getDimensions,r=await n(e.floating);return{reference:kq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Rq(e){return Ns(e).direction==="rtl"}const Tq={convertOffsetParentRelativeRectToViewportRelativeRect:vq,getDocumentElement:oo,getClippingRect:wq,getOffsetParent:HO,getElementRects:Eq,getClientRects:bq,getDimensions:Cq,getScale:Ou,isElement:As,isRTL:Rq};function $O(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Aq(e,t){let n=null,r;const i=oo(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),s();const d=e.getBoundingClientRect(),{left:f,top:h,width:g,height:b}=d;if(l||t(),!g||!b)return;const y=Pm(h),x=Pm(i.clientWidth-(f+g)),w=Pm(i.clientHeight-(h+b)),C=Pm(f),E={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:Mi(0,Xa(1,u))||1};let T=!0;function A(N){const L=N[0].intersectionRatio;if(L!==u){if(!T)return o();L?o(!1,L):r=setTimeout(()=>{o(!1,1e-7)},1e3)}L===1&&!$O(d,e.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(A,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(A,E)}n.observe(e)}return o(!0),s}function Nq(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,d=Qw(e),f=i||s?[...d?hf(d):[],...t?hf(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?Aq(d,n):null;let g=-1,b=null;o&&(b=new ResizeObserver(C=>{let[R]=C;R&&R.target===d&&b&&t&&(b.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=b)==null||E.observe(t)})),n()}),d&&!u&&b.observe(d),t&&b.observe(t));let y,x=u?rc(e):null;u&&w();function w(){const C=rc(e);x&&!$O(x,C)&&n(),x=C,y=requestAnimationFrame(w)}return n(),()=>{var C;f.forEach(R=>{i&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),h==null||h(),(C=b)==null||C.disconnect(),b=null,u&&cancelAnimationFrame(y)}}const Mq=aq,Lq=lq,Dq=iq,Iq=uq,Pq=sq,UA=rq,Oq=cq,jq=(e,t,n)=>{const r=new Map,i={platform:Tq,...n},s={...i.platform,_c:r};return nq(e,t,{...i,platform:s})};var zq=typeof document<"u",Bq=function(){},Ng=zq?_.useLayoutEffect:Bq;function lv(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(!lv(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;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!lv(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function UO(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function VA(e,t){const n=UO(e);return Math.round(t*n)/n}function Ly(e){const t=_.useRef(e);return Ng(()=>{t.current=e}),t}function Fq(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:u,open:d}=e,[f,h]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,b]=_.useState(r);lv(g,r)||b(r);const[y,x]=_.useState(null),[w,C]=_.useState(null),R=_.useCallback(F=>{F!==N.current&&(N.current=F,x(F))},[]),E=_.useCallback(F=>{F!==L.current&&(L.current=F,C(F))},[]),T=s||y,A=o||w,N=_.useRef(null),L=_.useRef(null),P=_.useRef(f),G=u!=null,O=Ly(u),B=Ly(i),H=Ly(d),j=_.useCallback(()=>{if(!N.current||!L.current)return;const F={placement:t,strategy:n,middleware:g};B.current&&(F.platform=B.current),jq(N.current,L.current,F).then(Y=>{const I={...Y,isPositioned:H.current!==!1};$.current&&!lv(P.current,I)&&(P.current=I,os.flushSync(()=>{h(I)}))})},[g,t,n,B,H]);Ng(()=>{d===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[d]);const $=_.useRef(!1);Ng(()=>($.current=!0,()=>{$.current=!1}),[]),Ng(()=>{if(T&&(N.current=T),A&&(L.current=A),T&&A){if(O.current)return O.current(T,A,j);j()}},[T,A,j,O,G]);const V=_.useMemo(()=>({reference:N,floating:L,setReference:R,setFloating:E}),[R,E]),z=_.useMemo(()=>({reference:T,floating:A}),[T,A]),q=_.useMemo(()=>{const F={position:n,left:0,top:0};if(!z.floating)return F;const Y=VA(z.floating,f.x),I=VA(z.floating,f.y);return l?{...F,transform:"translate("+Y+"px, "+I+"px)",...UO(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:I}},[n,l,z.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:j,refs:V,elements:z,floatingStyles:q}),[f,j,V,z,q])}const Hq=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?UA({element:r.current,padding:i}).fn(n):{}:r?UA({element:r,padding:i}).fn(n):{}}}},$q=(e,t)=>{const n=Mq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Uq=(e,t)=>{const n=Lq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vq=(e,t)=>({fn:Oq(e).fn,options:[e,t]}),Wq=(e,t)=>{const n=Dq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gq=(e,t)=>{const n=Iq(e);return{name:n.name,fn:n.fn,options:[e,t]}},qq=(e,t)=>{const n=Pq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kq=(e,t)=>{const n=Hq(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Yq="Arrow",VO=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Kt.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});VO.displayName=Yq;var Xq=VO;function Qq(e){const[t,n]=_.useState(void 0);return zr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,l;if("borderBoxSize"in s){const u=s.borderBoxSize,d=Array.isArray(u)?u[0]:u;o=d.inlineSize,l=d.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Zw="Popper",[WO,il]=Go(Zw),[Zq,GO]=WO(Zw),qO=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(Zq,{scope:t,anchor:r,onAnchorChange:i,children:n})};qO.displayName=Zw;var KO="PopperAnchor",YO=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=GO(KO,n),o=_.useRef(null),l=an(t,o),u=_.useRef(null);return _.useEffect(()=>{const d=u.current;u.current=(r==null?void 0:r.current)||o.current,d!==u.current&&s.onAnchorChange(u.current)}),r?null:m.jsx(Kt.div,{...i,ref:l})});YO.displayName=KO;var Jw="PopperContent",[Jq,eK]=WO(Jw),XO=_.forwardRef((e,t)=>{var re,pe,ce,ge,ue,ke;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:b="optimized",onPlaced:y,...x}=e,w=GO(Jw,n),[C,R]=_.useState(null),E=an(t,Ae=>R(Ae)),[T,A]=_.useState(null),N=Qq(T),L=(N==null?void 0:N.width)??0,P=(N==null?void 0:N.height)??0,G=r+(s!=="center"?"-"+s:""),O=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},B=Array.isArray(d)?d:[d],H=B.length>0,j={padding:O,boundary:B.filter(nK),altBoundary:H},{refs:$,floatingStyles:V,placement:z,isPositioned:q,middlewareData:F}=Fq({strategy:"fixed",placement:G,whileElementsMounted:(...Ae)=>Nq(...Ae,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[$q({mainAxis:i+P,alignmentAxis:o}),u&&Uq({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Vq():void 0,...j}),u&&Wq({...j}),Gq({...j,apply:({elements:Ae,rects:ze,availableWidth:Ge,availableHeight:Et})=>{const{width:zt,height:Ct}=ze.reference,Pe=Ae.floating.style;Pe.setProperty("--radix-popper-available-width",`${Ge}px`),Pe.setProperty("--radix-popper-available-height",`${Et}px`),Pe.setProperty("--radix-popper-anchor-width",`${zt}px`),Pe.setProperty("--radix-popper-anchor-height",`${Ct}px`)}}),T&&Kq({element:T,padding:l}),rK({arrowWidth:L,arrowHeight:P}),g&&qq({strategy:"referenceHidden",...j})]}),[Y,I]=JO(z),U=Ts(y);zr(()=>{q&&(U==null||U())},[q,U]);const X=(re=F.arrow)==null?void 0:re.x,D=(pe=F.arrow)==null?void 0:pe.y,te=((ce=F.arrow)==null?void 0:ce.centerOffset)!==0,[Q,ne]=_.useState();return zr(()=>{C&&ne(window.getComputedStyle(C).zIndex)},[C]),m.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:q?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[(ge=F.transformOrigin)==null?void 0:ge.x,(ue=F.transformOrigin)==null?void 0:ue.y].join(" "),...((ke=F.hide)==null?void 0:ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(Jq,{scope:n,placedSide:Y,onArrowChange:A,arrowX:X,arrowY:D,shouldHideArrow:te,children:m.jsx(Kt.div,{"data-side":Y,"data-align":I,...x,ref:E,style:{...x.style,animation:q?void 0:"none"}})})})});XO.displayName=Jw;var QO="PopperArrow",tK={top:"bottom",right:"left",bottom:"top",left:"right"},ZO=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=eK(QO,r),o=tK[s.placedSide];return m.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:m.jsx(Xq,{...i,ref:n,style:{...i.style,display:"block"}})})});ZO.displayName=QO;function nK(e){return e!==null}var rK=e=>({name:"transformOrigin",options:e,fn(t){var w,C,R;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,l=o?0:e.arrowWidth,u=o?0:e.arrowHeight,[d,f]=JO(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((C=i.arrow)==null?void 0:C.x)??0)+l/2,b=(((R=i.arrow)==null?void 0:R.y)??0)+u/2;let y="",x="";return d==="bottom"?(y=o?h:`${g}px`,x=`${-u}px`):d==="top"?(y=o?h:`${g}px`,x=`${r.floating.height+u}px`):d==="right"?(y=`${-u}px`,x=o?h:`${b}px`):d==="left"&&(y=`${r.floating.width+u}px`,x=o?h:`${b}px`),{data:{x:y,y:x}}}});function JO(e){const[t,n="center"]=e.split("-");return[t,n]}var m0=qO,Kf=YO,g0=XO,v0=ZO,e5=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"}),iK="VisuallyHidden",t5=_.forwardRef((e,t)=>m.jsx(Kt.span,{...e,ref:t,style:{...e5,...e.style}}));t5.displayName=iK;var sK=t5,[b0]=Go("Tooltip",[il]),_0=il(),n5="TooltipProvider",oK=700,_S="tooltip.open",[aK,eC]=b0(n5),r5=e=>{const{__scopeTooltip:t,delayDuration:n=oK,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=_.useRef(!0),l=_.useRef(!1),u=_.useRef(0);return _.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),m.jsx(aK,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(u.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:_.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:s})};r5.displayName=n5;var ff="Tooltip",[lK,Yf]=b0(ff),i5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,u=eC(ff,e.__scopeTooltip),d=_0(t),[f,h]=_.useState(null),g=zo(),b=_.useRef(0),y=o??u.disableHoverableContent,x=l??u.delayDuration,w=_.useRef(!1),[C,R]=Gu({prop:r,defaultProp:i??!1,onChange:L=>{L?(u.onOpen(),document.dispatchEvent(new CustomEvent(_S))):u.onClose(),s==null||s(L)},caller:ff}),E=_.useMemo(()=>C?w.current?"delayed-open":"instant-open":"closed",[C]),T=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,w.current=!1,R(!0)},[R]),A=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,R(!1)},[R]),N=_.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{w.current=!0,R(!0),b.current=0},x)},[x,R]);return _.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),m.jsx(m0,{...d,children:m.jsx(lK,{scope:t,contentId:g,open:C,stateAttribute:E,trigger:f,onTriggerChange:h,onTriggerEnter:_.useCallback(()=>{u.isOpenDelayedRef.current?N():T()},[u.isOpenDelayedRef,N,T]),onTriggerLeave:_.useCallback(()=>{y?A():(window.clearTimeout(b.current),b.current=0)},[A,y]),onOpen:T,onClose:A,disableHoverableContent:y,children:n})})};i5.displayName=ff;var yS="TooltipTrigger",s5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Yf(yS,n),s=eC(yS,n),o=_0(n),l=_.useRef(null),u=an(t,l,i.onTriggerChange),d=_.useRef(!1),f=_.useRef(!1),h=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(Kf,{asChild:!0,...o,children:m.jsx(Kt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:u,onPointerMove:Ve(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Ve(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Ve(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ve(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Ve(e.onBlur,i.onClose),onClick:Ve(e.onClick,i.onClose)})})});s5.displayName=yS;var tC="TooltipPortal",[cK,uK]=b0(tC,{forceMount:void 0}),o5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=Yf(tC,t);return m.jsx(cK,{scope:t,forceMount:n,children:m.jsx(ps,{present:n||s.open,children:m.jsx(dd,{asChild:!0,container:i,children:r})})})};o5.displayName=tC;var Ku="TooltipContent",a5=_.forwardRef((e,t)=>{const n=uK(Ku,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=Yf(Ku,e.__scopeTooltip);return m.jsx(ps,{present:r||o.open,children:o.disableHoverableContent?m.jsx(l5,{side:i,...s,ref:t}):m.jsx(dK,{side:i,...s,ref:t})})}),dK=_.forwardRef((e,t)=>{const n=Yf(Ku,e.__scopeTooltip),r=eC(Ku,e.__scopeTooltip),i=_.useRef(null),s=an(t,i),[o,l]=_.useState(null),{trigger:u,onClose:d}=n,f=i.current,{onPointerInTransitChange:h}=r,g=_.useCallback(()=>{l(null),h(!1)},[h]),b=_.useCallback((y,x)=>{const w=y.currentTarget,C={x:y.clientX,y:y.clientY},R=gK(C,w.getBoundingClientRect()),E=vK(C,R),T=bK(x.getBoundingClientRect()),A=yK([...E,...T]);l(A),h(!0)},[h]);return _.useEffect(()=>()=>g(),[g]),_.useEffect(()=>{if(u&&f){const y=w=>b(w,f),x=w=>b(w,u);return u.addEventListener("pointerleave",y),f.addEventListener("pointerleave",x),()=>{u.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",x)}}},[u,f,b,g]),_.useEffect(()=>{if(o){const y=x=>{const w=x.target,C={x:x.clientX,y:x.clientY},R=(u==null?void 0:u.contains(w))||(f==null?void 0:f.contains(w)),E=!_K(C,o);R?g():E&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[u,f,o,d,g]),m.jsx(l5,{...e,ref:s})}),[hK,fK]=b0(ff,{isInside:!1}),pK=hW("TooltipContent"),l5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,u=Yf(Ku,n),d=_0(n),{onClose:f}=u;return _.useEffect(()=>(document.addEventListener(_S,f),()=>document.removeEventListener(_S,f)),[f]),_.useEffect(()=>{if(u.trigger){const h=g=>{const b=g.target;b!=null&&b.contains(u.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,f]),m.jsx(ud,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs(g0,{"data-state":u.stateAttribute,...d,...l,ref:t,style:{...l.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:[m.jsx(pK,{children:r}),m.jsx(hK,{scope:n,isInside:!0,children:m.jsx(sK,{id:u.contentId,role:"tooltip",children:i||r})})]})})});a5.displayName=Ku;var c5="TooltipArrow",mK=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=_0(n);return fK(c5,n).isInside?null:m.jsx(v0,{...i,...r,ref:t})});mK.displayName=c5;function gK(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function vK(e,t,n=5){const 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 bK(e){const{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 _K(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const l=t[s],u=t[o],d=l.x,f=l.y,h=u.x,g=u.y;f>r!=g>r&&n<(h-d)*(r-f)/(g-f)+d&&(i=!i)}return i}function yK(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),xK(t)}function xK(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}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 SK=r5,u5=i5,d5=s5,h5=o5,nC=a5;function f5({className:e,...t}){return m.jsx("kbd",{className:ye("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",e),...t})}function wK({className:e,...t}){return m.jsx("span",{className:ye("inline-flex items-center gap-0.5",e),...t})}const CK="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 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",kK=SK,Za=u5,Ja=d5,$o=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(h5,{children:m.jsx(nC,{ref:r,sideOffset:t,className:ye("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 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",e),...n})}));$o.displayName=nC.displayName;const Oh=u5,jh=d5;function p5(e){return e.toUpperCase()}function EK(e){const t=e.split("+");return m.jsx(wK,{children:t.map((n,r)=>m.jsx(f5,{children:p5(n)},`${n}-${r}`))})}const Tu=_.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...i},s)=>{const o=r===void 0?null:Array.isArray(r)?r[0]??null:r;return m.jsx(h5,{children:m.jsx(nC,{ref:s,sideOffset:t,className:ye(CK,e),...i,children:o?EK(o):m.jsx("span",{children:typeof n=="string"?p5(n):n})})})});Tu.displayName="HotkeyTooltipContent";const RK="0.34.4",TK={version:RK},Bn="Kanna",WA="kanna",AK=".kanna",NK=".kanna-dev",MK="KANNA_RUNTIME_PROFILE",rC=`kanna/${TK.version}`,LK="[kanna]",DK=`~/${Bn}`;function y0(){var t;return(t=globalThis.process)==null?void 0:t.env}function IK(e=y0()){var t;return((t=e==null?void 0:e[MK])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function PK(e=y0()){return IK(e)==="dev"?NK:AK}function OK(e=y0()){return`~/${PK(e)}`}function jK(e=y0()){return`${OK(e)}/keybindings.json`}function Om(e){return e?`${WA} ${e}`:WA}const GA=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const g=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(b=>b(t,g))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d))},u=t=e(r,i,l);return l},zK=(e=>e?GA(e):GA),BK=e=>e;function FK(e,t=BK){const n=vn.useSyncExternalStore(e.subscribe,vn.useCallback(()=>t(e.getState()),[e,t]),vn.useCallback(()=>t(e.getInitialState()),[e,t]));return vn.useDebugValue(n),n}const HK=e=>{const t=zK(e),n=r=>FK(t,r);return Object.assign(n,t),n},gc=(e=>HK);function $K(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var s;const o=u=>u===null?null:JSON.parse(u,void 0),l=(s=n.getItem(i))!=null?s:null;return l instanceof Promise?l.then(o):o(l)},setItem:(i,s)=>n.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>n.removeItem(i)}}const xS=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return xS(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return xS(r)(n)}}}},UK=(e,t)=>(n,r,i)=>{let s={storage:$K(()=>window.localStorage),partialize:w=>w,version:0,merge:(w,C)=>({...C,...w}),...t},o=!1,l=0;const u=new Set,d=new Set;let f=s.storage;if(!f)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...w)},r,i);const h=()=>{const w=s.partialize({...r()});return f.setItem(s.name,{state:w,version:s.version})},g=i.setState;i.setState=(w,C)=>(g(w,C),h());const b=e((...w)=>(n(...w),h()),r,i);i.getInitialState=()=>b;let y;const x=()=>{var w,C;if(!f)return;const R=++l;o=!1,u.forEach(T=>{var A;return T((A=r())!=null?A:b)});const E=((C=s.onRehydrateStorage)==null?void 0:C.call(s,(w=r())!=null?w:b))||void 0;return xS(f.getItem.bind(f))(s.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==s.version){if(s.migrate){const A=s.migrate(T.state,T.version);return A instanceof Promise?A.then(N=>[!0,N]):[!0,A]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var A;if(R!==l)return;const[N,L]=T;if(y=s.merge(L,(A=r())!=null?A:b),n(y,!0),N)return h()}).then(()=>{R===l&&(E==null||E(y,void 0),y=r(),o=!0,d.forEach(T=>T(y)))}).catch(T=>{R===l&&(E==null||E(void 0,T))})};return i.persist={setOptions:w=>{s={...s,...w},w.storage&&(f=w.storage)},clearStorage:()=>{f==null||f.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>x(),hasHydrated:()=>o,onHydrate:w=>(u.add(w),()=>{u.delete(w)}),onFinishHydration:w=>(d.add(w),()=>{d.delete(w)})},s.skipHydration||x(),y||b},vc=UK,m5="always",g5="funk",VK=[{value:"blow",label:"Blow"},{value:"bottle",label:"Bottle"},{value:"frog",label:"Frog"},{value:"funk",label:"Funk"},{value:"glass",label:"Glass"},{value:"ping",label:"Ping"},{value:"pop",label:"Pop"},{value:"purr",label:"Purr"},{value:"tink",label:"Tink"}];function qA(e){switch(e){case"never":case"unfocused":case"always":return e;default:return m5}}function KA(e){switch(e){case"blow":case"bottle":case"frog":case"funk":case"glass":case"ping":case"pop":case"purr":case"tink":return e;default:return g5}}const Au=gc()(vc(e=>({chatSoundPreference:m5,chatSoundId:g5,setChatSoundPreference:t=>e({chatSoundPreference:qA(t)}),setChatSoundId:t=>e({chatSoundId:KA(t)})}),{name:"chat-sound-preferences",version:2,migrate:e=>{const t=e;return{chatSoundPreference:qA(t==null?void 0:t.chatSoundPreference),chatSoundId:KA(t==null?void 0:t.chatSoundId)}}})),WK={blow:"/chat-sounds/Blow.mp3",bottle:"/chat-sounds/Bottle.mp3",frog:"/chat-sounds/Frog.mp3",funk:"/chat-sounds/Funk.mp3",glass:"/chat-sounds/Glass.mp3",ping:"/chat-sounds/Ping.mp3",pop:"/chat-sounds/Pop.mp3",purr:"/chat-sounds/Purr.mp3",tink:"/chat-sounds/Tink.mp3"};function GK(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function qK(e){const t=new Audio(WK[e]);return t.preload="auto",t.play()}async function SS(e,t){if(t<=0)return;const n=Array.from({length:t},(r,i)=>new Promise(s=>{window.setTimeout(()=>{qK(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function KK(e,t=document){return e==="never"?!1:e==="always"?!0:GK(t)}function YK(e){return e.projectGroups.reduce((t,n)=>t+n.chats.reduce((r,i)=>r+(i.unread?1:0)+(i.status==="waiting_for_user"?1:0),0),0)}function YA(e){let t=0;const n=new Set;for(const r of e.projectGroups)for(const i of r.chats)i.unread&&(t+=1),i.status==="waiting_for_user"&&n.add(i.chatId);return{unreadCount:t,waitingChatIds:n}}function XK(e,t){if(!e)return 0;const n=YA(e),r=YA(t),i=Math.max(0,r.unreadCount-n.unreadCount);let s=0;for(const o of r.waitingChatIds)n.waitingChatIds.has(o)||(s+=1);return i+s}const pd=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...i})=>m.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:ye("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...i,children:e});function wS(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const QK=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function ZK(e){const t=e.trim();for(const n of QK){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function v5(e){return e.split("/").pop()||e}const JK=1440*6e4;function eY(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=JK,o=7*s;return n<r?"now":n<i?`${Math.floor(n/r)}m`:n<s?`${Math.floor(n/i)}h`:n<o?`${Math.floor(n/s)}d`:`${Math.floor(n/o)}w`}function tY(e){return e.lastMessageAt??e._creationTime}const nY=new Set(["starting","running"]);function rY({chat:e,activeChatId:t,nowMs:n,shortcutHint:r=null,showShortcutHint:i=!1,onSelectChat:s,onForkChat:o,onDeleteChat:l}){const u=eY(tY(e),n),d=i&&r?r:u,f=i&&!!r,h=rW(e.chatId);return m.jsxs("div",{"data-chat-id":h,className:ye("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg cursor-pointer border-border/0 hover:border-border hover:bg-muted/20 active:scale-[0.985] border transition-all",t===h?"bg-muted hover:bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>s(e.chatId),children:[nY.has(e.status)?m.jsx(Rn,{className:"size-3.5 flex-shrink-0 animate-spin text-logo"}):e.status==="waiting_for_user"?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):e.unread?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,m.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?m.jsx(pd,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.status!=="idle"||t===h||e.unread?m.jsx("span",{className:"",children:e.title}):m.jsx("span",{className:"text-slate-500 dark:text-slate-400",children:e.title})}),m.jsxs("div",{className:ye("relative h-7 mr-[2px] shrink-0",e.canFork?"w-12":"w-6"),children:[d?f?m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-0.5 text-[11px] text-foreground transition-opacity group-hover:opacity-0",children:m.jsx(f5,{className:"h-4 min-w-4 rounded-sm border-border/50 bg-transparent px-1 text-[10px]",children:r})}):m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-1 text-[11px] text-muted-foreground opacity-50 transition-opacity group-hover:opacity-0",children:d}):null,m.jsxs("div",{className:ye("absolute inset-0 flex items-center justify-end gap-0 opacity-100",d?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),children:[e.canFork?m.jsx(st,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:g=>{g.stopPropagation(),o(e.chatId)},title:"Fork chat",children:m.jsx(YU,{className:"size-3.5"})}):null,m.jsx(st,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:g=>{g.stopPropagation(),l(e.chatId)},title:"Delete chat",children:m.jsx(g$,{className:"size-3.5"})})]})]})]},e._id)}const iY=_.memo(rY);function sY(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const x0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function md(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function iC(e){return"nodeType"in e}function mi(e){var t,n;return e?md(e)?e:iC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function sC(e){const{Document:t}=mi(e);return e instanceof t}function Xf(e){return md(e)?!1:e instanceof mi(e).HTMLElement}function b5(e){return e instanceof mi(e).SVGElement}function gd(e){return e?md(e)?e.document:iC(e)?sC(e)?e:Xf(e)||b5(e)?e.ownerDocument:document:document:document}const io=x0?_.useLayoutEffect:_.useEffect;function oC(e){const t=_.useRef(e);return io(()=>{t.current=e}),_.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function oY(){const e=_.useRef(null),t=_.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function pf(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return io(()=>{n.current!==e&&(n.current=e)},t),n}function Qf(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function cv(e){const t=oC(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function CS(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let Dy={};function Zf(e,t){return _.useMemo(()=>{if(t)return t;const n=Dy[e]==null?0:Dy[e]+1;return Dy[e]=n,e+"-"+n},[e,t])}function _5(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const l=Object.entries(o);for(const[u,d]of l){const f=s[u];f!=null&&(s[u]=f+e*d)}return s},{...t})}}const ju=_5(1),uv=_5(-1);function aY(e){return"clientX"in e&&"clientY"in e}function aC(e){if(!e)return!1;const{KeyboardEvent:t}=mi(e.target);return t&&e instanceof t}function lY(e){if(!e)return!1;const{TouchEvent:t}=mi(e.target);return t&&e instanceof t}function kS(e){if(lY(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return aY(e)?{x:e.clientX,y:e.clientY}:null}const mf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[mf.Translate.toString(e),mf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),XA="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function cY(e){return e.matches(XA)?e:e.querySelector(XA)}const uY={display:"none"};function dY(e){let{id:t,value:n}=e;return vn.createElement("div",{id:t,style:uY},n)}function hY(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return vn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function fY(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const y5=_.createContext(null);function pY(e){const t=_.useContext(y5);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function mY(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:i,event:s}=r;e.forEach(o=>{var l;return(l=o[i])==null?void 0:l.call(o,s)})},[e]),t]}const gY={draggable:`
|
|
631
631
|
To pick up a draggable item, press the space bar.
|
|
632
632
|
While dragging, use the arrow keys to move the item.
|
|
633
633
|
Press space again to drop the item in its new position, or press escape to cancel.
|
package/dist/client/index.html
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover" />
|
|
6
6
|
<meta name="theme-color" content="#ffffff" />
|
|
7
7
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
8
8
|
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
})()
|
|
31
31
|
</script>
|
|
32
32
|
<title>Kanna</title>
|
|
33
|
-
<script type="module" crossorigin src="/assets/index-
|
|
33
|
+
<script type="module" crossorigin src="/assets/index-C661c2yH.js"></script>
|
|
34
34
|
<link rel="stylesheet" crossorigin href="/assets/index-N86Y2O-U.css">
|
|
35
35
|
</head>
|
|
36
36
|
<body>
|