kanna-code 0.33.2 → 0.33.3

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},RG="DialogDescriptionWarning",TG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${xO(RG).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},AG=lO,NG=dO,SO=hO,wO=fO,MG=mO,LG=vO,DG=_O;const cf="data-focus-fallback-ignore",CO="data-allow-focus-retain",tv="kanna:restore-chat-input-focus",Fw="data-chat-input",nv="data-chat-selection-zone";function Il(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function kO(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:Il(e,CO):!1}function IG(e){const t=e;return t!=null&&t.matches?kO(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Il(e,CO):!1}function MA(e){return!!e.querySelector(`[${cf}][data-state='open']`)}function PG(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function OG(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${Fw}]`)).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 LA(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||Il(t,Fw)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,u=s??i;return!o||!u||!o.contains(u)||Il(u,cf)||Il(t,cf)||l&&(Il(i,nv)||Il(u,nv))||kO(t)?"none":t&&t===u?"restore":IG(t)?"none":"restore"}const od=AG,jG=NG,EO=_.forwardRef(({className:e,...t},n)=>m.jsx(SO,{ref:n,className:xe("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}));EO.displayName=SO.displayName;const zG={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},uc=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>m.jsxs(jG,{children:[m.jsx(EO,{}),m.jsxs(wO,{ref:i,[cf]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(tv)),(o=r.onCloseAutoFocus)==null||o.call(r,s)},className:xe("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",zG[n],e),...r,children:[t,m.jsxs(DG,{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(tl,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));uc.displayName=wO.displayName;function BG({className:e,...t}){return m.jsx("div",{className:xe("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function ad({className:e,...t}){return m.jsx(MG,{className:xe("text-lg font-medium leading-none tracking-tight",e),...t})}function c0({className:e,...t}){return m.jsx(LG,{className:xe("text-sm text-muted-foreground",e),...t})}function ld({className:e,...t}){return m.jsx("div",{className:xe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function cd({className:e,...t}){return m.jsx("div",{className:xe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function FG({className:e,...t}){return m.jsx("button",{className:xe("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 Wr=_.forwardRef(({className:e,type:t,...n},r)=>m.jsx("input",{ref:r,type:t,className:xe("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}));Wr.displayName="Input";const RO=_.createContext(null);function HG({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(RO.Provider,{value:g,children:[e,m.jsx(od,{open:t!==null,onOpenChange:b=>{b||!t||l()},children:m.jsx(uc,{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(ld,{className:"space-y-4",children:[m.jsx(ad,{children:t.options.title}),t.options.description?m.jsx(c0,{children:t.options.description}):null,t.kind==="prompt"?m.jsx(Wr,{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(cd,{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 Hw(){const e=_.useContext(RO);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const $w=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("bg-card text-card-foreground",e),...t}));$w.displayName="Card";const Uw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex flex-col space-y-1.5 p-2",e),...t}));Uw.displayName="CardHeader";const TO=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...t}));TO.displayName="CardTitle";const AO=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));AO.displayName="CardDescription";const Vw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("p-6 pt-0",e),...t}));Vw.displayName="CardContent";const $G=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex items-center p-6 pt-0",e),...t}));$G.displayName="CardFooter";const UG=["top","right","bottom","left"],Ya=Math.min,Ci=Math.max,rv=Math.round,Lm=Math.floor,eo=e=>({x:e,y:e}),VG={left:"right",right:"left",bottom:"top",top:"bottom"};function gS(e,t,n){return Ci(e,Ya(t,n))}function Ho(e,t){return typeof e=="function"?e(t):e}function $o(e){return e.split("-")[0]}function ud(e){return e.split("-")[1]}function Ww(e){return e==="x"?"y":"x"}function Gw(e){return e==="y"?"height":"width"}function Ys(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function qw(e){return Ww(Ys(e))}function WG(e,t,n){n===void 0&&(n=!1);const r=ud(e),i=qw(e),s=Gw(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=iv(o)),[o,iv(o)]}function GG(e){const t=iv(e);return[vS(e),t,vS(t)]}function vS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const DA=["left","right"],IA=["right","left"],qG=["top","bottom"],KG=["bottom","top"];function YG(e,t,n){switch(e){case"top":case"bottom":return n?t?IA:DA:t?DA:IA;case"left":case"right":return t?qG:KG;default:return[]}}function XG(e,t,n,r){const i=ud(e);let s=YG($o(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(vS)))),s}function iv(e){const t=$o(e);return VG[t]+e.slice(t.length)}function QG(e){return{top:0,right:0,bottom:0,left:0,...e}}function NO(e){return typeof e!="number"?QG(e):{top:e,right:e,bottom:e,left:e}}function sv(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 PA(e,t,n){let{reference:r,floating:i}=e;const s=Ys(t),o=qw(t),l=Gw(o),u=$o(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(ud(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 ZG(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}=Ho(t,e),y=NO(b),w=l[g?h==="floating"?"reference":"floating":h],C=sv(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},N=sv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:R,offsetParent:E,strategy:u}):R);return{top:(C.top-N.top+y.top)/T.y,bottom:(N.bottom-C.bottom+y.bottom)/T.y,left:(C.left-N.left+y.left)/T.x,right:(N.right-C.right+y.right)/T.x}}const JG=50,eq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:ZG},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}=PA(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:N,reset:A}=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],...N},A&&b<JG&&(b++,typeof A=="object"&&(A.placement&&(g=A.placement),A.rects&&(d=A.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):A.rects),{x:f,y:h}=PA(d,g,u)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},tq=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}=Ho(e,t)||{};if(d==null)return{};const h=NO(f),g={x:n,y:r},b=qw(i),y=Gw(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],N=g[b]-s.reference[b],A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let L=A?A[E]:0;(!L||!await(o.isElement==null?void 0:o.isElement(A)))&&(L=l.floating[E]||s.floating[y]);const O=T/2-N/2,G=L/2-x[y]/2-1,P=Ya(h[C],G),j=Ya(h[R],G),B=P,H=L-x[y]-j,$=L/2-x[y]/2+O,V=gS(B,$,H),z=!u.arrow&&ud(i)!=null&&$!==V&&s.reference[y]/2-($<B?P:j)-x[y]/2<0,q=z?$<B?$-B:$-H:0;return{[b]:g[b]+q,data:{[b]:V,centerOffset:$-V-q,...z&&{alignmentOffset:q}},reset:z}}}),nq=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}=Ho(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=$o(i),R=Ys(l),E=$o(l)===l,T=await(u.isRTL==null?void 0:u.isRTL(d.floating)),N=g||(E||!x?[iv(l)]:GG(l)),A=y!=="none";!g&&A&&N.push(...XG(l,x,y,T));const L=[l,...N],O=await u.detectOverflow(t,w),G=[];let P=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(O[C]),h){const $=WG(i,o,T);G.push(O[$[0]],O[$[1]])}if(P=[...P,{placement:i,overflows:G}],!G.every($=>$<=0)){var j,B;const $=(((j=s.flip)==null?void 0:j.index)||0)+1,V=L[$];if(V&&(!(h==="alignment"?R!==Ys(V):!1)||P.every(F=>Ys(F.placement)===R?F.overflows[0]>0:!0)))return{data:{index:$,overflows:P},reset:{placement:V}};let z=(B=P.filter(q=>q.overflows[0]<=0).sort((q,F)=>q.overflows[1]-F.overflows[1])[0])==null?void 0:B.placement;if(!z)switch(b){case"bestFit":{var H;const q=(H=P.filter(F=>{if(A){const Y=Ys(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:H[0];q&&(z=q);break}case"initialPlacement":z=l;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function OA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function jA(e){return UG.some(t=>e[t]>=0)}const rq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Ho(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=OA(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:jA(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=OA(o,n.floating);return{data:{escapedOffsets:l,escaped:jA(l)}}}default:return{}}}}},MO=new Set(["left","top"]);async function iq(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=$o(n),l=ud(n),u=Ys(n)==="y",d=MO.has(o)?-1:1,f=s&&u?-1:1,h=Ho(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 sq=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 iq(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}}}}},oq=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}=Ho(e,t),f={x:n,y:r},h=await s.detectOverflow(t,d),g=Ys($o(i)),b=Ww(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}}}}}},aq=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}=Ho(e,t),f={x:n,y:r},h=Ys(i),g=Ww(h);let b=f[g],y=f[h];const x=Ho(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,N=s.reference[g]+s.reference[E]-w.mainAxis;b<T?b=T:b>N&&(b=N)}if(d){var C,R;const E=g==="y"?"width":"height",T=MO.has($o(i)),N=s.reference[h]-s.floating[E]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:w.crossAxis),A=s.reference[h]+s.reference[E]+(T?0:((R=o.offset)==null?void 0:R[h])||0)-(T?w.crossAxis:0);y<N?y=N:y>A&&(y=A)}return{[g]:b,[h]:y}}}},lq=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}=Ho(e,t),f=await o.detectOverflow(t,d),h=$o(i),g=ud(i),b=Ys(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=Ya(x-f[w],R),N=Ya(y-f[C],E),A=!t.middlewareData.shift;let L=T,O=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=R),A&&!g){const P=Ci(f.left,0),j=Ci(f.right,0),B=Ci(f.top,0),H=Ci(f.bottom,0);b?O=y-2*(P!==0||j!==0?P+j:Ci(f.left,f.right)):L=x-2*(B!==0||H!==0?B+H:Ci(f.top,f.bottom))}await u({...t,availableWidth:O,availableHeight:L});const G=await o.getDimensions(l.floating);return y!==G.width||x!==G.height?{reset:{rects:!0}}:{}}}};function u0(){return typeof window<"u"}function dd(e){return LO(e)?(e.nodeName||"").toLowerCase():"#document"}function Ei(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function io(e){var t;return(t=(LO(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function LO(e){return u0()?e instanceof Node||e instanceof Ei(e).Node:!1}function Rs(e){return u0()?e instanceof Element||e instanceof Ei(e).Element:!1}function Ko(e){return u0()?e instanceof HTMLElement||e instanceof Ei(e).HTMLElement:!1}function zA(e){return!u0()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ei(e).ShadowRoot}function Vf(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Ts(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function cq(e){return/^(table|td|th)$/.test(dd(e))}function d0(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const uq=/transform|translate|scale|rotate|perspective|filter/,dq=/paint|layout|strict|content/,El=e=>!!e&&e!=="none";let Ny;function Kw(e){const t=Rs(e)?Ts(e):e;return El(t.transform)||El(t.translate)||El(t.scale)||El(t.rotate)||El(t.perspective)||!Yw()&&(El(t.backdropFilter)||El(t.filter))||uq.test(t.willChange||"")||dq.test(t.contain||"")}function hq(e){let t=Xa(e);for(;Ko(t)&&!Hu(t);){if(Kw(t))return t;if(d0(t))return null;t=Xa(t)}return null}function Yw(){return Ny==null&&(Ny=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ny}function Hu(e){return/^(html|body|#document)$/.test(dd(e))}function Ts(e){return Ei(e).getComputedStyle(e)}function h0(e){return Rs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xa(e){if(dd(e)==="html")return e;const t=e.assignedSlot||e.parentNode||zA(e)&&e.host||io(e);return zA(t)?t.host:t}function DO(e){const t=Xa(e);return Hu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ko(t)&&Vf(t)?t:DO(t)}function uf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=DO(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Ei(i);if(s){const l=bS(o);return t.concat(o,o.visualViewport||[],Vf(i)?i:[],l&&n?uf(l):[])}else return t.concat(i,uf(i,[],n))}function bS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function IO(e){const t=Ts(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Ko(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=rv(n)!==s||rv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function Xw(e){return Rs(e)?e:e.contextElement}function Nu(e){const t=Xw(e);if(!Ko(t))return eo(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=IO(t);let o=(s?rv(n.width):n.width)/r,l=(s?rv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const fq=eo(0);function PO(e){const t=Ei(e);return!Yw()||!t.visualViewport?fq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pq(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ei(e)?!1:t}function Ql(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=Xw(e);let o=eo(1);t&&(r?Rs(r)&&(o=Nu(r)):o=Nu(e));const l=pq(s,n,r)?PO(s):eo(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=Ei(s),b=r&&Rs(r)?Ei(r):r;let y=g,x=bS(y);for(;x&&r&&b!==y;){const w=Nu(x),C=x.getBoundingClientRect(),R=Ts(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=Ei(x),x=bS(y)}}return sv({width:f,height:h,x:u,y:d})}function f0(e,t){const n=h0(e).scrollLeft;return t?t.left+n:Ql(io(e)).left+n}function OO(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-f0(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function mq(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=io(r),l=t?d0(t.floating):!1;if(r===o||l&&s)return n;let u={scrollLeft:0,scrollTop:0},d=eo(1);const f=eo(0),h=Ko(r);if((h||!h&&!s)&&((dd(r)!=="body"||Vf(o))&&(u=h0(r)),h)){const b=Ql(r);d=Nu(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const g=o&&!h&&!s?OO(o,u):eo(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 gq(e){return Array.from(e.getClientRects())}function vq(e){const t=io(e),n=h0(e),r=e.ownerDocument.body,i=Ci(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ci(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+f0(e);const l=-n.scrollTop;return Ts(r).direction==="rtl"&&(o+=Ci(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const BA=25;function bq(e,t){const n=Ei(e),r=io(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=Yw();(!f||f&&t==="fixed")&&(l=i.offsetLeft,u=i.offsetTop)}const d=f0(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<=BA&&(s-=y)}else d<=BA&&(s+=d);return{width:s,height:o,x:l,y:u}}function _q(e,t){const n=Ql(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Ko(e)?Nu(e):eo(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 FA(e,t,n){let r;if(t==="viewport")r=bq(e,n);else if(t==="document")r=vq(io(e));else if(Rs(t))r=_q(t,n);else{const i=PO(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return sv(r)}function jO(e,t){const n=Xa(e);return n===t||!Rs(n)||Hu(n)?!1:Ts(n).position==="fixed"||jO(n,t)}function yq(e,t){const n=t.get(e);if(n)return n;let r=uf(e,[],!1).filter(l=>Rs(l)&&dd(l)!=="body"),i=null;const s=Ts(e).position==="fixed";let o=s?Xa(e):e;for(;Rs(o)&&!Hu(o);){const l=Ts(o),u=Kw(o);!u&&l.position==="fixed"&&(i=null),(s?!u&&!i:!u&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Vf(o)&&!u&&jO(e,o))?r=r.filter(f=>f!==o):i=l,o=Xa(o)}return t.set(e,r),r}function xq(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?d0(t)?[]:yq(t,this._c):[].concat(n),r],l=FA(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=FA(t,o[g],i);u=Ci(b.top,u),d=Ya(b.right,d),f=Ya(b.bottom,f),h=Ci(b.left,h)}return{width:d-h,height:f-u,x:h,y:u}}function Sq(e){const{width:t,height:n}=IO(e);return{width:t,height:n}}function wq(e,t,n){const r=Ko(t),i=io(t),s=n==="fixed",o=Ql(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=eo(0);function d(){u.x=f0(i)}if(r||!r&&!s)if((dd(t)!=="body"||Vf(i))&&(l=h0(t)),r){const b=Ql(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?OO(i,l):eo(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 Ts(e).position==="static"}function HA(e,t){if(!Ko(e)||Ts(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return io(e)===n&&(n=n.ownerDocument.body),n}function zO(e,t){const n=Ei(e);if(d0(e))return n;if(!Ko(e)){let i=Xa(e);for(;i&&!Hu(i);){if(Rs(i)&&!My(i))return i;i=Xa(i)}return n}let r=HA(e,t);for(;r&&cq(r)&&My(r);)r=HA(r,t);return r&&Hu(r)&&My(r)&&!Kw(r)?n:r||hq(e)||n}const Cq=async function(e){const t=this.getOffsetParent||zO,n=this.getDimensions,r=await n(e.floating);return{reference:wq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function kq(e){return Ts(e).direction==="rtl"}const Eq={convertOffsetParentRelativeRectToViewportRelativeRect:mq,getDocumentElement:io,getClippingRect:xq,getOffsetParent:zO,getElementRects:Cq,getClientRects:gq,getDimensions:Sq,getScale:Nu,isElement:Rs,isRTL:kq};function BO(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Rq(e,t){let n=null,r;const i=io(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=Lm(h),x=Lm(i.clientWidth-(f+g)),w=Lm(i.clientHeight-(h+b)),C=Lm(f),E={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:Ci(0,Ya(1,u))||1};let T=!0;function N(A){const L=A[0].intersectionRatio;if(L!==u){if(!T)return o();L?o(!1,L):r=setTimeout(()=>{o(!1,1e-7)},1e3)}L===1&&!BO(d,e.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(N,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(N,E)}n.observe(e)}return o(!0),s}function Tq(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=Xw(e),f=i||s?[...d?uf(d):[],...t?uf(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?Rq(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?Ql(e):null;u&&w();function w(){const C=Ql(e);x&&!BO(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 Aq=sq,Nq=oq,Mq=nq,Lq=lq,Dq=rq,$A=tq,Iq=aq,Pq=(e,t,n)=>{const r=new Map,i={platform:Eq,...n},s={...i.platform,_c:r};return eq(e,t,{...i,platform:s})};var Oq=typeof document<"u",jq=function(){},Rg=Oq?_.useLayoutEffect:jq;function ov(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(!ov(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)&&!ov(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function FO(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function UA(e,t){const n=FO(e);return Math.round(t*n)/n}function Ly(e){const t=_.useRef(e);return Rg(()=>{t.current=e}),t}function zq(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);ov(g,r)||b(r);const[y,x]=_.useState(null),[w,C]=_.useState(null),R=_.useCallback(F=>{F!==A.current&&(A.current=F,x(F))},[]),E=_.useCallback(F=>{F!==L.current&&(L.current=F,C(F))},[]),T=s||y,N=o||w,A=_.useRef(null),L=_.useRef(null),O=_.useRef(f),G=u!=null,P=Ly(u),j=Ly(i),B=Ly(d),H=_.useCallback(()=>{if(!A.current||!L.current)return;const F={placement:t,strategy:n,middleware:g};j.current&&(F.platform=j.current),Pq(A.current,L.current,F).then(Y=>{const I={...Y,isPositioned:B.current!==!1};$.current&&!ov(O.current,I)&&(O.current=I,is.flushSync(()=>{h(I)}))})},[g,t,n,j,B]);Rg(()=>{d===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[d]);const $=_.useRef(!1);Rg(()=>($.current=!0,()=>{$.current=!1}),[]),Rg(()=>{if(T&&(A.current=T),N&&(L.current=N),T&&N){if(P.current)return P.current(T,N,H);H()}},[T,N,H,P,G]);const V=_.useMemo(()=>({reference:A,floating:L,setReference:R,setFloating:E}),[R,E]),z=_.useMemo(()=>({reference:T,floating:N}),[T,N]),q=_.useMemo(()=>{const F={position:n,left:0,top:0};if(!z.floating)return F;const Y=UA(z.floating,f.x),I=UA(z.floating,f.y);return l?{...F,transform:"translate("+Y+"px, "+I+"px)",...FO(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:I}},[n,l,z.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:H,refs:V,elements:z,floatingStyles:q}),[f,H,V,z,q])}const Bq=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?$A({element:r.current,padding:i}).fn(n):{}:r?$A({element:r,padding:i}).fn(n):{}}}},Fq=(e,t)=>{const n=Aq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hq=(e,t)=>{const n=Nq(e);return{name:n.name,fn:n.fn,options:[e,t]}},$q=(e,t)=>({fn:Iq(e).fn,options:[e,t]}),Uq=(e,t)=>{const n=Mq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vq=(e,t)=>{const n=Lq(e);return{name:n.name,fn:n.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=Bq(e);return{name:n.name,fn:n.fn,options:[e,t]}};var qq="Arrow",HO=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Ut.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"})})});HO.displayName=qq;var Kq=HO;function Yq(e){const[t,n]=_.useState(void 0);return Or(()=>{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 Qw="Popper",[$O,rl]=qo(Qw),[Xq,UO]=$O(Qw),VO=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(Xq,{scope:t,anchor:r,onAnchorChange:i,children:n})};VO.displayName=Qw;var WO="PopperAnchor",GO=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=UO(WO,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(Ut.div,{...i,ref:l})});GO.displayName=WO;var Zw="PopperContent",[Qq,Zq]=$O(Zw),qO=_.forwardRef((e,t)=>{var se,pe,re,me,Ee,we;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=UO(Zw,n),[C,R]=_.useState(null),E=an(t,Ae=>R(Ae)),[T,N]=_.useState(null),A=Yq(T),L=(A==null?void 0:A.width)??0,O=(A==null?void 0:A.height)??0,G=r+(s!=="center"?"-"+s:""),P=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},j=Array.isArray(d)?d:[d],B=j.length>0,H={padding:P,boundary:j.filter(eK),altBoundary:B},{refs:$,floatingStyles:V,placement:z,isPositioned:q,middlewareData:F}=zq({strategy:"fixed",placement:G,whileElementsMounted:(...Ae)=>Tq(...Ae,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[Fq({mainAxis:i+O,alignmentAxis:o}),u&&Hq({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?$q():void 0,...H}),u&&Uq({...H}),Vq({...H,apply:({elements:Ae,rects:ze,availableWidth:Ue,availableHeight:tt})=>{const{width:kt,height:Qt}=ze.reference,Pe=Ae.floating.style;Pe.setProperty("--radix-popper-available-width",`${Ue}px`),Pe.setProperty("--radix-popper-available-height",`${tt}px`),Pe.setProperty("--radix-popper-anchor-width",`${kt}px`),Pe.setProperty("--radix-popper-anchor-height",`${Qt}px`)}}),T&&Gq({element:T,padding:l}),tK({arrowWidth:L,arrowHeight:O}),g&&Wq({strategy:"referenceHidden",...H})]}),[Y,I]=XO(z),U=Es(y);Or(()=>{q&&(U==null||U())},[q,U]);const X=(se=F.arrow)==null?void 0:se.x,D=(pe=F.arrow)==null?void 0:pe.y,te=((re=F.arrow)==null?void 0:re.centerOffset)!==0,[Q,ie]=_.useState();return Or(()=>{C&&ie(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":[(me=F.transformOrigin)==null?void 0:me.x,(Ee=F.transformOrigin)==null?void 0:Ee.y].join(" "),...((we=F.hide)==null?void 0:we.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(Qq,{scope:n,placedSide:Y,onArrowChange:N,arrowX:X,arrowY:D,shouldHideArrow:te,children:m.jsx(Ut.div,{"data-side":Y,"data-align":I,...x,ref:E,style:{...x.style,animation:q?void 0:"none"}})})})});qO.displayName=Zw;var KO="PopperArrow",Jq={top:"bottom",right:"left",bottom:"top",left:"right"},YO=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=Zq(KO,r),o=Jq[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(Kq,{...i,ref:n,style:{...i.style,display:"block"}})})});YO.displayName=KO;function eK(e){return e!==null}var tK=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]=XO(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 XO(e){const[t,n="center"]=e.split("-");return[t,n]}var p0=VO,Wf=GO,m0=qO,g0=YO,QO=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"}),nK="VisuallyHidden",ZO=_.forwardRef((e,t)=>m.jsx(Ut.span,{...e,ref:t,style:{...QO,...e.style}}));ZO.displayName=nK;var rK=ZO,[v0]=qo("Tooltip",[rl]),b0=rl(),JO="TooltipProvider",iK=700,_S="tooltip.open",[sK,Jw]=v0(JO),e5=e=>{const{__scopeTooltip:t,delayDuration:n=iK,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(sK,{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})};e5.displayName=JO;var df="Tooltip",[oK,Gf]=v0(df),t5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,u=Jw(df,e.__scopeTooltip),d=b0(t),[f,h]=_.useState(null),g=zo(),b=_.useRef(0),y=o??u.disableHoverableContent,x=l??u.delayDuration,w=_.useRef(!1),[C,R]=Fu({prop:r,defaultProp:i??!1,onChange:L=>{L?(u.onOpen(),document.dispatchEvent(new CustomEvent(_S))):u.onClose(),s==null||s(L)},caller:df}),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]),N=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,R(!1)},[R]),A=_.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(p0,{...d,children:m.jsx(oK,{scope:t,contentId:g,open:C,stateAttribute:E,trigger:f,onTriggerChange:h,onTriggerEnter:_.useCallback(()=>{u.isOpenDelayedRef.current?A():T()},[u.isOpenDelayedRef,A,T]),onTriggerLeave:_.useCallback(()=>{y?N():(window.clearTimeout(b.current),b.current=0)},[N,y]),onOpen:T,onClose:N,disableHoverableContent:y,children:n})})};t5.displayName=df;var yS="TooltipTrigger",n5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Gf(yS,n),s=Jw(yS,n),o=b0(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(Wf,{asChild:!0,...o,children:m.jsx(Ut.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:u,onPointerMove:He(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:He(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:He(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:He(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:He(e.onBlur,i.onClose),onClick:He(e.onClick,i.onClose)})})});n5.displayName=yS;var eC="TooltipPortal",[aK,lK]=v0(eC,{forceMount:void 0}),r5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=Gf(eC,t);return m.jsx(aK,{scope:t,forceMount:n,children:m.jsx(hs,{present:n||s.open,children:m.jsx(sd,{asChild:!0,container:i,children:r})})})};r5.displayName=eC;var $u="TooltipContent",i5=_.forwardRef((e,t)=>{const n=lK($u,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=Gf($u,e.__scopeTooltip);return m.jsx(hs,{present:r||o.open,children:o.disableHoverableContent?m.jsx(s5,{side:i,...s,ref:t}):m.jsx(cK,{side:i,...s,ref:t})})}),cK=_.forwardRef((e,t)=>{const n=Gf($u,e.__scopeTooltip),r=Jw($u,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=pK(C,w.getBoundingClientRect()),E=mK(C,R),T=gK(x.getBoundingClientRect()),N=bK([...E,...T]);l(N),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=!vK(C,o);R?g():E&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[u,f,o,d,g]),m.jsx(s5,{...e,ref:s})}),[uK,dK]=v0(df,{isInside:!1}),hK=uW("TooltipContent"),s5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,u=Gf($u,n),d=b0(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(id,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs(m0,{"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(hK,{children:r}),m.jsx(uK,{scope:n,isInside:!0,children:m.jsx(rK,{id:u.contentId,role:"tooltip",children:i||r})})]})})});i5.displayName=$u;var o5="TooltipArrow",fK=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=b0(n);return dK(o5,n).isInside?null:m.jsx(g0,{...i,...r,ref:t})});fK.displayName=o5;function pK(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 mK(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 gK(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 vK(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 bK(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),_K(t)}function _K(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 yK=e5,a5=t5,l5=n5,c5=r5,tC=i5;function u5({className:e,...t}){return m.jsx("kbd",{className:xe("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 xK({className:e,...t}){return m.jsx("span",{className:xe("inline-flex items-center gap-0.5",e),...t})}const SK="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",wK=yK,Qa=a5,Za=l5,Uo=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(c5,{children:m.jsx(tC,{ref:r,sideOffset:t,className:xe("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})}));Uo.displayName=tC.displayName;const Ph=a5,Oh=l5;function d5(e){return e.toUpperCase()}function CK(e){const t=e.split("+");return m.jsx(xK,{children:t.map((n,r)=>m.jsx(u5,{children:d5(n)},`${n}-${r}`))})}const Su=_.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(c5,{children:m.jsx(tC,{ref:s,sideOffset:t,className:xe(SK,e),...i,children:o?CK(o):m.jsx("span",{children:typeof n=="string"?d5(n):n})})})});Su.displayName="HotkeyTooltipContent";const kK="0.33.2",EK={version:kK},Un="Kanna",VA="kanna",RK=".kanna",TK=".kanna-dev",AK="KANNA_RUNTIME_PROFILE",nC=`kanna/${EK.version}`,NK="[kanna]",MK=`~/${Un}`;function _0(){var t;return(t=globalThis.process)==null?void 0:t.env}function LK(e=_0()){var t;return((t=e==null?void 0:e[AK])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function DK(e=_0()){return LK(e)==="dev"?TK:RK}function IK(e=_0()){return`~/${DK(e)}`}function PK(e=_0()){return`${IK(e)}/keybindings.json`}function Dm(e){return e?`${VA} ${e}`:VA}const WA=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},OK=(e=>e?WA(e):WA),jK=e=>e;function zK(e,t=jK){const n=gn.useSyncExternalStore(e.subscribe,gn.useCallback(()=>t(e.getState()),[e,t]),gn.useCallback(()=>t(e.getInitialState()),[e,t]));return gn.useDebugValue(n),n}const BK=e=>{const t=OK(e),n=r=>zK(t,r);return Object.assign(n,t),n},dc=(e=>BK);function FK(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)}}}},HK=(e,t)=>(n,r,i)=>{let s={storage:FK(()=>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 N;return T((N=r())!=null?N: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 N=s.migrate(T.state,T.version);return N instanceof Promise?N.then(A=>[!0,A]):[!0,N]}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 N;if(R!==l)return;const[A,L]=T;if(y=s.merge(L,(N=r())!=null?N:b),n(y,!0),A)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},hc=HK,h5="always",f5="funk",$K=[{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 GA(e){switch(e){case"never":case"unfocused":case"always":return e;default:return h5}}function qA(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 f5}}const wu=dc()(hc(e=>({chatSoundPreference:h5,chatSoundId:f5,setChatSoundPreference:t=>e({chatSoundPreference:GA(t)}),setChatSoundId:t=>e({chatSoundId:qA(t)})}),{name:"chat-sound-preferences",version:2,migrate:e=>{const t=e;return{chatSoundPreference:GA(t==null?void 0:t.chatSoundPreference),chatSoundId:qA(t==null?void 0:t.chatSoundId)}}})),UK={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 VK(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function WK(e){const t=new Audio(UK[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(()=>{WK(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function GK(e,t=document){return e==="never"?!1:e==="always"?!0:VK(t)}function qK(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 KA(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 KK(e,t){if(!e)return 0;const n=KA(e),r=KA(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 hd=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...i})=>m.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:xe("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 YK=[/^(?:\/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 XK(e){const t=e.trim();for(const n of YK){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function p5(e){return e.split("/").pop()||e}const QK=1440*6e4;function ZK(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=QK,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 JK(e){return e.lastMessageAt??e._creationTime}const eY=new Set(["starting","running"]);function tY({chat:e,activeChatId:t,nowMs:n,shortcutHint:r=null,showShortcutHint:i=!1,onSelectChat:s,onForkChat:o,onDeleteChat:l}){const u=ZK(JK(e),n),d=i&&r?r:u,f=i&&!!r,h=tW(e.chatId);return m.jsxs("div",{"data-chat-id":h,className:xe("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:[eY.has(e.status)?m.jsx(kn,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):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(hd,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),m.jsxs("div",{className:xe("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(u5,{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:xe("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(qU,{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(p$,{className:"size-3.5"})})]})]})]},e._id)}const nY=_.memo(tY);function rY(){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 y0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function fd(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function rC(e){return"nodeType"in e}function ci(e){var t,n;return e?fd(e)?e:rC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function iC(e){const{Document:t}=ci(e);return e instanceof t}function qf(e){return fd(e)?!1:e instanceof ci(e).HTMLElement}function m5(e){return e instanceof ci(e).SVGElement}function pd(e){return e?fd(e)?e.document:rC(e)?iC(e)?e:qf(e)||m5(e)?e.ownerDocument:document:document:document}const no=y0?_.useLayoutEffect:_.useEffect;function sC(e){const t=_.useRef(e);return no(()=>{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 iY(){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 hf(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return no(()=>{n.current!==e&&(n.current=e)},t),n}function Kf(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function av(e){const t=sC(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 Yf(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 g5(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 Mu=g5(1),lv=g5(-1);function sY(e){return"clientX"in e&&"clientY"in e}function oC(e){if(!e)return!1;const{KeyboardEvent:t}=ci(e.target);return t&&e instanceof t}function oY(e){if(!e)return!1;const{TouchEvent:t}=ci(e.target);return t&&e instanceof t}function kS(e){if(oY(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 sY(e)?{x:e.clientX,y:e.clientY}:null}const ff=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[ff.Translate.toString(e),ff.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),YA="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function aY(e){return e.matches(YA)?e:e.querySelector(YA)}const lY={display:"none"};function cY(e){let{id:t,value:n}=e;return gn.createElement("div",{id:t,style:lY},n)}function uY(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 gn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function dY(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const v5=_.createContext(null);function hY(e){const t=_.useContext(v5);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function fY(){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 pY={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},RG="DialogDescriptionWarning",TG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${xO(RG).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},AG=lO,NG=dO,SO=hO,wO=fO,MG=mO,LG=vO,DG=_O;const cf="data-focus-fallback-ignore",CO="data-allow-focus-retain",tv="kanna:restore-chat-input-focus",Fw="data-chat-input",nv="data-chat-selection-zone";function Il(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function kO(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:Il(e,CO):!1}function IG(e){const t=e;return t!=null&&t.matches?kO(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Il(e,CO):!1}function MA(e){return!!e.querySelector(`[${cf}][data-state='open']`)}function PG(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function OG(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${Fw}]`)).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 LA(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||Il(t,Fw)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,u=s??i;return!o||!u||!o.contains(u)||Il(u,cf)||Il(t,cf)||l&&(Il(i,nv)||Il(u,nv))||kO(t)?"none":t&&t===u?"restore":IG(t)?"none":"restore"}const od=AG,jG=NG,EO=_.forwardRef(({className:e,...t},n)=>m.jsx(SO,{ref:n,className:xe("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}));EO.displayName=SO.displayName;const zG={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},uc=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>m.jsxs(jG,{children:[m.jsx(EO,{}),m.jsxs(wO,{ref:i,[cf]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(tv)),(o=r.onCloseAutoFocus)==null||o.call(r,s)},className:xe("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",zG[n],e),...r,children:[t,m.jsxs(DG,{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(tl,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));uc.displayName=wO.displayName;function BG({className:e,...t}){return m.jsx("div",{className:xe("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function ad({className:e,...t}){return m.jsx(MG,{className:xe("text-lg font-medium leading-none tracking-tight",e),...t})}function c0({className:e,...t}){return m.jsx(LG,{className:xe("text-sm text-muted-foreground",e),...t})}function ld({className:e,...t}){return m.jsx("div",{className:xe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function cd({className:e,...t}){return m.jsx("div",{className:xe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function FG({className:e,...t}){return m.jsx("button",{className:xe("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 Wr=_.forwardRef(({className:e,type:t,...n},r)=>m.jsx("input",{ref:r,type:t,className:xe("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}));Wr.displayName="Input";const RO=_.createContext(null);function HG({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(RO.Provider,{value:g,children:[e,m.jsx(od,{open:t!==null,onOpenChange:b=>{b||!t||l()},children:m.jsx(uc,{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(ld,{className:"space-y-4",children:[m.jsx(ad,{children:t.options.title}),t.options.description?m.jsx(c0,{children:t.options.description}):null,t.kind==="prompt"?m.jsx(Wr,{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(cd,{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 Hw(){const e=_.useContext(RO);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const $w=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("bg-card text-card-foreground",e),...t}));$w.displayName="Card";const Uw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex flex-col space-y-1.5 p-2",e),...t}));Uw.displayName="CardHeader";const TO=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...t}));TO.displayName="CardTitle";const AO=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));AO.displayName="CardDescription";const Vw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("p-6 pt-0",e),...t}));Vw.displayName="CardContent";const $G=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex items-center p-6 pt-0",e),...t}));$G.displayName="CardFooter";const UG=["top","right","bottom","left"],Ya=Math.min,Ci=Math.max,rv=Math.round,Lm=Math.floor,eo=e=>({x:e,y:e}),VG={left:"right",right:"left",bottom:"top",top:"bottom"};function gS(e,t,n){return Ci(e,Ya(t,n))}function Ho(e,t){return typeof e=="function"?e(t):e}function $o(e){return e.split("-")[0]}function ud(e){return e.split("-")[1]}function Ww(e){return e==="x"?"y":"x"}function Gw(e){return e==="y"?"height":"width"}function Ys(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function qw(e){return Ww(Ys(e))}function WG(e,t,n){n===void 0&&(n=!1);const r=ud(e),i=qw(e),s=Gw(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=iv(o)),[o,iv(o)]}function GG(e){const t=iv(e);return[vS(e),t,vS(t)]}function vS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const DA=["left","right"],IA=["right","left"],qG=["top","bottom"],KG=["bottom","top"];function YG(e,t,n){switch(e){case"top":case"bottom":return n?t?IA:DA:t?DA:IA;case"left":case"right":return t?qG:KG;default:return[]}}function XG(e,t,n,r){const i=ud(e);let s=YG($o(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(vS)))),s}function iv(e){const t=$o(e);return VG[t]+e.slice(t.length)}function QG(e){return{top:0,right:0,bottom:0,left:0,...e}}function NO(e){return typeof e!="number"?QG(e):{top:e,right:e,bottom:e,left:e}}function sv(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 PA(e,t,n){let{reference:r,floating:i}=e;const s=Ys(t),o=qw(t),l=Gw(o),u=$o(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(ud(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 ZG(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}=Ho(t,e),y=NO(b),w=l[g?h==="floating"?"reference":"floating":h],C=sv(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},N=sv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:R,offsetParent:E,strategy:u}):R);return{top:(C.top-N.top+y.top)/T.y,bottom:(N.bottom-C.bottom+y.bottom)/T.y,left:(C.left-N.left+y.left)/T.x,right:(N.right-C.right+y.right)/T.x}}const JG=50,eq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:ZG},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}=PA(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:N,reset:A}=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],...N},A&&b<JG&&(b++,typeof A=="object"&&(A.placement&&(g=A.placement),A.rects&&(d=A.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):A.rects),{x:f,y:h}=PA(d,g,u)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},tq=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}=Ho(e,t)||{};if(d==null)return{};const h=NO(f),g={x:n,y:r},b=qw(i),y=Gw(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],N=g[b]-s.reference[b],A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let L=A?A[E]:0;(!L||!await(o.isElement==null?void 0:o.isElement(A)))&&(L=l.floating[E]||s.floating[y]);const O=T/2-N/2,G=L/2-x[y]/2-1,P=Ya(h[C],G),j=Ya(h[R],G),B=P,H=L-x[y]-j,$=L/2-x[y]/2+O,V=gS(B,$,H),z=!u.arrow&&ud(i)!=null&&$!==V&&s.reference[y]/2-($<B?P:j)-x[y]/2<0,q=z?$<B?$-B:$-H:0;return{[b]:g[b]+q,data:{[b]:V,centerOffset:$-V-q,...z&&{alignmentOffset:q}},reset:z}}}),nq=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}=Ho(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=$o(i),R=Ys(l),E=$o(l)===l,T=await(u.isRTL==null?void 0:u.isRTL(d.floating)),N=g||(E||!x?[iv(l)]:GG(l)),A=y!=="none";!g&&A&&N.push(...XG(l,x,y,T));const L=[l,...N],O=await u.detectOverflow(t,w),G=[];let P=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(O[C]),h){const $=WG(i,o,T);G.push(O[$[0]],O[$[1]])}if(P=[...P,{placement:i,overflows:G}],!G.every($=>$<=0)){var j,B;const $=(((j=s.flip)==null?void 0:j.index)||0)+1,V=L[$];if(V&&(!(h==="alignment"?R!==Ys(V):!1)||P.every(F=>Ys(F.placement)===R?F.overflows[0]>0:!0)))return{data:{index:$,overflows:P},reset:{placement:V}};let z=(B=P.filter(q=>q.overflows[0]<=0).sort((q,F)=>q.overflows[1]-F.overflows[1])[0])==null?void 0:B.placement;if(!z)switch(b){case"bestFit":{var H;const q=(H=P.filter(F=>{if(A){const Y=Ys(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:H[0];q&&(z=q);break}case"initialPlacement":z=l;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function OA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function jA(e){return UG.some(t=>e[t]>=0)}const rq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Ho(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=OA(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:jA(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=OA(o,n.floating);return{data:{escapedOffsets:l,escaped:jA(l)}}}default:return{}}}}},MO=new Set(["left","top"]);async function iq(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=$o(n),l=ud(n),u=Ys(n)==="y",d=MO.has(o)?-1:1,f=s&&u?-1:1,h=Ho(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 sq=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 iq(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}}}}},oq=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}=Ho(e,t),f={x:n,y:r},h=await s.detectOverflow(t,d),g=Ys($o(i)),b=Ww(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}}}}}},aq=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}=Ho(e,t),f={x:n,y:r},h=Ys(i),g=Ww(h);let b=f[g],y=f[h];const x=Ho(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,N=s.reference[g]+s.reference[E]-w.mainAxis;b<T?b=T:b>N&&(b=N)}if(d){var C,R;const E=g==="y"?"width":"height",T=MO.has($o(i)),N=s.reference[h]-s.floating[E]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:w.crossAxis),A=s.reference[h]+s.reference[E]+(T?0:((R=o.offset)==null?void 0:R[h])||0)-(T?w.crossAxis:0);y<N?y=N:y>A&&(y=A)}return{[g]:b,[h]:y}}}},lq=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}=Ho(e,t),f=await o.detectOverflow(t,d),h=$o(i),g=ud(i),b=Ys(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=Ya(x-f[w],R),N=Ya(y-f[C],E),A=!t.middlewareData.shift;let L=T,O=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=R),A&&!g){const P=Ci(f.left,0),j=Ci(f.right,0),B=Ci(f.top,0),H=Ci(f.bottom,0);b?O=y-2*(P!==0||j!==0?P+j:Ci(f.left,f.right)):L=x-2*(B!==0||H!==0?B+H:Ci(f.top,f.bottom))}await u({...t,availableWidth:O,availableHeight:L});const G=await o.getDimensions(l.floating);return y!==G.width||x!==G.height?{reset:{rects:!0}}:{}}}};function u0(){return typeof window<"u"}function dd(e){return LO(e)?(e.nodeName||"").toLowerCase():"#document"}function Ei(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function io(e){var t;return(t=(LO(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function LO(e){return u0()?e instanceof Node||e instanceof Ei(e).Node:!1}function Rs(e){return u0()?e instanceof Element||e instanceof Ei(e).Element:!1}function Ko(e){return u0()?e instanceof HTMLElement||e instanceof Ei(e).HTMLElement:!1}function zA(e){return!u0()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ei(e).ShadowRoot}function Vf(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Ts(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function cq(e){return/^(table|td|th)$/.test(dd(e))}function d0(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const uq=/transform|translate|scale|rotate|perspective|filter/,dq=/paint|layout|strict|content/,El=e=>!!e&&e!=="none";let Ny;function Kw(e){const t=Rs(e)?Ts(e):e;return El(t.transform)||El(t.translate)||El(t.scale)||El(t.rotate)||El(t.perspective)||!Yw()&&(El(t.backdropFilter)||El(t.filter))||uq.test(t.willChange||"")||dq.test(t.contain||"")}function hq(e){let t=Xa(e);for(;Ko(t)&&!Hu(t);){if(Kw(t))return t;if(d0(t))return null;t=Xa(t)}return null}function Yw(){return Ny==null&&(Ny=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ny}function Hu(e){return/^(html|body|#document)$/.test(dd(e))}function Ts(e){return Ei(e).getComputedStyle(e)}function h0(e){return Rs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xa(e){if(dd(e)==="html")return e;const t=e.assignedSlot||e.parentNode||zA(e)&&e.host||io(e);return zA(t)?t.host:t}function DO(e){const t=Xa(e);return Hu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ko(t)&&Vf(t)?t:DO(t)}function uf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=DO(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Ei(i);if(s){const l=bS(o);return t.concat(o,o.visualViewport||[],Vf(i)?i:[],l&&n?uf(l):[])}else return t.concat(i,uf(i,[],n))}function bS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function IO(e){const t=Ts(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Ko(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=rv(n)!==s||rv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function Xw(e){return Rs(e)?e:e.contextElement}function Nu(e){const t=Xw(e);if(!Ko(t))return eo(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=IO(t);let o=(s?rv(n.width):n.width)/r,l=(s?rv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const fq=eo(0);function PO(e){const t=Ei(e);return!Yw()||!t.visualViewport?fq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pq(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ei(e)?!1:t}function Ql(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=Xw(e);let o=eo(1);t&&(r?Rs(r)&&(o=Nu(r)):o=Nu(e));const l=pq(s,n,r)?PO(s):eo(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=Ei(s),b=r&&Rs(r)?Ei(r):r;let y=g,x=bS(y);for(;x&&r&&b!==y;){const w=Nu(x),C=x.getBoundingClientRect(),R=Ts(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=Ei(x),x=bS(y)}}return sv({width:f,height:h,x:u,y:d})}function f0(e,t){const n=h0(e).scrollLeft;return t?t.left+n:Ql(io(e)).left+n}function OO(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-f0(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function mq(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=io(r),l=t?d0(t.floating):!1;if(r===o||l&&s)return n;let u={scrollLeft:0,scrollTop:0},d=eo(1);const f=eo(0),h=Ko(r);if((h||!h&&!s)&&((dd(r)!=="body"||Vf(o))&&(u=h0(r)),h)){const b=Ql(r);d=Nu(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const g=o&&!h&&!s?OO(o,u):eo(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 gq(e){return Array.from(e.getClientRects())}function vq(e){const t=io(e),n=h0(e),r=e.ownerDocument.body,i=Ci(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ci(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+f0(e);const l=-n.scrollTop;return Ts(r).direction==="rtl"&&(o+=Ci(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const BA=25;function bq(e,t){const n=Ei(e),r=io(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=Yw();(!f||f&&t==="fixed")&&(l=i.offsetLeft,u=i.offsetTop)}const d=f0(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<=BA&&(s-=y)}else d<=BA&&(s+=d);return{width:s,height:o,x:l,y:u}}function _q(e,t){const n=Ql(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Ko(e)?Nu(e):eo(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 FA(e,t,n){let r;if(t==="viewport")r=bq(e,n);else if(t==="document")r=vq(io(e));else if(Rs(t))r=_q(t,n);else{const i=PO(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return sv(r)}function jO(e,t){const n=Xa(e);return n===t||!Rs(n)||Hu(n)?!1:Ts(n).position==="fixed"||jO(n,t)}function yq(e,t){const n=t.get(e);if(n)return n;let r=uf(e,[],!1).filter(l=>Rs(l)&&dd(l)!=="body"),i=null;const s=Ts(e).position==="fixed";let o=s?Xa(e):e;for(;Rs(o)&&!Hu(o);){const l=Ts(o),u=Kw(o);!u&&l.position==="fixed"&&(i=null),(s?!u&&!i:!u&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Vf(o)&&!u&&jO(e,o))?r=r.filter(f=>f!==o):i=l,o=Xa(o)}return t.set(e,r),r}function xq(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?d0(t)?[]:yq(t,this._c):[].concat(n),r],l=FA(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=FA(t,o[g],i);u=Ci(b.top,u),d=Ya(b.right,d),f=Ya(b.bottom,f),h=Ci(b.left,h)}return{width:d-h,height:f-u,x:h,y:u}}function Sq(e){const{width:t,height:n}=IO(e);return{width:t,height:n}}function wq(e,t,n){const r=Ko(t),i=io(t),s=n==="fixed",o=Ql(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=eo(0);function d(){u.x=f0(i)}if(r||!r&&!s)if((dd(t)!=="body"||Vf(i))&&(l=h0(t)),r){const b=Ql(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?OO(i,l):eo(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 Ts(e).position==="static"}function HA(e,t){if(!Ko(e)||Ts(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return io(e)===n&&(n=n.ownerDocument.body),n}function zO(e,t){const n=Ei(e);if(d0(e))return n;if(!Ko(e)){let i=Xa(e);for(;i&&!Hu(i);){if(Rs(i)&&!My(i))return i;i=Xa(i)}return n}let r=HA(e,t);for(;r&&cq(r)&&My(r);)r=HA(r,t);return r&&Hu(r)&&My(r)&&!Kw(r)?n:r||hq(e)||n}const Cq=async function(e){const t=this.getOffsetParent||zO,n=this.getDimensions,r=await n(e.floating);return{reference:wq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function kq(e){return Ts(e).direction==="rtl"}const Eq={convertOffsetParentRelativeRectToViewportRelativeRect:mq,getDocumentElement:io,getClippingRect:xq,getOffsetParent:zO,getElementRects:Cq,getClientRects:gq,getDimensions:Sq,getScale:Nu,isElement:Rs,isRTL:kq};function BO(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Rq(e,t){let n=null,r;const i=io(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=Lm(h),x=Lm(i.clientWidth-(f+g)),w=Lm(i.clientHeight-(h+b)),C=Lm(f),E={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:Ci(0,Ya(1,u))||1};let T=!0;function N(A){const L=A[0].intersectionRatio;if(L!==u){if(!T)return o();L?o(!1,L):r=setTimeout(()=>{o(!1,1e-7)},1e3)}L===1&&!BO(d,e.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(N,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(N,E)}n.observe(e)}return o(!0),s}function Tq(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=Xw(e),f=i||s?[...d?uf(d):[],...t?uf(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?Rq(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?Ql(e):null;u&&w();function w(){const C=Ql(e);x&&!BO(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 Aq=sq,Nq=oq,Mq=nq,Lq=lq,Dq=rq,$A=tq,Iq=aq,Pq=(e,t,n)=>{const r=new Map,i={platform:Eq,...n},s={...i.platform,_c:r};return eq(e,t,{...i,platform:s})};var Oq=typeof document<"u",jq=function(){},Rg=Oq?_.useLayoutEffect:jq;function ov(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(!ov(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)&&!ov(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function FO(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function UA(e,t){const n=FO(e);return Math.round(t*n)/n}function Ly(e){const t=_.useRef(e);return Rg(()=>{t.current=e}),t}function zq(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);ov(g,r)||b(r);const[y,x]=_.useState(null),[w,C]=_.useState(null),R=_.useCallback(F=>{F!==A.current&&(A.current=F,x(F))},[]),E=_.useCallback(F=>{F!==L.current&&(L.current=F,C(F))},[]),T=s||y,N=o||w,A=_.useRef(null),L=_.useRef(null),O=_.useRef(f),G=u!=null,P=Ly(u),j=Ly(i),B=Ly(d),H=_.useCallback(()=>{if(!A.current||!L.current)return;const F={placement:t,strategy:n,middleware:g};j.current&&(F.platform=j.current),Pq(A.current,L.current,F).then(Y=>{const I={...Y,isPositioned:B.current!==!1};$.current&&!ov(O.current,I)&&(O.current=I,is.flushSync(()=>{h(I)}))})},[g,t,n,j,B]);Rg(()=>{d===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[d]);const $=_.useRef(!1);Rg(()=>($.current=!0,()=>{$.current=!1}),[]),Rg(()=>{if(T&&(A.current=T),N&&(L.current=N),T&&N){if(P.current)return P.current(T,N,H);H()}},[T,N,H,P,G]);const V=_.useMemo(()=>({reference:A,floating:L,setReference:R,setFloating:E}),[R,E]),z=_.useMemo(()=>({reference:T,floating:N}),[T,N]),q=_.useMemo(()=>{const F={position:n,left:0,top:0};if(!z.floating)return F;const Y=UA(z.floating,f.x),I=UA(z.floating,f.y);return l?{...F,transform:"translate("+Y+"px, "+I+"px)",...FO(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:I}},[n,l,z.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:H,refs:V,elements:z,floatingStyles:q}),[f,H,V,z,q])}const Bq=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?$A({element:r.current,padding:i}).fn(n):{}:r?$A({element:r,padding:i}).fn(n):{}}}},Fq=(e,t)=>{const n=Aq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hq=(e,t)=>{const n=Nq(e);return{name:n.name,fn:n.fn,options:[e,t]}},$q=(e,t)=>({fn:Iq(e).fn,options:[e,t]}),Uq=(e,t)=>{const n=Mq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vq=(e,t)=>{const n=Lq(e);return{name:n.name,fn:n.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=Bq(e);return{name:n.name,fn:n.fn,options:[e,t]}};var qq="Arrow",HO=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Ut.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"})})});HO.displayName=qq;var Kq=HO;function Yq(e){const[t,n]=_.useState(void 0);return Or(()=>{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 Qw="Popper",[$O,rl]=qo(Qw),[Xq,UO]=$O(Qw),VO=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(Xq,{scope:t,anchor:r,onAnchorChange:i,children:n})};VO.displayName=Qw;var WO="PopperAnchor",GO=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=UO(WO,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(Ut.div,{...i,ref:l})});GO.displayName=WO;var Zw="PopperContent",[Qq,Zq]=$O(Zw),qO=_.forwardRef((e,t)=>{var se,pe,re,me,Ee,we;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=UO(Zw,n),[C,R]=_.useState(null),E=an(t,Ae=>R(Ae)),[T,N]=_.useState(null),A=Yq(T),L=(A==null?void 0:A.width)??0,O=(A==null?void 0:A.height)??0,G=r+(s!=="center"?"-"+s:""),P=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},j=Array.isArray(d)?d:[d],B=j.length>0,H={padding:P,boundary:j.filter(eK),altBoundary:B},{refs:$,floatingStyles:V,placement:z,isPositioned:q,middlewareData:F}=zq({strategy:"fixed",placement:G,whileElementsMounted:(...Ae)=>Tq(...Ae,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[Fq({mainAxis:i+O,alignmentAxis:o}),u&&Hq({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?$q():void 0,...H}),u&&Uq({...H}),Vq({...H,apply:({elements:Ae,rects:ze,availableWidth:Ue,availableHeight:tt})=>{const{width:kt,height:Qt}=ze.reference,Pe=Ae.floating.style;Pe.setProperty("--radix-popper-available-width",`${Ue}px`),Pe.setProperty("--radix-popper-available-height",`${tt}px`),Pe.setProperty("--radix-popper-anchor-width",`${kt}px`),Pe.setProperty("--radix-popper-anchor-height",`${Qt}px`)}}),T&&Gq({element:T,padding:l}),tK({arrowWidth:L,arrowHeight:O}),g&&Wq({strategy:"referenceHidden",...H})]}),[Y,I]=XO(z),U=Es(y);Or(()=>{q&&(U==null||U())},[q,U]);const X=(se=F.arrow)==null?void 0:se.x,D=(pe=F.arrow)==null?void 0:pe.y,te=((re=F.arrow)==null?void 0:re.centerOffset)!==0,[Q,ie]=_.useState();return Or(()=>{C&&ie(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":[(me=F.transformOrigin)==null?void 0:me.x,(Ee=F.transformOrigin)==null?void 0:Ee.y].join(" "),...((we=F.hide)==null?void 0:we.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(Qq,{scope:n,placedSide:Y,onArrowChange:N,arrowX:X,arrowY:D,shouldHideArrow:te,children:m.jsx(Ut.div,{"data-side":Y,"data-align":I,...x,ref:E,style:{...x.style,animation:q?void 0:"none"}})})})});qO.displayName=Zw;var KO="PopperArrow",Jq={top:"bottom",right:"left",bottom:"top",left:"right"},YO=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=Zq(KO,r),o=Jq[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(Kq,{...i,ref:n,style:{...i.style,display:"block"}})})});YO.displayName=KO;function eK(e){return e!==null}var tK=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]=XO(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 XO(e){const[t,n="center"]=e.split("-");return[t,n]}var p0=VO,Wf=GO,m0=qO,g0=YO,QO=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"}),nK="VisuallyHidden",ZO=_.forwardRef((e,t)=>m.jsx(Ut.span,{...e,ref:t,style:{...QO,...e.style}}));ZO.displayName=nK;var rK=ZO,[v0]=qo("Tooltip",[rl]),b0=rl(),JO="TooltipProvider",iK=700,_S="tooltip.open",[sK,Jw]=v0(JO),e5=e=>{const{__scopeTooltip:t,delayDuration:n=iK,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(sK,{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})};e5.displayName=JO;var df="Tooltip",[oK,Gf]=v0(df),t5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,u=Jw(df,e.__scopeTooltip),d=b0(t),[f,h]=_.useState(null),g=zo(),b=_.useRef(0),y=o??u.disableHoverableContent,x=l??u.delayDuration,w=_.useRef(!1),[C,R]=Fu({prop:r,defaultProp:i??!1,onChange:L=>{L?(u.onOpen(),document.dispatchEvent(new CustomEvent(_S))):u.onClose(),s==null||s(L)},caller:df}),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]),N=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,R(!1)},[R]),A=_.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(p0,{...d,children:m.jsx(oK,{scope:t,contentId:g,open:C,stateAttribute:E,trigger:f,onTriggerChange:h,onTriggerEnter:_.useCallback(()=>{u.isOpenDelayedRef.current?A():T()},[u.isOpenDelayedRef,A,T]),onTriggerLeave:_.useCallback(()=>{y?N():(window.clearTimeout(b.current),b.current=0)},[N,y]),onOpen:T,onClose:N,disableHoverableContent:y,children:n})})};t5.displayName=df;var yS="TooltipTrigger",n5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Gf(yS,n),s=Jw(yS,n),o=b0(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(Wf,{asChild:!0,...o,children:m.jsx(Ut.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:u,onPointerMove:He(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:He(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:He(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:He(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:He(e.onBlur,i.onClose),onClick:He(e.onClick,i.onClose)})})});n5.displayName=yS;var eC="TooltipPortal",[aK,lK]=v0(eC,{forceMount:void 0}),r5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=Gf(eC,t);return m.jsx(aK,{scope:t,forceMount:n,children:m.jsx(hs,{present:n||s.open,children:m.jsx(sd,{asChild:!0,container:i,children:r})})})};r5.displayName=eC;var $u="TooltipContent",i5=_.forwardRef((e,t)=>{const n=lK($u,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=Gf($u,e.__scopeTooltip);return m.jsx(hs,{present:r||o.open,children:o.disableHoverableContent?m.jsx(s5,{side:i,...s,ref:t}):m.jsx(cK,{side:i,...s,ref:t})})}),cK=_.forwardRef((e,t)=>{const n=Gf($u,e.__scopeTooltip),r=Jw($u,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=pK(C,w.getBoundingClientRect()),E=mK(C,R),T=gK(x.getBoundingClientRect()),N=bK([...E,...T]);l(N),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=!vK(C,o);R?g():E&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[u,f,o,d,g]),m.jsx(s5,{...e,ref:s})}),[uK,dK]=v0(df,{isInside:!1}),hK=uW("TooltipContent"),s5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,u=Gf($u,n),d=b0(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(id,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs(m0,{"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(hK,{children:r}),m.jsx(uK,{scope:n,isInside:!0,children:m.jsx(rK,{id:u.contentId,role:"tooltip",children:i||r})})]})})});i5.displayName=$u;var o5="TooltipArrow",fK=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=b0(n);return dK(o5,n).isInside?null:m.jsx(g0,{...i,...r,ref:t})});fK.displayName=o5;function pK(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 mK(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 gK(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 vK(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 bK(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),_K(t)}function _K(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 yK=e5,a5=t5,l5=n5,c5=r5,tC=i5;function u5({className:e,...t}){return m.jsx("kbd",{className:xe("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 xK({className:e,...t}){return m.jsx("span",{className:xe("inline-flex items-center gap-0.5",e),...t})}const SK="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",wK=yK,Qa=a5,Za=l5,Uo=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(c5,{children:m.jsx(tC,{ref:r,sideOffset:t,className:xe("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})}));Uo.displayName=tC.displayName;const Ph=a5,Oh=l5;function d5(e){return e.toUpperCase()}function CK(e){const t=e.split("+");return m.jsx(xK,{children:t.map((n,r)=>m.jsx(u5,{children:d5(n)},`${n}-${r}`))})}const Su=_.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(c5,{children:m.jsx(tC,{ref:s,sideOffset:t,className:xe(SK,e),...i,children:o?CK(o):m.jsx("span",{children:typeof n=="string"?d5(n):n})})})});Su.displayName="HotkeyTooltipContent";const kK="0.33.3",EK={version:kK},Un="Kanna",VA="kanna",RK=".kanna",TK=".kanna-dev",AK="KANNA_RUNTIME_PROFILE",nC=`kanna/${EK.version}`,NK="[kanna]",MK=`~/${Un}`;function _0(){var t;return(t=globalThis.process)==null?void 0:t.env}function LK(e=_0()){var t;return((t=e==null?void 0:e[AK])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function DK(e=_0()){return LK(e)==="dev"?TK:RK}function IK(e=_0()){return`~/${DK(e)}`}function PK(e=_0()){return`${IK(e)}/keybindings.json`}function Dm(e){return e?`${VA} ${e}`:VA}const WA=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},OK=(e=>e?WA(e):WA),jK=e=>e;function zK(e,t=jK){const n=gn.useSyncExternalStore(e.subscribe,gn.useCallback(()=>t(e.getState()),[e,t]),gn.useCallback(()=>t(e.getInitialState()),[e,t]));return gn.useDebugValue(n),n}const BK=e=>{const t=OK(e),n=r=>zK(t,r);return Object.assign(n,t),n},dc=(e=>BK);function FK(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)}}}},HK=(e,t)=>(n,r,i)=>{let s={storage:FK(()=>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 N;return T((N=r())!=null?N: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 N=s.migrate(T.state,T.version);return N instanceof Promise?N.then(A=>[!0,A]):[!0,N]}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 N;if(R!==l)return;const[A,L]=T;if(y=s.merge(L,(N=r())!=null?N:b),n(y,!0),A)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},hc=HK,h5="always",f5="funk",$K=[{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 GA(e){switch(e){case"never":case"unfocused":case"always":return e;default:return h5}}function qA(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 f5}}const wu=dc()(hc(e=>({chatSoundPreference:h5,chatSoundId:f5,setChatSoundPreference:t=>e({chatSoundPreference:GA(t)}),setChatSoundId:t=>e({chatSoundId:qA(t)})}),{name:"chat-sound-preferences",version:2,migrate:e=>{const t=e;return{chatSoundPreference:GA(t==null?void 0:t.chatSoundPreference),chatSoundId:qA(t==null?void 0:t.chatSoundId)}}})),UK={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 VK(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function WK(e){const t=new Audio(UK[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(()=>{WK(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function GK(e,t=document){return e==="never"?!1:e==="always"?!0:VK(t)}function qK(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 KA(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 KK(e,t){if(!e)return 0;const n=KA(e),r=KA(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 hd=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...i})=>m.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:xe("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 YK=[/^(?:\/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 XK(e){const t=e.trim();for(const n of YK){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function p5(e){return e.split("/").pop()||e}const QK=1440*6e4;function ZK(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=QK,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 JK(e){return e.lastMessageAt??e._creationTime}const eY=new Set(["starting","running"]);function tY({chat:e,activeChatId:t,nowMs:n,shortcutHint:r=null,showShortcutHint:i=!1,onSelectChat:s,onForkChat:o,onDeleteChat:l}){const u=ZK(JK(e),n),d=i&&r?r:u,f=i&&!!r,h=tW(e.chatId);return m.jsxs("div",{"data-chat-id":h,className:xe("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:[eY.has(e.status)?m.jsx(kn,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):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(hd,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),m.jsxs("div",{className:xe("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(u5,{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:xe("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(qU,{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(p$,{className:"size-3.5"})})]})]})]},e._id)}const nY=_.memo(tY);function rY(){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 y0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function fd(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function rC(e){return"nodeType"in e}function ci(e){var t,n;return e?fd(e)?e:rC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function iC(e){const{Document:t}=ci(e);return e instanceof t}function qf(e){return fd(e)?!1:e instanceof ci(e).HTMLElement}function m5(e){return e instanceof ci(e).SVGElement}function pd(e){return e?fd(e)?e.document:rC(e)?iC(e)?e:qf(e)||m5(e)?e.ownerDocument:document:document:document}const no=y0?_.useLayoutEffect:_.useEffect;function sC(e){const t=_.useRef(e);return no(()=>{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 iY(){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 hf(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return no(()=>{n.current!==e&&(n.current=e)},t),n}function Kf(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function av(e){const t=sC(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 Yf(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 g5(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 Mu=g5(1),lv=g5(-1);function sY(e){return"clientX"in e&&"clientY"in e}function oC(e){if(!e)return!1;const{KeyboardEvent:t}=ci(e.target);return t&&e instanceof t}function oY(e){if(!e)return!1;const{TouchEvent:t}=ci(e.target);return t&&e instanceof t}function kS(e){if(oY(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 sY(e)?{x:e.clientX,y:e.clientY}:null}const ff=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[ff.Translate.toString(e),ff.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),YA="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function aY(e){return e.matches(YA)?e:e.querySelector(YA)}const lY={display:"none"};function cY(e){let{id:t,value:n}=e;return gn.createElement("div",{id:t,style:lY},n)}function uY(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 gn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function dY(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const v5=_.createContext(null);function hY(e){const t=_.useContext(v5);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function fY(){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 pY={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.
@@ -30,7 +30,7 @@
30
30
  })()
31
31
  </script>
32
32
  <title>Kanna</title>
33
- <script type="module" crossorigin src="/assets/index-LriUBeIQ.js"></script>
33
+ <script type="module" crossorigin src="/assets/index-5YfXW9xb.js"></script>
34
34
  <link rel="stylesheet" crossorigin href="/assets/index-FQ1dOuTJ.css">
35
35
  </head>
36
36
  <body>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kanna-code",
3
3
  "type": "module",
4
- "version": "0.33.2",
4
+ "version": "0.33.3",
5
5
  "description": "A beautiful web UI for Claude Code",
6
6
  "license": "MIT",
7
7
  "keywords": [