kanna-code 0.13.0 → 0.13.1
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.
|
@@ -431,7 +431,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
431
431
|
*
|
|
432
432
|
* This source code is licensed under the ISC license.
|
|
433
433
|
* See the LICENSE file in the root directory of this source tree.
|
|
434
|
-
*/const VP=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],wf=Ne("zap",VP),Cu="data-focus-fallback-ignore",KR="data-allow-focus-retain",Cf="kanna:restore-chat-input-focus",ub="data-chat-input",kf="data-chat-selection-zone";function Vo(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function GR(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:Vo(e,KR):!1}function qP(e){const t=e;return t!=null&&t.matches?GR(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Vo(e,KR):!1}function mC(e){return!!e.querySelector(`[${Cu}][data-state='open']`)}function KP(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function GP(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${ub}]`)).filter(a=>!a.disabled);if(n.length===0)return!1;const r=n.indexOf(e),s=r>=0?(r+1)%n.length:0,l=n[s];return l?(l.focus({preventScroll:!0}),!0):!1}function gC(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||Vo(t,ub)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:s,pointerEndTarget:l,root:a,hasActiveSelection:u}=e,h=l??s;return!a||!h||!a.contains(h)||Vo(h,Cu)||Vo(t,Cu)||u&&(Vo(s,kf)||Vo(h,kf))||GR(t)?"none":t&&t===h?"restore":qP(t)?"none":"restore"}const YR=Gz,YP=Yz,XR=b.forwardRef(({className:e,...t},n)=>g.jsx(BR,{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}));XR.displayName=BR.displayName;const XP={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},db=b.forwardRef(({className:e,children:t,size:n="md",...r},s)=>g.jsxs(YP,{children:[g.jsx(XR,{}),g.jsxs(IR,{ref:s,[Cu]:"",onCloseAutoFocus:l=>{var a;l.preventDefault(),window.dispatchEvent(new Event(Cf)),(a=r.onCloseAutoFocus)==null||a.call(r,l)},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",XP[n],e),...r,children:[t,g.jsxs(Qz,{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:[g.jsx(Oa,{className:"h-4 w-4"}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));db.displayName=IR.displayName;function ZR({className:e,...t}){return g.jsx(Xz,{className:xe("text-lg font-medium leading-none tracking-tight",e),...t})}function ZP({className:e,...t}){return g.jsx(Zz,{className:xe("text-sm text-muted-foreground",e),...t})}function QR({className:e,...t}){return g.jsx("div",{className:xe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function JR({className:e,...t}){return g.jsx("div",{className:xe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}const eT=b.createContext(null);function QP({children:e}){const[t,n]=b.useState(null),[r,s]=b.useState(""),l=b.useRef(null);b.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(s(t.options.initialValue??""),setTimeout(()=>{var _,y;(_=l.current)==null||_.focus(),(y=l.current)==null||y.select()},0))},[t]);const a=b.useCallback(()=>{n(null),s("")},[]),u=b.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.resolve(null),a())},[a,t]),h=b.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.resolve(r.trim()||null),a())},[a,t,r]),d=b.useCallback(_=>new Promise(y=>{n({kind:"confirm",options:_,resolve:y})}),[]),p=b.useCallback(_=>new Promise(y=>{n({kind:"prompt",options:_,resolve:y})}),[]),m=b.useMemo(()=>({confirm:d,prompt:p}),[d,p]);return g.jsxs(eT.Provider,{value:m,children:[e,g.jsx(YR,{open:t!==null,onOpenChange:_=>{_||!t||u()},children:g.jsx(db,{size:"sm",onKeyDown:_=>{_.key!=="Enter"||_.shiftKey||!t||t.kind!=="confirm"||(_.preventDefault(),h())},children:t?g.jsxs(g.Fragment,{children:[g.jsxs(QR,{className:"space-y-4",children:[g.jsx(ZR,{children:t.options.title}),t.options.description?g.jsx(ZP,{children:t.options.description}):null,t.kind==="prompt"?g.jsx("input",{ref:l,type:"text",value:r,onChange:_=>s(_.target.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),h())},className:"w-full px-3 py-2 text-sm border border-border rounded-md bg-background outline-none",placeholder:t.options.placeholder}):null]}),g.jsxs(JR,{children:[g.jsx(nt,{variant:"ghost",size:"sm",onClick:u,children:t.options.cancelLabel??"Cancel"}),g.jsx(nt,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:h,disabled:t.kind==="prompt"&&!r.trim(),children:t.options.confirmLabel??"Confirm"})]})]}):null})})]})}function JP(){const e=b.useContext(eT);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const eB=["top","right","bottom","left"],oo=Math.min,Sr=Math.max,Ef=Math.round,Th=Math.floor,Ti=e=>({x:e,y:e}),tB={left:"right",right:"left",bottom:"top",top:"bottom"};function m_(e,t,n){return Sr(e,oo(t,n))}function hs(e,t){return typeof e=="function"?e(t):e}function fs(e){return e.split("-")[0]}function La(e){return e.split("-")[1]}function hb(e){return e==="x"?"y":"x"}function fb(e){return e==="y"?"height":"width"}function Ci(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function pb(e){return hb(Ci(e))}function nB(e,t,n){n===void 0&&(n=!1);const r=La(e),s=pb(e),l=fb(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(a=Rf(a)),[a,Rf(a)]}function rB(e){const t=Rf(e);return[g_(e),t,g_(t)]}function g_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const vC=["left","right"],_C=["right","left"],iB=["top","bottom"],sB=["bottom","top"];function oB(e,t,n){switch(e){case"top":case"bottom":return n?t?_C:vC:t?vC:_C;case"left":case"right":return t?iB:sB;default:return[]}}function lB(e,t,n,r){const s=La(e);let l=oB(fs(e),n==="start",r);return s&&(l=l.map(a=>a+"-"+s),t&&(l=l.concat(l.map(g_)))),l}function Rf(e){const t=fs(e);return tB[t]+e.slice(t.length)}function aB(e){return{top:0,right:0,bottom:0,left:0,...e}}function tT(e){return typeof e!="number"?aB(e):{top:e,right:e,bottom:e,left:e}}function Tf(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function yC(e,t,n){let{reference:r,floating:s}=e;const l=Ci(t),a=pb(t),u=fb(a),h=fs(t),d=l==="y",p=r.x+r.width/2-s.width/2,m=r.y+r.height/2-s.height/2,_=r[u]/2-s[u]/2;let y;switch(h){case"top":y={x:p,y:r.y-s.height};break;case"bottom":y={x:p,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-s.width,y:m};break;default:y={x:r.x,y:r.y}}switch(La(t)){case"start":y[a]-=_*(n&&d?-1:1);break;case"end":y[a]+=_*(n&&d?-1:1);break}return y}async function cB(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:l,rects:a,elements:u,strategy:h}=e,{boundary:d="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:_=!1,padding:y=0}=hs(t,e),w=tT(y),C=u[_?m==="floating"?"reference":"floating":m],k=Tf(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(C)))==null||n?C:C.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:d,rootBoundary:p,strategy:h})),T=m==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,R=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),N=await(l.isElement==null?void 0:l.isElement(R))?await(l.getScale==null?void 0:l.getScale(R))||{x:1,y:1}:{x:1,y:1},j=Tf(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:T,offsetParent:R,strategy:h}):T);return{top:(k.top-j.top+w.top)/N.y,bottom:(j.bottom-k.bottom+w.bottom)/N.y,left:(k.left-j.left+w.left)/N.x,right:(j.right-k.right+w.right)/N.x}}const uB=50,dB=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:l=[],platform:a}=n,u=a.detectOverflow?a:{...a,detectOverflow:cB},h=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:p,y:m}=yC(d,r,h),_=r,y=0;const w={};for(let S=0;S<l.length;S++){const C=l[S];if(!C)continue;const{name:k,fn:T}=C,{x:R,y:N,data:j,reset:A}=await T({x:p,y:m,initialPlacement:r,placement:_,strategy:s,middlewareData:w,rects:d,platform:u,elements:{reference:e,floating:t}});p=R??p,m=N??m,w[k]={...w[k],...j},A&&y<uB&&(y++,typeof A=="object"&&(A.placement&&(_=A.placement),A.rects&&(d=A.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):A.rects),{x:p,y:m}=yC(d,_,h)),S=-1)}return{x:p,y:m,placement:_,strategy:s,middlewareData:w}},hB=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:l,platform:a,elements:u,middlewareData:h}=t,{element:d,padding:p=0}=hs(e,t)||{};if(d==null)return{};const m=tT(p),_={x:n,y:r},y=pb(s),w=fb(y),S=await a.getDimensions(d),C=y==="y",k=C?"top":"left",T=C?"bottom":"right",R=C?"clientHeight":"clientWidth",N=l.reference[w]+l.reference[y]-_[y]-l.floating[w],j=_[y]-l.reference[y],A=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let D=A?A[R]:0;(!D||!await(a.isElement==null?void 0:a.isElement(A)))&&(D=u.floating[R]||l.floating[w]);const B=N/2-j/2,K=D/2-S[w]/2-1,z=oo(m[k],K),U=oo(m[T],K),H=z,F=D-S[w]-U,q=D/2-S[w]/2+B,$=m_(H,q,F),P=!h.arrow&&La(s)!=null&&q!==$&&l.reference[w]/2-(q<H?z:U)-S[w]/2<0,V=P?q<H?q-H:q-F:0;return{[y]:_[y]+V,data:{[y]:$,centerOffset:q-$-V,...P&&{alignmentOffset:V}},reset:P}}}),fB=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:l,rects:a,initialPlacement:u,platform:h,elements:d}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:_,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...C}=hs(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=fs(s),T=Ci(u),R=fs(u)===u,N=await(h.isRTL==null?void 0:h.isRTL(d.floating)),j=_||(R||!S?[Rf(u)]:rB(u)),A=w!=="none";!_&&A&&j.push(...lB(u,S,w,N));const D=[u,...j],B=await h.detectOverflow(t,C),K=[];let z=((r=l.flip)==null?void 0:r.overflows)||[];if(p&&K.push(B[k]),m){const q=nB(s,a,N);K.push(B[q[0]],B[q[1]])}if(z=[...z,{placement:s,overflows:K}],!K.every(q=>q<=0)){var U,H;const q=(((U=l.flip)==null?void 0:U.index)||0)+1,$=D[q];if($&&(!(m==="alignment"?T!==Ci($):!1)||z.every(W=>Ci(W.placement)===T?W.overflows[0]>0:!0)))return{data:{index:q,overflows:z},reset:{placement:$}};let P=(H=z.filter(V=>V.overflows[0]<=0).sort((V,W)=>V.overflows[1]-W.overflows[1])[0])==null?void 0:H.placement;if(!P)switch(y){case"bestFit":{var F;const V=(F=z.filter(W=>{if(A){const Z=Ci(W.placement);return Z===T||Z==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(Z=>Z>0).reduce((Z,M)=>Z+M,0)]).sort((W,Z)=>W[1]-Z[1])[0])==null?void 0:F[0];V&&(P=V);break}case"initialPlacement":P=u;break}if(s!==P)return{reset:{placement:P}}}return{}}}};function bC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xC(e){return eB.some(t=>e[t]>=0)}const pB=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...l}=hs(e,t);switch(s){case"referenceHidden":{const a=await r.detectOverflow(t,{...l,elementContext:"reference"}),u=bC(a,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:xC(u)}}}case"escaped":{const a=await r.detectOverflow(t,{...l,altBoundary:!0}),u=bC(a,n.floating);return{data:{escapedOffsets:u,escaped:xC(u)}}}default:return{}}}}},nT=new Set(["left","top"]);async function mB(e,t){const{placement:n,platform:r,elements:s}=e,l=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=fs(n),u=La(n),h=Ci(n)==="y",d=nT.has(a)?-1:1,p=l&&h?-1:1,m=hs(t,e);let{mainAxis:_,crossAxis:y,alignmentAxis:w}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof w=="number"&&(y=u==="end"?w*-1:w),h?{x:y*p,y:_*d}:{x:_*d,y:y*p}}const gB=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:l,placement:a,middlewareData:u}=t,h=await mB(t,e);return a===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+h.x,y:l+h.y,data:{...h,placement:a}}}}},vB=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:l}=t,{mainAxis:a=!0,crossAxis:u=!1,limiter:h={fn:k=>{let{x:T,y:R}=k;return{x:T,y:R}}},...d}=hs(e,t),p={x:n,y:r},m=await l.detectOverflow(t,d),_=Ci(fs(s)),y=hb(_);let w=p[y],S=p[_];if(a){const k=y==="y"?"top":"left",T=y==="y"?"bottom":"right",R=w+m[k],N=w-m[T];w=m_(R,w,N)}if(u){const k=_==="y"?"top":"left",T=_==="y"?"bottom":"right",R=S+m[k],N=S-m[T];S=m_(R,S,N)}const C=h.fn({...t,[y]:w,[_]:S});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[y]:a,[_]:u}}}}}},_B=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:l,middlewareData:a}=t,{offset:u=0,mainAxis:h=!0,crossAxis:d=!0}=hs(e,t),p={x:n,y:r},m=Ci(s),_=hb(m);let y=p[_],w=p[m];const S=hs(u,t),C=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const R=_==="y"?"height":"width",N=l.reference[_]-l.floating[R]+C.mainAxis,j=l.reference[_]+l.reference[R]-C.mainAxis;y<N?y=N:y>j&&(y=j)}if(d){var k,T;const R=_==="y"?"width":"height",N=nT.has(fs(s)),j=l.reference[m]-l.floating[R]+(N&&((k=a.offset)==null?void 0:k[m])||0)+(N?0:C.crossAxis),A=l.reference[m]+l.reference[R]+(N?0:((T=a.offset)==null?void 0:T[m])||0)-(N?C.crossAxis:0);w<j?w=j:w>A&&(w=A)}return{[_]:y,[m]:w}}}},yB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:l,platform:a,elements:u}=t,{apply:h=()=>{},...d}=hs(e,t),p=await a.detectOverflow(t,d),m=fs(s),_=La(s),y=Ci(s)==="y",{width:w,height:S}=l.floating;let C,k;m==="top"||m==="bottom"?(C=m,k=_===(await(a.isRTL==null?void 0:a.isRTL(u.floating))?"start":"end")?"left":"right"):(k=m,C=_==="end"?"top":"bottom");const T=S-p.top-p.bottom,R=w-p.left-p.right,N=oo(S-p[C],T),j=oo(w-p[k],R),A=!t.middlewareData.shift;let D=N,B=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(B=R),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=T),A&&!_){const z=Sr(p.left,0),U=Sr(p.right,0),H=Sr(p.top,0),F=Sr(p.bottom,0);y?B=w-2*(z!==0||U!==0?z+U:Sr(p.left,p.right)):D=S-2*(H!==0||F!==0?H+F:Sr(p.top,p.bottom))}await h({...t,availableWidth:B,availableHeight:D});const K=await a.getDimensions(u.floating);return w!==K.width||S!==K.height?{reset:{rects:!0}}:{}}}};function cp(){return typeof window<"u"}function ja(e){return rT(e)?(e.nodeName||"").toLowerCase():"#document"}function wr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Oi(e){var t;return(t=(rT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function rT(e){return cp()?e instanceof Node||e instanceof wr(e).Node:!1}function ai(e){return cp()?e instanceof Element||e instanceof wr(e).Element:!1}function gs(e){return cp()?e instanceof HTMLElement||e instanceof wr(e).HTMLElement:!1}function SC(e){return!cp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof wr(e).ShadowRoot}function $u(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=ci(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function bB(e){return/^(table|td|th)$/.test(ja(e))}function up(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const xB=/transform|translate|scale|rotate|perspective|filter/,SB=/paint|layout|strict|content/,jo=e=>!!e&&e!=="none";let mv;function mb(e){const t=ai(e)?ci(e):e;return jo(t.transform)||jo(t.translate)||jo(t.scale)||jo(t.rotate)||jo(t.perspective)||!gb()&&(jo(t.backdropFilter)||jo(t.filter))||xB.test(t.willChange||"")||SB.test(t.contain||"")}function wB(e){let t=lo(e);for(;gs(t)&&!xa(t);){if(mb(t))return t;if(up(t))return null;t=lo(t)}return null}function gb(){return mv==null&&(mv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),mv}function xa(e){return/^(html|body|#document)$/.test(ja(e))}function ci(e){return wr(e).getComputedStyle(e)}function dp(e){return ai(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lo(e){if(ja(e)==="html")return e;const t=e.assignedSlot||e.parentNode||SC(e)&&e.host||Oi(e);return SC(t)?t.host:t}function iT(e){const t=lo(e);return xa(t)?e.ownerDocument?e.ownerDocument.body:e.body:gs(t)&&$u(t)?t:iT(t)}function ku(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=iT(e),l=s===((r=e.ownerDocument)==null?void 0:r.body),a=wr(s);if(l){const u=v_(a);return t.concat(a,a.visualViewport||[],$u(s)?s:[],u&&n?ku(u):[])}else return t.concat(s,ku(s,[],n))}function v_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function sT(e){const t=ci(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=gs(e),l=s?e.offsetWidth:n,a=s?e.offsetHeight:r,u=Ef(n)!==l||Ef(r)!==a;return u&&(n=l,r=a),{width:n,height:r,$:u}}function vb(e){return ai(e)?e:e.contextElement}function ma(e){const t=vb(e);if(!gs(t))return Ti(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:l}=sT(t);let a=(l?Ef(n.width):n.width)/r,u=(l?Ef(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!u||!Number.isFinite(u))&&(u=1),{x:a,y:u}}const CB=Ti(0);function oT(e){const t=wr(e);return!gb()||!t.visualViewport?CB:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function kB(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==wr(e)?!1:t}function Qo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),l=vb(e);let a=Ti(1);t&&(r?ai(r)&&(a=ma(r)):a=ma(e));const u=kB(l,n,r)?oT(l):Ti(0);let h=(s.left+u.x)/a.x,d=(s.top+u.y)/a.y,p=s.width/a.x,m=s.height/a.y;if(l){const _=wr(l),y=r&&ai(r)?wr(r):r;let w=_,S=v_(w);for(;S&&r&&y!==w;){const C=ma(S),k=S.getBoundingClientRect(),T=ci(S),R=k.left+(S.clientLeft+parseFloat(T.paddingLeft))*C.x,N=k.top+(S.clientTop+parseFloat(T.paddingTop))*C.y;h*=C.x,d*=C.y,p*=C.x,m*=C.y,h+=R,d+=N,w=wr(S),S=v_(w)}}return Tf({width:p,height:m,x:h,y:d})}function hp(e,t){const n=dp(e).scrollLeft;return t?t.left+n:Qo(Oi(e)).left+n}function lT(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-hp(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function EB(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const l=s==="fixed",a=Oi(r),u=t?up(t.floating):!1;if(r===a||u&&l)return n;let h={scrollLeft:0,scrollTop:0},d=Ti(1);const p=Ti(0),m=gs(r);if((m||!m&&!l)&&((ja(r)!=="body"||$u(a))&&(h=dp(r)),m)){const y=Qo(r);d=ma(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const _=a&&!m&&!l?lT(a,h):Ti(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-h.scrollLeft*d.x+p.x+_.x,y:n.y*d.y-h.scrollTop*d.y+p.y+_.y}}function RB(e){return Array.from(e.getClientRects())}function TB(e){const t=Oi(e),n=dp(e),r=e.ownerDocument.body,s=Sr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),l=Sr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+hp(e);const u=-n.scrollTop;return ci(r).direction==="rtl"&&(a+=Sr(t.clientWidth,r.clientWidth)-s),{width:s,height:l,x:a,y:u}}const wC=25;function MB(e,t){const n=wr(e),r=Oi(e),s=n.visualViewport;let l=r.clientWidth,a=r.clientHeight,u=0,h=0;if(s){l=s.width,a=s.height;const p=gb();(!p||p&&t==="fixed")&&(u=s.offsetLeft,h=s.offsetTop)}const d=hp(r);if(d<=0){const p=r.ownerDocument,m=p.body,_=getComputedStyle(m),y=p.compatMode==="CSS1Compat"&&parseFloat(_.marginLeft)+parseFloat(_.marginRight)||0,w=Math.abs(r.clientWidth-m.clientWidth-y);w<=wC&&(l-=w)}else d<=wC&&(l+=d);return{width:l,height:a,x:u,y:h}}function NB(e,t){const n=Qo(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,l=gs(e)?ma(e):Ti(1),a=e.clientWidth*l.x,u=e.clientHeight*l.y,h=s*l.x,d=r*l.y;return{width:a,height:u,x:h,y:d}}function CC(e,t,n){let r;if(t==="viewport")r=MB(e,n);else if(t==="document")r=TB(Oi(e));else if(ai(t))r=NB(t,n);else{const s=oT(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Tf(r)}function aT(e,t){const n=lo(e);return n===t||!ai(n)||xa(n)?!1:ci(n).position==="fixed"||aT(n,t)}function AB(e,t){const n=t.get(e);if(n)return n;let r=ku(e,[],!1).filter(u=>ai(u)&&ja(u)!=="body"),s=null;const l=ci(e).position==="fixed";let a=l?lo(e):e;for(;ai(a)&&!xa(a);){const u=ci(a),h=mb(a);!h&&u.position==="fixed"&&(s=null),(l?!h&&!s:!h&&u.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||$u(a)&&!h&&aT(e,a))?r=r.filter(p=>p!==a):s=u,a=lo(a)}return t.set(e,r),r}function DB(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?up(t)?[]:AB(t,this._c):[].concat(n),r],u=CC(t,a[0],s);let h=u.top,d=u.right,p=u.bottom,m=u.left;for(let _=1;_<a.length;_++){const y=CC(t,a[_],s);h=Sr(y.top,h),d=oo(y.right,d),p=oo(y.bottom,p),m=Sr(y.left,m)}return{width:d-m,height:p-h,x:m,y:h}}function OB(e){const{width:t,height:n}=sT(e);return{width:t,height:n}}function LB(e,t,n){const r=gs(t),s=Oi(t),l=n==="fixed",a=Qo(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const h=Ti(0);function d(){h.x=hp(s)}if(r||!r&&!l)if((ja(t)!=="body"||$u(s))&&(u=dp(t)),r){const y=Qo(t,!0,l,t);h.x=y.x+t.clientLeft,h.y=y.y+t.clientTop}else s&&d();l&&!r&&s&&d();const p=s&&!r&&!l?lT(s,u):Ti(0),m=a.left+u.scrollLeft-h.x-p.x,_=a.top+u.scrollTop-h.y-p.y;return{x:m,y:_,width:a.width,height:a.height}}function gv(e){return ci(e).position==="static"}function kC(e,t){if(!gs(e)||ci(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Oi(e)===n&&(n=n.ownerDocument.body),n}function cT(e,t){const n=wr(e);if(up(e))return n;if(!gs(e)){let s=lo(e);for(;s&&!xa(s);){if(ai(s)&&!gv(s))return s;s=lo(s)}return n}let r=kC(e,t);for(;r&&bB(r)&&gv(r);)r=kC(r,t);return r&&xa(r)&&gv(r)&&!mb(r)?n:r||wB(e)||n}const jB=async function(e){const t=this.getOffsetParent||cT,n=this.getDimensions,r=await n(e.floating);return{reference:LB(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zB(e){return ci(e).direction==="rtl"}const PB={convertOffsetParentRelativeRectToViewportRelativeRect:EB,getDocumentElement:Oi,getClippingRect:DB,getOffsetParent:cT,getElementRects:jB,getClientRects:RB,getDimensions:OB,getScale:ma,isElement:ai,isRTL:zB};function uT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function BB(e,t){let n=null,r;const s=Oi(e);function l(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function a(u,h){u===void 0&&(u=!1),h===void 0&&(h=1),l();const d=e.getBoundingClientRect(),{left:p,top:m,width:_,height:y}=d;if(u||t(),!_||!y)return;const w=Th(m),S=Th(s.clientWidth-(p+_)),C=Th(s.clientHeight-(m+y)),k=Th(p),R={rootMargin:-w+"px "+-S+"px "+-C+"px "+-k+"px",threshold:Sr(0,oo(1,h))||1};let N=!0;function j(A){const D=A[0].intersectionRatio;if(D!==h){if(!N)return a();D?a(!1,D):r=setTimeout(()=>{a(!1,1e-7)},1e3)}D===1&&!uT(d,e.getBoundingClientRect())&&a(),N=!1}try{n=new IntersectionObserver(j,{...R,root:s.ownerDocument})}catch{n=new IntersectionObserver(j,R)}n.observe(e)}return a(!0),l}function IB(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:l=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,d=vb(e),p=s||l?[...d?ku(d):[],...t?ku(t):[]]:[];p.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),l&&k.addEventListener("resize",n)});const m=d&&u?BB(d,n):null;let _=-1,y=null;a&&(y=new ResizeObserver(k=>{let[T]=k;T&&T.target===d&&y&&t&&(y.unobserve(t),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var R;(R=y)==null||R.observe(t)})),n()}),d&&!h&&y.observe(d),t&&y.observe(t));let w,S=h?Qo(e):null;h&&C();function C(){const k=Qo(e);S&&!uT(S,k)&&n(),S=k,w=requestAnimationFrame(C)}return n(),()=>{var k;p.forEach(T=>{s&&T.removeEventListener("scroll",n),l&&T.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,h&&cancelAnimationFrame(w)}}const HB=gB,FB=vB,UB=fB,$B=yB,WB=pB,EC=hB,VB=_B,qB=(e,t,n)=>{const r=new Map,s={platform:PB,...n},l={...s.platform,_c:r};return dB(e,t,{...s,platform:l})};var KB=typeof document<"u",GB=function(){},ef=KB?b.useLayoutEffect:GB;function Mf(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,s;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(!Mf(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const l=s[r];if(!(l==="_owner"&&e.$$typeof)&&!Mf(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function dT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function RC(e,t){const n=dT(e);return Math.round(t*n)/n}function vv(e){const t=b.useRef(e);return ef(()=>{t.current=e}),t}function YB(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:l,floating:a}={},transform:u=!0,whileElementsMounted:h,open:d}=e,[p,m]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[_,y]=b.useState(r);Mf(_,r)||y(r);const[w,S]=b.useState(null),[C,k]=b.useState(null),T=b.useCallback(W=>{W!==A.current&&(A.current=W,S(W))},[]),R=b.useCallback(W=>{W!==D.current&&(D.current=W,k(W))},[]),N=l||w,j=a||C,A=b.useRef(null),D=b.useRef(null),B=b.useRef(p),K=h!=null,z=vv(h),U=vv(s),H=vv(d),F=b.useCallback(()=>{if(!A.current||!D.current)return;const W={placement:t,strategy:n,middleware:_};U.current&&(W.platform=U.current),qB(A.current,D.current,W).then(Z=>{const M={...Z,isPositioned:H.current!==!1};q.current&&!Mf(B.current,M)&&(B.current=M,wi.flushSync(()=>{m(M)}))})},[_,t,n,U,H]);ef(()=>{d===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,m(W=>({...W,isPositioned:!1})))},[d]);const q=b.useRef(!1);ef(()=>(q.current=!0,()=>{q.current=!1}),[]),ef(()=>{if(N&&(A.current=N),j&&(D.current=j),N&&j){if(z.current)return z.current(N,j,F);F()}},[N,j,F,z,K]);const $=b.useMemo(()=>({reference:A,floating:D,setReference:T,setFloating:R}),[T,R]),P=b.useMemo(()=>({reference:N,floating:j}),[N,j]),V=b.useMemo(()=>{const W={position:n,left:0,top:0};if(!P.floating)return W;const Z=RC(P.floating,p.x),M=RC(P.floating,p.y);return u?{...W,transform:"translate("+Z+"px, "+M+"px)",...dT(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Z,top:M}},[n,u,P.floating,p.x,p.y]);return b.useMemo(()=>({...p,update:F,refs:$,elements:P,floatingStyles:V}),[p,F,$,P,V])}const XB=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?EC({element:r.current,padding:s}).fn(n):{}:r?EC({element:r,padding:s}).fn(n):{}}}},ZB=(e,t)=>{const n=HB(e);return{name:n.name,fn:n.fn,options:[e,t]}},QB=(e,t)=>{const n=FB(e);return{name:n.name,fn:n.fn,options:[e,t]}},JB=(e,t)=>({fn:VB(e).fn,options:[e,t]}),eI=(e,t)=>{const n=UB(e);return{name:n.name,fn:n.fn,options:[e,t]}},tI=(e,t)=>{const n=$B(e);return{name:n.name,fn:n.fn,options:[e,t]}},nI=(e,t)=>{const n=WB(e);return{name:n.name,fn:n.fn,options:[e,t]}},rI=(e,t)=>{const n=XB(e);return{name:n.name,fn:n.fn,options:[e,t]}};var iI="Arrow",hT=b.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...l}=e;return g.jsx(Je.svg,{...l,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});hT.displayName=iI;var sI=hT;function oI(e){const[t,n]=b.useState(void 0);return zn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const l=s[0];let a,u;if("borderBoxSize"in l){const h=l.borderBoxSize,d=Array.isArray(h)?h[0]:h;a=d.inlineSize,u=d.blockSize}else a=e.offsetWidth,u=e.offsetHeight;n({width:a,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var _b="Popper",[fT,uo]=ms(_b),[lI,pT]=fT(_b),mT=e=>{const{__scopePopper:t,children:n}=e,[r,s]=b.useState(null);return g.jsx(lI,{scope:t,anchor:r,onAnchorChange:s,children:n})};mT.displayName=_b;var gT="PopperAnchor",vT=b.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,l=pT(gT,n),a=b.useRef(null),u=dt(t,a),h=b.useRef(null);return b.useEffect(()=>{const d=h.current;h.current=(r==null?void 0:r.current)||a.current,d!==h.current&&l.onAnchorChange(h.current)}),r?null:g.jsx(Je.div,{...s,ref:u})});vT.displayName=gT;var yb="PopperContent",[aI,cI]=fT(yb),_T=b.forwardRef((e,t)=>{var J,re,he,ve,Ce,ce;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:l="center",alignOffset:a=0,arrowPadding:u=0,avoidCollisions:h=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:_=!1,updatePositionStrategy:y="optimized",onPlaced:w,...S}=e,C=pT(yb,n),[k,T]=b.useState(null),R=dt(t,_e=>T(_e)),[N,j]=b.useState(null),A=oI(N),D=(A==null?void 0:A.width)??0,B=(A==null?void 0:A.height)??0,K=r+(l!=="center"?"-"+l:""),z=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},U=Array.isArray(d)?d:[d],H=U.length>0,F={padding:z,boundary:U.filter(dI),altBoundary:H},{refs:q,floatingStyles:$,placement:P,isPositioned:V,middlewareData:W}=YB({strategy:"fixed",placement:K,whileElementsMounted:(..._e)=>IB(..._e,{animationFrame:y==="always"}),elements:{reference:C.anchor},middleware:[ZB({mainAxis:s+B,alignmentAxis:a}),h&&QB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?JB():void 0,...F}),h&&eI({...F}),tI({...F,apply:({elements:_e,rects:Le,availableWidth:St,availableHeight:yt})=>{const{width:$t,height:Gn}=Le.reference,Jt=_e.floating.style;Jt.setProperty("--radix-popper-available-width",`${St}px`),Jt.setProperty("--radix-popper-available-height",`${yt}px`),Jt.setProperty("--radix-popper-anchor-width",`${$t}px`),Jt.setProperty("--radix-popper-anchor-height",`${Gn}px`)}}),N&&rI({element:N,padding:u}),hI({arrowWidth:D,arrowHeight:B}),_&&nI({strategy:"referenceHidden",...F})]}),[Z,M]=xT(P),I=li(w);zn(()=>{V&&(I==null||I())},[V,I]);const X=(J=W.arrow)==null?void 0:J.x,L=(re=W.arrow)==null?void 0:re.y,oe=((he=W.arrow)==null?void 0:he.centerOffset)!==0,[ae,se]=b.useState();return zn(()=>{k&&se(window.getComputedStyle(k).zIndex)},[k]),g.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:V?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[(ve=W.transformOrigin)==null?void 0:ve.x,(Ce=W.transformOrigin)==null?void 0:Ce.y].join(" "),...((ce=W.hide)==null?void 0:ce.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:g.jsx(aI,{scope:n,placedSide:Z,onArrowChange:j,arrowX:X,arrowY:L,shouldHideArrow:oe,children:g.jsx(Je.div,{"data-side":Z,"data-align":M,...S,ref:R,style:{...S.style,animation:V?void 0:"none"}})})})});_T.displayName=yb;var yT="PopperArrow",uI={top:"bottom",right:"left",bottom:"top",left:"right"},bT=b.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,l=cI(yT,r),a=uI[l.placedSide];return g.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:g.jsx(sI,{...s,ref:n,style:{...s.style,display:"block"}})})});bT.displayName=yT;function dI(e){return e!==null}var hI=e=>({name:"transformOrigin",options:e,fn(t){var C,k,T;const{placement:n,rects:r,middlewareData:s}=t,a=((C=s.arrow)==null?void 0:C.centerOffset)!==0,u=a?0:e.arrowWidth,h=a?0:e.arrowHeight,[d,p]=xT(n),m={start:"0%",center:"50%",end:"100%"}[p],_=(((k=s.arrow)==null?void 0:k.x)??0)+u/2,y=(((T=s.arrow)==null?void 0:T.y)??0)+h/2;let w="",S="";return d==="bottom"?(w=a?m:`${_}px`,S=`${-h}px`):d==="top"?(w=a?m:`${_}px`,S=`${r.floating.height+h}px`):d==="right"?(w=`${-h}px`,S=a?m:`${y}px`):d==="left"&&(w=`${r.floating.width+h}px`,S=a?m:`${y}px`),{data:{x:w,y:S}}}});function xT(e){const[t,n="center"]=e.split("-");return[t,n]}var fp=mT,Wu=vT,pp=_T,mp=bT,ST=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"}),fI="VisuallyHidden",wT=b.forwardRef((e,t)=>g.jsx(Je.span,{...e,ref:t,style:{...ST,...e.style}}));wT.displayName=fI;var pI=wT,[gp]=ms("Tooltip",[uo]),vp=uo(),CT="TooltipProvider",mI=700,__="tooltip.open",[gI,bb]=gp(CT),kT=e=>{const{__scopeTooltip:t,delayDuration:n=mI,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:l}=e,a=b.useRef(!0),u=b.useRef(!1),h=b.useRef(0);return b.useEffect(()=>{const d=h.current;return()=>window.clearTimeout(d)},[]),g.jsx(gI,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(h.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:b.useCallback(d=>{u.current=d},[]),disableHoverableContent:s,children:l})};kT.displayName=CT;var Eu="Tooltip",[vI,Vu]=gp(Eu),ET=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:l,disableHoverableContent:a,delayDuration:u}=e,h=bb(Eu,e.__scopeTooltip),d=vp(t),[p,m]=b.useState(null),_=cs(),y=b.useRef(0),w=a??h.disableHoverableContent,S=u??h.delayDuration,C=b.useRef(!1),[k,T]=ba({prop:r,defaultProp:s??!1,onChange:D=>{D?(h.onOpen(),document.dispatchEvent(new CustomEvent(__))):h.onClose(),l==null||l(D)},caller:Eu}),R=b.useMemo(()=>k?C.current?"delayed-open":"instant-open":"closed",[k]),N=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,C.current=!1,T(!0)},[T]),j=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,T(!1)},[T]),A=b.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{C.current=!0,T(!0),y.current=0},S)},[S,T]);return b.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),g.jsx(fp,{...d,children:g.jsx(vI,{scope:t,contentId:_,open:k,stateAttribute:R,trigger:p,onTriggerChange:m,onTriggerEnter:b.useCallback(()=>{h.isOpenDelayedRef.current?A():N()},[h.isOpenDelayedRef,A,N]),onTriggerLeave:b.useCallback(()=>{w?j():(window.clearTimeout(y.current),y.current=0)},[j,w]),onOpen:N,onClose:j,disableHoverableContent:w,children:n})})};ET.displayName=Eu;var y_="TooltipTrigger",RT=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Vu(y_,n),l=bb(y_,n),a=vp(n),u=b.useRef(null),h=dt(t,u,s.onTriggerChange),d=b.useRef(!1),p=b.useRef(!1),m=b.useCallback(()=>d.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),g.jsx(Wu,{asChild:!0,...a,children:g.jsx(Je.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:h,onPointerMove:Ee(e.onPointerMove,_=>{_.pointerType!=="touch"&&!p.current&&!l.isPointerInTransitRef.current&&(s.onTriggerEnter(),p.current=!0)}),onPointerLeave:Ee(e.onPointerLeave,()=>{s.onTriggerLeave(),p.current=!1}),onPointerDown:Ee(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Ee(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:Ee(e.onBlur,s.onClose),onClick:Ee(e.onClick,s.onClose)})})});RT.displayName=y_;var xb="TooltipPortal",[_I,yI]=gp(xb,{forceMount:void 0}),TT=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,l=Vu(xb,t);return g.jsx(_I,{scope:t,forceMount:n,children:g.jsx(Yr,{present:n||l.open,children:g.jsx(Da,{asChild:!0,container:s,children:r})})})};TT.displayName=xb;var Sa="TooltipContent",MT=b.forwardRef((e,t)=>{const n=yI(Sa,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...l}=e,a=Vu(Sa,e.__scopeTooltip);return g.jsx(Yr,{present:r||a.open,children:a.disableHoverableContent?g.jsx(NT,{side:s,...l,ref:t}):g.jsx(bI,{side:s,...l,ref:t})})}),bI=b.forwardRef((e,t)=>{const n=Vu(Sa,e.__scopeTooltip),r=bb(Sa,e.__scopeTooltip),s=b.useRef(null),l=dt(t,s),[a,u]=b.useState(null),{trigger:h,onClose:d}=n,p=s.current,{onPointerInTransitChange:m}=r,_=b.useCallback(()=>{u(null),m(!1)},[m]),y=b.useCallback((w,S)=>{const C=w.currentTarget,k={x:w.clientX,y:w.clientY},T=kI(k,C.getBoundingClientRect()),R=EI(k,T),N=RI(S.getBoundingClientRect()),j=MI([...R,...N]);u(j),m(!0)},[m]);return b.useEffect(()=>()=>_(),[_]),b.useEffect(()=>{if(h&&p){const w=C=>y(C,p),S=C=>y(C,h);return h.addEventListener("pointerleave",w),p.addEventListener("pointerleave",S),()=>{h.removeEventListener("pointerleave",w),p.removeEventListener("pointerleave",S)}}},[h,p,y,_]),b.useEffect(()=>{if(a){const w=S=>{const C=S.target,k={x:S.clientX,y:S.clientY},T=(h==null?void 0:h.contains(C))||(p==null?void 0:p.contains(C)),R=!TI(k,a);T?_():R&&(_(),d())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[h,p,a,d,_]),g.jsx(NT,{...e,ref:l})}),[xI,SI]=gp(Eu,{isInside:!1}),wI=Mj("TooltipContent"),NT=b.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:l,onPointerDownOutside:a,...u}=e,h=Vu(Sa,n),d=vp(n),{onClose:p}=h;return b.useEffect(()=>(document.addEventListener(__,p),()=>document.removeEventListener(__,p)),[p]),b.useEffect(()=>{if(h.trigger){const m=_=>{const y=_.target;y!=null&&y.contains(h.trigger)&&p()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[h.trigger,p]),g.jsx(Aa,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:p,children:g.jsxs(pp,{"data-state":h.stateAttribute,...d,...u,ref:t,style:{...u.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:[g.jsx(wI,{children:r}),g.jsx(xI,{scope:n,isInside:!0,children:g.jsx(pI,{id:h.contentId,role:"tooltip",children:s||r})})]})})});MT.displayName=Sa;var AT="TooltipArrow",CI=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=vp(n);return SI(AT,n).isInside?null:g.jsx(mp,{...s,...r,ref:t})});CI.displayName=AT;function kI(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,r,s,l)){case l:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function EI(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 RI(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function TI(e,t){const{x:n,y:r}=e;let s=!1;for(let l=0,a=t.length-1;l<t.length;a=l++){const u=t[l],h=t[a],d=u.x,p=u.y,m=h.x,_=h.y;p>r!=_>r&&n<(m-d)*(r-p)/(_-p)+d&&(s=!s)}return s}function MI(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),NI(t)}function NI(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const l=t[t.length-1],a=t[t.length-2];if((l.x-a.x)*(s.y-a.y)>=(l.y-a.y)*(s.x-a.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const l=n[n.length-1],a=n[n.length-2];if((l.x-a.x)*(s.y-a.y)>=(l.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}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 AI=kT,DT=ET,OT=RT,LT=TT,Sb=MT;function DI({className:e,...t}){return g.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 OI({className:e,...t}){return g.jsx("span",{className:xe("inline-flex items-center gap-0.5",e),...t})}const LI="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",jI=AI,Nf=DT,Af=OT,Ru=b.forwardRef(({className:e,sideOffset:t=4,...n},r)=>g.jsx(LT,{children:g.jsx(Sb,{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})}));Ru.displayName=Sb.displayName;const tu=DT,nu=OT;function jT(e){return e.toUpperCase()}function zI(e){const t=e.split("+");return g.jsx(OI,{children:t.map((n,r)=>g.jsx(DI,{children:jT(n)},`${n}-${r}`))})}const ca=b.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...s},l)=>{const a=r===void 0?null:Array.isArray(r)?r[0]??null:r;return g.jsx(LT,{children:g.jsx(Sb,{ref:l,sideOffset:t,className:xe(LI,e),...s,children:a?zI(a):g.jsx("span",{children:typeof n=="string"?jT(n):n})})})});ca.displayName="HotkeyTooltipContent";const PI="0.13.0",BI={version:PI},Un="Kanna",TC="kanna",II=".kanna",HI=".kanna-dev",FI="KANNA_RUNTIME_PROFILE",wb=`kanna/${BI.version}`,UI="[kanna]",$I=`~/${Un}`;function _p(){var t;return(t=globalThis.process)==null?void 0:t.env}function WI(e=_p()){var t;return((t=e==null?void 0:e[FI])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function VI(e=_p()){return WI(e)==="dev"?HI:II}function qI(e=_p()){return`~/${VI(e)}`}function KI(e=_p()){return`${qI(e)}/keybindings.json`}function Mh(e){return e?`${TC} ${e}`:TC}const yp=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...s})=>g.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),...s,children:e});function b_(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const GI=[/^(?:\/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 YI(e){const t=e.trim();for(const n of GI){const r=t.match(n);if(!r)continue;const s=(r[2]??r[1]??"").trim();if(s)return s}return t}function zT(e){return e.split("/").pop()||e}function XI(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,s=60*r,l=24*s,a=7*l;return n<r?"now":n<s?`${Math.floor(n/r)}m`:n<l?`${Math.floor(n/s)}h`:n<a?`${Math.floor(n/l)}d`:`${Math.floor(n/a)}w`}const ZI=new Set(["starting","running"]);function QI({chat:e,activeChatId:t,nowMs:n,onSelectChat:r,onDeleteChat:s}){const l=XI(e.lastMessageAt,n);return g.jsxs("div",{"data-chat-id":Xw(e.chatId),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===Xw(e.chatId)?"bg-muted hover:bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>r(e.chatId),children:[ZI.has(e.status)?g.jsx(Ni,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?g.jsx("div",{className:"relative ",children:g.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[g.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),g.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,g.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?g.jsx(yp,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),g.jsxs("div",{className:"relative h-7 w-7 mr-[2px] shrink-0",children:[l?g.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:l}):null,g.jsx(nt,{variant:"ghost",size:"icon",className:xe("absolute inset-0 h-7 w-7 opacity-100 cursor-pointer rounded-sm hover:!bg-transparent !border-0",l?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),onClick:a=>{a.stopPropagation(),s(e.chatId)},title:"Delete chat",children:g.jsx(s6,{className:"size-3.5"})})]})]},e._id)}function JI(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return b.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const bp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function za(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Cb(e){return"nodeType"in e}function lr(e){var t,n;return e?za(e)?e:Cb(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function kb(e){const{Document:t}=lr(e);return e instanceof t}function qu(e){return za(e)?!1:e instanceof lr(e).HTMLElement}function PT(e){return e instanceof lr(e).SVGElement}function Pa(e){return e?za(e)?e.document:Cb(e)?kb(e)?e:qu(e)||PT(e)?e.ownerDocument:document:document:document}const Ai=bp?b.useLayoutEffect:b.useEffect;function Eb(e){const t=b.useRef(e);return Ai(()=>{t.current=e}),b.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function e8(){const e=b.useRef(null),t=b.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=b.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Tu(e,t){t===void 0&&(t=[e]);const n=b.useRef(e);return Ai(()=>{n.current!==e&&(n.current=e)},t),n}function Ku(e,t){const n=b.useRef();return b.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Df(e){const t=Eb(e),n=b.useRef(null),r=b.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function x_(e){const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}let _v={};function Gu(e,t){return b.useMemo(()=>{if(t)return t;const n=_v[e]==null?0:_v[e]+1;return _v[e]=n,e+"-"+n},[e,t])}function BT(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((l,a)=>{const u=Object.entries(a);for(const[h,d]of u){const p=l[h];p!=null&&(l[h]=p+e*d)}return l},{...t})}}const ga=BT(1),Of=BT(-1);function t8(e){return"clientX"in e&&"clientY"in e}function Rb(e){if(!e)return!1;const{KeyboardEvent:t}=lr(e.target);return t&&e instanceof t}function n8(e){if(!e)return!1;const{TouchEvent:t}=lr(e.target);return t&&e instanceof t}function S_(e){if(n8(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 t8(e)?{x:e.clientX,y:e.clientY}:null}const Mu=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[Mu.Translate.toString(e),Mu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),MC="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function r8(e){return e.matches(MC)?e:e.querySelector(MC)}const i8={display:"none"};function s8(e){let{id:t,value:n}=e;return Ct.createElement("div",{id:t,style:i8},n)}function o8(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={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 Ct.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function l8(){const[e,t]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const IT=b.createContext(null);function a8(e){const t=b.useContext(IT);b.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function c8(){const[e]=b.useState(()=>new Set),t=b.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[b.useCallback(r=>{let{type:s,event:l}=r;e.forEach(a=>{var u;return(u=a[s])==null?void 0:u.call(a,l)})},[e]),t]}const u8={draggable:`
|
|
434
|
+
*/const VP=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],wf=Ne("zap",VP),Cu="data-focus-fallback-ignore",KR="data-allow-focus-retain",Cf="kanna:restore-chat-input-focus",ub="data-chat-input",kf="data-chat-selection-zone";function Vo(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function GR(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:Vo(e,KR):!1}function qP(e){const t=e;return t!=null&&t.matches?GR(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Vo(e,KR):!1}function mC(e){return!!e.querySelector(`[${Cu}][data-state='open']`)}function KP(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function GP(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${ub}]`)).filter(a=>!a.disabled);if(n.length===0)return!1;const r=n.indexOf(e),s=r>=0?(r+1)%n.length:0,l=n[s];return l?(l.focus({preventScroll:!0}),!0):!1}function gC(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||Vo(t,ub)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:s,pointerEndTarget:l,root:a,hasActiveSelection:u}=e,h=l??s;return!a||!h||!a.contains(h)||Vo(h,Cu)||Vo(t,Cu)||u&&(Vo(s,kf)||Vo(h,kf))||GR(t)?"none":t&&t===h?"restore":qP(t)?"none":"restore"}const YR=Gz,YP=Yz,XR=b.forwardRef(({className:e,...t},n)=>g.jsx(BR,{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}));XR.displayName=BR.displayName;const XP={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},db=b.forwardRef(({className:e,children:t,size:n="md",...r},s)=>g.jsxs(YP,{children:[g.jsx(XR,{}),g.jsxs(IR,{ref:s,[Cu]:"",onCloseAutoFocus:l=>{var a;l.preventDefault(),window.dispatchEvent(new Event(Cf)),(a=r.onCloseAutoFocus)==null||a.call(r,l)},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",XP[n],e),...r,children:[t,g.jsxs(Qz,{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:[g.jsx(Oa,{className:"h-4 w-4"}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));db.displayName=IR.displayName;function ZR({className:e,...t}){return g.jsx(Xz,{className:xe("text-lg font-medium leading-none tracking-tight",e),...t})}function ZP({className:e,...t}){return g.jsx(Zz,{className:xe("text-sm text-muted-foreground",e),...t})}function QR({className:e,...t}){return g.jsx("div",{className:xe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function JR({className:e,...t}){return g.jsx("div",{className:xe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}const eT=b.createContext(null);function QP({children:e}){const[t,n]=b.useState(null),[r,s]=b.useState(""),l=b.useRef(null);b.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(s(t.options.initialValue??""),setTimeout(()=>{var _,y;(_=l.current)==null||_.focus(),(y=l.current)==null||y.select()},0))},[t]);const a=b.useCallback(()=>{n(null),s("")},[]),u=b.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.resolve(null),a())},[a,t]),h=b.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.resolve(r.trim()||null),a())},[a,t,r]),d=b.useCallback(_=>new Promise(y=>{n({kind:"confirm",options:_,resolve:y})}),[]),p=b.useCallback(_=>new Promise(y=>{n({kind:"prompt",options:_,resolve:y})}),[]),m=b.useMemo(()=>({confirm:d,prompt:p}),[d,p]);return g.jsxs(eT.Provider,{value:m,children:[e,g.jsx(YR,{open:t!==null,onOpenChange:_=>{_||!t||u()},children:g.jsx(db,{size:"sm",onKeyDown:_=>{_.key!=="Enter"||_.shiftKey||!t||t.kind!=="confirm"||(_.preventDefault(),h())},children:t?g.jsxs(g.Fragment,{children:[g.jsxs(QR,{className:"space-y-4",children:[g.jsx(ZR,{children:t.options.title}),t.options.description?g.jsx(ZP,{children:t.options.description}):null,t.kind==="prompt"?g.jsx("input",{ref:l,type:"text",value:r,onChange:_=>s(_.target.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),h())},className:"w-full px-3 py-2 text-sm border border-border rounded-md bg-background outline-none",placeholder:t.options.placeholder}):null]}),g.jsxs(JR,{children:[g.jsx(nt,{variant:"ghost",size:"sm",onClick:u,children:t.options.cancelLabel??"Cancel"}),g.jsx(nt,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:h,disabled:t.kind==="prompt"&&!r.trim(),children:t.options.confirmLabel??"Confirm"})]})]}):null})})]})}function JP(){const e=b.useContext(eT);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const eB=["top","right","bottom","left"],oo=Math.min,Sr=Math.max,Ef=Math.round,Th=Math.floor,Ti=e=>({x:e,y:e}),tB={left:"right",right:"left",bottom:"top",top:"bottom"};function m_(e,t,n){return Sr(e,oo(t,n))}function hs(e,t){return typeof e=="function"?e(t):e}function fs(e){return e.split("-")[0]}function La(e){return e.split("-")[1]}function hb(e){return e==="x"?"y":"x"}function fb(e){return e==="y"?"height":"width"}function Ci(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function pb(e){return hb(Ci(e))}function nB(e,t,n){n===void 0&&(n=!1);const r=La(e),s=pb(e),l=fb(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(a=Rf(a)),[a,Rf(a)]}function rB(e){const t=Rf(e);return[g_(e),t,g_(t)]}function g_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const vC=["left","right"],_C=["right","left"],iB=["top","bottom"],sB=["bottom","top"];function oB(e,t,n){switch(e){case"top":case"bottom":return n?t?_C:vC:t?vC:_C;case"left":case"right":return t?iB:sB;default:return[]}}function lB(e,t,n,r){const s=La(e);let l=oB(fs(e),n==="start",r);return s&&(l=l.map(a=>a+"-"+s),t&&(l=l.concat(l.map(g_)))),l}function Rf(e){const t=fs(e);return tB[t]+e.slice(t.length)}function aB(e){return{top:0,right:0,bottom:0,left:0,...e}}function tT(e){return typeof e!="number"?aB(e):{top:e,right:e,bottom:e,left:e}}function Tf(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function yC(e,t,n){let{reference:r,floating:s}=e;const l=Ci(t),a=pb(t),u=fb(a),h=fs(t),d=l==="y",p=r.x+r.width/2-s.width/2,m=r.y+r.height/2-s.height/2,_=r[u]/2-s[u]/2;let y;switch(h){case"top":y={x:p,y:r.y-s.height};break;case"bottom":y={x:p,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-s.width,y:m};break;default:y={x:r.x,y:r.y}}switch(La(t)){case"start":y[a]-=_*(n&&d?-1:1);break;case"end":y[a]+=_*(n&&d?-1:1);break}return y}async function cB(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:l,rects:a,elements:u,strategy:h}=e,{boundary:d="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:_=!1,padding:y=0}=hs(t,e),w=tT(y),C=u[_?m==="floating"?"reference":"floating":m],k=Tf(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(C)))==null||n?C:C.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:d,rootBoundary:p,strategy:h})),T=m==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,R=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),N=await(l.isElement==null?void 0:l.isElement(R))?await(l.getScale==null?void 0:l.getScale(R))||{x:1,y:1}:{x:1,y:1},j=Tf(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:T,offsetParent:R,strategy:h}):T);return{top:(k.top-j.top+w.top)/N.y,bottom:(j.bottom-k.bottom+w.bottom)/N.y,left:(k.left-j.left+w.left)/N.x,right:(j.right-k.right+w.right)/N.x}}const uB=50,dB=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:l=[],platform:a}=n,u=a.detectOverflow?a:{...a,detectOverflow:cB},h=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:p,y:m}=yC(d,r,h),_=r,y=0;const w={};for(let S=0;S<l.length;S++){const C=l[S];if(!C)continue;const{name:k,fn:T}=C,{x:R,y:N,data:j,reset:A}=await T({x:p,y:m,initialPlacement:r,placement:_,strategy:s,middlewareData:w,rects:d,platform:u,elements:{reference:e,floating:t}});p=R??p,m=N??m,w[k]={...w[k],...j},A&&y<uB&&(y++,typeof A=="object"&&(A.placement&&(_=A.placement),A.rects&&(d=A.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):A.rects),{x:p,y:m}=yC(d,_,h)),S=-1)}return{x:p,y:m,placement:_,strategy:s,middlewareData:w}},hB=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:l,platform:a,elements:u,middlewareData:h}=t,{element:d,padding:p=0}=hs(e,t)||{};if(d==null)return{};const m=tT(p),_={x:n,y:r},y=pb(s),w=fb(y),S=await a.getDimensions(d),C=y==="y",k=C?"top":"left",T=C?"bottom":"right",R=C?"clientHeight":"clientWidth",N=l.reference[w]+l.reference[y]-_[y]-l.floating[w],j=_[y]-l.reference[y],A=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let D=A?A[R]:0;(!D||!await(a.isElement==null?void 0:a.isElement(A)))&&(D=u.floating[R]||l.floating[w]);const B=N/2-j/2,K=D/2-S[w]/2-1,z=oo(m[k],K),U=oo(m[T],K),H=z,F=D-S[w]-U,q=D/2-S[w]/2+B,$=m_(H,q,F),P=!h.arrow&&La(s)!=null&&q!==$&&l.reference[w]/2-(q<H?z:U)-S[w]/2<0,V=P?q<H?q-H:q-F:0;return{[y]:_[y]+V,data:{[y]:$,centerOffset:q-$-V,...P&&{alignmentOffset:V}},reset:P}}}),fB=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:l,rects:a,initialPlacement:u,platform:h,elements:d}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:_,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...C}=hs(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=fs(s),T=Ci(u),R=fs(u)===u,N=await(h.isRTL==null?void 0:h.isRTL(d.floating)),j=_||(R||!S?[Rf(u)]:rB(u)),A=w!=="none";!_&&A&&j.push(...lB(u,S,w,N));const D=[u,...j],B=await h.detectOverflow(t,C),K=[];let z=((r=l.flip)==null?void 0:r.overflows)||[];if(p&&K.push(B[k]),m){const q=nB(s,a,N);K.push(B[q[0]],B[q[1]])}if(z=[...z,{placement:s,overflows:K}],!K.every(q=>q<=0)){var U,H;const q=(((U=l.flip)==null?void 0:U.index)||0)+1,$=D[q];if($&&(!(m==="alignment"?T!==Ci($):!1)||z.every(W=>Ci(W.placement)===T?W.overflows[0]>0:!0)))return{data:{index:q,overflows:z},reset:{placement:$}};let P=(H=z.filter(V=>V.overflows[0]<=0).sort((V,W)=>V.overflows[1]-W.overflows[1])[0])==null?void 0:H.placement;if(!P)switch(y){case"bestFit":{var F;const V=(F=z.filter(W=>{if(A){const Z=Ci(W.placement);return Z===T||Z==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(Z=>Z>0).reduce((Z,M)=>Z+M,0)]).sort((W,Z)=>W[1]-Z[1])[0])==null?void 0:F[0];V&&(P=V);break}case"initialPlacement":P=u;break}if(s!==P)return{reset:{placement:P}}}return{}}}};function bC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xC(e){return eB.some(t=>e[t]>=0)}const pB=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...l}=hs(e,t);switch(s){case"referenceHidden":{const a=await r.detectOverflow(t,{...l,elementContext:"reference"}),u=bC(a,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:xC(u)}}}case"escaped":{const a=await r.detectOverflow(t,{...l,altBoundary:!0}),u=bC(a,n.floating);return{data:{escapedOffsets:u,escaped:xC(u)}}}default:return{}}}}},nT=new Set(["left","top"]);async function mB(e,t){const{placement:n,platform:r,elements:s}=e,l=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=fs(n),u=La(n),h=Ci(n)==="y",d=nT.has(a)?-1:1,p=l&&h?-1:1,m=hs(t,e);let{mainAxis:_,crossAxis:y,alignmentAxis:w}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof w=="number"&&(y=u==="end"?w*-1:w),h?{x:y*p,y:_*d}:{x:_*d,y:y*p}}const gB=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:l,placement:a,middlewareData:u}=t,h=await mB(t,e);return a===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+h.x,y:l+h.y,data:{...h,placement:a}}}}},vB=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:l}=t,{mainAxis:a=!0,crossAxis:u=!1,limiter:h={fn:k=>{let{x:T,y:R}=k;return{x:T,y:R}}},...d}=hs(e,t),p={x:n,y:r},m=await l.detectOverflow(t,d),_=Ci(fs(s)),y=hb(_);let w=p[y],S=p[_];if(a){const k=y==="y"?"top":"left",T=y==="y"?"bottom":"right",R=w+m[k],N=w-m[T];w=m_(R,w,N)}if(u){const k=_==="y"?"top":"left",T=_==="y"?"bottom":"right",R=S+m[k],N=S-m[T];S=m_(R,S,N)}const C=h.fn({...t,[y]:w,[_]:S});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[y]:a,[_]:u}}}}}},_B=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:l,middlewareData:a}=t,{offset:u=0,mainAxis:h=!0,crossAxis:d=!0}=hs(e,t),p={x:n,y:r},m=Ci(s),_=hb(m);let y=p[_],w=p[m];const S=hs(u,t),C=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const R=_==="y"?"height":"width",N=l.reference[_]-l.floating[R]+C.mainAxis,j=l.reference[_]+l.reference[R]-C.mainAxis;y<N?y=N:y>j&&(y=j)}if(d){var k,T;const R=_==="y"?"width":"height",N=nT.has(fs(s)),j=l.reference[m]-l.floating[R]+(N&&((k=a.offset)==null?void 0:k[m])||0)+(N?0:C.crossAxis),A=l.reference[m]+l.reference[R]+(N?0:((T=a.offset)==null?void 0:T[m])||0)-(N?C.crossAxis:0);w<j?w=j:w>A&&(w=A)}return{[_]:y,[m]:w}}}},yB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:l,platform:a,elements:u}=t,{apply:h=()=>{},...d}=hs(e,t),p=await a.detectOverflow(t,d),m=fs(s),_=La(s),y=Ci(s)==="y",{width:w,height:S}=l.floating;let C,k;m==="top"||m==="bottom"?(C=m,k=_===(await(a.isRTL==null?void 0:a.isRTL(u.floating))?"start":"end")?"left":"right"):(k=m,C=_==="end"?"top":"bottom");const T=S-p.top-p.bottom,R=w-p.left-p.right,N=oo(S-p[C],T),j=oo(w-p[k],R),A=!t.middlewareData.shift;let D=N,B=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(B=R),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=T),A&&!_){const z=Sr(p.left,0),U=Sr(p.right,0),H=Sr(p.top,0),F=Sr(p.bottom,0);y?B=w-2*(z!==0||U!==0?z+U:Sr(p.left,p.right)):D=S-2*(H!==0||F!==0?H+F:Sr(p.top,p.bottom))}await h({...t,availableWidth:B,availableHeight:D});const K=await a.getDimensions(u.floating);return w!==K.width||S!==K.height?{reset:{rects:!0}}:{}}}};function cp(){return typeof window<"u"}function ja(e){return rT(e)?(e.nodeName||"").toLowerCase():"#document"}function wr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Oi(e){var t;return(t=(rT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function rT(e){return cp()?e instanceof Node||e instanceof wr(e).Node:!1}function ai(e){return cp()?e instanceof Element||e instanceof wr(e).Element:!1}function gs(e){return cp()?e instanceof HTMLElement||e instanceof wr(e).HTMLElement:!1}function SC(e){return!cp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof wr(e).ShadowRoot}function $u(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=ci(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function bB(e){return/^(table|td|th)$/.test(ja(e))}function up(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const xB=/transform|translate|scale|rotate|perspective|filter/,SB=/paint|layout|strict|content/,jo=e=>!!e&&e!=="none";let mv;function mb(e){const t=ai(e)?ci(e):e;return jo(t.transform)||jo(t.translate)||jo(t.scale)||jo(t.rotate)||jo(t.perspective)||!gb()&&(jo(t.backdropFilter)||jo(t.filter))||xB.test(t.willChange||"")||SB.test(t.contain||"")}function wB(e){let t=lo(e);for(;gs(t)&&!xa(t);){if(mb(t))return t;if(up(t))return null;t=lo(t)}return null}function gb(){return mv==null&&(mv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),mv}function xa(e){return/^(html|body|#document)$/.test(ja(e))}function ci(e){return wr(e).getComputedStyle(e)}function dp(e){return ai(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lo(e){if(ja(e)==="html")return e;const t=e.assignedSlot||e.parentNode||SC(e)&&e.host||Oi(e);return SC(t)?t.host:t}function iT(e){const t=lo(e);return xa(t)?e.ownerDocument?e.ownerDocument.body:e.body:gs(t)&&$u(t)?t:iT(t)}function ku(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=iT(e),l=s===((r=e.ownerDocument)==null?void 0:r.body),a=wr(s);if(l){const u=v_(a);return t.concat(a,a.visualViewport||[],$u(s)?s:[],u&&n?ku(u):[])}else return t.concat(s,ku(s,[],n))}function v_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function sT(e){const t=ci(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=gs(e),l=s?e.offsetWidth:n,a=s?e.offsetHeight:r,u=Ef(n)!==l||Ef(r)!==a;return u&&(n=l,r=a),{width:n,height:r,$:u}}function vb(e){return ai(e)?e:e.contextElement}function ma(e){const t=vb(e);if(!gs(t))return Ti(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:l}=sT(t);let a=(l?Ef(n.width):n.width)/r,u=(l?Ef(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!u||!Number.isFinite(u))&&(u=1),{x:a,y:u}}const CB=Ti(0);function oT(e){const t=wr(e);return!gb()||!t.visualViewport?CB:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function kB(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==wr(e)?!1:t}function Qo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),l=vb(e);let a=Ti(1);t&&(r?ai(r)&&(a=ma(r)):a=ma(e));const u=kB(l,n,r)?oT(l):Ti(0);let h=(s.left+u.x)/a.x,d=(s.top+u.y)/a.y,p=s.width/a.x,m=s.height/a.y;if(l){const _=wr(l),y=r&&ai(r)?wr(r):r;let w=_,S=v_(w);for(;S&&r&&y!==w;){const C=ma(S),k=S.getBoundingClientRect(),T=ci(S),R=k.left+(S.clientLeft+parseFloat(T.paddingLeft))*C.x,N=k.top+(S.clientTop+parseFloat(T.paddingTop))*C.y;h*=C.x,d*=C.y,p*=C.x,m*=C.y,h+=R,d+=N,w=wr(S),S=v_(w)}}return Tf({width:p,height:m,x:h,y:d})}function hp(e,t){const n=dp(e).scrollLeft;return t?t.left+n:Qo(Oi(e)).left+n}function lT(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-hp(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function EB(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const l=s==="fixed",a=Oi(r),u=t?up(t.floating):!1;if(r===a||u&&l)return n;let h={scrollLeft:0,scrollTop:0},d=Ti(1);const p=Ti(0),m=gs(r);if((m||!m&&!l)&&((ja(r)!=="body"||$u(a))&&(h=dp(r)),m)){const y=Qo(r);d=ma(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const _=a&&!m&&!l?lT(a,h):Ti(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-h.scrollLeft*d.x+p.x+_.x,y:n.y*d.y-h.scrollTop*d.y+p.y+_.y}}function RB(e){return Array.from(e.getClientRects())}function TB(e){const t=Oi(e),n=dp(e),r=e.ownerDocument.body,s=Sr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),l=Sr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+hp(e);const u=-n.scrollTop;return ci(r).direction==="rtl"&&(a+=Sr(t.clientWidth,r.clientWidth)-s),{width:s,height:l,x:a,y:u}}const wC=25;function MB(e,t){const n=wr(e),r=Oi(e),s=n.visualViewport;let l=r.clientWidth,a=r.clientHeight,u=0,h=0;if(s){l=s.width,a=s.height;const p=gb();(!p||p&&t==="fixed")&&(u=s.offsetLeft,h=s.offsetTop)}const d=hp(r);if(d<=0){const p=r.ownerDocument,m=p.body,_=getComputedStyle(m),y=p.compatMode==="CSS1Compat"&&parseFloat(_.marginLeft)+parseFloat(_.marginRight)||0,w=Math.abs(r.clientWidth-m.clientWidth-y);w<=wC&&(l-=w)}else d<=wC&&(l+=d);return{width:l,height:a,x:u,y:h}}function NB(e,t){const n=Qo(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,l=gs(e)?ma(e):Ti(1),a=e.clientWidth*l.x,u=e.clientHeight*l.y,h=s*l.x,d=r*l.y;return{width:a,height:u,x:h,y:d}}function CC(e,t,n){let r;if(t==="viewport")r=MB(e,n);else if(t==="document")r=TB(Oi(e));else if(ai(t))r=NB(t,n);else{const s=oT(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Tf(r)}function aT(e,t){const n=lo(e);return n===t||!ai(n)||xa(n)?!1:ci(n).position==="fixed"||aT(n,t)}function AB(e,t){const n=t.get(e);if(n)return n;let r=ku(e,[],!1).filter(u=>ai(u)&&ja(u)!=="body"),s=null;const l=ci(e).position==="fixed";let a=l?lo(e):e;for(;ai(a)&&!xa(a);){const u=ci(a),h=mb(a);!h&&u.position==="fixed"&&(s=null),(l?!h&&!s:!h&&u.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||$u(a)&&!h&&aT(e,a))?r=r.filter(p=>p!==a):s=u,a=lo(a)}return t.set(e,r),r}function DB(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?up(t)?[]:AB(t,this._c):[].concat(n),r],u=CC(t,a[0],s);let h=u.top,d=u.right,p=u.bottom,m=u.left;for(let _=1;_<a.length;_++){const y=CC(t,a[_],s);h=Sr(y.top,h),d=oo(y.right,d),p=oo(y.bottom,p),m=Sr(y.left,m)}return{width:d-m,height:p-h,x:m,y:h}}function OB(e){const{width:t,height:n}=sT(e);return{width:t,height:n}}function LB(e,t,n){const r=gs(t),s=Oi(t),l=n==="fixed",a=Qo(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const h=Ti(0);function d(){h.x=hp(s)}if(r||!r&&!l)if((ja(t)!=="body"||$u(s))&&(u=dp(t)),r){const y=Qo(t,!0,l,t);h.x=y.x+t.clientLeft,h.y=y.y+t.clientTop}else s&&d();l&&!r&&s&&d();const p=s&&!r&&!l?lT(s,u):Ti(0),m=a.left+u.scrollLeft-h.x-p.x,_=a.top+u.scrollTop-h.y-p.y;return{x:m,y:_,width:a.width,height:a.height}}function gv(e){return ci(e).position==="static"}function kC(e,t){if(!gs(e)||ci(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Oi(e)===n&&(n=n.ownerDocument.body),n}function cT(e,t){const n=wr(e);if(up(e))return n;if(!gs(e)){let s=lo(e);for(;s&&!xa(s);){if(ai(s)&&!gv(s))return s;s=lo(s)}return n}let r=kC(e,t);for(;r&&bB(r)&&gv(r);)r=kC(r,t);return r&&xa(r)&&gv(r)&&!mb(r)?n:r||wB(e)||n}const jB=async function(e){const t=this.getOffsetParent||cT,n=this.getDimensions,r=await n(e.floating);return{reference:LB(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zB(e){return ci(e).direction==="rtl"}const PB={convertOffsetParentRelativeRectToViewportRelativeRect:EB,getDocumentElement:Oi,getClippingRect:DB,getOffsetParent:cT,getElementRects:jB,getClientRects:RB,getDimensions:OB,getScale:ma,isElement:ai,isRTL:zB};function uT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function BB(e,t){let n=null,r;const s=Oi(e);function l(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function a(u,h){u===void 0&&(u=!1),h===void 0&&(h=1),l();const d=e.getBoundingClientRect(),{left:p,top:m,width:_,height:y}=d;if(u||t(),!_||!y)return;const w=Th(m),S=Th(s.clientWidth-(p+_)),C=Th(s.clientHeight-(m+y)),k=Th(p),R={rootMargin:-w+"px "+-S+"px "+-C+"px "+-k+"px",threshold:Sr(0,oo(1,h))||1};let N=!0;function j(A){const D=A[0].intersectionRatio;if(D!==h){if(!N)return a();D?a(!1,D):r=setTimeout(()=>{a(!1,1e-7)},1e3)}D===1&&!uT(d,e.getBoundingClientRect())&&a(),N=!1}try{n=new IntersectionObserver(j,{...R,root:s.ownerDocument})}catch{n=new IntersectionObserver(j,R)}n.observe(e)}return a(!0),l}function IB(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:l=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,d=vb(e),p=s||l?[...d?ku(d):[],...t?ku(t):[]]:[];p.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),l&&k.addEventListener("resize",n)});const m=d&&u?BB(d,n):null;let _=-1,y=null;a&&(y=new ResizeObserver(k=>{let[T]=k;T&&T.target===d&&y&&t&&(y.unobserve(t),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var R;(R=y)==null||R.observe(t)})),n()}),d&&!h&&y.observe(d),t&&y.observe(t));let w,S=h?Qo(e):null;h&&C();function C(){const k=Qo(e);S&&!uT(S,k)&&n(),S=k,w=requestAnimationFrame(C)}return n(),()=>{var k;p.forEach(T=>{s&&T.removeEventListener("scroll",n),l&&T.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,h&&cancelAnimationFrame(w)}}const HB=gB,FB=vB,UB=fB,$B=yB,WB=pB,EC=hB,VB=_B,qB=(e,t,n)=>{const r=new Map,s={platform:PB,...n},l={...s.platform,_c:r};return dB(e,t,{...s,platform:l})};var KB=typeof document<"u",GB=function(){},ef=KB?b.useLayoutEffect:GB;function Mf(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,s;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(!Mf(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const l=s[r];if(!(l==="_owner"&&e.$$typeof)&&!Mf(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function dT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function RC(e,t){const n=dT(e);return Math.round(t*n)/n}function vv(e){const t=b.useRef(e);return ef(()=>{t.current=e}),t}function YB(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:l,floating:a}={},transform:u=!0,whileElementsMounted:h,open:d}=e,[p,m]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[_,y]=b.useState(r);Mf(_,r)||y(r);const[w,S]=b.useState(null),[C,k]=b.useState(null),T=b.useCallback(W=>{W!==A.current&&(A.current=W,S(W))},[]),R=b.useCallback(W=>{W!==D.current&&(D.current=W,k(W))},[]),N=l||w,j=a||C,A=b.useRef(null),D=b.useRef(null),B=b.useRef(p),K=h!=null,z=vv(h),U=vv(s),H=vv(d),F=b.useCallback(()=>{if(!A.current||!D.current)return;const W={placement:t,strategy:n,middleware:_};U.current&&(W.platform=U.current),qB(A.current,D.current,W).then(Z=>{const M={...Z,isPositioned:H.current!==!1};q.current&&!Mf(B.current,M)&&(B.current=M,wi.flushSync(()=>{m(M)}))})},[_,t,n,U,H]);ef(()=>{d===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,m(W=>({...W,isPositioned:!1})))},[d]);const q=b.useRef(!1);ef(()=>(q.current=!0,()=>{q.current=!1}),[]),ef(()=>{if(N&&(A.current=N),j&&(D.current=j),N&&j){if(z.current)return z.current(N,j,F);F()}},[N,j,F,z,K]);const $=b.useMemo(()=>({reference:A,floating:D,setReference:T,setFloating:R}),[T,R]),P=b.useMemo(()=>({reference:N,floating:j}),[N,j]),V=b.useMemo(()=>{const W={position:n,left:0,top:0};if(!P.floating)return W;const Z=RC(P.floating,p.x),M=RC(P.floating,p.y);return u?{...W,transform:"translate("+Z+"px, "+M+"px)",...dT(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Z,top:M}},[n,u,P.floating,p.x,p.y]);return b.useMemo(()=>({...p,update:F,refs:$,elements:P,floatingStyles:V}),[p,F,$,P,V])}const XB=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?EC({element:r.current,padding:s}).fn(n):{}:r?EC({element:r,padding:s}).fn(n):{}}}},ZB=(e,t)=>{const n=HB(e);return{name:n.name,fn:n.fn,options:[e,t]}},QB=(e,t)=>{const n=FB(e);return{name:n.name,fn:n.fn,options:[e,t]}},JB=(e,t)=>({fn:VB(e).fn,options:[e,t]}),eI=(e,t)=>{const n=UB(e);return{name:n.name,fn:n.fn,options:[e,t]}},tI=(e,t)=>{const n=$B(e);return{name:n.name,fn:n.fn,options:[e,t]}},nI=(e,t)=>{const n=WB(e);return{name:n.name,fn:n.fn,options:[e,t]}},rI=(e,t)=>{const n=XB(e);return{name:n.name,fn:n.fn,options:[e,t]}};var iI="Arrow",hT=b.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...l}=e;return g.jsx(Je.svg,{...l,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});hT.displayName=iI;var sI=hT;function oI(e){const[t,n]=b.useState(void 0);return zn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const l=s[0];let a,u;if("borderBoxSize"in l){const h=l.borderBoxSize,d=Array.isArray(h)?h[0]:h;a=d.inlineSize,u=d.blockSize}else a=e.offsetWidth,u=e.offsetHeight;n({width:a,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var _b="Popper",[fT,uo]=ms(_b),[lI,pT]=fT(_b),mT=e=>{const{__scopePopper:t,children:n}=e,[r,s]=b.useState(null);return g.jsx(lI,{scope:t,anchor:r,onAnchorChange:s,children:n})};mT.displayName=_b;var gT="PopperAnchor",vT=b.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,l=pT(gT,n),a=b.useRef(null),u=dt(t,a),h=b.useRef(null);return b.useEffect(()=>{const d=h.current;h.current=(r==null?void 0:r.current)||a.current,d!==h.current&&l.onAnchorChange(h.current)}),r?null:g.jsx(Je.div,{...s,ref:u})});vT.displayName=gT;var yb="PopperContent",[aI,cI]=fT(yb),_T=b.forwardRef((e,t)=>{var J,re,he,ve,Ce,ce;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:l="center",alignOffset:a=0,arrowPadding:u=0,avoidCollisions:h=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:_=!1,updatePositionStrategy:y="optimized",onPlaced:w,...S}=e,C=pT(yb,n),[k,T]=b.useState(null),R=dt(t,_e=>T(_e)),[N,j]=b.useState(null),A=oI(N),D=(A==null?void 0:A.width)??0,B=(A==null?void 0:A.height)??0,K=r+(l!=="center"?"-"+l:""),z=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},U=Array.isArray(d)?d:[d],H=U.length>0,F={padding:z,boundary:U.filter(dI),altBoundary:H},{refs:q,floatingStyles:$,placement:P,isPositioned:V,middlewareData:W}=YB({strategy:"fixed",placement:K,whileElementsMounted:(..._e)=>IB(..._e,{animationFrame:y==="always"}),elements:{reference:C.anchor},middleware:[ZB({mainAxis:s+B,alignmentAxis:a}),h&&QB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?JB():void 0,...F}),h&&eI({...F}),tI({...F,apply:({elements:_e,rects:Le,availableWidth:St,availableHeight:yt})=>{const{width:$t,height:Gn}=Le.reference,Jt=_e.floating.style;Jt.setProperty("--radix-popper-available-width",`${St}px`),Jt.setProperty("--radix-popper-available-height",`${yt}px`),Jt.setProperty("--radix-popper-anchor-width",`${$t}px`),Jt.setProperty("--radix-popper-anchor-height",`${Gn}px`)}}),N&&rI({element:N,padding:u}),hI({arrowWidth:D,arrowHeight:B}),_&&nI({strategy:"referenceHidden",...F})]}),[Z,M]=xT(P),I=li(w);zn(()=>{V&&(I==null||I())},[V,I]);const X=(J=W.arrow)==null?void 0:J.x,L=(re=W.arrow)==null?void 0:re.y,oe=((he=W.arrow)==null?void 0:he.centerOffset)!==0,[ae,se]=b.useState();return zn(()=>{k&&se(window.getComputedStyle(k).zIndex)},[k]),g.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:V?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[(ve=W.transformOrigin)==null?void 0:ve.x,(Ce=W.transformOrigin)==null?void 0:Ce.y].join(" "),...((ce=W.hide)==null?void 0:ce.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:g.jsx(aI,{scope:n,placedSide:Z,onArrowChange:j,arrowX:X,arrowY:L,shouldHideArrow:oe,children:g.jsx(Je.div,{"data-side":Z,"data-align":M,...S,ref:R,style:{...S.style,animation:V?void 0:"none"}})})})});_T.displayName=yb;var yT="PopperArrow",uI={top:"bottom",right:"left",bottom:"top",left:"right"},bT=b.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,l=cI(yT,r),a=uI[l.placedSide];return g.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:g.jsx(sI,{...s,ref:n,style:{...s.style,display:"block"}})})});bT.displayName=yT;function dI(e){return e!==null}var hI=e=>({name:"transformOrigin",options:e,fn(t){var C,k,T;const{placement:n,rects:r,middlewareData:s}=t,a=((C=s.arrow)==null?void 0:C.centerOffset)!==0,u=a?0:e.arrowWidth,h=a?0:e.arrowHeight,[d,p]=xT(n),m={start:"0%",center:"50%",end:"100%"}[p],_=(((k=s.arrow)==null?void 0:k.x)??0)+u/2,y=(((T=s.arrow)==null?void 0:T.y)??0)+h/2;let w="",S="";return d==="bottom"?(w=a?m:`${_}px`,S=`${-h}px`):d==="top"?(w=a?m:`${_}px`,S=`${r.floating.height+h}px`):d==="right"?(w=`${-h}px`,S=a?m:`${y}px`):d==="left"&&(w=`${r.floating.width+h}px`,S=a?m:`${y}px`),{data:{x:w,y:S}}}});function xT(e){const[t,n="center"]=e.split("-");return[t,n]}var fp=mT,Wu=vT,pp=_T,mp=bT,ST=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"}),fI="VisuallyHidden",wT=b.forwardRef((e,t)=>g.jsx(Je.span,{...e,ref:t,style:{...ST,...e.style}}));wT.displayName=fI;var pI=wT,[gp]=ms("Tooltip",[uo]),vp=uo(),CT="TooltipProvider",mI=700,__="tooltip.open",[gI,bb]=gp(CT),kT=e=>{const{__scopeTooltip:t,delayDuration:n=mI,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:l}=e,a=b.useRef(!0),u=b.useRef(!1),h=b.useRef(0);return b.useEffect(()=>{const d=h.current;return()=>window.clearTimeout(d)},[]),g.jsx(gI,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(h.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:b.useCallback(d=>{u.current=d},[]),disableHoverableContent:s,children:l})};kT.displayName=CT;var Eu="Tooltip",[vI,Vu]=gp(Eu),ET=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:l,disableHoverableContent:a,delayDuration:u}=e,h=bb(Eu,e.__scopeTooltip),d=vp(t),[p,m]=b.useState(null),_=cs(),y=b.useRef(0),w=a??h.disableHoverableContent,S=u??h.delayDuration,C=b.useRef(!1),[k,T]=ba({prop:r,defaultProp:s??!1,onChange:D=>{D?(h.onOpen(),document.dispatchEvent(new CustomEvent(__))):h.onClose(),l==null||l(D)},caller:Eu}),R=b.useMemo(()=>k?C.current?"delayed-open":"instant-open":"closed",[k]),N=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,C.current=!1,T(!0)},[T]),j=b.useCallback(()=>{window.clearTimeout(y.current),y.current=0,T(!1)},[T]),A=b.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{C.current=!0,T(!0),y.current=0},S)},[S,T]);return b.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),g.jsx(fp,{...d,children:g.jsx(vI,{scope:t,contentId:_,open:k,stateAttribute:R,trigger:p,onTriggerChange:m,onTriggerEnter:b.useCallback(()=>{h.isOpenDelayedRef.current?A():N()},[h.isOpenDelayedRef,A,N]),onTriggerLeave:b.useCallback(()=>{w?j():(window.clearTimeout(y.current),y.current=0)},[j,w]),onOpen:N,onClose:j,disableHoverableContent:w,children:n})})};ET.displayName=Eu;var y_="TooltipTrigger",RT=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Vu(y_,n),l=bb(y_,n),a=vp(n),u=b.useRef(null),h=dt(t,u,s.onTriggerChange),d=b.useRef(!1),p=b.useRef(!1),m=b.useCallback(()=>d.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),g.jsx(Wu,{asChild:!0,...a,children:g.jsx(Je.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:h,onPointerMove:Ee(e.onPointerMove,_=>{_.pointerType!=="touch"&&!p.current&&!l.isPointerInTransitRef.current&&(s.onTriggerEnter(),p.current=!0)}),onPointerLeave:Ee(e.onPointerLeave,()=>{s.onTriggerLeave(),p.current=!1}),onPointerDown:Ee(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Ee(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:Ee(e.onBlur,s.onClose),onClick:Ee(e.onClick,s.onClose)})})});RT.displayName=y_;var xb="TooltipPortal",[_I,yI]=gp(xb,{forceMount:void 0}),TT=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,l=Vu(xb,t);return g.jsx(_I,{scope:t,forceMount:n,children:g.jsx(Yr,{present:n||l.open,children:g.jsx(Da,{asChild:!0,container:s,children:r})})})};TT.displayName=xb;var Sa="TooltipContent",MT=b.forwardRef((e,t)=>{const n=yI(Sa,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...l}=e,a=Vu(Sa,e.__scopeTooltip);return g.jsx(Yr,{present:r||a.open,children:a.disableHoverableContent?g.jsx(NT,{side:s,...l,ref:t}):g.jsx(bI,{side:s,...l,ref:t})})}),bI=b.forwardRef((e,t)=>{const n=Vu(Sa,e.__scopeTooltip),r=bb(Sa,e.__scopeTooltip),s=b.useRef(null),l=dt(t,s),[a,u]=b.useState(null),{trigger:h,onClose:d}=n,p=s.current,{onPointerInTransitChange:m}=r,_=b.useCallback(()=>{u(null),m(!1)},[m]),y=b.useCallback((w,S)=>{const C=w.currentTarget,k={x:w.clientX,y:w.clientY},T=kI(k,C.getBoundingClientRect()),R=EI(k,T),N=RI(S.getBoundingClientRect()),j=MI([...R,...N]);u(j),m(!0)},[m]);return b.useEffect(()=>()=>_(),[_]),b.useEffect(()=>{if(h&&p){const w=C=>y(C,p),S=C=>y(C,h);return h.addEventListener("pointerleave",w),p.addEventListener("pointerleave",S),()=>{h.removeEventListener("pointerleave",w),p.removeEventListener("pointerleave",S)}}},[h,p,y,_]),b.useEffect(()=>{if(a){const w=S=>{const C=S.target,k={x:S.clientX,y:S.clientY},T=(h==null?void 0:h.contains(C))||(p==null?void 0:p.contains(C)),R=!TI(k,a);T?_():R&&(_(),d())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[h,p,a,d,_]),g.jsx(NT,{...e,ref:l})}),[xI,SI]=gp(Eu,{isInside:!1}),wI=Mj("TooltipContent"),NT=b.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:l,onPointerDownOutside:a,...u}=e,h=Vu(Sa,n),d=vp(n),{onClose:p}=h;return b.useEffect(()=>(document.addEventListener(__,p),()=>document.removeEventListener(__,p)),[p]),b.useEffect(()=>{if(h.trigger){const m=_=>{const y=_.target;y!=null&&y.contains(h.trigger)&&p()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[h.trigger,p]),g.jsx(Aa,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:p,children:g.jsxs(pp,{"data-state":h.stateAttribute,...d,...u,ref:t,style:{...u.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:[g.jsx(wI,{children:r}),g.jsx(xI,{scope:n,isInside:!0,children:g.jsx(pI,{id:h.contentId,role:"tooltip",children:s||r})})]})})});MT.displayName=Sa;var AT="TooltipArrow",CI=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=vp(n);return SI(AT,n).isInside?null:g.jsx(mp,{...s,...r,ref:t})});CI.displayName=AT;function kI(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,r,s,l)){case l:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function EI(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 RI(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function TI(e,t){const{x:n,y:r}=e;let s=!1;for(let l=0,a=t.length-1;l<t.length;a=l++){const u=t[l],h=t[a],d=u.x,p=u.y,m=h.x,_=h.y;p>r!=_>r&&n<(m-d)*(r-p)/(_-p)+d&&(s=!s)}return s}function MI(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),NI(t)}function NI(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const l=t[t.length-1],a=t[t.length-2];if((l.x-a.x)*(s.y-a.y)>=(l.y-a.y)*(s.x-a.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const l=n[n.length-1],a=n[n.length-2];if((l.x-a.x)*(s.y-a.y)>=(l.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}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 AI=kT,DT=ET,OT=RT,LT=TT,Sb=MT;function DI({className:e,...t}){return g.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 OI({className:e,...t}){return g.jsx("span",{className:xe("inline-flex items-center gap-0.5",e),...t})}const LI="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",jI=AI,Nf=DT,Af=OT,Ru=b.forwardRef(({className:e,sideOffset:t=4,...n},r)=>g.jsx(LT,{children:g.jsx(Sb,{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})}));Ru.displayName=Sb.displayName;const tu=DT,nu=OT;function jT(e){return e.toUpperCase()}function zI(e){const t=e.split("+");return g.jsx(OI,{children:t.map((n,r)=>g.jsx(DI,{children:jT(n)},`${n}-${r}`))})}const ca=b.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...s},l)=>{const a=r===void 0?null:Array.isArray(r)?r[0]??null:r;return g.jsx(LT,{children:g.jsx(Sb,{ref:l,sideOffset:t,className:xe(LI,e),...s,children:a?zI(a):g.jsx("span",{children:typeof n=="string"?jT(n):n})})})});ca.displayName="HotkeyTooltipContent";const PI="0.13.1",BI={version:PI},Un="Kanna",TC="kanna",II=".kanna",HI=".kanna-dev",FI="KANNA_RUNTIME_PROFILE",wb=`kanna/${BI.version}`,UI="[kanna]",$I=`~/${Un}`;function _p(){var t;return(t=globalThis.process)==null?void 0:t.env}function WI(e=_p()){var t;return((t=e==null?void 0:e[FI])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function VI(e=_p()){return WI(e)==="dev"?HI:II}function qI(e=_p()){return`~/${VI(e)}`}function KI(e=_p()){return`${qI(e)}/keybindings.json`}function Mh(e){return e?`${TC} ${e}`:TC}const yp=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...s})=>g.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),...s,children:e});function b_(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const GI=[/^(?:\/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 YI(e){const t=e.trim();for(const n of GI){const r=t.match(n);if(!r)continue;const s=(r[2]??r[1]??"").trim();if(s)return s}return t}function zT(e){return e.split("/").pop()||e}function XI(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,s=60*r,l=24*s,a=7*l;return n<r?"now":n<s?`${Math.floor(n/r)}m`:n<l?`${Math.floor(n/s)}h`:n<a?`${Math.floor(n/l)}d`:`${Math.floor(n/a)}w`}const ZI=new Set(["starting","running"]);function QI({chat:e,activeChatId:t,nowMs:n,onSelectChat:r,onDeleteChat:s}){const l=XI(e.lastMessageAt,n);return g.jsxs("div",{"data-chat-id":Xw(e.chatId),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===Xw(e.chatId)?"bg-muted hover:bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>r(e.chatId),children:[ZI.has(e.status)?g.jsx(Ni,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?g.jsx("div",{className:"relative ",children:g.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[g.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),g.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,g.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?g.jsx(yp,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),g.jsxs("div",{className:"relative h-7 w-7 mr-[2px] shrink-0",children:[l?g.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:l}):null,g.jsx(nt,{variant:"ghost",size:"icon",className:xe("absolute inset-0 h-7 w-7 opacity-100 cursor-pointer rounded-sm hover:!bg-transparent !border-0",l?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),onClick:a=>{a.stopPropagation(),s(e.chatId)},title:"Delete chat",children:g.jsx(s6,{className:"size-3.5"})})]})]},e._id)}function JI(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return b.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const bp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function za(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Cb(e){return"nodeType"in e}function lr(e){var t,n;return e?za(e)?e:Cb(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function kb(e){const{Document:t}=lr(e);return e instanceof t}function qu(e){return za(e)?!1:e instanceof lr(e).HTMLElement}function PT(e){return e instanceof lr(e).SVGElement}function Pa(e){return e?za(e)?e.document:Cb(e)?kb(e)?e:qu(e)||PT(e)?e.ownerDocument:document:document:document}const Ai=bp?b.useLayoutEffect:b.useEffect;function Eb(e){const t=b.useRef(e);return Ai(()=>{t.current=e}),b.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function e8(){const e=b.useRef(null),t=b.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=b.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Tu(e,t){t===void 0&&(t=[e]);const n=b.useRef(e);return Ai(()=>{n.current!==e&&(n.current=e)},t),n}function Ku(e,t){const n=b.useRef();return b.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Df(e){const t=Eb(e),n=b.useRef(null),r=b.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function x_(e){const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}let _v={};function Gu(e,t){return b.useMemo(()=>{if(t)return t;const n=_v[e]==null?0:_v[e]+1;return _v[e]=n,e+"-"+n},[e,t])}function BT(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((l,a)=>{const u=Object.entries(a);for(const[h,d]of u){const p=l[h];p!=null&&(l[h]=p+e*d)}return l},{...t})}}const ga=BT(1),Of=BT(-1);function t8(e){return"clientX"in e&&"clientY"in e}function Rb(e){if(!e)return!1;const{KeyboardEvent:t}=lr(e.target);return t&&e instanceof t}function n8(e){if(!e)return!1;const{TouchEvent:t}=lr(e.target);return t&&e instanceof t}function S_(e){if(n8(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 t8(e)?{x:e.clientX,y:e.clientY}:null}const Mu=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[Mu.Translate.toString(e),Mu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),MC="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function r8(e){return e.matches(MC)?e:e.querySelector(MC)}const i8={display:"none"};function s8(e){let{id:t,value:n}=e;return Ct.createElement("div",{id:t,style:i8},n)}function o8(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={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 Ct.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function l8(){const[e,t]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const IT=b.createContext(null);function a8(e){const t=b.useContext(IT);b.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function c8(){const[e]=b.useState(()=>new Set),t=b.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[b.useCallback(r=>{let{type:s,event:l}=r;e.forEach(a=>{var u;return(u=a[s])==null?void 0:u.call(a,l)})},[e]),t]}const u8={draggable:`
|
|
435
435
|
To pick up a draggable item, press the space bar.
|
|
436
436
|
While dragging, use the arrow keys to move the item.
|
|
437
437
|
Press space again to drop the item in its new position, or press escape to cancel.
|
package/dist/client/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/png" href="/favicon.png" />
|
|
7
7
|
<title>Kanna</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-D-HpnCbj.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-DTEcy0lx.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|