@kimuson/claude-code-viewer 0.6.1-beta.2 → 0.6.1-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{d as t,f as n}from"./markdown-parser-vendor-D9j1a-bm.js";import{E as r,P as i,g as a,n as o,st as s,z as c}from"./AuthProvider-BKc7q7ka.js";import{$ as l,A as u,C as d,D as f,E as p,M as m,N as h,O as g,S as _,T as v,Y as y,_ as b,b as x,et as S,j as C,k as w,v as T,w as E,x as D,y as O}from"./dist-DiGJ7VFi.js";import{n as k}from"./dist-CG2L4mx5.js";import{t as A}from"./createLucideIcon-BL_meogc.js";import{f as j,s as M}from"./card-DGrqtTaC.js";var N=A(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),ee=A(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),te=A(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),ne=A(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),re=A(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),P=e(n(),1),F=t(),I=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`}),ie=`VisuallyHidden`,ae=P.forwardRef((e,t)=>(0,F.jsx)(u.span,{...e,ref:t,style:{...I,...e.style}}));ae.displayName=ie;var oe=ae;function se(e){let t=P.useRef({value:e,previous:e});return P.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ce(e){let[t,n]=P.useState(void 0);return f(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var le=`Checkbox`,[ue,de]=w(le),[fe,pe]=ue(le);function me(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,m]=p({prop:n,defaultProp:i??!1,onChange:c,caller:le}),[h,g]=P.useState(null),[_,v]=P.useState(null),y=P.useRef(!1),b=h?!!o||!!h.closest(`form`):!0,x={checked:f,disabled:a,setChecked:m,control:h,setControl:g,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:L(i)?!1:i,isFormControl:b,bubbleInput:_,setBubbleInput:v};return(0,F.jsx)(fe,{scope:t,...x,children:Se(d)?d(x):r})}var he=`CheckboxTrigger`,ge=P.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:p,isFormControl:m,bubbleInput:h}=pe(he,e),_=j(i,d),v=P.useRef(c);return P.useEffect(()=>{let e=a?.form;if(e){let t=()=>f(v.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,f]),(0,F.jsx)(u.button,{type:`button`,role:`checkbox`,"aria-checked":L(c)?`mixed`:c,"aria-required":l,"data-state":Ce(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:_,onKeyDown:g(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:g(n,e=>{f(e=>L(e)?!0:!e),h&&m&&(p.current=e.isPropagationStopped(),p.current||e.stopPropagation())})})});ge.displayName=he;var _e=P.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,F.jsx)(me,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(ge,{...d,ref:t,__scopeCheckbox:n}),e&&(0,F.jsx)(xe,{__scopeCheckbox:n})]})})});_e.displayName=le;var ve=`CheckboxIndicator`,ye=P.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=pe(ve,n);return(0,F.jsx)(v,{present:r||L(a.checked)||a.checked===!0,children:(0,F.jsx)(u.span,{"data-state":Ce(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});ye.displayName=ve;var be=`CheckboxBubbleInput`,xe=P.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:d,form:f,bubbleInput:p,setBubbleInput:m}=pe(be,e),h=j(n,m),g=se(a),_=ce(r);P.useEffect(()=>{let e=p;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(g!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=L(a),n.call(e,L(a)?!1:a),e.dispatchEvent(t)}},[p,g,a,i]);let v=P.useRef(L(a)?!1:a);return(0,F.jsx)(u.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:d,form:f,...t,tabIndex:-1,ref:h,style:{...t.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});xe.displayName=be;function Se(e){return typeof e==`function`}function L(e){return e===`indeterminate`}function Ce(e){return L(e)?`indeterminate`:e?`checked`:`unchecked`}var we=[`top`,`right`,`bottom`,`left`],R=Math.min,z=Math.max,Te=Math.round,Ee=Math.floor,B=e=>({x:e,y:e}),De={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Oe(e,t,n){return z(e,R(t,n))}function V(e,t){return typeof e==`function`?e(t):e}function H(e){return e.split(`-`)[0]}function U(e){return e.split(`-`)[1]}function ke(e){return e===`x`?`y`:`x`}function Ae(e){return e===`y`?`height`:`width`}function W(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function je(e){return ke(W(e))}function Me(e,t,n){n===void 0&&(n=!1);let r=U(e),i=je(e),a=Ae(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ve(o)),[o,Ve(o)]}function Ne(e){let t=Ve(e);return[Pe(e),t,Pe(t)]}function Pe(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Fe=[`left`,`right`],Ie=[`right`,`left`],Le=[`top`,`bottom`],Re=[`bottom`,`top`];function ze(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ie:Fe:t?Fe:Ie;case`left`:case`right`:return t?Le:Re;default:return[]}}function Be(e,t,n,r){let i=U(e),a=ze(H(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Pe)))),a}function Ve(e){let t=H(e);return De[t]+e.slice(t.length)}function He(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ue(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:He(e)}function We(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ge(e,t,n){let{reference:r,floating:i}=e,a=W(t),o=je(t),s=Ae(o),c=H(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(U(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Ke(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=V(t,e),p=Ue(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=We(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=We(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var qe=50,Je=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ke},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ge(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<qe&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Ge(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ye=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=V(e,t)||{};if(l==null)return{};let d=Ue(u),f={x:n,y:r},p=je(i),m=Ae(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=R(d[_],T),D=R(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Oe(O,A,k),M=!c.arrow&&U(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Xe=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=V(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=H(r),_=W(o),v=H(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ve(o)]:Ne(o)),x=p!==`none`;!d&&x&&b.push(...Be(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Me(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==W(t))||T.every(e=>W(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=W(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ze(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Qe(e){return we.some(t=>e[t]>=0)}var $e=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=V(e,t);switch(i){case`referenceHidden`:{let e=Ze(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Qe(e)}}}case`escaped`:{let e=Ze(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Qe(e)}}}default:return{}}}}},et=new Set([`left`,`top`]);async function tt(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=H(n),s=U(n),c=W(n)===`y`,l=et.has(o)?-1:1,u=a&&c?-1:1,d=V(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var nt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await tt(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},rt=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=V(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=W(H(i)),p=ke(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Oe(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Oe(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},it=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=V(e,t),u={x:n,y:r},d=W(i),f=ke(d),p=u[f],m=u[d],h=V(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=et.has(H(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},at=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=V(e,t),u=await o.detectOverflow(t,l),d=H(i),f=U(i),p=W(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=R(h-u[g],v),x=R(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=z(u.left,0),t=z(u.right,0),n=z(u.top,0),r=z(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:z(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:z(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function ot(){return typeof window<`u`}function st(e){return ct(e)?(e.nodeName||``).toLowerCase():`#document`}function G(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function K(e){return((ct(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ct(e){return ot()?e instanceof Node||e instanceof G(e).Node:!1}function q(e){return ot()?e instanceof Element||e instanceof G(e).Element:!1}function J(e){return ot()?e instanceof HTMLElement||e instanceof G(e).HTMLElement:!1}function lt(e){return!ot()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof G(e).ShadowRoot}function ut(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=X(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function dt(e){return/^(table|td|th)$/.test(st(e))}function ft(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var pt=/transform|translate|scale|rotate|perspective|filter/,mt=/paint|layout|strict|content/,Y=e=>!!e&&e!==`none`,ht;function gt(e){let t=q(e)?X(e):e;return Y(t.transform)||Y(t.translate)||Y(t.scale)||Y(t.rotate)||Y(t.perspective)||!vt()&&(Y(t.backdropFilter)||Y(t.filter))||pt.test(t.willChange||``)||mt.test(t.contain||``)}function _t(e){let t=Z(e);for(;J(t)&&!yt(t);){if(gt(t))return t;if(ft(t))return null;t=Z(t)}return null}function vt(){return ht??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ht}function yt(e){return/^(html|body|#document)$/.test(st(e))}function X(e){return G(e).getComputedStyle(e)}function bt(e){return q(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Z(e){if(st(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||lt(e)&&e.host||K(e);return lt(t)?t.host:t}function xt(e){let t=Z(e);return yt(t)?e.ownerDocument?e.ownerDocument.body:e.body:J(t)&&ut(t)?t:xt(t)}function St(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=xt(e),i=r===e.ownerDocument?.body,a=G(r);if(i){let e=Ct(a);return t.concat(a,a.visualViewport||[],ut(r)?r:[],e&&n?St(e):[])}else return t.concat(r,St(r,[],n))}function Ct(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wt(e){let t=X(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=J(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Te(n)!==a||Te(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Tt(e){return q(e)?e:e.contextElement}function Et(e){let t=Tt(e);if(!J(t))return B(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=wt(t),o=(a?Te(n.width):n.width)/r,s=(a?Te(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Dt=B(0);function Ot(e){let t=G(e);return!vt()||!t.visualViewport?Dt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function kt(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==G(e)?!1:t}function Q(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Tt(e),o=B(1);t&&(r?q(r)&&(o=Et(r)):o=Et(e));let s=kt(a,n,r)?Ot(a):B(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=G(a),t=r&&q(r)?G(r):r,n=e,i=Ct(n);for(;i&&r&&t!==n;){let e=Et(i),t=i.getBoundingClientRect(),r=X(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=G(i),i=Ct(n)}}return We({width:u,height:d,x:c,y:l})}function At(e,t){let n=bt(e).scrollLeft;return t?t.left+n:Q(K(e)).left+n}function jt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-At(e,n),y:n.top+t.scrollTop}}function Mt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=K(r),s=t?ft(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=B(1),u=B(0),d=J(r);if((d||!d&&!a)&&((st(r)!==`body`||ut(o))&&(c=bt(r)),d)){let e=Q(r);l=Et(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?jt(o,c):B(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Nt(e){return Array.from(e.getClientRects())}function Pt(e){let t=K(e),n=bt(e),r=e.ownerDocument.body,i=z(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=z(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+At(e),s=-n.scrollTop;return X(r).direction===`rtl`&&(o+=z(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Ft=25;function It(e,t){let n=G(e),r=K(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=vt();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=At(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Ft&&(a-=o)}else l<=Ft&&(a+=l);return{width:a,height:o,x:s,y:c}}function Lt(e,t){let n=Q(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=J(e)?Et(e):B(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Rt(e,t,n){let r;if(t===`viewport`)r=It(e,n);else if(t===`document`)r=Pt(K(e));else if(q(t))r=Lt(t,n);else{let n=Ot(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return We(r)}function zt(e,t){let n=Z(e);return n===t||!q(n)||yt(n)?!1:X(n).position===`fixed`||zt(n,t)}function Bt(e,t){let n=t.get(e);if(n)return n;let r=St(e,[],!1).filter(e=>q(e)&&st(e)!==`body`),i=null,a=X(e).position===`fixed`,o=a?Z(e):e;for(;q(o)&&!yt(o);){let t=X(o),n=gt(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||ut(o)&&!n&&zt(e,o))?r=r.filter(e=>e!==o):i=t,o=Z(o)}return t.set(e,r),r}function Vt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ft(t)?[]:Bt(t,this._c):[].concat(n),r],o=Rt(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Rt(t,a[e],i);s=z(n.top,s),c=R(n.right,c),l=R(n.bottom,l),u=z(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ht(e){let{width:t,height:n}=wt(e);return{width:t,height:n}}function Ut(e,t,n){let r=J(t),i=K(t),a=n===`fixed`,o=Q(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=B(0);function l(){c.x=At(i)}if(r||!r&&!a)if((st(t)!==`body`||ut(i))&&(s=bt(t)),r){let e=Q(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?jt(i,s):B(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Wt(e){return X(e).position===`static`}function Gt(e,t){if(!J(e)||X(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return K(e)===n&&(n=n.ownerDocument.body),n}function Kt(e,t){let n=G(e);if(ft(e))return n;if(!J(e)){let t=Z(e);for(;t&&!yt(t);){if(q(t)&&!Wt(t))return t;t=Z(t)}return n}let r=Gt(e,t);for(;r&&dt(r)&&Wt(r);)r=Gt(r,t);return r&&yt(r)&&Wt(r)&&!gt(r)?n:r||_t(e)||n}var qt=async function(e){let t=this.getOffsetParent||Kt,n=this.getDimensions,r=await n(e.floating);return{reference:Ut(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jt(e){return X(e).direction===`rtl`}var Yt={convertOffsetParentRelativeRectToViewportRelativeRect:Mt,getDocumentElement:K,getClippingRect:Vt,getOffsetParent:Kt,getElementRects:qt,getClientRects:Nt,getDimensions:Ht,getScale:Et,isElement:q,isRTL:Jt};function Xt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Zt(e,t){let n=null,r,i=K(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Ee(d),h=Ee(i.clientWidth-(u+f)),g=Ee(i.clientHeight-(d+p)),_=Ee(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:z(0,R(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Xt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Qt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Tt(e),u=i||a?[...l?St(l):[],...t?St(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Zt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Q(e):null;c&&g();function g(){let t=Q(e);h&&!Xt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var $t=nt,en=rt,tn=Xe,nn=at,rn=$e,an=Ye,on=it,sn=(e,t,n)=>{let r=new Map,i={platform:Yt,...n},a={...i.platform,_c:r};return Je(e,t,{...i,platform:a})},cn=e(S(),1),ln=typeof document<`u`?P.useLayoutEffect:function(){};function un(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!un(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!un(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function dn(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fn(e,t){let n=dn(e);return Math.round(t*n)/n}function pn(e){let t=P.useRef(e);return ln(()=>{t.current=e}),t}function mn(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=P.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=P.useState(r);un(f,r)||p(r);let[m,h]=P.useState(null),[g,_]=P.useState(null),v=P.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=P.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=P.useRef(null),C=P.useRef(null),w=P.useRef(u),T=c!=null,E=pn(c),D=pn(i),O=pn(l),k=P.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),sn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!un(w.current,t)&&(w.current=t,cn.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);ln(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=P.useRef(!1);ln(()=>(A.current=!0,()=>{A.current=!1}),[]),ln(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=P.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=P.useMemo(()=>({reference:b,floating:x}),[b,x]),N=P.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=fn(M.floating,u.x),r=fn(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...dn(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return P.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var hn=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:an({element:r.current,padding:i}).fn(n):r?an({element:r,padding:i}).fn(n):{}}}},gn=(e,t)=>{let n=$t(e);return{name:n.name,fn:n.fn,options:[e,t]}},_n=(e,t)=>{let n=en(e);return{name:n.name,fn:n.fn,options:[e,t]}},vn=(e,t)=>({fn:on(e).fn,options:[e,t]}),yn=(e,t)=>{let n=tn(e);return{name:n.name,fn:n.fn,options:[e,t]}},bn=(e,t)=>{let n=nn(e);return{name:n.name,fn:n.fn,options:[e,t]}},xn=(e,t)=>{let n=rn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sn=(e,t)=>{let n=hn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cn=`Arrow`,wn=P.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,F.jsx)(u.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,F.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});wn.displayName=Cn;var Tn=wn,En=`Popper`,[Dn,On]=w(En),[kn,An]=Dn(En),jn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=P.useState(null);return(0,F.jsx)(kn,{scope:t,anchor:r,onAnchorChange:i,children:n})};jn.displayName=En;var Mn=`PopperAnchor`,Nn=P.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=An(Mn,n),o=P.useRef(null),s=j(t,o),c=P.useRef(null);return P.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,F.jsx)(u.div,{...i,ref:s})});Nn.displayName=Mn;var Pn=`PopperContent`,[Fn,In]=Dn(Pn),Ln=P.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:p=0,sticky:m=`partial`,hideWhenDetached:h=!1,updatePositionStrategy:g=`optimized`,onPlaced:_,...v}=e,y=An(Pn,n),[b,x]=P.useState(null),S=j(t,e=>x(e)),[C,w]=P.useState(null),T=ce(C),E=T?.width??0,D=T?.height??0,O=r+(a===`center`?``:`-`+a),k=typeof p==`number`?p:{top:0,right:0,bottom:0,left:0,...p},A=Array.isArray(l)?l:[l],M=A.length>0,N={padding:k,boundary:A.filter(Vn),altBoundary:M},{refs:ee,floatingStyles:te,placement:ne,isPositioned:re,middlewareData:I}=mn({strategy:`fixed`,placement:O,whileElementsMounted:(...e)=>Qt(...e,{animationFrame:g===`always`}),elements:{reference:y.anchor},middleware:[gn({mainAxis:i+D,alignmentAxis:o}),c&&_n({mainAxis:!0,crossAxis:!1,limiter:m===`partial`?vn():void 0,...N}),c&&yn({...N}),bn({...N,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),C&&Sn({element:C,padding:s}),Hn({arrowWidth:E,arrowHeight:D}),h&&xn({strategy:`referenceHidden`,...N})]}),[ie,ae]=Un(ne),oe=d(_);f(()=>{re&&oe?.()},[re,oe]);let se=I.arrow?.x,le=I.arrow?.y,ue=I.arrow?.centerOffset!==0,[de,fe]=P.useState();return f(()=>{b&&fe(window.getComputedStyle(b).zIndex)},[b]),(0,F.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:re?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:de,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(` `),...I.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,F.jsx)(Fn,{scope:n,placedSide:ie,onArrowChange:w,arrowX:se,arrowY:le,shouldHideArrow:ue,children:(0,F.jsx)(u.div,{"data-side":ie,"data-align":ae,...v,ref:S,style:{...v.style,animation:re?void 0:`none`}})})})});Ln.displayName=Pn;var Rn=`PopperArrow`,zn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Bn=P.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=In(Rn,n),a=zn[i.placedSide];return(0,F.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,F.jsx)(Tn,{...r,ref:t,style:{...r.style,display:`block`}})})});Bn.displayName=Rn;function Vn(e){return e!==null}var Hn=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Un(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Un(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Wn=jn,Gn=Nn,Kn=Ln,qn=Bn,Jn=`Popover`,[Yn,Xn]=w(Jn,[On]),Zn=On(),[Qn,$]=Yn(Jn),$n=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Zn(t),c=P.useRef(null),[l,u]=P.useState(!1),[d,f]=p({prop:r,defaultProp:i??!1,onChange:a,caller:Jn});return(0,F.jsx)(Wn,{...s,children:(0,F.jsx)(Qn,{scope:t,contentId:E(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:P.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:P.useCallback(()=>u(!0),[]),onCustomAnchorRemove:P.useCallback(()=>u(!1),[]),modal:o,children:n})})};$n.displayName=Jn;var er=`PopoverAnchor`,tr=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$(er,n),a=Zn(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return P.useEffect(()=>(o(),()=>s()),[o,s]),(0,F.jsx)(Gn,{...a,...r,ref:t})});tr.displayName=er;var nr=`PopoverTrigger`,rr=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$(nr,n),a=Zn(n),o=j(t,i.triggerRef),s=(0,F.jsx)(u.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":vr(i.open),...r,ref:o,onClick:g(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,F.jsx)(Gn,{asChild:!0,...a,children:s})});rr.displayName=nr;var ir=`PopoverPortal`,[ar,or]=Yn(ir,{forceMount:void 0}),sr=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=$(ir,t);return(0,F.jsx)(ar,{scope:t,forceMount:n,children:(0,F.jsx)(v,{present:n||a.open,children:(0,F.jsx)(x,{asChild:!0,container:i,children:r})})})};sr.displayName=ir;var cr=`PopoverContent`,lr=P.forwardRef((e,t)=>{let n=or(cr,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=$(cr,e.__scopePopover);return(0,F.jsx)(v,{present:r||a.open,children:a.modal?(0,F.jsx)(dr,{...i,ref:t}):(0,F.jsx)(fr,{...i,ref:t})})});lr.displayName=cr;var ur=C(`PopoverContent.RemoveScroll`),dr=P.forwardRef((e,t)=>{let n=$(cr,e.__scopePopover),r=P.useRef(null),i=j(t,r),a=P.useRef(!1);return P.useEffect(()=>{let e=r.current;if(e)return b(e)},[]),(0,F.jsx)(T,{as:ur,allowPinchZoom:!0,children:(0,F.jsx)(pr,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:g(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:g(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:g(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),fr=P.forwardRef((e,t)=>{let n=$(cr,e.__scopePopover),r=P.useRef(!1),i=P.useRef(!1);return(0,F.jsx)(pr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),pr=P.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=$(cr,n),p=Zn(n);return O(),(0,F.jsx)(D,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,F.jsx)(_,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,F.jsx)(Kn,{"data-state":vr(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),mr=`PopoverClose`,hr=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$(mr,n);return(0,F.jsx)(u.button,{type:`button`,...r,ref:t,onClick:g(e.onClick,()=>i.onOpenChange(!1))})});hr.displayName=mr;var gr=`PopoverArrow`,_r=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Zn(n);return(0,F.jsx)(qn,{...i,...r,ref:t})});_r.displayName=gr;function vr(e){return e?`open`:`closed`}var yr=$n,br=rr,xr=sr,Sr=lr,[Cr,wr]=w(`Tooltip`,[On]),Tr=On(),Er=`TooltipProvider`,Dr=700,Or=`tooltip.open`,[kr,Ar]=Cr(Er),jr=e=>{let{__scopeTooltip:t,delayDuration:n=Dr,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=P.useRef(!0),s=P.useRef(!1),c=P.useRef(0);return P.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,F.jsx)(kr,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:P.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:P.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:P.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};jr.displayName=Er;var Mr=`Tooltip`,[Nr,Pr]=Cr(Mr),Fr=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Ar(Mr,e.__scopeTooltip),l=Tr(t),[u,d]=P.useState(null),f=E(),m=P.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=P.useRef(!1),[v,y]=p({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Or))):c.onClose(),a?.(e)},caller:Mr}),b=P.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),x=P.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,y(!0)},[y]),S=P.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),C=P.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,y(!0),m.current=0},g)},[g,y]);return P.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,F.jsx)(Wn,{...l,children:(0,F.jsx)(Nr,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:P.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:P.useCallback(()=>{h?S():(window.clearTimeout(m.current),m.current=0)},[S,h]),onOpen:x,onClose:S,disableHoverableContent:h,children:n})})};Fr.displayName=Mr;var Ir=`TooltipTrigger`,Lr=P.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Pr(Ir,n),a=Ar(Ir,n),o=Tr(n),s=j(t,P.useRef(null),i.onTriggerChange),c=P.useRef(!1),l=P.useRef(!1),d=P.useCallback(()=>c.current=!1,[]);return P.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,F.jsx)(Gn,{asChild:!0,...o,children:(0,F.jsx)(u.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:g(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:g(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:g(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:g(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:g(e.onBlur,i.onClose),onClick:g(e.onClick,i.onClose)})})});Lr.displayName=Ir;var Rr=`TooltipPortal`,[zr,Br]=Cr(Rr,{forceMount:void 0}),Vr=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Pr(Rr,t);return(0,F.jsx)(zr,{scope:t,forceMount:n,children:(0,F.jsx)(v,{present:n||a.open,children:(0,F.jsx)(x,{asChild:!0,container:i,children:r})})})};Vr.displayName=Rr;var Hr=`TooltipContent`,Ur=P.forwardRef((e,t)=>{let n=Br(Hr,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Pr(Hr,e.__scopeTooltip);return(0,F.jsx)(v,{present:r||o.open,children:o.disableHoverableContent?(0,F.jsx)(Jr,{side:i,...a,ref:t}):(0,F.jsx)(Wr,{side:i,...a,ref:t})})}),Wr=P.forwardRef((e,t)=>{let n=Pr(Hr,e.__scopeTooltip),r=Ar(Hr,e.__scopeTooltip),i=P.useRef(null),a=j(t,i),[o,s]=P.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=P.useCallback(()=>{s(null),d(!1)},[d]),p=P.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Qr(r,Zr(r,n.getBoundingClientRect())),a=$r(t.getBoundingClientRect());s(ti([...i,...a])),d(!0)},[d]);return P.useEffect(()=>()=>f(),[f]),P.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),P.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!ei(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,F.jsx)(Jr,{...e,ref:a})}),[Gr,Kr]=Cr(Mr,{isInside:!1}),qr=m(`TooltipContent`),Jr=P.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Pr(Hr,n),l=Tr(n),{onClose:u}=c;return P.useEffect(()=>(document.addEventListener(Or,u),()=>document.removeEventListener(Or,u)),[u]),P.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,F.jsx)(_,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,F.jsxs)(Kn,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,F.jsx)(qr,{children:r}),(0,F.jsx)(Gr,{scope:n,isInside:!0,children:(0,F.jsx)(oe,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Ur.displayName=Hr;var Yr=`TooltipArrow`,Xr=P.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Tr(n);return Kr(Yr,n).isInside?null:(0,F.jsx)(qn,{...i,...r,ref:t})});Xr.displayName=Yr;function Zr(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Qr(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function $r(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ei(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ti(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),ni(t)}function ni(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var ri=jr,ii=Fr,ai=Lr,oi=Vr,si=Ur,ci=Xr,li=({delayDuration:e=0,...t})=>(0,F.jsx)(ri,{"data-slot":`tooltip-provider`,delayDuration:e,...t}),ui=({...e})=>(0,F.jsx)(li,{children:(0,F.jsx)(ii,{"data-slot":`tooltip`,...e})}),di=({...e})=>(0,F.jsx)(ai,{"data-slot":`tooltip-trigger`,...e}),fi=({className:e,sideOffset:t=0,children:n,...r})=>(0,F.jsx)(oi,{children:(0,F.jsxs)(si,{"data-slot":`tooltip-content`,sideOffset:t,className:M(`bg-foreground text-background 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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance`,e),...r,children:[n,(0,F.jsx)(ci,{className:`bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]`})]})}),pi=({...e})=>(0,F.jsx)(yr,{"data-slot":`popover`,...e}),mi=({...e})=>(0,F.jsx)(br,{"data-slot":`popover-trigger`,...e}),hi=({className:e,align:t=`center`,sideOffset:n=4,...r})=>(0,F.jsx)(xr,{children:(0,F.jsx)(Sr,{"data-slot":`popover-content`,align:t,sideOffset:n,className:M(`bg-popover text-popover-foreground 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-[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 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden`,e),...r})}),gi=({sessionId:e})=>{let t=c(),{data:n}=y(a),o=(0,P.useMemo)(()=>n?.notifications??[],[n?.notifications]),s=i({mutationFn:async e=>{await r.api.notifications[`:sessionId`].consume.$post({param:{sessionId:e},json:{types:[`session_paused`,`session_completed`]}})},onSuccess:()=>{t.invalidateQueries({queryKey:a.queryKey})}}),u=(0,P.useRef)(null);(0,P.useEffect)(()=>{if(e===void 0||e===``){u.current=null;return}n!==void 0&&u.current!==e&&(u.current=e,o.some(t=>t.sessionId===e&&(t.type===`session_paused`||t.type===`session_completed`))&&s.mutate(e))},[e,n,o,s]);let d=o.length;return(0,F.jsx)(li,{children:(0,F.jsxs)(pi,{children:[(0,F.jsxs)(ui,{children:[(0,F.jsx)(di,{asChild:!0,children:(0,F.jsx)(mi,{asChild:!0,children:(0,F.jsxs)(`button`,{type:`button`,className:M(`relative w-11 h-11 md:w-7 md:h-7 flex items-center justify-center rounded transition-colors`,d>0?`text-primary`:`hover:bg-muted text-muted-foreground hover:text-foreground`),"aria-label":`Notifications`,children:[(0,F.jsx)(N,{className:`w-3.5 h-3.5`}),d>0&&(0,F.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 md:top-0 md:right-0 flex h-3.5 w-3.5 items-center justify-center rounded-full bg-primary text-[9px] font-bold text-primary-foreground`,children:d>9?`9+`:d})]})})}),(0,F.jsx)(fi,{side:`bottom`,className:`text-xs`,children:(0,F.jsx)(k,{id:`notification.title`})})]}),(0,F.jsxs)(hi,{align:`end`,className:`w-[calc(100vw-2rem)] sm:w-80 p-0 z-[53]`,sideOffset:8,collisionPadding:16,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2`,children:[(0,F.jsx)(`p`,{className:`text-sm font-medium`,children:(0,F.jsx)(k,{id:`notification.title`})}),d>0&&(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:d})]}),(0,F.jsx)(`div`,{className:`max-h-[300px] overflow-y-auto`,children:o.length===0?(0,F.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:[(0,F.jsx)(ee,{className:`w-5 h-5 mb-2`}),(0,F.jsx)(`p`,{className:`text-xs`,children:(0,F.jsx)(k,{id:`notification.empty`})})]}):(0,F.jsx)(`div`,{className:`p-1.5 space-y-0.5`,children:o.map(e=>(0,F.jsxs)(l,{to:`/projects/$projectId/session`,params:{projectId:e.projectId},search:{sessionId:e.sessionId},className:`flex items-start gap-2.5 rounded-md p-2 text-sm transition-colors hover:bg-muted/50`,onClick:()=>s.mutate(e.sessionId),children:[(0,F.jsx)(`div`,{className:`mt-0.5 h-2 w-2 rounded-full bg-primary flex-shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.type===`session_paused`?(0,F.jsx)(k,{id:`notification.session_paused`}):e.type===`session_completed`?(0,F.jsx)(k,{id:`notification.session_completed`}):e.type===`permission_requested`?(0,F.jsx)(k,{id:`notification.permission_requested`}):(0,F.jsx)(k,{id:`notification.question_asked`})}),(0,F.jsx)(`p`,{className:`text-[11px] text-muted-foreground font-mono truncate`,children:e.sessionId}),(0,F.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:h(new Date(e.createdAt),{target:`time`})})]})]},e.id))})})]})]})})},_i=({className:e,...t})=>(0,F.jsx)(_e,{"data-slot":`checkbox`,className:M(`peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,F.jsx)(ye,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current transition-none`,children:(0,F.jsx)(ee,{className:`size-3.5`})})}),vi=({children:e})=>{let{isAuthenticated:t}=o(),n=s();return(0,P.useEffect)(()=>{t||n({to:`/login`})},[t,n]),t?(0,F.jsx)(F.Fragment,{children:e}):null};export{I as _,hi as a,te as b,fi as c,Gn as d,qn as f,se as g,On as h,pi as i,li as l,Wn as m,_i as n,mi as o,Kn as p,gi as r,ui as s,vi as t,di as u,re as v,ee as x,ne as y};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{d as t,f as n}from"./markdown-parser-vendor-D9j1a-bm.js";import{E as r,P as i,g as a,n as o,st as s,z as c}from"./AuthProvider-BKc7q7ka.js";import{$ as l,A as u,C as d,D as f,E as p,M as m,N as h,O as g,S as _,T as v,Y as y,_ as b,b as x,et as S,j as C,k as w,v as T,w as E,x as D,y as O}from"./dist-DiGJ7VFi.js";import{n as k}from"./dist-CG2L4mx5.js";import{t as A}from"./createLucideIcon-BL_meogc.js";import{f as j,s as M}from"./card-DGrqtTaC.js";var N=A(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),ee=A(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),te=A(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),ne=A(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),re=A(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),P=e(n(),1),F=t(),I=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`}),ie=`VisuallyHidden`,ae=P.forwardRef((e,t)=>(0,F.jsx)(u.span,{...e,ref:t,style:{...I,...e.style}}));ae.displayName=ie;var oe=ae;function se(e){let t=P.useRef({value:e,previous:e});return P.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ce(e){let[t,n]=P.useState(void 0);return f(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var le=`Checkbox`,[ue,de]=w(le),[fe,pe]=ue(le);function me(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,m]=p({prop:n,defaultProp:i??!1,onChange:c,caller:le}),[h,g]=P.useState(null),[_,v]=P.useState(null),y=P.useRef(!1),b=h?!!o||!!h.closest(`form`):!0,x={checked:f,disabled:a,setChecked:m,control:h,setControl:g,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:L(i)?!1:i,isFormControl:b,bubbleInput:_,setBubbleInput:v};return(0,F.jsx)(fe,{scope:t,...x,children:Se(d)?d(x):r})}var he=`CheckboxTrigger`,ge=P.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:p,isFormControl:m,bubbleInput:h}=pe(he,e),_=j(i,d),v=P.useRef(c);return P.useEffect(()=>{let e=a?.form;if(e){let t=()=>f(v.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,f]),(0,F.jsx)(u.button,{type:`button`,role:`checkbox`,"aria-checked":L(c)?`mixed`:c,"aria-required":l,"data-state":Ce(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:_,onKeyDown:g(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:g(n,e=>{f(e=>L(e)?!0:!e),h&&m&&(p.current=e.isPropagationStopped(),p.current||e.stopPropagation())})})});ge.displayName=he;var _e=P.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,F.jsx)(me,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(ge,{...d,ref:t,__scopeCheckbox:n}),e&&(0,F.jsx)(xe,{__scopeCheckbox:n})]})})});_e.displayName=le;var ve=`CheckboxIndicator`,ye=P.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=pe(ve,n);return(0,F.jsx)(v,{present:r||L(a.checked)||a.checked===!0,children:(0,F.jsx)(u.span,{"data-state":Ce(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});ye.displayName=ve;var be=`CheckboxBubbleInput`,xe=P.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:d,form:f,bubbleInput:p,setBubbleInput:m}=pe(be,e),h=j(n,m),g=se(a),_=ce(r);P.useEffect(()=>{let e=p;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(g!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=L(a),n.call(e,L(a)?!1:a),e.dispatchEvent(t)}},[p,g,a,i]);let v=P.useRef(L(a)?!1:a);return(0,F.jsx)(u.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:d,form:f,...t,tabIndex:-1,ref:h,style:{...t.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});xe.displayName=be;function Se(e){return typeof e==`function`}function L(e){return e===`indeterminate`}function Ce(e){return L(e)?`indeterminate`:e?`checked`:`unchecked`}var we=[`top`,`right`,`bottom`,`left`],R=Math.min,z=Math.max,Te=Math.round,Ee=Math.floor,B=e=>({x:e,y:e}),De={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Oe(e,t,n){return z(e,R(t,n))}function V(e,t){return typeof e==`function`?e(t):e}function H(e){return e.split(`-`)[0]}function U(e){return e.split(`-`)[1]}function ke(e){return e===`x`?`y`:`x`}function Ae(e){return e===`y`?`height`:`width`}function W(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function je(e){return ke(W(e))}function Me(e,t,n){n===void 0&&(n=!1);let r=U(e),i=je(e),a=Ae(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ve(o)),[o,Ve(o)]}function Ne(e){let t=Ve(e);return[Pe(e),t,Pe(t)]}function Pe(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Fe=[`left`,`right`],Ie=[`right`,`left`],Le=[`top`,`bottom`],Re=[`bottom`,`top`];function ze(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ie:Fe:t?Fe:Ie;case`left`:case`right`:return t?Le:Re;default:return[]}}function Be(e,t,n,r){let i=U(e),a=ze(H(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Pe)))),a}function Ve(e){let t=H(e);return De[t]+e.slice(t.length)}function He(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ue(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:He(e)}function We(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ge(e,t,n){let{reference:r,floating:i}=e,a=W(t),o=je(t),s=Ae(o),c=H(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(U(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Ke(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=V(t,e),p=Ue(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=We(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=We(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var qe=50,Je=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ke},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ge(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<qe&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Ge(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ye=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=V(e,t)||{};if(l==null)return{};let d=Ue(u),f={x:n,y:r},p=je(i),m=Ae(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=R(d[_],T),D=R(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Oe(O,A,k),M=!c.arrow&&U(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Xe=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=V(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=H(r),_=W(o),v=H(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ve(o)]:Ne(o)),x=p!==`none`;!d&&x&&b.push(...Be(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Me(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==W(t))||T.every(e=>W(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=W(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ze(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Qe(e){return we.some(t=>e[t]>=0)}var $e=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=V(e,t);switch(i){case`referenceHidden`:{let e=Ze(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Qe(e)}}}case`escaped`:{let e=Ze(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Qe(e)}}}default:return{}}}}},et=new Set([`left`,`top`]);async function tt(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=H(n),s=U(n),c=W(n)===`y`,l=et.has(o)?-1:1,u=a&&c?-1:1,d=V(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var nt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await tt(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},rt=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=V(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=W(H(i)),p=ke(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Oe(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Oe(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},it=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=V(e,t),u={x:n,y:r},d=W(i),f=ke(d),p=u[f],m=u[d],h=V(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=et.has(H(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},at=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=V(e,t),u=await o.detectOverflow(t,l),d=H(i),f=U(i),p=W(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=R(h-u[g],v),x=R(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=z(u.left,0),t=z(u.right,0),n=z(u.top,0),r=z(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:z(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:z(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function ot(){return typeof window<`u`}function st(e){return ct(e)?(e.nodeName||``).toLowerCase():`#document`}function G(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function K(e){return((ct(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ct(e){return ot()?e instanceof Node||e instanceof G(e).Node:!1}function q(e){return ot()?e instanceof Element||e instanceof G(e).Element:!1}function J(e){return ot()?e instanceof HTMLElement||e instanceof G(e).HTMLElement:!1}function lt(e){return!ot()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof G(e).ShadowRoot}function ut(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=X(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function dt(e){return/^(table|td|th)$/.test(st(e))}function ft(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var pt=/transform|translate|scale|rotate|perspective|filter/,mt=/paint|layout|strict|content/,Y=e=>!!e&&e!==`none`,ht;function gt(e){let t=q(e)?X(e):e;return Y(t.transform)||Y(t.translate)||Y(t.scale)||Y(t.rotate)||Y(t.perspective)||!vt()&&(Y(t.backdropFilter)||Y(t.filter))||pt.test(t.willChange||``)||mt.test(t.contain||``)}function _t(e){let t=Z(e);for(;J(t)&&!yt(t);){if(gt(t))return t;if(ft(t))return null;t=Z(t)}return null}function vt(){return ht??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ht}function yt(e){return/^(html|body|#document)$/.test(st(e))}function X(e){return G(e).getComputedStyle(e)}function bt(e){return q(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Z(e){if(st(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||lt(e)&&e.host||K(e);return lt(t)?t.host:t}function xt(e){let t=Z(e);return yt(t)?e.ownerDocument?e.ownerDocument.body:e.body:J(t)&&ut(t)?t:xt(t)}function St(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=xt(e),i=r===e.ownerDocument?.body,a=G(r);if(i){let e=Ct(a);return t.concat(a,a.visualViewport||[],ut(r)?r:[],e&&n?St(e):[])}else return t.concat(r,St(r,[],n))}function Ct(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wt(e){let t=X(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=J(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Te(n)!==a||Te(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Tt(e){return q(e)?e:e.contextElement}function Et(e){let t=Tt(e);if(!J(t))return B(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=wt(t),o=(a?Te(n.width):n.width)/r,s=(a?Te(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Dt=B(0);function Ot(e){let t=G(e);return!vt()||!t.visualViewport?Dt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function kt(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==G(e)?!1:t}function Q(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Tt(e),o=B(1);t&&(r?q(r)&&(o=Et(r)):o=Et(e));let s=kt(a,n,r)?Ot(a):B(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=G(a),t=r&&q(r)?G(r):r,n=e,i=Ct(n);for(;i&&r&&t!==n;){let e=Et(i),t=i.getBoundingClientRect(),r=X(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=G(i),i=Ct(n)}}return We({width:u,height:d,x:c,y:l})}function At(e,t){let n=bt(e).scrollLeft;return t?t.left+n:Q(K(e)).left+n}function jt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-At(e,n),y:n.top+t.scrollTop}}function Mt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=K(r),s=t?ft(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=B(1),u=B(0),d=J(r);if((d||!d&&!a)&&((st(r)!==`body`||ut(o))&&(c=bt(r)),d)){let e=Q(r);l=Et(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?jt(o,c):B(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Nt(e){return Array.from(e.getClientRects())}function Pt(e){let t=K(e),n=bt(e),r=e.ownerDocument.body,i=z(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=z(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+At(e),s=-n.scrollTop;return X(r).direction===`rtl`&&(o+=z(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Ft=25;function It(e,t){let n=G(e),r=K(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=vt();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=At(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Ft&&(a-=o)}else l<=Ft&&(a+=l);return{width:a,height:o,x:s,y:c}}function Lt(e,t){let n=Q(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=J(e)?Et(e):B(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Rt(e,t,n){let r;if(t===`viewport`)r=It(e,n);else if(t===`document`)r=Pt(K(e));else if(q(t))r=Lt(t,n);else{let n=Ot(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return We(r)}function zt(e,t){let n=Z(e);return n===t||!q(n)||yt(n)?!1:X(n).position===`fixed`||zt(n,t)}function Bt(e,t){let n=t.get(e);if(n)return n;let r=St(e,[],!1).filter(e=>q(e)&&st(e)!==`body`),i=null,a=X(e).position===`fixed`,o=a?Z(e):e;for(;q(o)&&!yt(o);){let t=X(o),n=gt(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||ut(o)&&!n&&zt(e,o))?r=r.filter(e=>e!==o):i=t,o=Z(o)}return t.set(e,r),r}function Vt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ft(t)?[]:Bt(t,this._c):[].concat(n),r],o=Rt(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Rt(t,a[e],i);s=z(n.top,s),c=R(n.right,c),l=R(n.bottom,l),u=z(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ht(e){let{width:t,height:n}=wt(e);return{width:t,height:n}}function Ut(e,t,n){let r=J(t),i=K(t),a=n===`fixed`,o=Q(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=B(0);function l(){c.x=At(i)}if(r||!r&&!a)if((st(t)!==`body`||ut(i))&&(s=bt(t)),r){let e=Q(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?jt(i,s):B(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Wt(e){return X(e).position===`static`}function Gt(e,t){if(!J(e)||X(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return K(e)===n&&(n=n.ownerDocument.body),n}function Kt(e,t){let n=G(e);if(ft(e))return n;if(!J(e)){let t=Z(e);for(;t&&!yt(t);){if(q(t)&&!Wt(t))return t;t=Z(t)}return n}let r=Gt(e,t);for(;r&&dt(r)&&Wt(r);)r=Gt(r,t);return r&&yt(r)&&Wt(r)&&!gt(r)?n:r||_t(e)||n}var qt=async function(e){let t=this.getOffsetParent||Kt,n=this.getDimensions,r=await n(e.floating);return{reference:Ut(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jt(e){return X(e).direction===`rtl`}var Yt={convertOffsetParentRelativeRectToViewportRelativeRect:Mt,getDocumentElement:K,getClippingRect:Vt,getOffsetParent:Kt,getElementRects:qt,getClientRects:Nt,getDimensions:Ht,getScale:Et,isElement:q,isRTL:Jt};function Xt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Zt(e,t){let n=null,r,i=K(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Ee(d),h=Ee(i.clientWidth-(u+f)),g=Ee(i.clientHeight-(d+p)),_=Ee(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:z(0,R(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Xt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Qt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Tt(e),u=i||a?[...l?St(l):[],...t?St(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Zt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Q(e):null;c&&g();function g(){let t=Q(e);h&&!Xt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var $t=nt,en=rt,tn=Xe,nn=at,rn=$e,an=Ye,on=it,sn=(e,t,n)=>{let r=new Map,i={platform:Yt,...n},a={...i.platform,_c:r};return Je(e,t,{...i,platform:a})},cn=e(S(),1),ln=typeof document<`u`?P.useLayoutEffect:function(){};function un(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!un(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!un(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function dn(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fn(e,t){let n=dn(e);return Math.round(t*n)/n}function pn(e){let t=P.useRef(e);return ln(()=>{t.current=e}),t}function mn(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=P.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=P.useState(r);un(f,r)||p(r);let[m,h]=P.useState(null),[g,_]=P.useState(null),v=P.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=P.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=P.useRef(null),C=P.useRef(null),w=P.useRef(u),T=c!=null,E=pn(c),D=pn(i),O=pn(l),k=P.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),sn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!un(w.current,t)&&(w.current=t,cn.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);ln(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=P.useRef(!1);ln(()=>(A.current=!0,()=>{A.current=!1}),[]),ln(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=P.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=P.useMemo(()=>({reference:b,floating:x}),[b,x]),N=P.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=fn(M.floating,u.x),r=fn(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...dn(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return P.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var hn=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:an({element:r.current,padding:i}).fn(n):r?an({element:r,padding:i}).fn(n):{}}}},gn=(e,t)=>{let n=$t(e);return{name:n.name,fn:n.fn,options:[e,t]}},_n=(e,t)=>{let n=en(e);return{name:n.name,fn:n.fn,options:[e,t]}},vn=(e,t)=>({fn:on(e).fn,options:[e,t]}),yn=(e,t)=>{let n=tn(e);return{name:n.name,fn:n.fn,options:[e,t]}},bn=(e,t)=>{let n=nn(e);return{name:n.name,fn:n.fn,options:[e,t]}},xn=(e,t)=>{let n=rn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sn=(e,t)=>{let n=hn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cn=`Arrow`,wn=P.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,F.jsx)(u.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,F.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});wn.displayName=Cn;var Tn=wn,En=`Popper`,[Dn,On]=w(En),[kn,An]=Dn(En),jn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=P.useState(null);return(0,F.jsx)(kn,{scope:t,anchor:r,onAnchorChange:i,children:n})};jn.displayName=En;var Mn=`PopperAnchor`,Nn=P.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=An(Mn,n),o=P.useRef(null),s=j(t,o),c=P.useRef(null);return P.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,F.jsx)(u.div,{...i,ref:s})});Nn.displayName=Mn;var Pn=`PopperContent`,[Fn,In]=Dn(Pn),Ln=P.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:p=0,sticky:m=`partial`,hideWhenDetached:h=!1,updatePositionStrategy:g=`optimized`,onPlaced:_,...v}=e,y=An(Pn,n),[b,x]=P.useState(null),S=j(t,e=>x(e)),[C,w]=P.useState(null),T=ce(C),E=T?.width??0,D=T?.height??0,O=r+(a===`center`?``:`-`+a),k=typeof p==`number`?p:{top:0,right:0,bottom:0,left:0,...p},A=Array.isArray(l)?l:[l],M=A.length>0,N={padding:k,boundary:A.filter(Vn),altBoundary:M},{refs:ee,floatingStyles:te,placement:ne,isPositioned:re,middlewareData:I}=mn({strategy:`fixed`,placement:O,whileElementsMounted:(...e)=>Qt(...e,{animationFrame:g===`always`}),elements:{reference:y.anchor},middleware:[gn({mainAxis:i+D,alignmentAxis:o}),c&&_n({mainAxis:!0,crossAxis:!1,limiter:m===`partial`?vn():void 0,...N}),c&&yn({...N}),bn({...N,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),C&&Sn({element:C,padding:s}),Hn({arrowWidth:E,arrowHeight:D}),h&&xn({strategy:`referenceHidden`,...N})]}),[ie,ae]=Un(ne),oe=d(_);f(()=>{re&&oe?.()},[re,oe]);let se=I.arrow?.x,le=I.arrow?.y,ue=I.arrow?.centerOffset!==0,[de,fe]=P.useState();return f(()=>{b&&fe(window.getComputedStyle(b).zIndex)},[b]),(0,F.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:re?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:de,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(` `),...I.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,F.jsx)(Fn,{scope:n,placedSide:ie,onArrowChange:w,arrowX:se,arrowY:le,shouldHideArrow:ue,children:(0,F.jsx)(u.div,{"data-side":ie,"data-align":ae,...v,ref:S,style:{...v.style,animation:re?void 0:`none`}})})})});Ln.displayName=Pn;var Rn=`PopperArrow`,zn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Bn=P.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=In(Rn,n),a=zn[i.placedSide];return(0,F.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,F.jsx)(Tn,{...r,ref:t,style:{...r.style,display:`block`}})})});Bn.displayName=Rn;function Vn(e){return e!==null}var Hn=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Un(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Un(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Wn=jn,Gn=Nn,Kn=Ln,qn=Bn,Jn=`Popover`,[Yn,Xn]=w(Jn,[On]),Zn=On(),[Qn,$]=Yn(Jn),$n=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Zn(t),c=P.useRef(null),[l,u]=P.useState(!1),[d,f]=p({prop:r,defaultProp:i??!1,onChange:a,caller:Jn});return(0,F.jsx)(Wn,{...s,children:(0,F.jsx)(Qn,{scope:t,contentId:E(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:P.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:P.useCallback(()=>u(!0),[]),onCustomAnchorRemove:P.useCallback(()=>u(!1),[]),modal:o,children:n})})};$n.displayName=Jn;var er=`PopoverAnchor`,tr=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$(er,n),a=Zn(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return P.useEffect(()=>(o(),()=>s()),[o,s]),(0,F.jsx)(Gn,{...a,...r,ref:t})});tr.displayName=er;var nr=`PopoverTrigger`,rr=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$(nr,n),a=Zn(n),o=j(t,i.triggerRef),s=(0,F.jsx)(u.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":vr(i.open),...r,ref:o,onClick:g(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,F.jsx)(Gn,{asChild:!0,...a,children:s})});rr.displayName=nr;var ir=`PopoverPortal`,[ar,or]=Yn(ir,{forceMount:void 0}),sr=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=$(ir,t);return(0,F.jsx)(ar,{scope:t,forceMount:n,children:(0,F.jsx)(v,{present:n||a.open,children:(0,F.jsx)(x,{asChild:!0,container:i,children:r})})})};sr.displayName=ir;var cr=`PopoverContent`,lr=P.forwardRef((e,t)=>{let n=or(cr,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=$(cr,e.__scopePopover);return(0,F.jsx)(v,{present:r||a.open,children:a.modal?(0,F.jsx)(dr,{...i,ref:t}):(0,F.jsx)(fr,{...i,ref:t})})});lr.displayName=cr;var ur=C(`PopoverContent.RemoveScroll`),dr=P.forwardRef((e,t)=>{let n=$(cr,e.__scopePopover),r=P.useRef(null),i=j(t,r),a=P.useRef(!1);return P.useEffect(()=>{let e=r.current;if(e)return b(e)},[]),(0,F.jsx)(T,{as:ur,allowPinchZoom:!0,children:(0,F.jsx)(pr,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:g(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:g(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:g(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),fr=P.forwardRef((e,t)=>{let n=$(cr,e.__scopePopover),r=P.useRef(!1),i=P.useRef(!1);return(0,F.jsx)(pr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),pr=P.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=$(cr,n),p=Zn(n);return O(),(0,F.jsx)(D,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,F.jsx)(_,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,F.jsx)(Kn,{"data-state":vr(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),mr=`PopoverClose`,hr=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=$(mr,n);return(0,F.jsx)(u.button,{type:`button`,...r,ref:t,onClick:g(e.onClick,()=>i.onOpenChange(!1))})});hr.displayName=mr;var gr=`PopoverArrow`,_r=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Zn(n);return(0,F.jsx)(qn,{...i,...r,ref:t})});_r.displayName=gr;function vr(e){return e?`open`:`closed`}var yr=$n,br=rr,xr=sr,Sr=lr,[Cr,wr]=w(`Tooltip`,[On]),Tr=On(),Er=`TooltipProvider`,Dr=700,Or=`tooltip.open`,[kr,Ar]=Cr(Er),jr=e=>{let{__scopeTooltip:t,delayDuration:n=Dr,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=P.useRef(!0),s=P.useRef(!1),c=P.useRef(0);return P.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,F.jsx)(kr,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:P.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:P.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:P.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};jr.displayName=Er;var Mr=`Tooltip`,[Nr,Pr]=Cr(Mr),Fr=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Ar(Mr,e.__scopeTooltip),l=Tr(t),[u,d]=P.useState(null),f=E(),m=P.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=P.useRef(!1),[v,y]=p({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Or))):c.onClose(),a?.(e)},caller:Mr}),b=P.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),x=P.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,y(!0)},[y]),S=P.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),C=P.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,y(!0),m.current=0},g)},[g,y]);return P.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,F.jsx)(Wn,{...l,children:(0,F.jsx)(Nr,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:P.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:P.useCallback(()=>{h?S():(window.clearTimeout(m.current),m.current=0)},[S,h]),onOpen:x,onClose:S,disableHoverableContent:h,children:n})})};Fr.displayName=Mr;var Ir=`TooltipTrigger`,Lr=P.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Pr(Ir,n),a=Ar(Ir,n),o=Tr(n),s=j(t,P.useRef(null),i.onTriggerChange),c=P.useRef(!1),l=P.useRef(!1),d=P.useCallback(()=>c.current=!1,[]);return P.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,F.jsx)(Gn,{asChild:!0,...o,children:(0,F.jsx)(u.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:g(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:g(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:g(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:g(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:g(e.onBlur,i.onClose),onClick:g(e.onClick,i.onClose)})})});Lr.displayName=Ir;var Rr=`TooltipPortal`,[zr,Br]=Cr(Rr,{forceMount:void 0}),Vr=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Pr(Rr,t);return(0,F.jsx)(zr,{scope:t,forceMount:n,children:(0,F.jsx)(v,{present:n||a.open,children:(0,F.jsx)(x,{asChild:!0,container:i,children:r})})})};Vr.displayName=Rr;var Hr=`TooltipContent`,Ur=P.forwardRef((e,t)=>{let n=Br(Hr,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Pr(Hr,e.__scopeTooltip);return(0,F.jsx)(v,{present:r||o.open,children:o.disableHoverableContent?(0,F.jsx)(Jr,{side:i,...a,ref:t}):(0,F.jsx)(Wr,{side:i,...a,ref:t})})}),Wr=P.forwardRef((e,t)=>{let n=Pr(Hr,e.__scopeTooltip),r=Ar(Hr,e.__scopeTooltip),i=P.useRef(null),a=j(t,i),[o,s]=P.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=P.useCallback(()=>{s(null),d(!1)},[d]),p=P.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Qr(r,Zr(r,n.getBoundingClientRect())),a=$r(t.getBoundingClientRect());s(ti([...i,...a])),d(!0)},[d]);return P.useEffect(()=>()=>f(),[f]),P.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),P.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!ei(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,F.jsx)(Jr,{...e,ref:a})}),[Gr,Kr]=Cr(Mr,{isInside:!1}),qr=m(`TooltipContent`),Jr=P.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Pr(Hr,n),l=Tr(n),{onClose:u}=c;return P.useEffect(()=>(document.addEventListener(Or,u),()=>document.removeEventListener(Or,u)),[u]),P.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,F.jsx)(_,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,F.jsxs)(Kn,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,F.jsx)(qr,{children:r}),(0,F.jsx)(Gr,{scope:n,isInside:!0,children:(0,F.jsx)(oe,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Ur.displayName=Hr;var Yr=`TooltipArrow`,Xr=P.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Tr(n);return Kr(Yr,n).isInside?null:(0,F.jsx)(qn,{...i,...r,ref:t})});Xr.displayName=Yr;function Zr(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Qr(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function $r(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ei(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ti(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),ni(t)}function ni(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var ri=jr,ii=Fr,ai=Lr,oi=Vr,si=Ur,ci=Xr,li=({delayDuration:e=0,...t})=>(0,F.jsx)(ri,{"data-slot":`tooltip-provider`,delayDuration:e,...t}),ui=({...e})=>(0,F.jsx)(li,{children:(0,F.jsx)(ii,{"data-slot":`tooltip`,...e})}),di=({...e})=>(0,F.jsx)(ai,{"data-slot":`tooltip-trigger`,...e}),fi=({className:e,sideOffset:t=0,children:n,...r})=>(0,F.jsx)(oi,{children:(0,F.jsxs)(si,{"data-slot":`tooltip-content`,sideOffset:t,className:M(`bg-foreground text-background 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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance`,e),...r,children:[n,(0,F.jsx)(ci,{className:`bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]`})]})}),pi=({...e})=>(0,F.jsx)(yr,{"data-slot":`popover`,...e}),mi=({...e})=>(0,F.jsx)(br,{"data-slot":`popover-trigger`,...e}),hi=({className:e,align:t=`center`,sideOffset:n=4,...r})=>(0,F.jsx)(xr,{children:(0,F.jsx)(Sr,{"data-slot":`popover-content`,align:t,sideOffset:n,className:M(`bg-popover text-popover-foreground 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-[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 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden`,e),...r})}),gi=({sessionId:e})=>{let t=c(),{data:n}=y(a),o=(0,P.useMemo)(()=>n?.notifications??[],[n?.notifications]),s=i({mutationFn:async e=>{await r.api.notifications[`:sessionId`].consume.$post({param:{sessionId:e},json:{types:[`session_paused`,`session_completed`]}})},onSuccess:()=>{t.invalidateQueries({queryKey:a.queryKey})}}),u=(0,P.useRef)(null);(0,P.useEffect)(()=>{if(e===void 0||e===``){u.current=null;return}n!==void 0&&u.current!==e&&(u.current=e,o.some(t=>t.sessionId===e&&(t.type===`session_paused`||t.type===`session_completed`))&&s.mutate(e))},[e,n,o,s]);let d=o.length;return(0,F.jsx)(li,{children:(0,F.jsxs)(pi,{children:[(0,F.jsxs)(ui,{children:[(0,F.jsx)(di,{asChild:!0,children:(0,F.jsx)(mi,{asChild:!0,children:(0,F.jsxs)(`button`,{type:`button`,className:M(`relative w-11 h-11 md:w-7 md:h-7 flex items-center justify-center rounded transition-colors`,d>0?`text-primary`:`hover:bg-muted text-muted-foreground hover:text-foreground`),"aria-label":`Notifications`,children:[(0,F.jsx)(N,{className:`w-3.5 h-3.5`}),d>0&&(0,F.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 md:top-0 md:right-0 flex h-3.5 w-3.5 items-center justify-center rounded-full bg-primary text-[9px] font-bold text-primary-foreground`,children:d>9?`9+`:d})]})})}),(0,F.jsx)(fi,{side:`bottom`,className:`text-xs`,children:(0,F.jsx)(k,{id:`notification.title`})})]}),(0,F.jsxs)(hi,{align:`end`,className:`w-[calc(100vw-2rem)] sm:w-80 p-0 z-[53]`,sideOffset:8,collisionPadding:16,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2`,children:[(0,F.jsx)(`p`,{className:`text-sm font-medium`,children:(0,F.jsx)(k,{id:`notification.title`})}),d>0&&(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:d})]}),(0,F.jsx)(`div`,{className:`max-h-[300px] overflow-y-auto`,children:o.length===0?(0,F.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:[(0,F.jsx)(ee,{className:`w-5 h-5 mb-2`}),(0,F.jsx)(`p`,{className:`text-xs`,children:(0,F.jsx)(k,{id:`notification.empty`})})]}):(0,F.jsx)(`div`,{className:`p-1.5 space-y-0.5`,children:o.map(e=>(0,F.jsxs)(l,{to:`/projects/$projectId/session`,params:{projectId:e.projectId},search:{sessionId:e.sessionId},className:`flex items-start gap-2.5 rounded-md p-2 text-sm transition-colors hover:bg-muted/50`,onClick:()=>s.mutate(e.sessionId),children:[(0,F.jsx)(`div`,{className:`mt-0.5 h-2 w-2 rounded-full bg-primary flex-shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.type===`session_paused`?(0,F.jsx)(k,{id:`notification.session_paused`}):e.type===`session_completed`?(0,F.jsx)(k,{id:`notification.session_completed`}):e.type===`permission_requested`?(0,F.jsx)(k,{id:`notification.permission_requested`}):(0,F.jsx)(k,{id:`notification.question_asked`})}),(0,F.jsx)(`p`,{className:`text-[11px] text-muted-foreground font-mono truncate`,children:e.sessionId}),(0,F.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:h(new Date(e.createdAt),{target:`time`})})]})]},e.id))})})]})]})})},_i=({className:e,...t})=>(0,F.jsx)(_e,{"data-slot":`checkbox`,className:M(`peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,F.jsx)(ye,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current transition-none`,children:(0,F.jsx)(ee,{className:`size-3.5`})})}),vi=({children:e})=>{let{isAuthenticated:t}=o(),n=s();return(0,P.useEffect)(()=>{t||n({to:`/login`})},[t,n]),t?(0,F.jsx)(F.Fragment,{children:e}):null};export{N as S,I as _,hi as a,te as b,fi as c,Gn as d,qn as f,se as g,On as h,pi as i,li as l,Wn as m,_i as n,mi as o,Kn as p,gi as r,ui as s,vi as t,di as u,re as v,ee as x,ne as y};