kanna-code 0.41.6 → 0.41.7

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.
@@ -657,7 +657,7 @@ Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}
657
657
 
658
658
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
659
659
 
660
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},IG="DialogDescriptionWarning",PG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$O(IG).contentName}}.`;return _.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},OG=AO,jG=LO,UO=DO,VO=IO,zG=OO,BG=zO,FG=FO;function WO(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=WO(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function GO(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=WO(e))&&(r&&(r+=" "),r+=t);return r}const HG=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},$G=(e,t)=>({classGroupId:e,validator:t}),qO=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),_v="-",tN=[],UG="arbitrary..",VG=e=>{const t=GG(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return WG(o);const l=o.split(_v),c=l[0]===""&&l.length>1?1:0;return KO(l,c,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const c=r[o],d=n[o];return c?d?HG(d,c):c:d||tN}return n[o]||tN}}},KO=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],s=n.nextPart.get(i);if(s){const d=KO(e,t+1,s);if(d)return d}const o=n.validators;if(o===null)return;const l=t===0?e.join(_v):e.slice(t).join(_v),c=o.length;for(let d=0;d<c;d++){const f=o[d];if(f.validator(l))return f.classGroupId}},WG=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?UG+r:void 0})(),GG=e=>{const{theme:t,classGroups:n}=e;return qG(n,t)},qG=(e,t)=>{const n=qO();for(const r in e){const i=e[r];vC(i,n,r,t)}return n},vC=(e,t,n,r)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];KG(o,t,n,r)}},KG=(e,t,n,r)=>{if(typeof e=="string"){YG(e,t,n);return}if(typeof e=="function"){XG(e,t,n,r);return}QG(e,t,n,r)},YG=(e,t,n)=>{const r=e===""?t:YO(t,e);r.classGroupId=n},XG=(e,t,n,r)=>{if(ZG(e)){vC(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push($G(n,e))},QG=(e,t,n,r)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[l,c]=i[o];vC(c,YO(t,l),n,r)}},YO=(e,t)=>{let n=e;const r=t.split(_v),i=r.length;for(let s=0;s<i;s++){const o=r[s];let l=n.nextPart.get(o);l||(l=qO(),n.nextPart.set(o,l)),n=l}return n},ZG=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,JG=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(s,o)=>{n[s]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=r[s])!==void 0)return i(s,o),o},set(s,o){s in n?n[s]=o:i(s,o)}}},GS="!",nN=":",eq=[],rN=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),tq=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const s=[];let o=0,l=0,c=0,d;const f=i.length;for(let x=0;x<f;x++){const w=i[x];if(o===0&&l===0){if(w===nN){s.push(i.slice(c,x)),c=x+1;continue}if(w==="/"){d=x;continue}}w==="["?o++:w==="]"?o--:w==="("?l++:w===")"&&l--}const h=s.length===0?i:i.slice(c);let g=h,v=!1;h.endsWith(GS)?(g=h.slice(0,-1),v=!0):h.startsWith(GS)&&(g=h.slice(1),v=!0);const y=d&&d>c?d-c:void 0;return rN(s,v,g,y)};if(t){const i=t+nN,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):rN(eq,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},nq=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let s=0;s<n.length;s++){const o=n[s],l=o[0]==="[",c=t.has(o);l||c?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},rq=e=>({cache:JG(e.cacheSize),parseClassName:tq(e),sortModifiers:nq(e),...VG(e)}),iq=/\s+/,sq=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],l=e.trim().split(iq);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:h,modifiers:g,hasImportantModifier:v,baseClassName:y,maybePostfixModifierPosition:x}=n(f);if(h){c=f+(c.length>0?" "+c:c);continue}let w=!!x,C=r(w?y.substring(0,x):y);if(!C){if(!w){c=f+(c.length>0?" "+c:c);continue}if(C=r(y),!C){c=f+(c.length>0?" "+c:c);continue}w=!1}const E=g.length===0?"":g.length===1?g[0]:s(g).join(":"),R=v?E+GS:E,T=R+C;if(o.indexOf(T)>-1)continue;o.push(T);const A=i(C,w);for(let N=0;N<A.length;++N){const D=A[N];o.push(R+D)}c=f+(c.length>0?" "+c:c)}return c},oq=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=XO(n))&&(i&&(i+=" "),i+=r);return i},XO=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=XO(e[r]))&&(n&&(n+=" "),n+=t);return n},aq=(e,...t)=>{let n,r,i,s;const o=c=>{const d=t.reduce((f,h)=>h(f),e());return n=rq(d),r=n.cache.get,i=n.cache.set,s=l,l(c)},l=c=>{const d=r(c);if(d)return d;const f=sq(c,n);return i(c,f),f};return s=o,(...c)=>s(oq(...c))},lq=[],ar=e=>{const t=n=>n[e]||lq;return t.isThemeGetter=!0,t},QO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ZO=/^\((?:(\w[\w-]*):)?(.+)\)$/i,cq=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,uq=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,dq=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,hq=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,fq=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,pq=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ua=e=>cq.test(e),Ft=e=>!!e&&!Number.isNaN(Number(e)),Va=e=>!!e&&Number.isInteger(Number(e)),ex=e=>e.endsWith("%")&&Ft(e.slice(0,-1)),Po=e=>uq.test(e),JO=()=>!0,mq=e=>dq.test(e)&&!hq.test(e),bC=()=>!1,gq=e=>fq.test(e),vq=e=>pq.test(e),bq=e=>!et(e)&&!rt(e),_q=e=>Sl(e,n5,bC),et=e=>QO.test(e),Kl=e=>Sl(e,r5,mq),iN=e=>Sl(e,Rq,Ft),yq=e=>Sl(e,s5,JO),xq=e=>Sl(e,i5,bC),sN=e=>Sl(e,e5,bC),Sq=e=>Sl(e,t5,vq),qm=e=>Sl(e,o5,gq),rt=e=>ZO.test(e),Dh=e=>Mc(e,r5),wq=e=>Mc(e,i5),oN=e=>Mc(e,e5),Cq=e=>Mc(e,n5),kq=e=>Mc(e,t5),Km=e=>Mc(e,o5,!0),Eq=e=>Mc(e,s5,!0),Sl=(e,t,n)=>{const r=QO.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Mc=(e,t,n=!1)=>{const r=ZO.exec(e);return r?r[1]?t(r[1]):n:!1},e5=e=>e==="position"||e==="percentage",t5=e=>e==="image"||e==="url",n5=e=>e==="length"||e==="size"||e==="bg-size",r5=e=>e==="length",Rq=e=>e==="number",i5=e=>e==="family-name",s5=e=>e==="number"||e==="weight",o5=e=>e==="shadow",Tq=()=>{const e=ar("color"),t=ar("font"),n=ar("text"),r=ar("font-weight"),i=ar("tracking"),s=ar("leading"),o=ar("breakpoint"),l=ar("container"),c=ar("spacing"),d=ar("radius"),f=ar("shadow"),h=ar("inset-shadow"),g=ar("text-shadow"),v=ar("drop-shadow"),y=ar("blur"),x=ar("perspective"),w=ar("aspect"),C=ar("ease"),E=ar("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...T(),rt,et],N=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],I=()=>[rt,et,c],G=()=>[Ua,"full","auto",...I()],z=()=>[Va,"none","subgrid",rt,et],H=()=>["auto",{span:["full",Va,rt,et]},Va,rt,et],$=()=>[Va,"auto",rt,et],O=()=>["auto","min","max","fr",rt,et],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...I()],V=()=>[Ua,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],F=()=>[Ua,"screen","full","dvw","lvw","svw","min","max","fit",...I()],K=()=>[Ua,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],L=()=>[e,rt,et],W=()=>[...T(),oN,sN,{position:[rt,et]}],Z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],P=()=>["auto","cover","contain",Cq,_q,{size:[rt,et]}],ne=()=>[ex,Dh,Kl],ie=()=>["","none","full",d,rt,et],oe=()=>["",Ft,Dh,Kl],se=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[Ft,ex,oN,sN],ve=()=>["","none",y,rt,et],le=()=>["none",Ft,rt,et],X=()=>["none",Ft,rt,et],_e=()=>[Ft,rt,et],Le=()=>[Ua,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Po],breakpoint:[Po],color:[JO],container:[Po],"drop-shadow":[Po],ease:["in","out","in-out"],font:[bq],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Po],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Po],shadow:[Po],spacing:["px",Ft],text:[Po],"text-shadow":[Po],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ua,et,rt,w]}],container:["container"],columns:[{columns:[Ft,et,rt,l]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:A()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:G()}],"inset-x":[{"inset-x":G()}],"inset-y":[{"inset-y":G()}],start:[{"inset-s":G(),start:G()}],end:[{"inset-e":G(),end:G()}],"inset-bs":[{"inset-bs":G()}],"inset-be":[{"inset-be":G()}],top:[{top:G()}],right:[{right:G()}],bottom:[{bottom:G()}],left:[{left:G()}],visibility:["visible","invisible","collapse"],z:[{z:[Va,"auto",rt,et]}],basis:[{basis:[Ua,"full","auto",l,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ft,Ua,"auto","initial","none",et]}],grow:[{grow:["",Ft,rt,et]}],shrink:[{shrink:["",Ft,rt,et]}],order:[{order:[Va,"first","last","none",rt,et]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],"inline-size":[{inline:["auto",...F()]}],"min-inline-size":[{"min-inline":["auto",...F()]}],"max-inline-size":[{"max-inline":["none",...F()]}],"block-size":[{block:["auto",...K()]}],"min-block-size":[{"min-block":["auto",...K()]}],"max-block-size":[{"max-block":["none",...K()]}],w:[{w:[l,"screen",...V()]}],"min-w":[{"min-w":[l,"screen","none",...V()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",n,Dh,Kl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Eq,yq]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ex,et]}],"font-family":[{font:[wq,xq,t]}],"font-features":[{"font-features":[et]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,rt,et]}],"line-clamp":[{"line-clamp":[Ft,"none",rt,iN]}],leading:[{leading:[s,...I()]}],"list-image":[{"list-image":["none",rt,et]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",rt,et]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ft,"from-font","auto",rt,Kl]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[Ft,"auto",rt,et]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",rt,et]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",rt,et]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:Z()}],"bg-size":[{bg:P()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Va,rt,et],radial:["",rt,et],conic:[Va,rt,et]},kq,Sq]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:ie()}],"rounded-s":[{"rounded-s":ie()}],"rounded-e":[{"rounded-e":ie()}],"rounded-t":[{"rounded-t":ie()}],"rounded-r":[{"rounded-r":ie()}],"rounded-b":[{"rounded-b":ie()}],"rounded-l":[{"rounded-l":ie()}],"rounded-ss":[{"rounded-ss":ie()}],"rounded-se":[{"rounded-se":ie()}],"rounded-ee":[{"rounded-ee":ie()}],"rounded-es":[{"rounded-es":ie()}],"rounded-tl":[{"rounded-tl":ie()}],"rounded-tr":[{"rounded-tr":ie()}],"rounded-br":[{"rounded-br":ie()}],"rounded-bl":[{"rounded-bl":ie()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ft,rt,et]}],"outline-w":[{outline:["",Ft,Dh,Kl]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",f,Km,qm]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",h,Km,qm]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[Ft,Kl]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",g,Km,qm]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[Ft,rt,et]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ft]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[rt,et]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[Ft]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:W()}],"mask-repeat":[{mask:Z()}],"mask-size":[{mask:P()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",rt,et]}],filter:[{filter:["","none",rt,et]}],blur:[{blur:ve()}],brightness:[{brightness:[Ft,rt,et]}],contrast:[{contrast:[Ft,rt,et]}],"drop-shadow":[{"drop-shadow":["","none",v,Km,qm]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",Ft,rt,et]}],"hue-rotate":[{"hue-rotate":[Ft,rt,et]}],invert:[{invert:["",Ft,rt,et]}],saturate:[{saturate:[Ft,rt,et]}],sepia:[{sepia:["",Ft,rt,et]}],"backdrop-filter":[{"backdrop-filter":["","none",rt,et]}],"backdrop-blur":[{"backdrop-blur":ve()}],"backdrop-brightness":[{"backdrop-brightness":[Ft,rt,et]}],"backdrop-contrast":[{"backdrop-contrast":[Ft,rt,et]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ft,rt,et]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ft,rt,et]}],"backdrop-invert":[{"backdrop-invert":["",Ft,rt,et]}],"backdrop-opacity":[{"backdrop-opacity":[Ft,rt,et]}],"backdrop-saturate":[{"backdrop-saturate":[Ft,rt,et]}],"backdrop-sepia":[{"backdrop-sepia":["",Ft,rt,et]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",rt,et]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ft,"initial",rt,et]}],ease:[{ease:["linear","initial",C,rt,et]}],delay:[{delay:[Ft,rt,et]}],animate:[{animate:["none",E,rt,et]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,rt,et]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:_e()}],"skew-x":[{"skew-x":_e()}],"skew-y":[{"skew-y":_e()}],transform:[{transform:[rt,et,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Le()}],"translate-x":[{"translate-x":Le()}],"translate-y":[{"translate-y":Le()}],"translate-z":[{"translate-z":Le()}],"translate-none":["translate-none"],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",rt,et]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",rt,et]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[Ft,Dh,Kl,iN]}],stroke:[{stroke:["none",...L()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Aq=aq(Tq);function xe(...e){return Aq(GO(e))}function cf(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Nq(e){return e.startsWith("chatId:")?e.slice(7):e}const Ef="data-focus-fallback-ignore",a5="data-allow-focus-retain",yv="kanna:restore-chat-input-focus",_C="data-chat-input",xv="data-chat-selection-zone";function ic(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function l5(e){var n;const t=e;return t!=null&&t.matches?t.matches("input:not([type='checkbox']):not([type='radio']):not([type='button']):not([type='submit']):not([type='reset']), textarea, select")||t.isContentEditable||((n=t.getAttribute)==null?void 0:n.call(t,"role"))==="textbox"?!0:ic(e,a5):!1}function Mq(e){const t=e;return t!=null&&t.matches?l5(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:ic(e,a5):!1}function aN(e){return!!e.querySelector(`[${Ef}][data-state='open']`)}function Lq(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function Dq(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${_C}]`)).filter(o=>!o.disabled);if(n.length===0)return!1;const r=n.indexOf(e),i=r>=0?(r+1)%n.length:0,s=n[i];return s?(s.focus({preventScroll:!0}),!0):!1}function lN(e){const{activeElement:t,fallback:n,hasActiveOverlay:r}=e;if(!n||n.disabled||r||t===n)return"none";if(e.trigger==="escape")return e.defaultPrevented||ic(t,_C)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,c=s??i;return!o||!c||!o.contains(c)||ic(c,Ef)||ic(t,Ef)||l&&(ic(i,xv)||ic(c,xv))||l5(t)?"none":t&&t===c?"restore":Mq(t)?"none":"restore"}const Zo=OG,Iq=jG,c5=_.forwardRef(({className:e,...t},n)=>m.jsx(UO,{ref:n,className:xe("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));c5.displayName=UO.displayName;const Pq={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},po=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>m.jsxs(Iq,{children:[m.jsx(c5,{}),m.jsxs(VO,{ref:i,[Ef]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(yv)),(o=r.onCloseAutoFocus)==null||o.call(r,s)},className:xe("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","max-h-[85vh] flex flex-col",Pq[n],e),...r,children:[t,m.jsxs(FG,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[m.jsx(aa,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));po.displayName=VO.displayName;function yC({className:e,...t}){return m.jsx("div",{className:xe("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function Jo({className:e,...t}){return m.jsx(zG,{className:xe("text-lg font-medium leading-none tracking-tight",e),...t})}function Rd({className:e,...t}){return m.jsx(BG,{className:xe("text-sm text-muted-foreground",e),...t})}function ea({className:e,...t}){return m.jsx("div",{className:xe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function ml({className:e,...t}){return m.jsx("div",{className:xe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function Oq({className:e,...t}){return m.jsx("button",{className:xe("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","bg-primary text-primary-foreground hover:bg-primary/90","disabled:pointer-events-none disabled:bg-primary/20 disabled:text-primary/60",e),...t})}function jq({className:e,...t}){return m.jsx("button",{className:xe("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground","disabled:pointer-events-none disabled:text-muted-foreground/50",e),...t})}function zq({open:e,shareUrl:t,onOpenChange:n,onOpenLink:r,onCopyLink:i}){const[s,o]=_.useState(!1);_.useEffect(()=>{e||o(!1)},[e,t]);const l=async()=>{await i()&&(o(!0),window.setTimeout(()=>{o(!1)},2e3))};return m.jsx(Zo,{open:e,onOpenChange:n,children:m.jsxs(po,{size:"md",children:[m.jsxs(yC,{children:[m.jsx(Jo,{children:"Shared Link"}),m.jsx(Rd,{children:"Shared links are snapshots in time and contain all attachments, tool calls and history. Be mindful of sensitive info."})]}),m.jsx(ea,{className:"space-y-3",children:m.jsxs("div",{className:"flex w-full items-center gap-2 rounded-2xl border border-border bg-muted/40 pl-4 px-3 py-2.5",children:[m.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-sm text-foreground",children:t}),m.jsx("button",{type:"button",onClick:()=>void l(),title:s?"Copied":"Copy link","aria-label":s?"Copied":"Copy link",className:"flex flex-shrink-0 items-center justify-center rounded-lg text-logo hover:text-logo/60 transition-colors hover:bg-background hover:text-foreground",children:s?m.jsx(ri,{className:"h-4 w-4 text-emerald-400"}):m.jsx(pl,{className:"h-4 w-4"})})]})}),m.jsx(ml,{children:m.jsxs(Oq,{type:"button",onClick:r,children:[m.jsx(ip,{className:"mr-2 h-4 w-4"}),"Open"]})})]})})}const cN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,uN=GO,Bq=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return uN(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=t,o=Object.keys(i).map(d=>{const f=n==null?void 0:n[d],h=s==null?void 0:s[d];if(f===null)return null;const g=cN(f)||cN(h);return i[d][g]}),l=n&&Object.entries(n).reduce((d,f)=>{let[h,g]=f;return g===void 0||(d[h]=g),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:h,className:g,...v}=f;return Object.entries(v).every(y=>{let[x,w]=y;return Array.isArray(w)?w.includes({...s,...l}[x]):{...s,...l}[x]===w})?[...d,h,g]:d},[]);return uN(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},Ob=Bq("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none",{variants:{variant:{default:"bg-primary text-primary-foreground disabled:bg-primary/50 disabled:text-primary-foreground/90 hover:bg-primary/90",juicy:"bg-logo text-primary-foreground disabled:text-primary-foreground/50 hover:bg-logo/90",destructive:"bg-destructive/80 dark:text-white",outline:"border disabled:bg-transparent disabled:text-foreground/50 border-inpu disabled:border-input/90 bg-card hover:bg-muted hover:text-accent-foreground",secondary:"bg-transparent border border-border text-secondary-foreground hover:text-secondary-foreground/60 disabled:text-secondary-foreground/50",ghost:"hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground disabled:text-muted-foreground/50 border border-border/0 hover:border-border",link:"text-primary disabled:text-primary/50 underline-offset-4 hover:underline",none:""},size:{default:"h-10 px-4 rounded-full py-2",sm:"h-9 rounded-full px-3",lg:"h-11 rounded-full px-8",icon:"h-9 w-9 rounded-full",none:"","icon-sm":"h-5.5 w-5.5 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),qe=_.forwardRef(({className:e,variant:t,size:n,...r},i)=>m.jsx("button",{className:xe(Ob({variant:t,size:n,className:e})),ref:i,...r}));qe.displayName="Button";const Or=_.forwardRef(({className:e,type:t,...n},r)=>m.jsx("input",{ref:r,type:t,className:xe("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Or.displayName="Input";const u5=_.createContext(null);function Fq({children:e}){const[t,n]=_.useState(null),[r,i]=_.useState(""),s=_.useRef(null);_.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(i(t.options.initialValue??""),setTimeout(()=>{var v,y;(v=s.current)==null||v.focus(),(y=s.current)==null||y.select()},0))},[t]);const o=_.useCallback(()=>{n(null),i("")},[]),l=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.kind==="prompt"?t.resolve(null):t.resolve(),o())},[o,t]),c=_.useCallback(()=>{if(t){if(t.kind==="confirm")t.resolve(!0);else if(t.kind==="prompt"){const v=r.trim();t.resolve(v||(t.options.allowEmpty?"":null))}else t.resolve();o()}},[o,t,r]),d=_.useCallback(v=>new Promise(y=>{n({kind:"confirm",options:v,resolve:y})}),[]),f=_.useCallback(v=>new Promise(y=>{n({kind:"prompt",options:v,resolve:y})}),[]),h=_.useCallback(v=>new Promise(y=>{n({kind:"alert",options:v,resolve:y})}),[]),g=_.useMemo(()=>({confirm:d,prompt:f,alert:h}),[h,d,f]);return m.jsxs(u5.Provider,{value:g,children:[e,m.jsx(Zo,{open:t!==null,onOpenChange:v=>{v||!t||l()},children:m.jsx(po,{size:"sm",onKeyDown:v=>{v.key!=="Enter"||v.shiftKey||!t||t.kind!=="confirm"||(v.preventDefault(),c())},children:t?m.jsxs(m.Fragment,{children:[m.jsxs(ea,{className:"space-y-4",children:[m.jsx(Jo,{children:t.options.title}),t.options.description?m.jsx(Rd,{children:t.options.description}):null,t.kind==="prompt"?m.jsx(Or,{ref:s,type:"text",value:r,onChange:v=>i(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),c())},placeholder:t.options.placeholder}):null]}),m.jsxs(ml,{children:[t.kind==="prompt"&&t.options.resetLabel?m.jsx(qe,{variant:"ghost",size:"sm",onClick:()=>i(t.options.resetValue??""),className:"mr-auto",children:t.options.resetLabel}):null,m.jsx(qe,{variant:"ghost",size:"sm",onClick:l,className:t.kind==="alert"?"hidden":void 0,children:"cancelLabel"in t.options?t.options.cancelLabel??"Cancel":"Cancel"}),m.jsx(qe,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:c,disabled:t.kind==="prompt"&&!t.options.allowEmpty&&!r.trim(),children:t.kind==="alert"?t.options.closeLabel??"OK":"confirmLabel"in t.options?t.options.confirmLabel??"Confirm":"Confirm"})]})]}):null})})]})}function xC(){const e=_.useContext(u5);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const SC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("bg-card text-card-foreground",e),...t}));SC.displayName="Card";const wC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex flex-col space-y-1.5 p-2",e),...t}));wC.displayName="CardHeader";const d5=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...t}));d5.displayName="CardTitle";const h5=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));h5.displayName="CardDescription";const CC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("p-6 pt-0",e),...t}));CC.displayName="CardContent";const Hq=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex items-center p-6 pt-0",e),...t}));Hq.displayName="CardFooter";const $q=["top","right","bottom","left"],gl=Math.min,zi=Math.max,Sv=Math.round,Ym=Math.floor,ho=e=>({x:e,y:e}),Uq={left:"right",right:"left",bottom:"top",top:"bottom"};function qS(e,t,n){return zi(e,gl(t,n))}function ta(e,t){return typeof e=="function"?e(t):e}function na(e){return e.split("-")[0]}function Td(e){return e.split("-")[1]}function kC(e){return e==="x"?"y":"x"}function EC(e){return e==="y"?"height":"width"}function oo(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function RC(e){return kC(oo(e))}function Vq(e,t,n){n===void 0&&(n=!1);const r=Td(e),i=RC(e),s=EC(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=wv(o)),[o,wv(o)]}function Wq(e){const t=wv(e);return[KS(e),t,KS(t)]}function KS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const dN=["left","right"],hN=["right","left"],Gq=["top","bottom"],qq=["bottom","top"];function Kq(e,t,n){switch(e){case"top":case"bottom":return n?t?hN:dN:t?dN:hN;case"left":case"right":return t?Gq:qq;default:return[]}}function Yq(e,t,n,r){const i=Td(e);let s=Kq(na(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(KS)))),s}function wv(e){const t=na(e);return Uq[t]+e.slice(t.length)}function Xq(e){return{top:0,right:0,bottom:0,left:0,...e}}function f5(e){return typeof e!="number"?Xq(e):{top:e,right:e,bottom:e,left:e}}function Cv(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function fN(e,t,n){let{reference:r,floating:i}=e;const s=oo(t),o=RC(t),l=EC(o),c=na(t),d=s==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,g=r[l]/2-i[l]/2;let v;switch(c){case"top":v={x:f,y:r.y-i.height};break;case"bottom":v={x:f,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:h};break;case"left":v={x:r.x-i.width,y:h};break;default:v={x:r.x,y:r.y}}switch(Td(t)){case"start":v[o]-=g*(n&&d?-1:1);break;case"end":v[o]+=g*(n&&d?-1:1);break}return v}async function Qq(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:g=!1,padding:v=0}=ta(t,e),y=f5(v),w=l[g?h==="floating"?"reference":"floating":h],C=Cv(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),E=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),T=await(s.isElement==null?void 0:s.isElement(R))?await(s.getScale==null?void 0:s.getScale(R))||{x:1,y:1}:{x:1,y:1},A=Cv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:E,offsetParent:R,strategy:c}):E);return{top:(C.top-A.top+y.top)/T.y,bottom:(A.bottom-C.bottom+y.bottom)/T.y,left:(C.left-A.left+y.left)/T.x,right:(A.right-C.right+y.right)/T.x}}const Zq=50,Jq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:Qq},c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:h}=fN(d,r,c),g=r,v=0;const y={};for(let x=0;x<s.length;x++){const w=s[x];if(!w)continue;const{name:C,fn:E}=w,{x:R,y:T,data:A,reset:N}=await E({x:f,y:h,initialPlacement:r,placement:g,strategy:i,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});f=R??f,h=T??h,y[C]={...y[C],...A},N&&v<Zq&&(v++,typeof N=="object"&&(N.placement&&(g=N.placement),N.rects&&(d=N.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):N.rects),{x:f,y:h}=fN(d,g,c)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},eK=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=ta(e,t)||{};if(d==null)return{};const h=f5(f),g={x:n,y:r},v=RC(i),y=EC(v),x=await o.getDimensions(d),w=v==="y",C=w?"top":"left",E=w?"bottom":"right",R=w?"clientHeight":"clientWidth",T=s.reference[y]+s.reference[v]-g[v]-s.floating[y],A=g[v]-s.reference[v],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let D=N?N[R]:0;(!D||!await(o.isElement==null?void 0:o.isElement(N)))&&(D=l.floating[R]||s.floating[y]);const I=T/2-A/2,G=D/2-x[y]/2-1,z=gl(h[C],G),H=gl(h[E],G),$=z,O=D-x[y]-H,B=D/2-x[y]/2+I,U=qS($,B,O),j=!c.arrow&&Td(i)!=null&&B!==U&&s.reference[y]/2-(B<$?z:H)-x[y]/2<0,V=j?B<$?B-$:B-O:0;return{[v]:g[v]+V,data:{[v]:U,centerOffset:B-U-V,...j&&{alignmentOffset:V}},reset:j}}}),tK=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...w}=ta(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=na(i),E=oo(l),R=na(l)===l,T=await(c.isRTL==null?void 0:c.isRTL(d.floating)),A=g||(R||!x?[wv(l)]:Wq(l)),N=y!=="none";!g&&N&&A.push(...Yq(l,x,y,T));const D=[l,...A],I=await c.detectOverflow(t,w),G=[];let z=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(I[C]),h){const B=Vq(i,o,T);G.push(I[B[0]],I[B[1]])}if(z=[...z,{placement:i,overflows:G}],!G.every(B=>B<=0)){var H,$;const B=(((H=s.flip)==null?void 0:H.index)||0)+1,U=D[B];if(U&&(!(h==="alignment"?E!==oo(U):!1)||z.every(F=>oo(F.placement)===E?F.overflows[0]>0:!0)))return{data:{index:B,overflows:z},reset:{placement:U}};let j=($=z.filter(V=>V.overflows[0]<=0).sort((V,F)=>V.overflows[1]-F.overflows[1])[0])==null?void 0:$.placement;if(!j)switch(v){case"bestFit":{var O;const V=(O=z.filter(F=>{if(N){const K=oo(F.placement);return K===E||K==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(K=>K>0).reduce((K,L)=>K+L,0)]).sort((F,K)=>F[1]-K[1])[0])==null?void 0:O[0];V&&(j=V);break}case"initialPlacement":j=l;break}if(i!==j)return{reset:{placement:j}}}return{}}}};function pN(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function mN(e){return $q.some(t=>e[t]>=0)}const nK=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=ta(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=pN(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:mN(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=pN(o,n.floating);return{data:{escapedOffsets:l,escaped:mN(l)}}}default:return{}}}}},p5=new Set(["left","top"]);async function rK(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=na(n),l=Td(n),c=oo(n)==="y",d=p5.has(o)?-1:1,f=s&&c?-1:1,h=ta(t,e);let{mainAxis:g,crossAxis:v,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof y=="number"&&(v=l==="end"?y*-1:y),c?{x:v*f,y:g*d}:{x:g*d,y:v*f}}const iK=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=t,c=await rK(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},sK=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:C=>{let{x:E,y:R}=C;return{x:E,y:R}}},...d}=ta(e,t),f={x:n,y:r},h=await s.detectOverflow(t,d),g=oo(na(i)),v=kC(g);let y=f[v],x=f[g];if(o){const C=v==="y"?"top":"left",E=v==="y"?"bottom":"right",R=y+h[C],T=y-h[E];y=qS(R,y,T)}if(l){const C=g==="y"?"top":"left",E=g==="y"?"bottom":"right",R=x+h[C],T=x-h[E];x=qS(R,x,T)}const w=c.fn({...t,[v]:y,[g]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[v]:o,[g]:l}}}}}},oK=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=ta(e,t),f={x:n,y:r},h=oo(i),g=kC(h);let v=f[g],y=f[h];const x=ta(l,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(c){const R=g==="y"?"height":"width",T=s.reference[g]-s.floating[R]+w.mainAxis,A=s.reference[g]+s.reference[R]-w.mainAxis;v<T?v=T:v>A&&(v=A)}if(d){var C,E;const R=g==="y"?"width":"height",T=p5.has(na(i)),A=s.reference[h]-s.floating[R]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:w.crossAxis),N=s.reference[h]+s.reference[R]+(T?0:((E=o.offset)==null?void 0:E[h])||0)-(T?w.crossAxis:0);y<A?y=A:y>N&&(y=N)}return{[g]:v,[h]:y}}}},aK=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:l}=t,{apply:c=()=>{},...d}=ta(e,t),f=await o.detectOverflow(t,d),h=na(i),g=Td(i),v=oo(i)==="y",{width:y,height:x}=s.floating;let w,C;h==="top"||h==="bottom"?(w=h,C=g===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,w=g==="end"?"top":"bottom");const E=x-f.top-f.bottom,R=y-f.left-f.right,T=gl(x-f[w],E),A=gl(y-f[C],R),N=!t.middlewareData.shift;let D=T,I=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(I=R),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=E),N&&!g){const z=zi(f.left,0),H=zi(f.right,0),$=zi(f.top,0),O=zi(f.bottom,0);v?I=y-2*(z!==0||H!==0?z+H:zi(f.left,f.right)):D=x-2*($!==0||O!==0?$+O:zi(f.top,f.bottom))}await c({...t,availableWidth:I,availableHeight:D});const G=await o.getDimensions(l.floating);return y!==G.width||x!==G.height?{reset:{rects:!0}}:{}}}};function jb(){return typeof window<"u"}function Ad(e){return m5(e)?(e.nodeName||"").toLowerCase():"#document"}function Bi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function vo(e){var t;return(t=(m5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function m5(e){return jb()?e instanceof Node||e instanceof Bi(e).Node:!1}function $s(e){return jb()?e instanceof Element||e instanceof Bi(e).Element:!1}function ca(e){return jb()?e instanceof HTMLElement||e instanceof Bi(e).HTMLElement:!1}function gN(e){return!jb()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Bi(e).ShadowRoot}function ap(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Us(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function lK(e){return/^(table|td|th)$/.test(Ad(e))}function zb(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const cK=/transform|translate|scale|rotate|perspective|filter/,uK=/paint|layout|strict|content/,Yl=e=>!!e&&e!=="none";let tx;function TC(e){const t=$s(e)?Us(e):e;return Yl(t.transform)||Yl(t.translate)||Yl(t.scale)||Yl(t.rotate)||Yl(t.perspective)||!AC()&&(Yl(t.backdropFilter)||Yl(t.filter))||cK.test(t.willChange||"")||uK.test(t.contain||"")}function dK(e){let t=vl(e);for(;ca(t)&&!sd(t);){if(TC(t))return t;if(zb(t))return null;t=vl(t)}return null}function AC(){return tx==null&&(tx=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),tx}function sd(e){return/^(html|body|#document)$/.test(Ad(e))}function Us(e){return Bi(e).getComputedStyle(e)}function Bb(e){return $s(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function vl(e){if(Ad(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gN(e)&&e.host||vo(e);return gN(t)?t.host:t}function g5(e){const t=vl(e);return sd(t)?e.ownerDocument?e.ownerDocument.body:e.body:ca(t)&&ap(t)?t:g5(t)}function Rf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=g5(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Bi(i);if(s){const l=YS(o);return t.concat(o,o.visualViewport||[],ap(i)?i:[],l&&n?Rf(l):[])}else return t.concat(i,Rf(i,[],n))}function YS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function v5(e){const t=Us(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ca(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=Sv(n)!==s||Sv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function NC(e){return $s(e)?e:e.contextElement}function qu(e){const t=NC(e);if(!ca(t))return ho(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=v5(t);let o=(s?Sv(n.width):n.width)/r,l=(s?Sv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const hK=ho(0);function b5(e){const t=Bi(e);return!AC()||!t.visualViewport?hK:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function fK(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Bi(e)?!1:t}function _c(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=NC(e);let o=ho(1);t&&(r?$s(r)&&(o=qu(r)):o=qu(e));const l=fK(s,n,r)?b5(s):ho(0);let c=(i.left+l.x)/o.x,d=(i.top+l.y)/o.y,f=i.width/o.x,h=i.height/o.y;if(s){const g=Bi(s),v=r&&$s(r)?Bi(r):r;let y=g,x=YS(y);for(;x&&r&&v!==y;){const w=qu(x),C=x.getBoundingClientRect(),E=Us(x),R=C.left+(x.clientLeft+parseFloat(E.paddingLeft))*w.x,T=C.top+(x.clientTop+parseFloat(E.paddingTop))*w.y;c*=w.x,d*=w.y,f*=w.x,h*=w.y,c+=R,d+=T,y=Bi(x),x=YS(y)}}return Cv({width:f,height:h,x:c,y:d})}function Fb(e,t){const n=Bb(e).scrollLeft;return t?t.left+n:_c(vo(e)).left+n}function _5(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Fb(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function pK(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=vo(r),l=t?zb(t.floating):!1;if(r===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=ho(1);const f=ho(0),h=ca(r);if((h||!h&&!s)&&((Ad(r)!=="body"||ap(o))&&(c=Bb(r)),h)){const v=_c(r);d=qu(r),f.x=v.x+r.clientLeft,f.y=v.y+r.clientTop}const g=o&&!h&&!s?_5(o,c):ho(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+g.x,y:n.y*d.y-c.scrollTop*d.y+f.y+g.y}}function mK(e){return Array.from(e.getClientRects())}function gK(e){const t=vo(e),n=Bb(e),r=e.ownerDocument.body,i=zi(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=zi(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Fb(e);const l=-n.scrollTop;return Us(r).direction==="rtl"&&(o+=zi(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const vN=25;function vK(e,t){const n=Bi(e),r=vo(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,c=0;if(i){s=i.width,o=i.height;const f=AC();(!f||f&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const d=Fb(r);if(d<=0){const f=r.ownerDocument,h=f.body,g=getComputedStyle(h),v=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-h.clientWidth-v);y<=vN&&(s-=y)}else d<=vN&&(s+=d);return{width:s,height:o,x:l,y:c}}function bK(e,t){const n=_c(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ca(e)?qu(e):ho(1),o=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,d=r*s.y;return{width:o,height:l,x:c,y:d}}function bN(e,t,n){let r;if(t==="viewport")r=vK(e,n);else if(t==="document")r=gK(vo(e));else if($s(t))r=bK(t,n);else{const i=b5(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Cv(r)}function y5(e,t){const n=vl(e);return n===t||!$s(n)||sd(n)?!1:Us(n).position==="fixed"||y5(n,t)}function _K(e,t){const n=t.get(e);if(n)return n;let r=Rf(e,[],!1).filter(l=>$s(l)&&Ad(l)!=="body"),i=null;const s=Us(e).position==="fixed";let o=s?vl(e):e;for(;$s(o)&&!sd(o);){const l=Us(o),c=TC(o);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||ap(o)&&!c&&y5(e,o))?r=r.filter(f=>f!==o):i=l,o=vl(o)}return t.set(e,r),r}function yK(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?zb(t)?[]:_K(t,this._c):[].concat(n),r],l=bN(t,o[0],i);let c=l.top,d=l.right,f=l.bottom,h=l.left;for(let g=1;g<o.length;g++){const v=bN(t,o[g],i);c=zi(v.top,c),d=gl(v.right,d),f=gl(v.bottom,f),h=zi(v.left,h)}return{width:d-h,height:f-c,x:h,y:c}}function xK(e){const{width:t,height:n}=v5(e);return{width:t,height:n}}function SK(e,t,n){const r=ca(t),i=vo(t),s=n==="fixed",o=_c(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=ho(0);function d(){c.x=Fb(i)}if(r||!r&&!s)if((Ad(t)!=="body"||ap(i))&&(l=Bb(t)),r){const v=_c(t,!0,s,t);c.x=v.x+t.clientLeft,c.y=v.y+t.clientTop}else i&&d();s&&!r&&i&&d();const f=i&&!r&&!s?_5(i,l):ho(0),h=o.left+l.scrollLeft-c.x-f.x,g=o.top+l.scrollTop-c.y-f.y;return{x:h,y:g,width:o.width,height:o.height}}function nx(e){return Us(e).position==="static"}function _N(e,t){if(!ca(e)||Us(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return vo(e)===n&&(n=n.ownerDocument.body),n}function x5(e,t){const n=Bi(e);if(zb(e))return n;if(!ca(e)){let i=vl(e);for(;i&&!sd(i);){if($s(i)&&!nx(i))return i;i=vl(i)}return n}let r=_N(e,t);for(;r&&lK(r)&&nx(r);)r=_N(r,t);return r&&sd(r)&&nx(r)&&!TC(r)?n:r||dK(e)||n}const wK=async function(e){const t=this.getOffsetParent||x5,n=this.getDimensions,r=await n(e.floating);return{reference:SK(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function CK(e){return Us(e).direction==="rtl"}const kK={convertOffsetParentRelativeRectToViewportRelativeRect:pK,getDocumentElement:vo,getClippingRect:yK,getOffsetParent:x5,getElementRects:wK,getClientRects:mK,getDimensions:xK,getScale:qu,isElement:$s,isRTL:CK};function S5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function EK(e,t){let n=null,r;const i=vo(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:f,top:h,width:g,height:v}=d;if(l||t(),!g||!v)return;const y=Ym(h),x=Ym(i.clientWidth-(f+g)),w=Ym(i.clientHeight-(h+v)),C=Ym(f),R={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:zi(0,gl(1,c))||1};let T=!0;function A(N){const D=N[0].intersectionRatio;if(D!==c){if(!T)return o();D?o(!1,D):r=setTimeout(()=>{o(!1,1e-7)},1e3)}D===1&&!S5(d,e.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(A,{...R,root:i.ownerDocument})}catch{n=new IntersectionObserver(A,R)}n.observe(e)}return o(!0),s}function RK(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=NC(e),f=i||s?[...d?Rf(d):[],...t?Rf(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?EK(d,n):null;let g=-1,v=null;o&&(v=new ResizeObserver(C=>{let[E]=C;E&&E.target===d&&v&&t&&(v.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var R;(R=v)==null||R.observe(t)})),n()}),d&&!c&&v.observe(d),t&&v.observe(t));let y,x=c?_c(e):null;c&&w();function w(){const C=_c(e);x&&!S5(x,C)&&n(),x=C,y=requestAnimationFrame(w)}return n(),()=>{var C;f.forEach(E=>{i&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),h==null||h(),(C=v)==null||C.disconnect(),v=null,c&&cancelAnimationFrame(y)}}const TK=iK,AK=sK,NK=tK,MK=aK,LK=nK,yN=eK,DK=oK,IK=(e,t,n)=>{const r=new Map,i={platform:kK,...n},s={...i.platform,_c:r};return Jq(e,t,{...i,platform:s})};var PK=typeof document<"u",OK=function(){},qg=PK?_.useLayoutEffect:OK;function kv(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(!kv(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!kv(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function w5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xN(e,t){const n=w5(e);return Math.round(t*n)/n}function rx(e){const t=_.useRef(e);return qg(()=>{t.current=e}),t}function jK(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,h]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,v]=_.useState(r);kv(g,r)||v(r);const[y,x]=_.useState(null),[w,C]=_.useState(null),E=_.useCallback(F=>{F!==N.current&&(N.current=F,x(F))},[]),R=_.useCallback(F=>{F!==D.current&&(D.current=F,C(F))},[]),T=s||y,A=o||w,N=_.useRef(null),D=_.useRef(null),I=_.useRef(f),G=c!=null,z=rx(c),H=rx(i),$=rx(d),O=_.useCallback(()=>{if(!N.current||!D.current)return;const F={placement:t,strategy:n,middleware:g};H.current&&(F.platform=H.current),IK(N.current,D.current,F).then(K=>{const L={...K,isPositioned:$.current!==!1};B.current&&!kv(I.current,L)&&(I.current=L,ps.flushSync(()=>{h(L)}))})},[g,t,n,H,$]);qg(()=>{d===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[d]);const B=_.useRef(!1);qg(()=>(B.current=!0,()=>{B.current=!1}),[]),qg(()=>{if(T&&(N.current=T),A&&(D.current=A),T&&A){if(z.current)return z.current(T,A,O);O()}},[T,A,O,z,G]);const U=_.useMemo(()=>({reference:N,floating:D,setReference:E,setFloating:R}),[E,R]),j=_.useMemo(()=>({reference:T,floating:A}),[T,A]),V=_.useMemo(()=>{const F={position:n,left:0,top:0};if(!j.floating)return F;const K=xN(j.floating,f.x),L=xN(j.floating,f.y);return l?{...F,transform:"translate("+K+"px, "+L+"px)",...w5(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:L}},[n,l,j.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:O,refs:U,elements:j,floatingStyles:V}),[f,O,U,j,V])}const zK=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?yN({element:r.current,padding:i}).fn(n):{}:r?yN({element:r,padding:i}).fn(n):{}}}},BK=(e,t)=>{const n=TK(e);return{name:n.name,fn:n.fn,options:[e,t]}},FK=(e,t)=>{const n=AK(e);return{name:n.name,fn:n.fn,options:[e,t]}},HK=(e,t)=>({fn:DK(e).fn,options:[e,t]}),$K=(e,t)=>{const n=NK(e);return{name:n.name,fn:n.fn,options:[e,t]}},UK=(e,t)=>{const n=MK(e);return{name:n.name,fn:n.fn,options:[e,t]}},VK=(e,t)=>{const n=LK(e);return{name:n.name,fn:n.fn,options:[e,t]}},WK=(e,t)=>{const n=zK(e);return{name:n.name,fn:n.fn,options:[e,t]}};var GK="Arrow",C5=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Kt.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});C5.displayName=GK;var qK=C5;function KK(e){const[t,n]=_.useState(void 0);return Gr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;o=d.inlineSize,l=d.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var MC="Popper",[k5,wl]=la(MC),[YK,E5]=k5(MC),R5=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(YK,{scope:t,anchor:r,onAnchorChange:i,children:n})};R5.displayName=MC;var T5="PopperAnchor",A5=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=E5(T5,n),o=_.useRef(null),l=dn(t,o),c=_.useRef(null);return _.useEffect(()=>{const d=c.current;c.current=(r==null?void 0:r.current)||o.current,d!==c.current&&s.onAnchorChange(c.current)}),r?null:m.jsx(Kt.div,{...i,ref:l})});A5.displayName=T5;var LC="PopperContent",[XK,QK]=k5(LC),N5=_.forwardRef((e,t)=>{var se,ge,de,ve,le,X;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:v="optimized",onPlaced:y,...x}=e,w=E5(LC,n),[C,E]=_.useState(null),R=dn(t,_e=>E(_e)),[T,A]=_.useState(null),N=KK(T),D=(N==null?void 0:N.width)??0,I=(N==null?void 0:N.height)??0,G=r+(s!=="center"?"-"+s:""),z=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},H=Array.isArray(d)?d:[d],$=H.length>0,O={padding:z,boundary:H.filter(JK),altBoundary:$},{refs:B,floatingStyles:U,placement:j,isPositioned:V,middlewareData:F}=jK({strategy:"fixed",placement:G,whileElementsMounted:(..._e)=>RK(..._e,{animationFrame:v==="always"}),elements:{reference:w.anchor},middleware:[BK({mainAxis:i+I,alignmentAxis:o}),c&&FK({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?HK():void 0,...O}),c&&$K({...O}),UK({...O,apply:({elements:_e,rects:Le,availableWidth:$e,availableHeight:gt})=>{const{width:Rt,height:ft}=Le.reference,Yt=_e.floating.style;Yt.setProperty("--radix-popper-available-width",`${$e}px`),Yt.setProperty("--radix-popper-available-height",`${gt}px`),Yt.setProperty("--radix-popper-anchor-width",`${Rt}px`),Yt.setProperty("--radix-popper-anchor-height",`${ft}px`)}}),T&&WK({element:T,padding:l}),eY({arrowWidth:D,arrowHeight:I}),g&&VK({strategy:"referenceHidden",...O})]}),[K,L]=D5(j),W=Hs(y);Gr(()=>{V&&(W==null||W())},[V,W]);const Z=(se=F.arrow)==null?void 0:se.x,P=(ge=F.arrow)==null?void 0:ge.y,ne=((de=F.arrow)==null?void 0:de.centerOffset)!==0,[ie,oe]=_.useState();return Gr(()=>{C&&oe(window.getComputedStyle(C).zIndex)},[C]),m.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:V?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[(ve=F.transformOrigin)==null?void 0:ve.x,(le=F.transformOrigin)==null?void 0:le.y].join(" "),...((X=F.hide)==null?void 0:X.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(XK,{scope:n,placedSide:K,onArrowChange:A,arrowX:Z,arrowY:P,shouldHideArrow:ne,children:m.jsx(Kt.div,{"data-side":K,"data-align":L,...x,ref:R,style:{...x.style,animation:V?void 0:"none"}})})})});N5.displayName=LC;var M5="PopperArrow",ZK={top:"bottom",right:"left",bottom:"top",left:"right"},L5=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=QK(M5,r),o=ZK[s.placedSide];return m.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:m.jsx(qK,{...i,ref:n,style:{...i.style,display:"block"}})})});L5.displayName=M5;function JK(e){return e!==null}var eY=e=>({name:"transformOrigin",options:e,fn(t){var w,C,E;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[d,f]=D5(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((C=i.arrow)==null?void 0:C.x)??0)+l/2,v=(((E=i.arrow)==null?void 0:E.y)??0)+c/2;let y="",x="";return d==="bottom"?(y=o?h:`${g}px`,x=`${-c}px`):d==="top"?(y=o?h:`${g}px`,x=`${r.floating.height+c}px`):d==="right"?(y=`${-c}px`,x=o?h:`${v}px`):d==="left"&&(y=`${r.floating.width+c}px`,x=o?h:`${v}px`),{data:{x:y,y:x}}}});function D5(e){const[t,n="center"]=e.split("-");return[t,n]}var Hb=R5,lp=A5,$b=N5,Ub=L5,I5=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"}),tY="VisuallyHidden",P5=_.forwardRef((e,t)=>m.jsx(Kt.span,{...e,ref:t,style:{...I5,...e.style}}));P5.displayName=tY;var nY=P5,[Vb]=la("Tooltip",[wl]),Wb=wl(),O5="TooltipProvider",rY=700,XS="tooltip.open",[iY,DC]=Vb(O5),j5=e=>{const{__scopeTooltip:t,delayDuration:n=rY,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=_.useRef(!0),l=_.useRef(!1),c=_.useRef(0);return _.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),m.jsx(iY,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:_.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:s})};j5.displayName=O5;var Tf="Tooltip",[sY,cp]=Vb(Tf),z5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,c=DC(Tf,e.__scopeTooltip),d=Wb(t),[f,h]=_.useState(null),g=Xo(),v=_.useRef(0),y=o??c.disableHoverableContent,x=l??c.delayDuration,w=_.useRef(!1),[C,E]=id({prop:r,defaultProp:i??!1,onChange:D=>{D?(c.onOpen(),document.dispatchEvent(new CustomEvent(XS))):c.onClose(),s==null||s(D)},caller:Tf}),R=_.useMemo(()=>C?w.current?"delayed-open":"instant-open":"closed",[C]),T=_.useCallback(()=>{window.clearTimeout(v.current),v.current=0,w.current=!1,E(!0)},[E]),A=_.useCallback(()=>{window.clearTimeout(v.current),v.current=0,E(!1)},[E]),N=_.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{w.current=!0,E(!0),v.current=0},x)},[x,E]);return _.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),m.jsx(Hb,{...d,children:m.jsx(sY,{scope:t,contentId:g,open:C,stateAttribute:R,trigger:f,onTriggerChange:h,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?N():T()},[c.isOpenDelayedRef,N,T]),onTriggerLeave:_.useCallback(()=>{y?A():(window.clearTimeout(v.current),v.current=0)},[A,y]),onOpen:T,onClose:A,disableHoverableContent:y,children:n})})};z5.displayName=Tf;var QS="TooltipTrigger",B5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=cp(QS,n),s=DC(QS,n),o=Wb(n),l=_.useRef(null),c=dn(t,l,i.onTriggerChange),d=_.useRef(!1),f=_.useRef(!1),h=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(lp,{asChild:!0,...o,children:m.jsx(Kt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:Ze(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Ze(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Ze(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ze(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Ze(e.onBlur,i.onClose),onClick:Ze(e.onClick,i.onClose)})})});B5.displayName=QS;var IC="TooltipPortal",[oY,aY]=Vb(IC,{forceMount:void 0}),F5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=cp(IC,t);return m.jsx(oY,{scope:t,forceMount:n,children:m.jsx(Ss,{present:n||s.open,children:m.jsx(Ed,{asChild:!0,container:i,children:r})})})};F5.displayName=IC;var od="TooltipContent",H5=_.forwardRef((e,t)=>{const n=aY(od,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=cp(od,e.__scopeTooltip);return m.jsx(Ss,{present:r||o.open,children:o.disableHoverableContent?m.jsx($5,{side:i,...s,ref:t}):m.jsx(lY,{side:i,...s,ref:t})})}),lY=_.forwardRef((e,t)=>{const n=cp(od,e.__scopeTooltip),r=DC(od,e.__scopeTooltip),i=_.useRef(null),s=dn(t,i),[o,l]=_.useState(null),{trigger:c,onClose:d}=n,f=i.current,{onPointerInTransitChange:h}=r,g=_.useCallback(()=>{l(null),h(!1)},[h]),v=_.useCallback((y,x)=>{const w=y.currentTarget,C={x:y.clientX,y:y.clientY},E=fY(C,w.getBoundingClientRect()),R=pY(C,E),T=mY(x.getBoundingClientRect()),A=vY([...R,...T]);l(A),h(!0)},[h]);return _.useEffect(()=>()=>g(),[g]),_.useEffect(()=>{if(c&&f){const y=w=>v(w,f),x=w=>v(w,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",x)}}},[c,f,v,g]),_.useEffect(()=>{if(o){const y=x=>{const w=x.target,C={x:x.clientX,y:x.clientY},E=(c==null?void 0:c.contains(w))||(f==null?void 0:f.contains(w)),R=!gY(C,o);E?g():R&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,o,d,g]),m.jsx($5,{...e,ref:s})}),[cY,uY]=Vb(Tf,{isInside:!1}),dY=vW("TooltipContent"),$5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,c=cp(od,n),d=Wb(n),{onClose:f}=c;return _.useEffect(()=>(document.addEventListener(XS,f),()=>document.removeEventListener(XS,f)),[f]),_.useEffect(()=>{if(c.trigger){const h=g=>{const v=g.target;v!=null&&v.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),m.jsx(kd,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs($b,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[m.jsx(dY,{children:r}),m.jsx(cY,{scope:n,isInside:!0,children:m.jsx(nY,{id:c.contentId,role:"tooltip",children:i||r})})]})})});H5.displayName=od;var U5="TooltipArrow",hY=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Wb(n);return uY(U5,n).isInside?null:m.jsx(Ub,{...i,...r,ref:t})});hY.displayName=U5;function fY(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function pY(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function mY(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function gY(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const l=t[s],c=t[o],d=l.x,f=l.y,h=c.x,g=c.y;f>r!=g>r&&n<(h-d)*(r-f)/(g-f)+d&&(i=!i)}return i}function vY(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),bY(t)}function bY(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var _Y=j5,V5=z5,W5=B5,G5=F5,PC=H5;function q5({className:e,...t}){return m.jsx("kbd",{className:xe("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",e),...t})}function yY({className:e,...t}){return m.jsx("span",{className:xe("inline-flex items-center gap-0.5",e),...t})}const xY="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",SY=_Y,Os=V5,js=W5,gs=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(G5,{children:m.jsx(PC,{ref:r,sideOffset:t,className:xe("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));gs.displayName=PC.displayName;const Ev=V5,Rv=W5;function K5(e){return e.toUpperCase()}function wY(e){const t=e.split("+");return m.jsx(yY,{children:t.map((n,r)=>m.jsx(q5,{children:K5(n)},`${n}-${r}`))})}const Af=_.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...i},s)=>{const o=r===void 0?null:Array.isArray(r)?r[0]??null:r;return m.jsx(G5,{children:m.jsx(PC,{ref:s,sideOffset:t,className:xe(xY,e),...i,children:o?wY(o):m.jsx("span",{children:typeof n=="string"?K5(n):n})})})});Af.displayName="HotkeyTooltipContent";const CY="0.41.6",kY={version:CY},Kn="Kanna",SN="kanna",EY=".kanna",RY=".kanna-dev",TY="KANNA_RUNTIME_PROFILE",OC=`kanna/${kY.version}`,AY="[kanna]",NY=`~/${Kn}`;function Gb(){var t;return(t=globalThis.process)==null?void 0:t.env}function MY(e=Gb()){var t;return((t=e==null?void 0:e[TY])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function LY(e=Gb()){return MY(e)==="dev"?RY:EY}function DY(e=Gb()){return`~/${LY(e)}`}function IY(e=Gb()){return`${DY(e)}/keybindings.json`}function Xm(e){return e?`${SN} ${e}`:SN}const wN=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const g=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(v=>v(t,g))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>c,subscribe:d=>(n.add(d),()=>n.delete(d))},c=t=e(r,i,l);return l},PY=(e=>e?wN(e):wN),OY=e=>e;function jY(e,t=OY){const n=wn.useSyncExternalStore(e.subscribe,wn.useCallback(()=>t(e.getState()),[e,t]),wn.useCallback(()=>t(e.getInitialState()),[e,t]));return wn.useDebugValue(n),n}const zY=e=>{const t=PY(e),n=r=>jY(t,r);return Object.assign(n,t),n},Cl=(e=>zY),Y5="always",X5="funk",BY=[{value:"blow",label:"Blow"},{value:"bottle",label:"Bottle"},{value:"frog",label:"Frog"},{value:"funk",label:"Funk"},{value:"glass",label:"Glass"},{value:"ping",label:"Ping"},{value:"pop",label:"Pop"},{value:"purr",label:"Purr"},{value:"tink",label:"Tink"}];function FY(e){switch(e){case"never":case"unfocused":case"always":return e;default:return Y5}}function HY(e){switch(e){case"blow":case"bottle":case"frog":case"funk":case"glass":case"ping":case"pop":case"purr":case"tink":return e;default:return X5}}const ac=Cl()(e=>({chatSoundPreference:Y5,chatSoundId:X5,setChatSoundPreference:t=>e({chatSoundPreference:FY(t)}),setChatSoundId:t=>e({chatSoundId:HY(t)})})),$Y={blow:"/chat-sounds/Blow.mp3",bottle:"/chat-sounds/Bottle.mp3",frog:"/chat-sounds/Frog.mp3",funk:"/chat-sounds/Funk.mp3",glass:"/chat-sounds/Glass.mp3",ping:"/chat-sounds/Ping.mp3",pop:"/chat-sounds/Pop.mp3",purr:"/chat-sounds/Purr.mp3",tink:"/chat-sounds/Tink.mp3"};function UY(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function VY(e){const t=new Audio($Y[e]);return t.preload="auto",t.play()}async function ZS(e,t){if(t<=0)return;const n=Array.from({length:t},(r,i)=>new Promise(s=>{window.setTimeout(()=>{VY(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function WY(e,t=document){return e==="never"?!1:e==="always"?!0:UY(t)}function GY(e){return e.projectGroups.reduce((t,n)=>t+n.chats.reduce((r,i)=>r+(i.unread?1:0)+(i.status==="waiting_for_user"?1:0),0),0)}function CN(e){let t=0;const n=new Set;for(const r of e.projectGroups)for(const i of r.chats)i.unread&&(t+=1),i.status==="waiting_for_user"&&n.add(i.chatId);return{unreadCount:t,waitingChatIds:n}}function qY(e,t){if(!e)return 0;const n=CN(e),r=CN(t),i=Math.max(0,r.unreadCount-n.unreadCount);let s=0;for(const o of r.waitingChatIds)n.waitingChatIds.has(o)||(s+=1);return i+s}function JS(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const KY=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function YY(e){const t=e.trim();for(const n of KY){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function ew(e){return e.split("/").pop()||e}const XY=1440*6e4;function Q5(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=XY,o=7*s;return n<r?"now":n<i?`${Math.floor(n/r)}m`:n<s?`${Math.floor(n/i)}h`:n<o?`${Math.floor(n/s)}d`:`${Math.floor(n/o)}w`}function Z5(e){return e.lastMessageAt??e._creationTime}const Nd=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...i})=>m.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:xe("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...i,children:e});function jC(e){const t=e+"CollectionProvider",[n,r]=la(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=x=>{const{scope:w,children:C}=x,E=wn.useRef(null),R=wn.useRef(new Map).current;return m.jsx(i,{scope:w,itemMap:R,collectionRef:E,children:C})};o.displayName=t;const l=e+"CollectionSlot",c=vc(l),d=wn.forwardRef((x,w)=>{const{scope:C,children:E}=x,R=s(l,C),T=dn(w,R.collectionRef);return m.jsx(c,{ref:T,children:E})});d.displayName=l;const f=e+"CollectionItemSlot",h="data-radix-collection-item",g=vc(f),v=wn.forwardRef((x,w)=>{const{scope:C,children:E,...R}=x,T=wn.useRef(null),A=dn(w,T),N=s(f,C);return wn.useEffect(()=>(N.itemMap.set(T,{ref:T,...R}),()=>void N.itemMap.delete(T))),m.jsx(g,{[h]:"",ref:A,children:E})});v.displayName=f;function y(x){const w=s(e+"CollectionConsumer",x);return wn.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const R=Array.from(E.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((N,D)=>R.indexOf(N.ref.current)-R.indexOf(D.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:d,ItemSlot:v},y,r]}var QY=_.createContext(void 0);function zC(e){const t=_.useContext(QY);return e||t||"ltr"}var ix="rovingFocusGroup.onEntryFocus",ZY={bubbles:!1,cancelable:!0},up="RovingFocusGroup",[tw,J5,JY]=jC(up),[eX,ej]=la(up,[JY]),[tX,nX]=eX(up),tj=_.forwardRef((e,t)=>m.jsx(tw.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(tw.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(rX,{...e,ref:t})})}));tj.displayName=up;var rX=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=e,g=_.useRef(null),v=dn(t,g),y=zC(s),[x,w]=id({prop:o,defaultProp:l??null,onChange:c,caller:up}),[C,E]=_.useState(!1),R=Hs(d),T=J5(n),A=_.useRef(!1),[N,D]=_.useState(0);return _.useEffect(()=>{const I=g.current;if(I)return I.addEventListener(ix,R),()=>I.removeEventListener(ix,R)},[R]),m.jsx(tX,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:x,onItemFocus:_.useCallback(I=>w(I),[w]),onItemShiftTab:_.useCallback(()=>E(!0),[]),onFocusableItemAdd:_.useCallback(()=>D(I=>I+1),[]),onFocusableItemRemove:_.useCallback(()=>D(I=>I-1),[]),children:m.jsx(Kt.div,{tabIndex:C||N===0?-1:0,"data-orientation":r,...h,ref:v,style:{outline:"none",...e.style},onMouseDown:Ze(e.onMouseDown,()=>{A.current=!0}),onFocus:Ze(e.onFocus,I=>{const G=!A.current;if(I.target===I.currentTarget&&G&&!C){const z=new CustomEvent(ix,ZY);if(I.currentTarget.dispatchEvent(z),!z.defaultPrevented){const H=T().filter(j=>j.focusable),$=H.find(j=>j.active),O=H.find(j=>j.id===x),U=[$,O,...H].filter(Boolean).map(j=>j.ref.current);ij(U,f)}}A.current=!1}),onBlur:Ze(e.onBlur,()=>E(!1))})})}),nj="RovingFocusGroupItem",rj=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...l}=e,c=Xo(),d=s||c,f=nX(nj,n),h=f.currentTabStopId===d,g=J5(n),{onFocusableItemAdd:v,onFocusableItemRemove:y,currentTabStopId:x}=f;return _.useEffect(()=>{if(r)return v(),()=>y()},[r,v,y]),m.jsx(tw.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:m.jsx(Kt.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:Ze(e.onMouseDown,w=>{r?f.onItemFocus(d):w.preventDefault()}),onFocus:Ze(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:Ze(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const C=oX(w,f.orientation,f.dir);if(C!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let R=g().filter(T=>T.focusable).map(T=>T.ref.current);if(C==="last")R.reverse();else if(C==="prev"||C==="next"){C==="prev"&&R.reverse();const T=R.indexOf(w.currentTarget);R=f.loop?aX(R,T+1):R.slice(T+1)}setTimeout(()=>ij(R))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:x!=null}):o})})});rj.displayName=nj;var iX={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function sX(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function oX(e,t,n){const r=sX(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return iX[r]}function ij(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function aX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var lX=tj,cX=rj,nw=["Enter"," "],uX=["ArrowDown","PageUp","Home"],sj=["ArrowUp","PageDown","End"],dX=[...uX,...sj],hX={ltr:[...nw,"ArrowRight"],rtl:[...nw,"ArrowLeft"]},fX={ltr:["ArrowLeft"],rtl:["ArrowRight"]},dp="Menu",[Nf,pX,mX]=jC(dp),[Lc,oj]=la(dp,[mX,wl,ej]),qb=wl(),aj=ej(),[gX,Dc]=Lc(dp),[vX,hp]=Lc(dp),lj=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,l=qb(t),[c,d]=_.useState(null),f=_.useRef(!1),h=Hs(s),g=zC(i);return _.useEffect(()=>{const v=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),m.jsx(Hb,{...l,children:m.jsx(gX,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:m.jsx(vX,{scope:t,onClose:_.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:g,modal:o,children:r})})})};lj.displayName=dp;var bX="MenuAnchor",BC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=qb(n);return m.jsx(lp,{...i,...r,ref:t})});BC.displayName=bX;var FC="MenuPortal",[_X,cj]=Lc(FC,{forceMount:void 0}),uj=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Dc(FC,t);return m.jsx(_X,{scope:t,forceMount:n,children:m.jsx(Ss,{present:n||s.open,children:m.jsx(Ed,{asChild:!0,container:i,children:r})})})};uj.displayName=FC;var vs="MenuContent",[yX,HC]=Lc(vs),dj=_.forwardRef((e,t)=>{const n=cj(vs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Dc(vs,e.__scopeMenu),o=hp(vs,e.__scopeMenu);return m.jsx(Nf.Provider,{scope:e.__scopeMenu,children:m.jsx(Ss,{present:r||s.open,children:m.jsx(Nf.Slot,{scope:e.__scopeMenu,children:o.modal?m.jsx(xX,{...i,ref:t}):m.jsx(SX,{...i,ref:t})})})})}),xX=_.forwardRef((e,t)=>{const n=Dc(vs,e.__scopeMenu),r=_.useRef(null),i=dn(t,r);return _.useEffect(()=>{const s=r.current;if(s)return Ib(s)},[]),m.jsx($C,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ze(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),SX=_.forwardRef((e,t)=>{const n=Dc(vs,e.__scopeMenu);return m.jsx($C,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),wX=vc("MenuContent.ScrollLock"),$C=_.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:v,disableOutsideScroll:y,...x}=e,w=Dc(vs,n),C=hp(vs,n),E=qb(n),R=aj(n),T=pX(n),[A,N]=_.useState(null),D=_.useRef(null),I=dn(t,D,w.onContentChange),G=_.useRef(0),z=_.useRef(""),H=_.useRef(0),$=_.useRef(null),O=_.useRef("right"),B=_.useRef(0),U=y?op:_.Fragment,j=y?{as:wX,allowPinchZoom:!0}:void 0,V=K=>{var se,ge;const L=z.current+K,W=T().filter(de=>!de.disabled),Z=document.activeElement,P=(se=W.find(de=>de.ref.current===Z))==null?void 0:se.textValue,ne=W.map(de=>de.textValue),ie=PX(ne,L,P),oe=(ge=W.find(de=>de.textValue===ie))==null?void 0:ge.ref.current;(function de(ve){z.current=ve,window.clearTimeout(G.current),ve!==""&&(G.current=window.setTimeout(()=>de(""),1e3))})(L),oe&&setTimeout(()=>oe.focus())};_.useEffect(()=>()=>window.clearTimeout(G.current),[]),Lb();const F=_.useCallback(K=>{var W,Z;return O.current===((W=$.current)==null?void 0:W.side)&&jX(K,(Z=$.current)==null?void 0:Z.area)},[]);return m.jsx(yX,{scope:n,searchRef:z,onItemEnter:_.useCallback(K=>{F(K)&&K.preventDefault()},[F]),onItemLeave:_.useCallback(K=>{var L;F(K)||((L=D.current)==null||L.focus(),N(null))},[F]),onTriggerLeave:_.useCallback(K=>{F(K)&&K.preventDefault()},[F]),pointerGraceTimerRef:H,onPointerGraceIntentChange:_.useCallback(K=>{$.current=K},[]),children:m.jsx(U,{...j,children:m.jsx(sp,{asChild:!0,trapped:i,onMountAutoFocus:Ze(s,K=>{var L;K.preventDefault(),(L=D.current)==null||L.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:m.jsx(kd,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:v,children:m.jsx(lX,{asChild:!0,...R,dir:C.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:N,onEntryFocus:Ze(c,K=>{C.isUsingKeyboardRef.current||K.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx($b,{role:"menu","aria-orientation":"vertical","data-state":Rj(w.open),"data-radix-menu-content":"",dir:C.dir,...E,...x,ref:I,style:{outline:"none",...x.style},onKeyDown:Ze(x.onKeyDown,K=>{const W=K.target.closest("[data-radix-menu-content]")===K.currentTarget,Z=K.ctrlKey||K.altKey||K.metaKey,P=K.key.length===1;W&&(K.key==="Tab"&&K.preventDefault(),!Z&&P&&V(K.key));const ne=D.current;if(K.target!==ne||!dX.includes(K.key))return;K.preventDefault();const oe=T().filter(se=>!se.disabled).map(se=>se.ref.current);sj.includes(K.key)&&oe.reverse(),DX(oe)}),onBlur:Ze(e.onBlur,K=>{K.currentTarget.contains(K.target)||(window.clearTimeout(G.current),z.current="")}),onPointerMove:Ze(e.onPointerMove,Mf(K=>{const L=K.target,W=B.current!==K.clientX;if(K.currentTarget.contains(L)&&W){const Z=K.clientX>B.current?"right":"left";O.current=Z,B.current=K.clientX}}))})})})})})})});dj.displayName=vs;var CX="MenuGroup",UC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Kt.div,{role:"group",...r,ref:t})});UC.displayName=CX;var kX="MenuLabel",hj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Kt.div,{...r,ref:t})});hj.displayName=kX;var Tv="MenuItem",kN="menu.itemSelect",Kb=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=_.useRef(null),o=hp(Tv,e.__scopeMenu),l=HC(Tv,e.__scopeMenu),c=dn(t,s),d=_.useRef(!1),f=()=>{const h=s.current;if(!n&&h){const g=new CustomEvent(kN,{bubbles:!0,cancelable:!0});h.addEventListener(kN,v=>r==null?void 0:r(v),{once:!0}),gO(h,g),g.defaultPrevented?d.current=!1:o.onClose()}};return m.jsx(fj,{...i,ref:c,disabled:n,onClick:Ze(e.onClick,f),onPointerDown:h=>{var g;(g=e.onPointerDown)==null||g.call(e,h),d.current=!0},onPointerUp:Ze(e.onPointerUp,h=>{var g;d.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:Ze(e.onKeyDown,h=>{const g=l.searchRef.current!=="";n||g&&h.key===" "||nw.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Kb.displayName=Tv;var fj=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=HC(Tv,n),l=aj(n),c=_.useRef(null),d=dn(t,c),[f,h]=_.useState(!1),[g,v]=_.useState("");return _.useEffect(()=>{const y=c.current;y&&v((y.textContent??"").trim())},[s.children]),m.jsx(Nf.ItemSlot,{scope:n,disabled:r,textValue:i??g,children:m.jsx(cX,{asChild:!0,...l,focusable:!r,children:m.jsx(Kt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:Ze(e.onPointerMove,Mf(y=>{r?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ze(e.onPointerLeave,Mf(y=>o.onItemLeave(y))),onFocus:Ze(e.onFocus,()=>h(!0)),onBlur:Ze(e.onBlur,()=>h(!1))})})})}),EX="MenuCheckboxItem",pj=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return m.jsx(_j,{scope:e.__scopeMenu,checked:n,children:m.jsx(Kb,{role:"menuitemcheckbox","aria-checked":Av(n)?"mixed":n,...i,ref:t,"data-state":WC(n),onSelect:Ze(i.onSelect,()=>r==null?void 0:r(Av(n)?!0:!n),{checkForDefaultPrevented:!1})})})});pj.displayName=EX;var mj="MenuRadioGroup",[RX,TX]=Lc(mj,{value:void 0,onValueChange:()=>{}}),gj=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=Hs(r);return m.jsx(RX,{scope:e.__scopeMenu,value:n,onValueChange:s,children:m.jsx(UC,{...i,ref:t})})});gj.displayName=mj;var vj="MenuRadioItem",bj=_.forwardRef((e,t)=>{const{value:n,...r}=e,i=TX(vj,e.__scopeMenu),s=n===i.value;return m.jsx(_j,{scope:e.__scopeMenu,checked:s,children:m.jsx(Kb,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":WC(s),onSelect:Ze(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});bj.displayName=vj;var VC="MenuItemIndicator",[_j,AX]=Lc(VC,{checked:!1}),yj=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=AX(VC,n);return m.jsx(Ss,{present:r||Av(s.checked)||s.checked===!0,children:m.jsx(Kt.span,{...i,ref:t,"data-state":WC(s.checked)})})});yj.displayName=VC;var NX="MenuSeparator",xj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Kt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});xj.displayName=NX;var MX="MenuArrow",Sj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=qb(n);return m.jsx(Ub,{...i,...r,ref:t})});Sj.displayName=MX;var LX="MenuSub",[oCe,wj]=Lc(LX),Xh="MenuSubTrigger",Cj=_.forwardRef((e,t)=>{const n=Dc(Xh,e.__scopeMenu),r=hp(Xh,e.__scopeMenu),i=wj(Xh,e.__scopeMenu),s=HC(Xh,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=s,d={__scopeMenu:e.__scopeMenu},f=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>f,[f]),_.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),m.jsx(BC,{asChild:!0,...d,children:m.jsx(fj,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Rj(n.open),...e,ref:fC(t,i.onTriggerChange),onClick:h=>{var g;(g=e.onClick)==null||g.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ze(e.onPointerMove,Mf(h=>{s.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Ze(e.onPointerLeave,Mf(h=>{var v,y;f();const g=(v=n.content)==null?void 0:v.getBoundingClientRect();if(g){const x=(y=n.content)==null?void 0:y.dataset.side,w=x==="right",C=w?-5:5,E=g[w?"left":"right"],R=g[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+C,y:h.clientY},{x:E,y:g.top},{x:R,y:g.top},{x:R,y:g.bottom},{x:E,y:g.bottom}],side:x}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Ze(e.onKeyDown,h=>{var v;const g=s.searchRef.current!=="";e.disabled||g&&h.key===" "||hX[r.dir].includes(h.key)&&(n.onOpenChange(!0),(v=n.content)==null||v.focus(),h.preventDefault())})})})});Cj.displayName=Xh;var kj="MenuSubContent",Ej=_.forwardRef((e,t)=>{const n=cj(vs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Dc(vs,e.__scopeMenu),o=hp(vs,e.__scopeMenu),l=wj(kj,e.__scopeMenu),c=_.useRef(null),d=dn(t,c);return m.jsx(Nf.Provider,{scope:e.__scopeMenu,children:m.jsx(Ss,{present:r||s.open,children:m.jsx(Nf.Slot,{scope:e.__scopeMenu,children:m.jsx($C,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:d,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;o.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Ze(e.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Ze(e.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:Ze(e.onKeyDown,f=>{var v;const h=f.currentTarget.contains(f.target),g=fX[o.dir].includes(f.key);h&&g&&(s.onOpenChange(!1),(v=l.trigger)==null||v.focus(),f.preventDefault())})})})})})});Ej.displayName=kj;function Rj(e){return e?"open":"closed"}function Av(e){return e==="indeterminate"}function WC(e){return Av(e)?"indeterminate":e?"checked":"unchecked"}function DX(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function IX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function PX(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=IX(e,Math.max(s,0));i.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function OX(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const l=t[s],c=t[o],d=l.x,f=l.y,h=c.x,g=c.y;f>r!=g>r&&n<(h-d)*(r-f)/(g-f)+d&&(i=!i)}return i}function jX(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return OX(n,t)}function Mf(e){return t=>t.pointerType==="mouse"?e(t):void 0}var zX=lj,BX=BC,FX=uj,HX=dj,$X=UC,UX=hj,VX=Kb,WX=pj,GX=gj,qX=bj,KX=yj,YX=xj,XX=Sj,QX=Cj,ZX=Ej,GC="ContextMenu",[JX]=la(GC,[oj]),ii=oj(),[eQ,Tj]=JX(GC),Aj=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:s=!0}=e,[o,l]=_.useState(!1),c=ii(t),d=Hs(r),f=_.useCallback(h=>{l(h),d(h)},[d]);return m.jsx(eQ,{scope:t,open:o,onOpenChange:f,modal:s,children:m.jsx(zX,{...c,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};Aj.displayName=GC;var Nj="ContextMenuTrigger",Mj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,s=Tj(Nj,n),o=ii(n),l=_.useRef({x:0,y:0}),c=_.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=_.useRef(0),f=_.useCallback(()=>window.clearTimeout(d.current),[]),h=g=>{l.current={x:g.clientX,y:g.clientY},s.onOpenChange(!0)};return _.useEffect(()=>f,[f]),_.useEffect(()=>void(r&&f()),[r,f]),m.jsxs(m.Fragment,{children:[m.jsx(BX,{...o,virtualRef:c}),m.jsx(Kt.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Ze(e.onContextMenu,g=>{f(),h(g),g.preventDefault()}),onPointerDown:r?e.onPointerDown:Ze(e.onPointerDown,Qm(g=>{f(),d.current=window.setTimeout(()=>h(g),700)})),onPointerMove:r?e.onPointerMove:Ze(e.onPointerMove,Qm(f)),onPointerCancel:r?e.onPointerCancel:Ze(e.onPointerCancel,Qm(f)),onPointerUp:r?e.onPointerUp:Ze(e.onPointerUp,Qm(f))})]})});Mj.displayName=Nj;var tQ="ContextMenuPortal",Lj=e=>{const{__scopeContextMenu:t,...n}=e,r=ii(t);return m.jsx(FX,{...r,...n})};Lj.displayName=tQ;var Dj="ContextMenuContent",Ij=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Tj(Dj,n),s=ii(n),o=_.useRef(!1);return m.jsx(HX,{...s,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var c;(c=e.onCloseAutoFocus)==null||c.call(e,l),!l.defaultPrevented&&o.current&&l.preventDefault(),o.current=!1},onInteractOutside:l=>{var c;(c=e.onInteractOutside)==null||c.call(e,l),!l.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ij.displayName=Dj;var nQ="ContextMenuGroup",rQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx($X,{...i,...r,ref:t})});rQ.displayName=nQ;var iQ="ContextMenuLabel",sQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(UX,{...i,...r,ref:t})});sQ.displayName=iQ;var oQ="ContextMenuItem",Pj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(VX,{...i,...r,ref:t})});Pj.displayName=oQ;var aQ="ContextMenuCheckboxItem",lQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(WX,{...i,...r,ref:t})});lQ.displayName=aQ;var cQ="ContextMenuRadioGroup",uQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(GX,{...i,...r,ref:t})});uQ.displayName=cQ;var dQ="ContextMenuRadioItem",hQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(qX,{...i,...r,ref:t})});hQ.displayName=dQ;var fQ="ContextMenuItemIndicator",pQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(KX,{...i,...r,ref:t})});pQ.displayName=fQ;var mQ="ContextMenuSeparator",Oj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(YX,{...i,...r,ref:t})});Oj.displayName=mQ;var gQ="ContextMenuArrow",vQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(XX,{...i,...r,ref:t})});vQ.displayName=gQ;var bQ="ContextMenuSubTrigger",_Q=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(QX,{...i,...r,ref:t})});_Q.displayName=bQ;var yQ="ContextMenuSubContent",xQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(ZX,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});xQ.displayName=yQ;function Qm(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var SQ=Aj,wQ=Mj,CQ=Lj,jj=Ij,zj=Pj,Bj=Oj;const Fj=_.createContext(null);function bl({onOpenChange:e,...t}){const[n,r]=_.useState(0),i=_.useCallback(()=>{r(s=>s+1),e==null||e(!1)},[e]);return m.jsx(Fj.Provider,{value:i,children:m.jsx(SQ,{onOpenChange:e,...t},n)})}const _l=wQ,ra=_.forwardRef(({className:e,...t},n)=>m.jsx(CQ,{children:m.jsx(jj,{ref:n,className:xe("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg outline-hidden 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",e),...t})}));ra.displayName=jj.displayName;const En=_.forwardRef(({className:e,onSelect:t,...n},r)=>{const i=_.useContext(Fj);return m.jsx(zj,{ref:r,className:xe("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-muted focus:bg-muted data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onSelect:s=>{t==null||t(s),i==null||i()},...n})});En.displayName=zj.displayName;const Hj=_.forwardRef(({className:e,...t},n)=>m.jsx(Bj,{ref:n,className:xe("-mx-1 my-1 h-px bg-border",e),...t}));Hj.displayName=Bj.displayName;function kQ({editorLabel:e,onRename:t,onCopyPath:n,onShowArchived:r,onOpenInFinder:i,onOpenInEditor:s,onHide:o,children:l}){return m.jsxs(bl,{children:[m.jsx(_l,{asChild:!0,children:l}),m.jsxs(ra,{children:[m.jsxs(En,{onSelect:c=>{c.preventDefault(),t()},children:[m.jsx(Ab,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),m.jsxs(En,{onSelect:c=>{c.stopPropagation(),n()},children:[m.jsx(pl,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Copy Path"})]}),m.jsxs(En,{onSelect:c=>{c.stopPropagation(),r()},children:[m.jsx(oC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show Archived"})]}),m.jsxs(En,{onSelect:c=>{c.stopPropagation(),i()},children:[m.jsx(Rb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show in Finder"})]}),m.jsxs(En,{onSelect:c=>{c.stopPropagation(),s()},children:[m.jsx(aC,{className:"h-3.5 w-3.5"}),m.jsxs("span",{className:"text-xs font-medium",children:["Open in ",e]})]}),m.jsxs(En,{onSelect:c=>{c.stopPropagation(),o()},children:[m.jsx(sU,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})]})]})}function EQ({canFork:e,onRename:t,onShare:n,onOpenInFinder:r,onFork:i,onArchive:s,onDelete:o,children:l}){return m.jsxs(bl,{children:[m.jsx(_l,{asChild:!0,children:l}),m.jsxs(ra,{children:[m.jsxs(En,{onSelect:c=>{c.preventDefault(),t()},children:[m.jsx(Ab,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),m.jsxs(En,{onSelect:c=>{c.preventDefault(),n()},children:[m.jsx(hC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Share"})]}),m.jsxs(En,{onSelect:c=>{c.preventDefault(),r()},children:[m.jsx(Rb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Open in Finder"})]}),m.jsxs(En,{disabled:!e,onSelect:c=>{c.preventDefault(),e&&i()},children:[m.jsx(pO,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Fork"})]}),m.jsxs(En,{onSelect:c=>{c.preventDefault(),s()},children:[m.jsx(oC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Archive"})]}),m.jsxs(En,{onSelect:c=>{c.preventDefault(),o()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[m.jsx(kf,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Delete"})]})]})]})}const RQ=new Set(["starting","running"]);function TQ({chat:e,activeChatId:t,nowMs:n,shortcutHint:r=null,showShortcutHint:i=!1,onSelectChat:s,onRenameChat:o,onShareChat:l,onOpenInFinder:c,onForkChat:d,onArchiveChat:f,onDeleteChat:h}){const g=Q5(Z5(e),n),v=i&&r?r:g,y=i&&!!r,x=Nq(e.chatId),w=m.jsxs("div",{"data-chat-id":x,className:xe("group flex items-center gap-2 pl-[9px] pr-0.5 py-0.5 rounded-lg cursor-pointer border-border/0 hover:border-border hover:bg-muted/20 active:scale-[0.985] border transition-all",t===x?"bg-muted hover:bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>s(e.chatId),children:[RQ.has(e.status)?m.jsx(ln,{className:"size-3.5 flex-shrink-0 animate-spin text-logo"}):e.status==="waiting_for_user"?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):e.unread?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,m.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?m.jsx(Nd,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.status!=="idle"||t===x||e.unread?m.jsx("span",{className:"",children:e.title}):m.jsx("span",{className:"text-slate-500 dark:text-slate-400",children:e.title})}),m.jsxs("div",{className:xe("relative h-7 mr-[2px] shrink-0",e.canFork?"w-12":"w-6"),children:[v?y?m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-0.5 text-[11px] text-foreground transition-opacity group-hover:opacity-0",children:m.jsx(q5,{className:"h-4 min-w-4 rounded-sm border-border/50 bg-transparent px-1 text-[10px]",children:r})}):m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-2 text-[11px] text-muted-foreground opacity-60 transition-opacity group-hover:opacity-0",children:v}):null,m.jsxs("div",{className:xe("absolute inset-0 flex items-center justify-end gap-0 opacity-100 mr-[3px]",v?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),children:[e.canFork?m.jsx(qe,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:C=>{C.stopPropagation(),d(e.chatId)},title:"Fork chat",children:m.jsx(pO,{className:"size-3.5"})}):null,m.jsx(qe,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:C=>{C.stopPropagation(),f(e.chatId)},title:"Archive chat",children:m.jsx(oC,{className:"size-3.5"})})]})]})]},e._id);return m.jsx(EQ,{canFork:e.canFork,onRename:()=>o(e.chatId),onShare:()=>l(e.chatId),onOpenInFinder:()=>c(e.localPath),onFork:()=>d(e.chatId),onArchive:()=>f(e.chatId),onDelete:()=>h(e.chatId),children:w})}const AQ=_.memo(TQ);function NQ(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const Yb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Md(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function qC(e){return"nodeType"in e}function xi(e){var t,n;return e?Md(e)?e:qC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function KC(e){const{Document:t}=xi(e);return e instanceof t}function fp(e){return Md(e)?!1:e instanceof xi(e).HTMLElement}function $j(e){return e instanceof xi(e).SVGElement}function Ld(e){return e?Md(e)?e.document:qC(e)?KC(e)?e:fp(e)||$j(e)?e.ownerDocument:document:document:document}const mo=Yb?_.useLayoutEffect:_.useEffect;function YC(e){const t=_.useRef(e);return mo(()=>{t.current=e}),_.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function MQ(){const e=_.useRef(null),t=_.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Lf(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return mo(()=>{n.current!==e&&(n.current=e)},t),n}function pp(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Nv(e){const t=YC(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function rw(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let sx={};function mp(e,t){return _.useMemo(()=>{if(t)return t;const n=sx[e]==null?0:sx[e]+1;return sx[e]=n,e+"-"+n},[e,t])}function Uj(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const l=Object.entries(o);for(const[c,d]of l){const f=s[c];f!=null&&(s[c]=f+e*d)}return s},{...t})}}const Ku=Uj(1),Mv=Uj(-1);function LQ(e){return"clientX"in e&&"clientY"in e}function XC(e){if(!e)return!1;const{KeyboardEvent:t}=xi(e.target);return t&&e instanceof t}function DQ(e){if(!e)return!1;const{TouchEvent:t}=xi(e.target);return t&&e instanceof t}function iw(e){if(DQ(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return LQ(e)?{x:e.clientX,y:e.clientY}:null}const Df=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Df.Translate.toString(e),Df.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),EN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function IQ(e){return e.matches(EN)?e:e.querySelector(EN)}const PQ={display:"none"};function OQ(e){let{id:t,value:n}=e;return wn.createElement("div",{id:t,style:PQ},n)}function jQ(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return wn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function zQ(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Vj=_.createContext(null);function BQ(e){const t=_.useContext(Vj);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function FQ(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:i,event:s}=r;e.forEach(o=>{var l;return(l=o[i])==null?void 0:l.call(o,s)})},[e]),t]}const HQ={draggable:`
660
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},IG="DialogDescriptionWarning",PG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$O(IG).contentName}}.`;return _.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},OG=AO,jG=LO,UO=DO,VO=IO,zG=OO,BG=zO,FG=FO;function WO(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=WO(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function GO(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=WO(e))&&(r&&(r+=" "),r+=t);return r}const HG=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},$G=(e,t)=>({classGroupId:e,validator:t}),qO=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),_v="-",tN=[],UG="arbitrary..",VG=e=>{const t=GG(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return WG(o);const l=o.split(_v),c=l[0]===""&&l.length>1?1:0;return KO(l,c,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const c=r[o],d=n[o];return c?d?HG(d,c):c:d||tN}return n[o]||tN}}},KO=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],s=n.nextPart.get(i);if(s){const d=KO(e,t+1,s);if(d)return d}const o=n.validators;if(o===null)return;const l=t===0?e.join(_v):e.slice(t).join(_v),c=o.length;for(let d=0;d<c;d++){const f=o[d];if(f.validator(l))return f.classGroupId}},WG=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?UG+r:void 0})(),GG=e=>{const{theme:t,classGroups:n}=e;return qG(n,t)},qG=(e,t)=>{const n=qO();for(const r in e){const i=e[r];vC(i,n,r,t)}return n},vC=(e,t,n,r)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];KG(o,t,n,r)}},KG=(e,t,n,r)=>{if(typeof e=="string"){YG(e,t,n);return}if(typeof e=="function"){XG(e,t,n,r);return}QG(e,t,n,r)},YG=(e,t,n)=>{const r=e===""?t:YO(t,e);r.classGroupId=n},XG=(e,t,n,r)=>{if(ZG(e)){vC(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push($G(n,e))},QG=(e,t,n,r)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[l,c]=i[o];vC(c,YO(t,l),n,r)}},YO=(e,t)=>{let n=e;const r=t.split(_v),i=r.length;for(let s=0;s<i;s++){const o=r[s];let l=n.nextPart.get(o);l||(l=qO(),n.nextPart.set(o,l)),n=l}return n},ZG=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,JG=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(s,o)=>{n[s]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=r[s])!==void 0)return i(s,o),o},set(s,o){s in n?n[s]=o:i(s,o)}}},GS="!",nN=":",eq=[],rN=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),tq=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const s=[];let o=0,l=0,c=0,d;const f=i.length;for(let x=0;x<f;x++){const w=i[x];if(o===0&&l===0){if(w===nN){s.push(i.slice(c,x)),c=x+1;continue}if(w==="/"){d=x;continue}}w==="["?o++:w==="]"?o--:w==="("?l++:w===")"&&l--}const h=s.length===0?i:i.slice(c);let g=h,v=!1;h.endsWith(GS)?(g=h.slice(0,-1),v=!0):h.startsWith(GS)&&(g=h.slice(1),v=!0);const y=d&&d>c?d-c:void 0;return rN(s,v,g,y)};if(t){const i=t+nN,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):rN(eq,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},nq=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let s=0;s<n.length;s++){const o=n[s],l=o[0]==="[",c=t.has(o);l||c?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},rq=e=>({cache:JG(e.cacheSize),parseClassName:tq(e),sortModifiers:nq(e),...VG(e)}),iq=/\s+/,sq=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],l=e.trim().split(iq);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:h,modifiers:g,hasImportantModifier:v,baseClassName:y,maybePostfixModifierPosition:x}=n(f);if(h){c=f+(c.length>0?" "+c:c);continue}let w=!!x,C=r(w?y.substring(0,x):y);if(!C){if(!w){c=f+(c.length>0?" "+c:c);continue}if(C=r(y),!C){c=f+(c.length>0?" "+c:c);continue}w=!1}const E=g.length===0?"":g.length===1?g[0]:s(g).join(":"),R=v?E+GS:E,T=R+C;if(o.indexOf(T)>-1)continue;o.push(T);const A=i(C,w);for(let N=0;N<A.length;++N){const D=A[N];o.push(R+D)}c=f+(c.length>0?" "+c:c)}return c},oq=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=XO(n))&&(i&&(i+=" "),i+=r);return i},XO=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=XO(e[r]))&&(n&&(n+=" "),n+=t);return n},aq=(e,...t)=>{let n,r,i,s;const o=c=>{const d=t.reduce((f,h)=>h(f),e());return n=rq(d),r=n.cache.get,i=n.cache.set,s=l,l(c)},l=c=>{const d=r(c);if(d)return d;const f=sq(c,n);return i(c,f),f};return s=o,(...c)=>s(oq(...c))},lq=[],ar=e=>{const t=n=>n[e]||lq;return t.isThemeGetter=!0,t},QO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ZO=/^\((?:(\w[\w-]*):)?(.+)\)$/i,cq=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,uq=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,dq=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,hq=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,fq=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,pq=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ua=e=>cq.test(e),Ft=e=>!!e&&!Number.isNaN(Number(e)),Va=e=>!!e&&Number.isInteger(Number(e)),ex=e=>e.endsWith("%")&&Ft(e.slice(0,-1)),Po=e=>uq.test(e),JO=()=>!0,mq=e=>dq.test(e)&&!hq.test(e),bC=()=>!1,gq=e=>fq.test(e),vq=e=>pq.test(e),bq=e=>!et(e)&&!rt(e),_q=e=>Sl(e,n5,bC),et=e=>QO.test(e),Kl=e=>Sl(e,r5,mq),iN=e=>Sl(e,Rq,Ft),yq=e=>Sl(e,s5,JO),xq=e=>Sl(e,i5,bC),sN=e=>Sl(e,e5,bC),Sq=e=>Sl(e,t5,vq),qm=e=>Sl(e,o5,gq),rt=e=>ZO.test(e),Dh=e=>Mc(e,r5),wq=e=>Mc(e,i5),oN=e=>Mc(e,e5),Cq=e=>Mc(e,n5),kq=e=>Mc(e,t5),Km=e=>Mc(e,o5,!0),Eq=e=>Mc(e,s5,!0),Sl=(e,t,n)=>{const r=QO.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Mc=(e,t,n=!1)=>{const r=ZO.exec(e);return r?r[1]?t(r[1]):n:!1},e5=e=>e==="position"||e==="percentage",t5=e=>e==="image"||e==="url",n5=e=>e==="length"||e==="size"||e==="bg-size",r5=e=>e==="length",Rq=e=>e==="number",i5=e=>e==="family-name",s5=e=>e==="number"||e==="weight",o5=e=>e==="shadow",Tq=()=>{const e=ar("color"),t=ar("font"),n=ar("text"),r=ar("font-weight"),i=ar("tracking"),s=ar("leading"),o=ar("breakpoint"),l=ar("container"),c=ar("spacing"),d=ar("radius"),f=ar("shadow"),h=ar("inset-shadow"),g=ar("text-shadow"),v=ar("drop-shadow"),y=ar("blur"),x=ar("perspective"),w=ar("aspect"),C=ar("ease"),E=ar("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...T(),rt,et],N=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],I=()=>[rt,et,c],G=()=>[Ua,"full","auto",...I()],z=()=>[Va,"none","subgrid",rt,et],H=()=>["auto",{span:["full",Va,rt,et]},Va,rt,et],$=()=>[Va,"auto",rt,et],O=()=>["auto","min","max","fr",rt,et],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...I()],V=()=>[Ua,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],F=()=>[Ua,"screen","full","dvw","lvw","svw","min","max","fit",...I()],K=()=>[Ua,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],L=()=>[e,rt,et],W=()=>[...T(),oN,sN,{position:[rt,et]}],Z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],P=()=>["auto","cover","contain",Cq,_q,{size:[rt,et]}],ne=()=>[ex,Dh,Kl],ie=()=>["","none","full",d,rt,et],oe=()=>["",Ft,Dh,Kl],se=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[Ft,ex,oN,sN],ve=()=>["","none",y,rt,et],le=()=>["none",Ft,rt,et],X=()=>["none",Ft,rt,et],_e=()=>[Ft,rt,et],Le=()=>[Ua,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Po],breakpoint:[Po],color:[JO],container:[Po],"drop-shadow":[Po],ease:["in","out","in-out"],font:[bq],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Po],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Po],shadow:[Po],spacing:["px",Ft],text:[Po],"text-shadow":[Po],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ua,et,rt,w]}],container:["container"],columns:[{columns:[Ft,et,rt,l]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:A()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:G()}],"inset-x":[{"inset-x":G()}],"inset-y":[{"inset-y":G()}],start:[{"inset-s":G(),start:G()}],end:[{"inset-e":G(),end:G()}],"inset-bs":[{"inset-bs":G()}],"inset-be":[{"inset-be":G()}],top:[{top:G()}],right:[{right:G()}],bottom:[{bottom:G()}],left:[{left:G()}],visibility:["visible","invisible","collapse"],z:[{z:[Va,"auto",rt,et]}],basis:[{basis:[Ua,"full","auto",l,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ft,Ua,"auto","initial","none",et]}],grow:[{grow:["",Ft,rt,et]}],shrink:[{shrink:["",Ft,rt,et]}],order:[{order:[Va,"first","last","none",rt,et]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],"inline-size":[{inline:["auto",...F()]}],"min-inline-size":[{"min-inline":["auto",...F()]}],"max-inline-size":[{"max-inline":["none",...F()]}],"block-size":[{block:["auto",...K()]}],"min-block-size":[{"min-block":["auto",...K()]}],"max-block-size":[{"max-block":["none",...K()]}],w:[{w:[l,"screen",...V()]}],"min-w":[{"min-w":[l,"screen","none",...V()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",n,Dh,Kl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Eq,yq]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ex,et]}],"font-family":[{font:[wq,xq,t]}],"font-features":[{"font-features":[et]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,rt,et]}],"line-clamp":[{"line-clamp":[Ft,"none",rt,iN]}],leading:[{leading:[s,...I()]}],"list-image":[{"list-image":["none",rt,et]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",rt,et]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ft,"from-font","auto",rt,Kl]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[Ft,"auto",rt,et]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",rt,et]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",rt,et]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:Z()}],"bg-size":[{bg:P()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Va,rt,et],radial:["",rt,et],conic:[Va,rt,et]},kq,Sq]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:ie()}],"rounded-s":[{"rounded-s":ie()}],"rounded-e":[{"rounded-e":ie()}],"rounded-t":[{"rounded-t":ie()}],"rounded-r":[{"rounded-r":ie()}],"rounded-b":[{"rounded-b":ie()}],"rounded-l":[{"rounded-l":ie()}],"rounded-ss":[{"rounded-ss":ie()}],"rounded-se":[{"rounded-se":ie()}],"rounded-ee":[{"rounded-ee":ie()}],"rounded-es":[{"rounded-es":ie()}],"rounded-tl":[{"rounded-tl":ie()}],"rounded-tr":[{"rounded-tr":ie()}],"rounded-br":[{"rounded-br":ie()}],"rounded-bl":[{"rounded-bl":ie()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ft,rt,et]}],"outline-w":[{outline:["",Ft,Dh,Kl]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",f,Km,qm]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",h,Km,qm]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[Ft,Kl]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",g,Km,qm]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[Ft,rt,et]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ft]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[rt,et]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[Ft]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:W()}],"mask-repeat":[{mask:Z()}],"mask-size":[{mask:P()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",rt,et]}],filter:[{filter:["","none",rt,et]}],blur:[{blur:ve()}],brightness:[{brightness:[Ft,rt,et]}],contrast:[{contrast:[Ft,rt,et]}],"drop-shadow":[{"drop-shadow":["","none",v,Km,qm]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",Ft,rt,et]}],"hue-rotate":[{"hue-rotate":[Ft,rt,et]}],invert:[{invert:["",Ft,rt,et]}],saturate:[{saturate:[Ft,rt,et]}],sepia:[{sepia:["",Ft,rt,et]}],"backdrop-filter":[{"backdrop-filter":["","none",rt,et]}],"backdrop-blur":[{"backdrop-blur":ve()}],"backdrop-brightness":[{"backdrop-brightness":[Ft,rt,et]}],"backdrop-contrast":[{"backdrop-contrast":[Ft,rt,et]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ft,rt,et]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ft,rt,et]}],"backdrop-invert":[{"backdrop-invert":["",Ft,rt,et]}],"backdrop-opacity":[{"backdrop-opacity":[Ft,rt,et]}],"backdrop-saturate":[{"backdrop-saturate":[Ft,rt,et]}],"backdrop-sepia":[{"backdrop-sepia":["",Ft,rt,et]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",rt,et]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ft,"initial",rt,et]}],ease:[{ease:["linear","initial",C,rt,et]}],delay:[{delay:[Ft,rt,et]}],animate:[{animate:["none",E,rt,et]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,rt,et]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:_e()}],"skew-x":[{"skew-x":_e()}],"skew-y":[{"skew-y":_e()}],transform:[{transform:[rt,et,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Le()}],"translate-x":[{"translate-x":Le()}],"translate-y":[{"translate-y":Le()}],"translate-z":[{"translate-z":Le()}],"translate-none":["translate-none"],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",rt,et]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",rt,et]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[Ft,Dh,Kl,iN]}],stroke:[{stroke:["none",...L()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Aq=aq(Tq);function xe(...e){return Aq(GO(e))}function cf(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Nq(e){return e.startsWith("chatId:")?e.slice(7):e}const Ef="data-focus-fallback-ignore",a5="data-allow-focus-retain",yv="kanna:restore-chat-input-focus",_C="data-chat-input",xv="data-chat-selection-zone";function ic(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function l5(e){var n;const t=e;return t!=null&&t.matches?t.matches("input:not([type='checkbox']):not([type='radio']):not([type='button']):not([type='submit']):not([type='reset']), textarea, select")||t.isContentEditable||((n=t.getAttribute)==null?void 0:n.call(t,"role"))==="textbox"?!0:ic(e,a5):!1}function Mq(e){const t=e;return t!=null&&t.matches?l5(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:ic(e,a5):!1}function aN(e){return!!e.querySelector(`[${Ef}][data-state='open']`)}function Lq(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function Dq(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${_C}]`)).filter(o=>!o.disabled);if(n.length===0)return!1;const r=n.indexOf(e),i=r>=0?(r+1)%n.length:0,s=n[i];return s?(s.focus({preventScroll:!0}),!0):!1}function lN(e){const{activeElement:t,fallback:n,hasActiveOverlay:r}=e;if(!n||n.disabled||r||t===n)return"none";if(e.trigger==="escape")return e.defaultPrevented||ic(t,_C)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,c=s??i;return!o||!c||!o.contains(c)||ic(c,Ef)||ic(t,Ef)||l&&(ic(i,xv)||ic(c,xv))||l5(t)?"none":t&&t===c?"restore":Mq(t)?"none":"restore"}const Zo=OG,Iq=jG,c5=_.forwardRef(({className:e,...t},n)=>m.jsx(UO,{ref:n,className:xe("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));c5.displayName=UO.displayName;const Pq={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},po=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>m.jsxs(Iq,{children:[m.jsx(c5,{}),m.jsxs(VO,{ref:i,[Ef]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(yv)),(o=r.onCloseAutoFocus)==null||o.call(r,s)},className:xe("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","max-h-[85vh] flex flex-col",Pq[n],e),...r,children:[t,m.jsxs(FG,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[m.jsx(aa,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));po.displayName=VO.displayName;function yC({className:e,...t}){return m.jsx("div",{className:xe("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function Jo({className:e,...t}){return m.jsx(zG,{className:xe("text-lg font-medium leading-none tracking-tight",e),...t})}function Rd({className:e,...t}){return m.jsx(BG,{className:xe("text-sm text-muted-foreground",e),...t})}function ea({className:e,...t}){return m.jsx("div",{className:xe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function ml({className:e,...t}){return m.jsx("div",{className:xe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function Oq({className:e,...t}){return m.jsx("button",{className:xe("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","bg-primary text-primary-foreground hover:bg-primary/90","disabled:pointer-events-none disabled:bg-primary/20 disabled:text-primary/60",e),...t})}function jq({className:e,...t}){return m.jsx("button",{className:xe("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground","disabled:pointer-events-none disabled:text-muted-foreground/50",e),...t})}function zq({open:e,shareUrl:t,onOpenChange:n,onOpenLink:r,onCopyLink:i}){const[s,o]=_.useState(!1);_.useEffect(()=>{e||o(!1)},[e,t]);const l=async()=>{await i()&&(o(!0),window.setTimeout(()=>{o(!1)},2e3))};return m.jsx(Zo,{open:e,onOpenChange:n,children:m.jsxs(po,{size:"md",children:[m.jsxs(yC,{children:[m.jsx(Jo,{children:"Shared Link"}),m.jsx(Rd,{children:"Shared links are snapshots in time and contain all attachments, tool calls and history. Be mindful of sensitive info."})]}),m.jsx(ea,{className:"space-y-3",children:m.jsxs("div",{className:"flex w-full items-center gap-2 rounded-2xl border border-border bg-muted/40 pl-4 px-3 py-2.5",children:[m.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-sm text-foreground",children:t}),m.jsx("button",{type:"button",onClick:()=>void l(),title:s?"Copied":"Copy link","aria-label":s?"Copied":"Copy link",className:"flex flex-shrink-0 items-center justify-center rounded-lg text-logo hover:text-logo/60 transition-colors hover:bg-background hover:text-foreground",children:s?m.jsx(ri,{className:"h-4 w-4 text-emerald-400"}):m.jsx(pl,{className:"h-4 w-4"})})]})}),m.jsx(ml,{children:m.jsxs(Oq,{type:"button",onClick:r,children:[m.jsx(ip,{className:"mr-2 h-4 w-4"}),"Open"]})})]})})}const cN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,uN=GO,Bq=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return uN(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=t,o=Object.keys(i).map(d=>{const f=n==null?void 0:n[d],h=s==null?void 0:s[d];if(f===null)return null;const g=cN(f)||cN(h);return i[d][g]}),l=n&&Object.entries(n).reduce((d,f)=>{let[h,g]=f;return g===void 0||(d[h]=g),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:h,className:g,...v}=f;return Object.entries(v).every(y=>{let[x,w]=y;return Array.isArray(w)?w.includes({...s,...l}[x]):{...s,...l}[x]===w})?[...d,h,g]:d},[]);return uN(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},Ob=Bq("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none",{variants:{variant:{default:"bg-primary text-primary-foreground disabled:bg-primary/50 disabled:text-primary-foreground/90 hover:bg-primary/90",juicy:"bg-logo text-primary-foreground disabled:text-primary-foreground/50 hover:bg-logo/90",destructive:"bg-destructive/80 dark:text-white",outline:"border disabled:bg-transparent disabled:text-foreground/50 border-inpu disabled:border-input/90 bg-card hover:bg-muted hover:text-accent-foreground",secondary:"bg-transparent border border-border text-secondary-foreground hover:text-secondary-foreground/60 disabled:text-secondary-foreground/50",ghost:"hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground disabled:text-muted-foreground/50 border border-border/0 hover:border-border",link:"text-primary disabled:text-primary/50 underline-offset-4 hover:underline",none:""},size:{default:"h-10 px-4 rounded-full py-2",sm:"h-9 rounded-full px-3",lg:"h-11 rounded-full px-8",icon:"h-9 w-9 rounded-full",none:"","icon-sm":"h-5.5 w-5.5 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),qe=_.forwardRef(({className:e,variant:t,size:n,...r},i)=>m.jsx("button",{className:xe(Ob({variant:t,size:n,className:e})),ref:i,...r}));qe.displayName="Button";const Or=_.forwardRef(({className:e,type:t,...n},r)=>m.jsx("input",{ref:r,type:t,className:xe("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Or.displayName="Input";const u5=_.createContext(null);function Fq({children:e}){const[t,n]=_.useState(null),[r,i]=_.useState(""),s=_.useRef(null);_.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(i(t.options.initialValue??""),setTimeout(()=>{var v,y;(v=s.current)==null||v.focus(),(y=s.current)==null||y.select()},0))},[t]);const o=_.useCallback(()=>{n(null),i("")},[]),l=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.kind==="prompt"?t.resolve(null):t.resolve(),o())},[o,t]),c=_.useCallback(()=>{if(t){if(t.kind==="confirm")t.resolve(!0);else if(t.kind==="prompt"){const v=r.trim();t.resolve(v||(t.options.allowEmpty?"":null))}else t.resolve();o()}},[o,t,r]),d=_.useCallback(v=>new Promise(y=>{n({kind:"confirm",options:v,resolve:y})}),[]),f=_.useCallback(v=>new Promise(y=>{n({kind:"prompt",options:v,resolve:y})}),[]),h=_.useCallback(v=>new Promise(y=>{n({kind:"alert",options:v,resolve:y})}),[]),g=_.useMemo(()=>({confirm:d,prompt:f,alert:h}),[h,d,f]);return m.jsxs(u5.Provider,{value:g,children:[e,m.jsx(Zo,{open:t!==null,onOpenChange:v=>{v||!t||l()},children:m.jsx(po,{size:"sm",onKeyDown:v=>{v.key!=="Enter"||v.shiftKey||!t||t.kind!=="confirm"||(v.preventDefault(),c())},children:t?m.jsxs(m.Fragment,{children:[m.jsxs(ea,{className:"space-y-4",children:[m.jsx(Jo,{children:t.options.title}),t.options.description?m.jsx(Rd,{children:t.options.description}):null,t.kind==="prompt"?m.jsx(Or,{ref:s,type:"text",value:r,onChange:v=>i(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),c())},placeholder:t.options.placeholder}):null]}),m.jsxs(ml,{children:[t.kind==="prompt"&&t.options.resetLabel?m.jsx(qe,{variant:"ghost",size:"sm",onClick:()=>i(t.options.resetValue??""),className:"mr-auto",children:t.options.resetLabel}):null,m.jsx(qe,{variant:"ghost",size:"sm",onClick:l,className:t.kind==="alert"?"hidden":void 0,children:"cancelLabel"in t.options?t.options.cancelLabel??"Cancel":"Cancel"}),m.jsx(qe,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:c,disabled:t.kind==="prompt"&&!t.options.allowEmpty&&!r.trim(),children:t.kind==="alert"?t.options.closeLabel??"OK":"confirmLabel"in t.options?t.options.confirmLabel??"Confirm":"Confirm"})]})]}):null})})]})}function xC(){const e=_.useContext(u5);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const SC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("bg-card text-card-foreground",e),...t}));SC.displayName="Card";const wC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex flex-col space-y-1.5 p-2",e),...t}));wC.displayName="CardHeader";const d5=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...t}));d5.displayName="CardTitle";const h5=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));h5.displayName="CardDescription";const CC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("p-6 pt-0",e),...t}));CC.displayName="CardContent";const Hq=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex items-center p-6 pt-0",e),...t}));Hq.displayName="CardFooter";const $q=["top","right","bottom","left"],gl=Math.min,zi=Math.max,Sv=Math.round,Ym=Math.floor,ho=e=>({x:e,y:e}),Uq={left:"right",right:"left",bottom:"top",top:"bottom"};function qS(e,t,n){return zi(e,gl(t,n))}function ta(e,t){return typeof e=="function"?e(t):e}function na(e){return e.split("-")[0]}function Td(e){return e.split("-")[1]}function kC(e){return e==="x"?"y":"x"}function EC(e){return e==="y"?"height":"width"}function oo(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function RC(e){return kC(oo(e))}function Vq(e,t,n){n===void 0&&(n=!1);const r=Td(e),i=RC(e),s=EC(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=wv(o)),[o,wv(o)]}function Wq(e){const t=wv(e);return[KS(e),t,KS(t)]}function KS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const dN=["left","right"],hN=["right","left"],Gq=["top","bottom"],qq=["bottom","top"];function Kq(e,t,n){switch(e){case"top":case"bottom":return n?t?hN:dN:t?dN:hN;case"left":case"right":return t?Gq:qq;default:return[]}}function Yq(e,t,n,r){const i=Td(e);let s=Kq(na(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(KS)))),s}function wv(e){const t=na(e);return Uq[t]+e.slice(t.length)}function Xq(e){return{top:0,right:0,bottom:0,left:0,...e}}function f5(e){return typeof e!="number"?Xq(e):{top:e,right:e,bottom:e,left:e}}function Cv(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function fN(e,t,n){let{reference:r,floating:i}=e;const s=oo(t),o=RC(t),l=EC(o),c=na(t),d=s==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,g=r[l]/2-i[l]/2;let v;switch(c){case"top":v={x:f,y:r.y-i.height};break;case"bottom":v={x:f,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:h};break;case"left":v={x:r.x-i.width,y:h};break;default:v={x:r.x,y:r.y}}switch(Td(t)){case"start":v[o]-=g*(n&&d?-1:1);break;case"end":v[o]+=g*(n&&d?-1:1);break}return v}async function Qq(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:g=!1,padding:v=0}=ta(t,e),y=f5(v),w=l[g?h==="floating"?"reference":"floating":h],C=Cv(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),E=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),T=await(s.isElement==null?void 0:s.isElement(R))?await(s.getScale==null?void 0:s.getScale(R))||{x:1,y:1}:{x:1,y:1},A=Cv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:E,offsetParent:R,strategy:c}):E);return{top:(C.top-A.top+y.top)/T.y,bottom:(A.bottom-C.bottom+y.bottom)/T.y,left:(C.left-A.left+y.left)/T.x,right:(A.right-C.right+y.right)/T.x}}const Zq=50,Jq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:Qq},c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:h}=fN(d,r,c),g=r,v=0;const y={};for(let x=0;x<s.length;x++){const w=s[x];if(!w)continue;const{name:C,fn:E}=w,{x:R,y:T,data:A,reset:N}=await E({x:f,y:h,initialPlacement:r,placement:g,strategy:i,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});f=R??f,h=T??h,y[C]={...y[C],...A},N&&v<Zq&&(v++,typeof N=="object"&&(N.placement&&(g=N.placement),N.rects&&(d=N.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):N.rects),{x:f,y:h}=fN(d,g,c)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},eK=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=ta(e,t)||{};if(d==null)return{};const h=f5(f),g={x:n,y:r},v=RC(i),y=EC(v),x=await o.getDimensions(d),w=v==="y",C=w?"top":"left",E=w?"bottom":"right",R=w?"clientHeight":"clientWidth",T=s.reference[y]+s.reference[v]-g[v]-s.floating[y],A=g[v]-s.reference[v],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let D=N?N[R]:0;(!D||!await(o.isElement==null?void 0:o.isElement(N)))&&(D=l.floating[R]||s.floating[y]);const I=T/2-A/2,G=D/2-x[y]/2-1,z=gl(h[C],G),H=gl(h[E],G),$=z,O=D-x[y]-H,B=D/2-x[y]/2+I,U=qS($,B,O),j=!c.arrow&&Td(i)!=null&&B!==U&&s.reference[y]/2-(B<$?z:H)-x[y]/2<0,V=j?B<$?B-$:B-O:0;return{[v]:g[v]+V,data:{[v]:U,centerOffset:B-U-V,...j&&{alignmentOffset:V}},reset:j}}}),tK=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...w}=ta(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=na(i),E=oo(l),R=na(l)===l,T=await(c.isRTL==null?void 0:c.isRTL(d.floating)),A=g||(R||!x?[wv(l)]:Wq(l)),N=y!=="none";!g&&N&&A.push(...Yq(l,x,y,T));const D=[l,...A],I=await c.detectOverflow(t,w),G=[];let z=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(I[C]),h){const B=Vq(i,o,T);G.push(I[B[0]],I[B[1]])}if(z=[...z,{placement:i,overflows:G}],!G.every(B=>B<=0)){var H,$;const B=(((H=s.flip)==null?void 0:H.index)||0)+1,U=D[B];if(U&&(!(h==="alignment"?E!==oo(U):!1)||z.every(F=>oo(F.placement)===E?F.overflows[0]>0:!0)))return{data:{index:B,overflows:z},reset:{placement:U}};let j=($=z.filter(V=>V.overflows[0]<=0).sort((V,F)=>V.overflows[1]-F.overflows[1])[0])==null?void 0:$.placement;if(!j)switch(v){case"bestFit":{var O;const V=(O=z.filter(F=>{if(N){const K=oo(F.placement);return K===E||K==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(K=>K>0).reduce((K,L)=>K+L,0)]).sort((F,K)=>F[1]-K[1])[0])==null?void 0:O[0];V&&(j=V);break}case"initialPlacement":j=l;break}if(i!==j)return{reset:{placement:j}}}return{}}}};function pN(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function mN(e){return $q.some(t=>e[t]>=0)}const nK=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=ta(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=pN(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:mN(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=pN(o,n.floating);return{data:{escapedOffsets:l,escaped:mN(l)}}}default:return{}}}}},p5=new Set(["left","top"]);async function rK(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=na(n),l=Td(n),c=oo(n)==="y",d=p5.has(o)?-1:1,f=s&&c?-1:1,h=ta(t,e);let{mainAxis:g,crossAxis:v,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof y=="number"&&(v=l==="end"?y*-1:y),c?{x:v*f,y:g*d}:{x:g*d,y:v*f}}const iK=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=t,c=await rK(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},sK=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:C=>{let{x:E,y:R}=C;return{x:E,y:R}}},...d}=ta(e,t),f={x:n,y:r},h=await s.detectOverflow(t,d),g=oo(na(i)),v=kC(g);let y=f[v],x=f[g];if(o){const C=v==="y"?"top":"left",E=v==="y"?"bottom":"right",R=y+h[C],T=y-h[E];y=qS(R,y,T)}if(l){const C=g==="y"?"top":"left",E=g==="y"?"bottom":"right",R=x+h[C],T=x-h[E];x=qS(R,x,T)}const w=c.fn({...t,[v]:y,[g]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[v]:o,[g]:l}}}}}},oK=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=ta(e,t),f={x:n,y:r},h=oo(i),g=kC(h);let v=f[g],y=f[h];const x=ta(l,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(c){const R=g==="y"?"height":"width",T=s.reference[g]-s.floating[R]+w.mainAxis,A=s.reference[g]+s.reference[R]-w.mainAxis;v<T?v=T:v>A&&(v=A)}if(d){var C,E;const R=g==="y"?"width":"height",T=p5.has(na(i)),A=s.reference[h]-s.floating[R]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:w.crossAxis),N=s.reference[h]+s.reference[R]+(T?0:((E=o.offset)==null?void 0:E[h])||0)-(T?w.crossAxis:0);y<A?y=A:y>N&&(y=N)}return{[g]:v,[h]:y}}}},aK=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:l}=t,{apply:c=()=>{},...d}=ta(e,t),f=await o.detectOverflow(t,d),h=na(i),g=Td(i),v=oo(i)==="y",{width:y,height:x}=s.floating;let w,C;h==="top"||h==="bottom"?(w=h,C=g===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,w=g==="end"?"top":"bottom");const E=x-f.top-f.bottom,R=y-f.left-f.right,T=gl(x-f[w],E),A=gl(y-f[C],R),N=!t.middlewareData.shift;let D=T,I=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(I=R),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=E),N&&!g){const z=zi(f.left,0),H=zi(f.right,0),$=zi(f.top,0),O=zi(f.bottom,0);v?I=y-2*(z!==0||H!==0?z+H:zi(f.left,f.right)):D=x-2*($!==0||O!==0?$+O:zi(f.top,f.bottom))}await c({...t,availableWidth:I,availableHeight:D});const G=await o.getDimensions(l.floating);return y!==G.width||x!==G.height?{reset:{rects:!0}}:{}}}};function jb(){return typeof window<"u"}function Ad(e){return m5(e)?(e.nodeName||"").toLowerCase():"#document"}function Bi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function vo(e){var t;return(t=(m5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function m5(e){return jb()?e instanceof Node||e instanceof Bi(e).Node:!1}function $s(e){return jb()?e instanceof Element||e instanceof Bi(e).Element:!1}function ca(e){return jb()?e instanceof HTMLElement||e instanceof Bi(e).HTMLElement:!1}function gN(e){return!jb()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Bi(e).ShadowRoot}function ap(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Us(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function lK(e){return/^(table|td|th)$/.test(Ad(e))}function zb(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const cK=/transform|translate|scale|rotate|perspective|filter/,uK=/paint|layout|strict|content/,Yl=e=>!!e&&e!=="none";let tx;function TC(e){const t=$s(e)?Us(e):e;return Yl(t.transform)||Yl(t.translate)||Yl(t.scale)||Yl(t.rotate)||Yl(t.perspective)||!AC()&&(Yl(t.backdropFilter)||Yl(t.filter))||cK.test(t.willChange||"")||uK.test(t.contain||"")}function dK(e){let t=vl(e);for(;ca(t)&&!sd(t);){if(TC(t))return t;if(zb(t))return null;t=vl(t)}return null}function AC(){return tx==null&&(tx=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),tx}function sd(e){return/^(html|body|#document)$/.test(Ad(e))}function Us(e){return Bi(e).getComputedStyle(e)}function Bb(e){return $s(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function vl(e){if(Ad(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gN(e)&&e.host||vo(e);return gN(t)?t.host:t}function g5(e){const t=vl(e);return sd(t)?e.ownerDocument?e.ownerDocument.body:e.body:ca(t)&&ap(t)?t:g5(t)}function Rf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=g5(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Bi(i);if(s){const l=YS(o);return t.concat(o,o.visualViewport||[],ap(i)?i:[],l&&n?Rf(l):[])}else return t.concat(i,Rf(i,[],n))}function YS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function v5(e){const t=Us(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ca(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=Sv(n)!==s||Sv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function NC(e){return $s(e)?e:e.contextElement}function qu(e){const t=NC(e);if(!ca(t))return ho(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=v5(t);let o=(s?Sv(n.width):n.width)/r,l=(s?Sv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const hK=ho(0);function b5(e){const t=Bi(e);return!AC()||!t.visualViewport?hK:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function fK(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Bi(e)?!1:t}function _c(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=NC(e);let o=ho(1);t&&(r?$s(r)&&(o=qu(r)):o=qu(e));const l=fK(s,n,r)?b5(s):ho(0);let c=(i.left+l.x)/o.x,d=(i.top+l.y)/o.y,f=i.width/o.x,h=i.height/o.y;if(s){const g=Bi(s),v=r&&$s(r)?Bi(r):r;let y=g,x=YS(y);for(;x&&r&&v!==y;){const w=qu(x),C=x.getBoundingClientRect(),E=Us(x),R=C.left+(x.clientLeft+parseFloat(E.paddingLeft))*w.x,T=C.top+(x.clientTop+parseFloat(E.paddingTop))*w.y;c*=w.x,d*=w.y,f*=w.x,h*=w.y,c+=R,d+=T,y=Bi(x),x=YS(y)}}return Cv({width:f,height:h,x:c,y:d})}function Fb(e,t){const n=Bb(e).scrollLeft;return t?t.left+n:_c(vo(e)).left+n}function _5(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Fb(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function pK(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=vo(r),l=t?zb(t.floating):!1;if(r===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=ho(1);const f=ho(0),h=ca(r);if((h||!h&&!s)&&((Ad(r)!=="body"||ap(o))&&(c=Bb(r)),h)){const v=_c(r);d=qu(r),f.x=v.x+r.clientLeft,f.y=v.y+r.clientTop}const g=o&&!h&&!s?_5(o,c):ho(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+g.x,y:n.y*d.y-c.scrollTop*d.y+f.y+g.y}}function mK(e){return Array.from(e.getClientRects())}function gK(e){const t=vo(e),n=Bb(e),r=e.ownerDocument.body,i=zi(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=zi(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Fb(e);const l=-n.scrollTop;return Us(r).direction==="rtl"&&(o+=zi(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const vN=25;function vK(e,t){const n=Bi(e),r=vo(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,c=0;if(i){s=i.width,o=i.height;const f=AC();(!f||f&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const d=Fb(r);if(d<=0){const f=r.ownerDocument,h=f.body,g=getComputedStyle(h),v=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-h.clientWidth-v);y<=vN&&(s-=y)}else d<=vN&&(s+=d);return{width:s,height:o,x:l,y:c}}function bK(e,t){const n=_c(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ca(e)?qu(e):ho(1),o=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,d=r*s.y;return{width:o,height:l,x:c,y:d}}function bN(e,t,n){let r;if(t==="viewport")r=vK(e,n);else if(t==="document")r=gK(vo(e));else if($s(t))r=bK(t,n);else{const i=b5(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Cv(r)}function y5(e,t){const n=vl(e);return n===t||!$s(n)||sd(n)?!1:Us(n).position==="fixed"||y5(n,t)}function _K(e,t){const n=t.get(e);if(n)return n;let r=Rf(e,[],!1).filter(l=>$s(l)&&Ad(l)!=="body"),i=null;const s=Us(e).position==="fixed";let o=s?vl(e):e;for(;$s(o)&&!sd(o);){const l=Us(o),c=TC(o);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||ap(o)&&!c&&y5(e,o))?r=r.filter(f=>f!==o):i=l,o=vl(o)}return t.set(e,r),r}function yK(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?zb(t)?[]:_K(t,this._c):[].concat(n),r],l=bN(t,o[0],i);let c=l.top,d=l.right,f=l.bottom,h=l.left;for(let g=1;g<o.length;g++){const v=bN(t,o[g],i);c=zi(v.top,c),d=gl(v.right,d),f=gl(v.bottom,f),h=zi(v.left,h)}return{width:d-h,height:f-c,x:h,y:c}}function xK(e){const{width:t,height:n}=v5(e);return{width:t,height:n}}function SK(e,t,n){const r=ca(t),i=vo(t),s=n==="fixed",o=_c(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=ho(0);function d(){c.x=Fb(i)}if(r||!r&&!s)if((Ad(t)!=="body"||ap(i))&&(l=Bb(t)),r){const v=_c(t,!0,s,t);c.x=v.x+t.clientLeft,c.y=v.y+t.clientTop}else i&&d();s&&!r&&i&&d();const f=i&&!r&&!s?_5(i,l):ho(0),h=o.left+l.scrollLeft-c.x-f.x,g=o.top+l.scrollTop-c.y-f.y;return{x:h,y:g,width:o.width,height:o.height}}function nx(e){return Us(e).position==="static"}function _N(e,t){if(!ca(e)||Us(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return vo(e)===n&&(n=n.ownerDocument.body),n}function x5(e,t){const n=Bi(e);if(zb(e))return n;if(!ca(e)){let i=vl(e);for(;i&&!sd(i);){if($s(i)&&!nx(i))return i;i=vl(i)}return n}let r=_N(e,t);for(;r&&lK(r)&&nx(r);)r=_N(r,t);return r&&sd(r)&&nx(r)&&!TC(r)?n:r||dK(e)||n}const wK=async function(e){const t=this.getOffsetParent||x5,n=this.getDimensions,r=await n(e.floating);return{reference:SK(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function CK(e){return Us(e).direction==="rtl"}const kK={convertOffsetParentRelativeRectToViewportRelativeRect:pK,getDocumentElement:vo,getClippingRect:yK,getOffsetParent:x5,getElementRects:wK,getClientRects:mK,getDimensions:xK,getScale:qu,isElement:$s,isRTL:CK};function S5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function EK(e,t){let n=null,r;const i=vo(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:f,top:h,width:g,height:v}=d;if(l||t(),!g||!v)return;const y=Ym(h),x=Ym(i.clientWidth-(f+g)),w=Ym(i.clientHeight-(h+v)),C=Ym(f),R={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:zi(0,gl(1,c))||1};let T=!0;function A(N){const D=N[0].intersectionRatio;if(D!==c){if(!T)return o();D?o(!1,D):r=setTimeout(()=>{o(!1,1e-7)},1e3)}D===1&&!S5(d,e.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(A,{...R,root:i.ownerDocument})}catch{n=new IntersectionObserver(A,R)}n.observe(e)}return o(!0),s}function RK(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=NC(e),f=i||s?[...d?Rf(d):[],...t?Rf(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?EK(d,n):null;let g=-1,v=null;o&&(v=new ResizeObserver(C=>{let[E]=C;E&&E.target===d&&v&&t&&(v.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var R;(R=v)==null||R.observe(t)})),n()}),d&&!c&&v.observe(d),t&&v.observe(t));let y,x=c?_c(e):null;c&&w();function w(){const C=_c(e);x&&!S5(x,C)&&n(),x=C,y=requestAnimationFrame(w)}return n(),()=>{var C;f.forEach(E=>{i&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),h==null||h(),(C=v)==null||C.disconnect(),v=null,c&&cancelAnimationFrame(y)}}const TK=iK,AK=sK,NK=tK,MK=aK,LK=nK,yN=eK,DK=oK,IK=(e,t,n)=>{const r=new Map,i={platform:kK,...n},s={...i.platform,_c:r};return Jq(e,t,{...i,platform:s})};var PK=typeof document<"u",OK=function(){},qg=PK?_.useLayoutEffect:OK;function kv(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(!kv(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!kv(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function w5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xN(e,t){const n=w5(e);return Math.round(t*n)/n}function rx(e){const t=_.useRef(e);return qg(()=>{t.current=e}),t}function jK(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,h]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,v]=_.useState(r);kv(g,r)||v(r);const[y,x]=_.useState(null),[w,C]=_.useState(null),E=_.useCallback(F=>{F!==N.current&&(N.current=F,x(F))},[]),R=_.useCallback(F=>{F!==D.current&&(D.current=F,C(F))},[]),T=s||y,A=o||w,N=_.useRef(null),D=_.useRef(null),I=_.useRef(f),G=c!=null,z=rx(c),H=rx(i),$=rx(d),O=_.useCallback(()=>{if(!N.current||!D.current)return;const F={placement:t,strategy:n,middleware:g};H.current&&(F.platform=H.current),IK(N.current,D.current,F).then(K=>{const L={...K,isPositioned:$.current!==!1};B.current&&!kv(I.current,L)&&(I.current=L,ps.flushSync(()=>{h(L)}))})},[g,t,n,H,$]);qg(()=>{d===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[d]);const B=_.useRef(!1);qg(()=>(B.current=!0,()=>{B.current=!1}),[]),qg(()=>{if(T&&(N.current=T),A&&(D.current=A),T&&A){if(z.current)return z.current(T,A,O);O()}},[T,A,O,z,G]);const U=_.useMemo(()=>({reference:N,floating:D,setReference:E,setFloating:R}),[E,R]),j=_.useMemo(()=>({reference:T,floating:A}),[T,A]),V=_.useMemo(()=>{const F={position:n,left:0,top:0};if(!j.floating)return F;const K=xN(j.floating,f.x),L=xN(j.floating,f.y);return l?{...F,transform:"translate("+K+"px, "+L+"px)",...w5(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:L}},[n,l,j.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:O,refs:U,elements:j,floatingStyles:V}),[f,O,U,j,V])}const zK=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?yN({element:r.current,padding:i}).fn(n):{}:r?yN({element:r,padding:i}).fn(n):{}}}},BK=(e,t)=>{const n=TK(e);return{name:n.name,fn:n.fn,options:[e,t]}},FK=(e,t)=>{const n=AK(e);return{name:n.name,fn:n.fn,options:[e,t]}},HK=(e,t)=>({fn:DK(e).fn,options:[e,t]}),$K=(e,t)=>{const n=NK(e);return{name:n.name,fn:n.fn,options:[e,t]}},UK=(e,t)=>{const n=MK(e);return{name:n.name,fn:n.fn,options:[e,t]}},VK=(e,t)=>{const n=LK(e);return{name:n.name,fn:n.fn,options:[e,t]}},WK=(e,t)=>{const n=zK(e);return{name:n.name,fn:n.fn,options:[e,t]}};var GK="Arrow",C5=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Kt.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});C5.displayName=GK;var qK=C5;function KK(e){const[t,n]=_.useState(void 0);return Gr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;o=d.inlineSize,l=d.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var MC="Popper",[k5,wl]=la(MC),[YK,E5]=k5(MC),R5=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(YK,{scope:t,anchor:r,onAnchorChange:i,children:n})};R5.displayName=MC;var T5="PopperAnchor",A5=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=E5(T5,n),o=_.useRef(null),l=dn(t,o),c=_.useRef(null);return _.useEffect(()=>{const d=c.current;c.current=(r==null?void 0:r.current)||o.current,d!==c.current&&s.onAnchorChange(c.current)}),r?null:m.jsx(Kt.div,{...i,ref:l})});A5.displayName=T5;var LC="PopperContent",[XK,QK]=k5(LC),N5=_.forwardRef((e,t)=>{var se,ge,de,ve,le,X;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:v="optimized",onPlaced:y,...x}=e,w=E5(LC,n),[C,E]=_.useState(null),R=dn(t,_e=>E(_e)),[T,A]=_.useState(null),N=KK(T),D=(N==null?void 0:N.width)??0,I=(N==null?void 0:N.height)??0,G=r+(s!=="center"?"-"+s:""),z=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},H=Array.isArray(d)?d:[d],$=H.length>0,O={padding:z,boundary:H.filter(JK),altBoundary:$},{refs:B,floatingStyles:U,placement:j,isPositioned:V,middlewareData:F}=jK({strategy:"fixed",placement:G,whileElementsMounted:(..._e)=>RK(..._e,{animationFrame:v==="always"}),elements:{reference:w.anchor},middleware:[BK({mainAxis:i+I,alignmentAxis:o}),c&&FK({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?HK():void 0,...O}),c&&$K({...O}),UK({...O,apply:({elements:_e,rects:Le,availableWidth:$e,availableHeight:gt})=>{const{width:Rt,height:ft}=Le.reference,Yt=_e.floating.style;Yt.setProperty("--radix-popper-available-width",`${$e}px`),Yt.setProperty("--radix-popper-available-height",`${gt}px`),Yt.setProperty("--radix-popper-anchor-width",`${Rt}px`),Yt.setProperty("--radix-popper-anchor-height",`${ft}px`)}}),T&&WK({element:T,padding:l}),eY({arrowWidth:D,arrowHeight:I}),g&&VK({strategy:"referenceHidden",...O})]}),[K,L]=D5(j),W=Hs(y);Gr(()=>{V&&(W==null||W())},[V,W]);const Z=(se=F.arrow)==null?void 0:se.x,P=(ge=F.arrow)==null?void 0:ge.y,ne=((de=F.arrow)==null?void 0:de.centerOffset)!==0,[ie,oe]=_.useState();return Gr(()=>{C&&oe(window.getComputedStyle(C).zIndex)},[C]),m.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:V?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[(ve=F.transformOrigin)==null?void 0:ve.x,(le=F.transformOrigin)==null?void 0:le.y].join(" "),...((X=F.hide)==null?void 0:X.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(XK,{scope:n,placedSide:K,onArrowChange:A,arrowX:Z,arrowY:P,shouldHideArrow:ne,children:m.jsx(Kt.div,{"data-side":K,"data-align":L,...x,ref:R,style:{...x.style,animation:V?void 0:"none"}})})})});N5.displayName=LC;var M5="PopperArrow",ZK={top:"bottom",right:"left",bottom:"top",left:"right"},L5=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=QK(M5,r),o=ZK[s.placedSide];return m.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:m.jsx(qK,{...i,ref:n,style:{...i.style,display:"block"}})})});L5.displayName=M5;function JK(e){return e!==null}var eY=e=>({name:"transformOrigin",options:e,fn(t){var w,C,E;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[d,f]=D5(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((C=i.arrow)==null?void 0:C.x)??0)+l/2,v=(((E=i.arrow)==null?void 0:E.y)??0)+c/2;let y="",x="";return d==="bottom"?(y=o?h:`${g}px`,x=`${-c}px`):d==="top"?(y=o?h:`${g}px`,x=`${r.floating.height+c}px`):d==="right"?(y=`${-c}px`,x=o?h:`${v}px`):d==="left"&&(y=`${r.floating.width+c}px`,x=o?h:`${v}px`),{data:{x:y,y:x}}}});function D5(e){const[t,n="center"]=e.split("-");return[t,n]}var Hb=R5,lp=A5,$b=N5,Ub=L5,I5=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"}),tY="VisuallyHidden",P5=_.forwardRef((e,t)=>m.jsx(Kt.span,{...e,ref:t,style:{...I5,...e.style}}));P5.displayName=tY;var nY=P5,[Vb]=la("Tooltip",[wl]),Wb=wl(),O5="TooltipProvider",rY=700,XS="tooltip.open",[iY,DC]=Vb(O5),j5=e=>{const{__scopeTooltip:t,delayDuration:n=rY,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=_.useRef(!0),l=_.useRef(!1),c=_.useRef(0);return _.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),m.jsx(iY,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:_.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:s})};j5.displayName=O5;var Tf="Tooltip",[sY,cp]=Vb(Tf),z5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,c=DC(Tf,e.__scopeTooltip),d=Wb(t),[f,h]=_.useState(null),g=Xo(),v=_.useRef(0),y=o??c.disableHoverableContent,x=l??c.delayDuration,w=_.useRef(!1),[C,E]=id({prop:r,defaultProp:i??!1,onChange:D=>{D?(c.onOpen(),document.dispatchEvent(new CustomEvent(XS))):c.onClose(),s==null||s(D)},caller:Tf}),R=_.useMemo(()=>C?w.current?"delayed-open":"instant-open":"closed",[C]),T=_.useCallback(()=>{window.clearTimeout(v.current),v.current=0,w.current=!1,E(!0)},[E]),A=_.useCallback(()=>{window.clearTimeout(v.current),v.current=0,E(!1)},[E]),N=_.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{w.current=!0,E(!0),v.current=0},x)},[x,E]);return _.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),m.jsx(Hb,{...d,children:m.jsx(sY,{scope:t,contentId:g,open:C,stateAttribute:R,trigger:f,onTriggerChange:h,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?N():T()},[c.isOpenDelayedRef,N,T]),onTriggerLeave:_.useCallback(()=>{y?A():(window.clearTimeout(v.current),v.current=0)},[A,y]),onOpen:T,onClose:A,disableHoverableContent:y,children:n})})};z5.displayName=Tf;var QS="TooltipTrigger",B5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=cp(QS,n),s=DC(QS,n),o=Wb(n),l=_.useRef(null),c=dn(t,l,i.onTriggerChange),d=_.useRef(!1),f=_.useRef(!1),h=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(lp,{asChild:!0,...o,children:m.jsx(Kt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:Ze(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Ze(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Ze(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ze(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Ze(e.onBlur,i.onClose),onClick:Ze(e.onClick,i.onClose)})})});B5.displayName=QS;var IC="TooltipPortal",[oY,aY]=Vb(IC,{forceMount:void 0}),F5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=cp(IC,t);return m.jsx(oY,{scope:t,forceMount:n,children:m.jsx(Ss,{present:n||s.open,children:m.jsx(Ed,{asChild:!0,container:i,children:r})})})};F5.displayName=IC;var od="TooltipContent",H5=_.forwardRef((e,t)=>{const n=aY(od,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=cp(od,e.__scopeTooltip);return m.jsx(Ss,{present:r||o.open,children:o.disableHoverableContent?m.jsx($5,{side:i,...s,ref:t}):m.jsx(lY,{side:i,...s,ref:t})})}),lY=_.forwardRef((e,t)=>{const n=cp(od,e.__scopeTooltip),r=DC(od,e.__scopeTooltip),i=_.useRef(null),s=dn(t,i),[o,l]=_.useState(null),{trigger:c,onClose:d}=n,f=i.current,{onPointerInTransitChange:h}=r,g=_.useCallback(()=>{l(null),h(!1)},[h]),v=_.useCallback((y,x)=>{const w=y.currentTarget,C={x:y.clientX,y:y.clientY},E=fY(C,w.getBoundingClientRect()),R=pY(C,E),T=mY(x.getBoundingClientRect()),A=vY([...R,...T]);l(A),h(!0)},[h]);return _.useEffect(()=>()=>g(),[g]),_.useEffect(()=>{if(c&&f){const y=w=>v(w,f),x=w=>v(w,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",x)}}},[c,f,v,g]),_.useEffect(()=>{if(o){const y=x=>{const w=x.target,C={x:x.clientX,y:x.clientY},E=(c==null?void 0:c.contains(w))||(f==null?void 0:f.contains(w)),R=!gY(C,o);E?g():R&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,o,d,g]),m.jsx($5,{...e,ref:s})}),[cY,uY]=Vb(Tf,{isInside:!1}),dY=vW("TooltipContent"),$5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,c=cp(od,n),d=Wb(n),{onClose:f}=c;return _.useEffect(()=>(document.addEventListener(XS,f),()=>document.removeEventListener(XS,f)),[f]),_.useEffect(()=>{if(c.trigger){const h=g=>{const v=g.target;v!=null&&v.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),m.jsx(kd,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs($b,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[m.jsx(dY,{children:r}),m.jsx(cY,{scope:n,isInside:!0,children:m.jsx(nY,{id:c.contentId,role:"tooltip",children:i||r})})]})})});H5.displayName=od;var U5="TooltipArrow",hY=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Wb(n);return uY(U5,n).isInside?null:m.jsx(Ub,{...i,...r,ref:t})});hY.displayName=U5;function fY(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function pY(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function mY(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function gY(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const l=t[s],c=t[o],d=l.x,f=l.y,h=c.x,g=c.y;f>r!=g>r&&n<(h-d)*(r-f)/(g-f)+d&&(i=!i)}return i}function vY(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),bY(t)}function bY(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var _Y=j5,V5=z5,W5=B5,G5=F5,PC=H5;function q5({className:e,...t}){return m.jsx("kbd",{className:xe("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",e),...t})}function yY({className:e,...t}){return m.jsx("span",{className:xe("inline-flex items-center gap-0.5",e),...t})}const xY="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",SY=_Y,Os=V5,js=W5,gs=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(G5,{children:m.jsx(PC,{ref:r,sideOffset:t,className:xe("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));gs.displayName=PC.displayName;const Ev=V5,Rv=W5;function K5(e){return e.toUpperCase()}function wY(e){const t=e.split("+");return m.jsx(yY,{children:t.map((n,r)=>m.jsx(q5,{children:K5(n)},`${n}-${r}`))})}const Af=_.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...i},s)=>{const o=r===void 0?null:Array.isArray(r)?r[0]??null:r;return m.jsx(G5,{children:m.jsx(PC,{ref:s,sideOffset:t,className:xe(xY,e),...i,children:o?wY(o):m.jsx("span",{children:typeof n=="string"?K5(n):n})})})});Af.displayName="HotkeyTooltipContent";const CY="0.41.7",kY={version:CY},Kn="Kanna",SN="kanna",EY=".kanna",RY=".kanna-dev",TY="KANNA_RUNTIME_PROFILE",OC=`kanna/${kY.version}`,AY="[kanna]",NY=`~/${Kn}`;function Gb(){var t;return(t=globalThis.process)==null?void 0:t.env}function MY(e=Gb()){var t;return((t=e==null?void 0:e[TY])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function LY(e=Gb()){return MY(e)==="dev"?RY:EY}function DY(e=Gb()){return`~/${LY(e)}`}function IY(e=Gb()){return`${DY(e)}/keybindings.json`}function Xm(e){return e?`${SN} ${e}`:SN}const wN=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const g=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(v=>v(t,g))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>c,subscribe:d=>(n.add(d),()=>n.delete(d))},c=t=e(r,i,l);return l},PY=(e=>e?wN(e):wN),OY=e=>e;function jY(e,t=OY){const n=wn.useSyncExternalStore(e.subscribe,wn.useCallback(()=>t(e.getState()),[e,t]),wn.useCallback(()=>t(e.getInitialState()),[e,t]));return wn.useDebugValue(n),n}const zY=e=>{const t=PY(e),n=r=>jY(t,r);return Object.assign(n,t),n},Cl=(e=>zY),Y5="always",X5="funk",BY=[{value:"blow",label:"Blow"},{value:"bottle",label:"Bottle"},{value:"frog",label:"Frog"},{value:"funk",label:"Funk"},{value:"glass",label:"Glass"},{value:"ping",label:"Ping"},{value:"pop",label:"Pop"},{value:"purr",label:"Purr"},{value:"tink",label:"Tink"}];function FY(e){switch(e){case"never":case"unfocused":case"always":return e;default:return Y5}}function HY(e){switch(e){case"blow":case"bottle":case"frog":case"funk":case"glass":case"ping":case"pop":case"purr":case"tink":return e;default:return X5}}const ac=Cl()(e=>({chatSoundPreference:Y5,chatSoundId:X5,setChatSoundPreference:t=>e({chatSoundPreference:FY(t)}),setChatSoundId:t=>e({chatSoundId:HY(t)})})),$Y={blow:"/chat-sounds/Blow.mp3",bottle:"/chat-sounds/Bottle.mp3",frog:"/chat-sounds/Frog.mp3",funk:"/chat-sounds/Funk.mp3",glass:"/chat-sounds/Glass.mp3",ping:"/chat-sounds/Ping.mp3",pop:"/chat-sounds/Pop.mp3",purr:"/chat-sounds/Purr.mp3",tink:"/chat-sounds/Tink.mp3"};function UY(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function VY(e){const t=new Audio($Y[e]);return t.preload="auto",t.play()}async function ZS(e,t){if(t<=0)return;const n=Array.from({length:t},(r,i)=>new Promise(s=>{window.setTimeout(()=>{VY(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function WY(e,t=document){return e==="never"?!1:e==="always"?!0:UY(t)}function GY(e){return e.projectGroups.reduce((t,n)=>t+n.chats.reduce((r,i)=>r+(i.unread?1:0)+(i.status==="waiting_for_user"?1:0),0),0)}function CN(e){let t=0;const n=new Set;for(const r of e.projectGroups)for(const i of r.chats)i.unread&&(t+=1),i.status==="waiting_for_user"&&n.add(i.chatId);return{unreadCount:t,waitingChatIds:n}}function qY(e,t){if(!e)return 0;const n=CN(e),r=CN(t),i=Math.max(0,r.unreadCount-n.unreadCount);let s=0;for(const o of r.waitingChatIds)n.waitingChatIds.has(o)||(s+=1);return i+s}function JS(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const KY=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function YY(e){const t=e.trim();for(const n of KY){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function ew(e){return e.split("/").pop()||e}const XY=1440*6e4;function Q5(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=XY,o=7*s;return n<r?"now":n<i?`${Math.floor(n/r)}m`:n<s?`${Math.floor(n/i)}h`:n<o?`${Math.floor(n/s)}d`:`${Math.floor(n/o)}w`}function Z5(e){return e.lastMessageAt??e._creationTime}const Nd=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...i})=>m.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:xe("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...i,children:e});function jC(e){const t=e+"CollectionProvider",[n,r]=la(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=x=>{const{scope:w,children:C}=x,E=wn.useRef(null),R=wn.useRef(new Map).current;return m.jsx(i,{scope:w,itemMap:R,collectionRef:E,children:C})};o.displayName=t;const l=e+"CollectionSlot",c=vc(l),d=wn.forwardRef((x,w)=>{const{scope:C,children:E}=x,R=s(l,C),T=dn(w,R.collectionRef);return m.jsx(c,{ref:T,children:E})});d.displayName=l;const f=e+"CollectionItemSlot",h="data-radix-collection-item",g=vc(f),v=wn.forwardRef((x,w)=>{const{scope:C,children:E,...R}=x,T=wn.useRef(null),A=dn(w,T),N=s(f,C);return wn.useEffect(()=>(N.itemMap.set(T,{ref:T,...R}),()=>void N.itemMap.delete(T))),m.jsx(g,{[h]:"",ref:A,children:E})});v.displayName=f;function y(x){const w=s(e+"CollectionConsumer",x);return wn.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const R=Array.from(E.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((N,D)=>R.indexOf(N.ref.current)-R.indexOf(D.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:d,ItemSlot:v},y,r]}var QY=_.createContext(void 0);function zC(e){const t=_.useContext(QY);return e||t||"ltr"}var ix="rovingFocusGroup.onEntryFocus",ZY={bubbles:!1,cancelable:!0},up="RovingFocusGroup",[tw,J5,JY]=jC(up),[eX,ej]=la(up,[JY]),[tX,nX]=eX(up),tj=_.forwardRef((e,t)=>m.jsx(tw.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(tw.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(rX,{...e,ref:t})})}));tj.displayName=up;var rX=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=e,g=_.useRef(null),v=dn(t,g),y=zC(s),[x,w]=id({prop:o,defaultProp:l??null,onChange:c,caller:up}),[C,E]=_.useState(!1),R=Hs(d),T=J5(n),A=_.useRef(!1),[N,D]=_.useState(0);return _.useEffect(()=>{const I=g.current;if(I)return I.addEventListener(ix,R),()=>I.removeEventListener(ix,R)},[R]),m.jsx(tX,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:x,onItemFocus:_.useCallback(I=>w(I),[w]),onItemShiftTab:_.useCallback(()=>E(!0),[]),onFocusableItemAdd:_.useCallback(()=>D(I=>I+1),[]),onFocusableItemRemove:_.useCallback(()=>D(I=>I-1),[]),children:m.jsx(Kt.div,{tabIndex:C||N===0?-1:0,"data-orientation":r,...h,ref:v,style:{outline:"none",...e.style},onMouseDown:Ze(e.onMouseDown,()=>{A.current=!0}),onFocus:Ze(e.onFocus,I=>{const G=!A.current;if(I.target===I.currentTarget&&G&&!C){const z=new CustomEvent(ix,ZY);if(I.currentTarget.dispatchEvent(z),!z.defaultPrevented){const H=T().filter(j=>j.focusable),$=H.find(j=>j.active),O=H.find(j=>j.id===x),U=[$,O,...H].filter(Boolean).map(j=>j.ref.current);ij(U,f)}}A.current=!1}),onBlur:Ze(e.onBlur,()=>E(!1))})})}),nj="RovingFocusGroupItem",rj=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...l}=e,c=Xo(),d=s||c,f=nX(nj,n),h=f.currentTabStopId===d,g=J5(n),{onFocusableItemAdd:v,onFocusableItemRemove:y,currentTabStopId:x}=f;return _.useEffect(()=>{if(r)return v(),()=>y()},[r,v,y]),m.jsx(tw.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:m.jsx(Kt.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:Ze(e.onMouseDown,w=>{r?f.onItemFocus(d):w.preventDefault()}),onFocus:Ze(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:Ze(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const C=oX(w,f.orientation,f.dir);if(C!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let R=g().filter(T=>T.focusable).map(T=>T.ref.current);if(C==="last")R.reverse();else if(C==="prev"||C==="next"){C==="prev"&&R.reverse();const T=R.indexOf(w.currentTarget);R=f.loop?aX(R,T+1):R.slice(T+1)}setTimeout(()=>ij(R))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:x!=null}):o})})});rj.displayName=nj;var iX={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function sX(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function oX(e,t,n){const r=sX(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return iX[r]}function ij(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function aX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var lX=tj,cX=rj,nw=["Enter"," "],uX=["ArrowDown","PageUp","Home"],sj=["ArrowUp","PageDown","End"],dX=[...uX,...sj],hX={ltr:[...nw,"ArrowRight"],rtl:[...nw,"ArrowLeft"]},fX={ltr:["ArrowLeft"],rtl:["ArrowRight"]},dp="Menu",[Nf,pX,mX]=jC(dp),[Lc,oj]=la(dp,[mX,wl,ej]),qb=wl(),aj=ej(),[gX,Dc]=Lc(dp),[vX,hp]=Lc(dp),lj=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,l=qb(t),[c,d]=_.useState(null),f=_.useRef(!1),h=Hs(s),g=zC(i);return _.useEffect(()=>{const v=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),m.jsx(Hb,{...l,children:m.jsx(gX,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:m.jsx(vX,{scope:t,onClose:_.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:g,modal:o,children:r})})})};lj.displayName=dp;var bX="MenuAnchor",BC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=qb(n);return m.jsx(lp,{...i,...r,ref:t})});BC.displayName=bX;var FC="MenuPortal",[_X,cj]=Lc(FC,{forceMount:void 0}),uj=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Dc(FC,t);return m.jsx(_X,{scope:t,forceMount:n,children:m.jsx(Ss,{present:n||s.open,children:m.jsx(Ed,{asChild:!0,container:i,children:r})})})};uj.displayName=FC;var vs="MenuContent",[yX,HC]=Lc(vs),dj=_.forwardRef((e,t)=>{const n=cj(vs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Dc(vs,e.__scopeMenu),o=hp(vs,e.__scopeMenu);return m.jsx(Nf.Provider,{scope:e.__scopeMenu,children:m.jsx(Ss,{present:r||s.open,children:m.jsx(Nf.Slot,{scope:e.__scopeMenu,children:o.modal?m.jsx(xX,{...i,ref:t}):m.jsx(SX,{...i,ref:t})})})})}),xX=_.forwardRef((e,t)=>{const n=Dc(vs,e.__scopeMenu),r=_.useRef(null),i=dn(t,r);return _.useEffect(()=>{const s=r.current;if(s)return Ib(s)},[]),m.jsx($C,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ze(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),SX=_.forwardRef((e,t)=>{const n=Dc(vs,e.__scopeMenu);return m.jsx($C,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),wX=vc("MenuContent.ScrollLock"),$C=_.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:v,disableOutsideScroll:y,...x}=e,w=Dc(vs,n),C=hp(vs,n),E=qb(n),R=aj(n),T=pX(n),[A,N]=_.useState(null),D=_.useRef(null),I=dn(t,D,w.onContentChange),G=_.useRef(0),z=_.useRef(""),H=_.useRef(0),$=_.useRef(null),O=_.useRef("right"),B=_.useRef(0),U=y?op:_.Fragment,j=y?{as:wX,allowPinchZoom:!0}:void 0,V=K=>{var se,ge;const L=z.current+K,W=T().filter(de=>!de.disabled),Z=document.activeElement,P=(se=W.find(de=>de.ref.current===Z))==null?void 0:se.textValue,ne=W.map(de=>de.textValue),ie=PX(ne,L,P),oe=(ge=W.find(de=>de.textValue===ie))==null?void 0:ge.ref.current;(function de(ve){z.current=ve,window.clearTimeout(G.current),ve!==""&&(G.current=window.setTimeout(()=>de(""),1e3))})(L),oe&&setTimeout(()=>oe.focus())};_.useEffect(()=>()=>window.clearTimeout(G.current),[]),Lb();const F=_.useCallback(K=>{var W,Z;return O.current===((W=$.current)==null?void 0:W.side)&&jX(K,(Z=$.current)==null?void 0:Z.area)},[]);return m.jsx(yX,{scope:n,searchRef:z,onItemEnter:_.useCallback(K=>{F(K)&&K.preventDefault()},[F]),onItemLeave:_.useCallback(K=>{var L;F(K)||((L=D.current)==null||L.focus(),N(null))},[F]),onTriggerLeave:_.useCallback(K=>{F(K)&&K.preventDefault()},[F]),pointerGraceTimerRef:H,onPointerGraceIntentChange:_.useCallback(K=>{$.current=K},[]),children:m.jsx(U,{...j,children:m.jsx(sp,{asChild:!0,trapped:i,onMountAutoFocus:Ze(s,K=>{var L;K.preventDefault(),(L=D.current)==null||L.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:m.jsx(kd,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:v,children:m.jsx(lX,{asChild:!0,...R,dir:C.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:N,onEntryFocus:Ze(c,K=>{C.isUsingKeyboardRef.current||K.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx($b,{role:"menu","aria-orientation":"vertical","data-state":Rj(w.open),"data-radix-menu-content":"",dir:C.dir,...E,...x,ref:I,style:{outline:"none",...x.style},onKeyDown:Ze(x.onKeyDown,K=>{const W=K.target.closest("[data-radix-menu-content]")===K.currentTarget,Z=K.ctrlKey||K.altKey||K.metaKey,P=K.key.length===1;W&&(K.key==="Tab"&&K.preventDefault(),!Z&&P&&V(K.key));const ne=D.current;if(K.target!==ne||!dX.includes(K.key))return;K.preventDefault();const oe=T().filter(se=>!se.disabled).map(se=>se.ref.current);sj.includes(K.key)&&oe.reverse(),DX(oe)}),onBlur:Ze(e.onBlur,K=>{K.currentTarget.contains(K.target)||(window.clearTimeout(G.current),z.current="")}),onPointerMove:Ze(e.onPointerMove,Mf(K=>{const L=K.target,W=B.current!==K.clientX;if(K.currentTarget.contains(L)&&W){const Z=K.clientX>B.current?"right":"left";O.current=Z,B.current=K.clientX}}))})})})})})})});dj.displayName=vs;var CX="MenuGroup",UC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Kt.div,{role:"group",...r,ref:t})});UC.displayName=CX;var kX="MenuLabel",hj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Kt.div,{...r,ref:t})});hj.displayName=kX;var Tv="MenuItem",kN="menu.itemSelect",Kb=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=_.useRef(null),o=hp(Tv,e.__scopeMenu),l=HC(Tv,e.__scopeMenu),c=dn(t,s),d=_.useRef(!1),f=()=>{const h=s.current;if(!n&&h){const g=new CustomEvent(kN,{bubbles:!0,cancelable:!0});h.addEventListener(kN,v=>r==null?void 0:r(v),{once:!0}),gO(h,g),g.defaultPrevented?d.current=!1:o.onClose()}};return m.jsx(fj,{...i,ref:c,disabled:n,onClick:Ze(e.onClick,f),onPointerDown:h=>{var g;(g=e.onPointerDown)==null||g.call(e,h),d.current=!0},onPointerUp:Ze(e.onPointerUp,h=>{var g;d.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:Ze(e.onKeyDown,h=>{const g=l.searchRef.current!=="";n||g&&h.key===" "||nw.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Kb.displayName=Tv;var fj=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=HC(Tv,n),l=aj(n),c=_.useRef(null),d=dn(t,c),[f,h]=_.useState(!1),[g,v]=_.useState("");return _.useEffect(()=>{const y=c.current;y&&v((y.textContent??"").trim())},[s.children]),m.jsx(Nf.ItemSlot,{scope:n,disabled:r,textValue:i??g,children:m.jsx(cX,{asChild:!0,...l,focusable:!r,children:m.jsx(Kt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:Ze(e.onPointerMove,Mf(y=>{r?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ze(e.onPointerLeave,Mf(y=>o.onItemLeave(y))),onFocus:Ze(e.onFocus,()=>h(!0)),onBlur:Ze(e.onBlur,()=>h(!1))})})})}),EX="MenuCheckboxItem",pj=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return m.jsx(_j,{scope:e.__scopeMenu,checked:n,children:m.jsx(Kb,{role:"menuitemcheckbox","aria-checked":Av(n)?"mixed":n,...i,ref:t,"data-state":WC(n),onSelect:Ze(i.onSelect,()=>r==null?void 0:r(Av(n)?!0:!n),{checkForDefaultPrevented:!1})})})});pj.displayName=EX;var mj="MenuRadioGroup",[RX,TX]=Lc(mj,{value:void 0,onValueChange:()=>{}}),gj=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=Hs(r);return m.jsx(RX,{scope:e.__scopeMenu,value:n,onValueChange:s,children:m.jsx(UC,{...i,ref:t})})});gj.displayName=mj;var vj="MenuRadioItem",bj=_.forwardRef((e,t)=>{const{value:n,...r}=e,i=TX(vj,e.__scopeMenu),s=n===i.value;return m.jsx(_j,{scope:e.__scopeMenu,checked:s,children:m.jsx(Kb,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":WC(s),onSelect:Ze(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});bj.displayName=vj;var VC="MenuItemIndicator",[_j,AX]=Lc(VC,{checked:!1}),yj=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=AX(VC,n);return m.jsx(Ss,{present:r||Av(s.checked)||s.checked===!0,children:m.jsx(Kt.span,{...i,ref:t,"data-state":WC(s.checked)})})});yj.displayName=VC;var NX="MenuSeparator",xj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Kt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});xj.displayName=NX;var MX="MenuArrow",Sj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=qb(n);return m.jsx(Ub,{...i,...r,ref:t})});Sj.displayName=MX;var LX="MenuSub",[oCe,wj]=Lc(LX),Xh="MenuSubTrigger",Cj=_.forwardRef((e,t)=>{const n=Dc(Xh,e.__scopeMenu),r=hp(Xh,e.__scopeMenu),i=wj(Xh,e.__scopeMenu),s=HC(Xh,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=s,d={__scopeMenu:e.__scopeMenu},f=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>f,[f]),_.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),m.jsx(BC,{asChild:!0,...d,children:m.jsx(fj,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Rj(n.open),...e,ref:fC(t,i.onTriggerChange),onClick:h=>{var g;(g=e.onClick)==null||g.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ze(e.onPointerMove,Mf(h=>{s.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Ze(e.onPointerLeave,Mf(h=>{var v,y;f();const g=(v=n.content)==null?void 0:v.getBoundingClientRect();if(g){const x=(y=n.content)==null?void 0:y.dataset.side,w=x==="right",C=w?-5:5,E=g[w?"left":"right"],R=g[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+C,y:h.clientY},{x:E,y:g.top},{x:R,y:g.top},{x:R,y:g.bottom},{x:E,y:g.bottom}],side:x}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Ze(e.onKeyDown,h=>{var v;const g=s.searchRef.current!=="";e.disabled||g&&h.key===" "||hX[r.dir].includes(h.key)&&(n.onOpenChange(!0),(v=n.content)==null||v.focus(),h.preventDefault())})})})});Cj.displayName=Xh;var kj="MenuSubContent",Ej=_.forwardRef((e,t)=>{const n=cj(vs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Dc(vs,e.__scopeMenu),o=hp(vs,e.__scopeMenu),l=wj(kj,e.__scopeMenu),c=_.useRef(null),d=dn(t,c);return m.jsx(Nf.Provider,{scope:e.__scopeMenu,children:m.jsx(Ss,{present:r||s.open,children:m.jsx(Nf.Slot,{scope:e.__scopeMenu,children:m.jsx($C,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:d,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;o.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Ze(e.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Ze(e.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:Ze(e.onKeyDown,f=>{var v;const h=f.currentTarget.contains(f.target),g=fX[o.dir].includes(f.key);h&&g&&(s.onOpenChange(!1),(v=l.trigger)==null||v.focus(),f.preventDefault())})})})})})});Ej.displayName=kj;function Rj(e){return e?"open":"closed"}function Av(e){return e==="indeterminate"}function WC(e){return Av(e)?"indeterminate":e?"checked":"unchecked"}function DX(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function IX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function PX(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=IX(e,Math.max(s,0));i.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function OX(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const l=t[s],c=t[o],d=l.x,f=l.y,h=c.x,g=c.y;f>r!=g>r&&n<(h-d)*(r-f)/(g-f)+d&&(i=!i)}return i}function jX(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return OX(n,t)}function Mf(e){return t=>t.pointerType==="mouse"?e(t):void 0}var zX=lj,BX=BC,FX=uj,HX=dj,$X=UC,UX=hj,VX=Kb,WX=pj,GX=gj,qX=bj,KX=yj,YX=xj,XX=Sj,QX=Cj,ZX=Ej,GC="ContextMenu",[JX]=la(GC,[oj]),ii=oj(),[eQ,Tj]=JX(GC),Aj=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:s=!0}=e,[o,l]=_.useState(!1),c=ii(t),d=Hs(r),f=_.useCallback(h=>{l(h),d(h)},[d]);return m.jsx(eQ,{scope:t,open:o,onOpenChange:f,modal:s,children:m.jsx(zX,{...c,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};Aj.displayName=GC;var Nj="ContextMenuTrigger",Mj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,s=Tj(Nj,n),o=ii(n),l=_.useRef({x:0,y:0}),c=_.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=_.useRef(0),f=_.useCallback(()=>window.clearTimeout(d.current),[]),h=g=>{l.current={x:g.clientX,y:g.clientY},s.onOpenChange(!0)};return _.useEffect(()=>f,[f]),_.useEffect(()=>void(r&&f()),[r,f]),m.jsxs(m.Fragment,{children:[m.jsx(BX,{...o,virtualRef:c}),m.jsx(Kt.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Ze(e.onContextMenu,g=>{f(),h(g),g.preventDefault()}),onPointerDown:r?e.onPointerDown:Ze(e.onPointerDown,Qm(g=>{f(),d.current=window.setTimeout(()=>h(g),700)})),onPointerMove:r?e.onPointerMove:Ze(e.onPointerMove,Qm(f)),onPointerCancel:r?e.onPointerCancel:Ze(e.onPointerCancel,Qm(f)),onPointerUp:r?e.onPointerUp:Ze(e.onPointerUp,Qm(f))})]})});Mj.displayName=Nj;var tQ="ContextMenuPortal",Lj=e=>{const{__scopeContextMenu:t,...n}=e,r=ii(t);return m.jsx(FX,{...r,...n})};Lj.displayName=tQ;var Dj="ContextMenuContent",Ij=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Tj(Dj,n),s=ii(n),o=_.useRef(!1);return m.jsx(HX,{...s,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var c;(c=e.onCloseAutoFocus)==null||c.call(e,l),!l.defaultPrevented&&o.current&&l.preventDefault(),o.current=!1},onInteractOutside:l=>{var c;(c=e.onInteractOutside)==null||c.call(e,l),!l.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ij.displayName=Dj;var nQ="ContextMenuGroup",rQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx($X,{...i,...r,ref:t})});rQ.displayName=nQ;var iQ="ContextMenuLabel",sQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(UX,{...i,...r,ref:t})});sQ.displayName=iQ;var oQ="ContextMenuItem",Pj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(VX,{...i,...r,ref:t})});Pj.displayName=oQ;var aQ="ContextMenuCheckboxItem",lQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(WX,{...i,...r,ref:t})});lQ.displayName=aQ;var cQ="ContextMenuRadioGroup",uQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(GX,{...i,...r,ref:t})});uQ.displayName=cQ;var dQ="ContextMenuRadioItem",hQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(qX,{...i,...r,ref:t})});hQ.displayName=dQ;var fQ="ContextMenuItemIndicator",pQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(KX,{...i,...r,ref:t})});pQ.displayName=fQ;var mQ="ContextMenuSeparator",Oj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(YX,{...i,...r,ref:t})});Oj.displayName=mQ;var gQ="ContextMenuArrow",vQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(XX,{...i,...r,ref:t})});vQ.displayName=gQ;var bQ="ContextMenuSubTrigger",_Q=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(QX,{...i,...r,ref:t})});_Q.displayName=bQ;var yQ="ContextMenuSubContent",xQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(ZX,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});xQ.displayName=yQ;function Qm(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var SQ=Aj,wQ=Mj,CQ=Lj,jj=Ij,zj=Pj,Bj=Oj;const Fj=_.createContext(null);function bl({onOpenChange:e,...t}){const[n,r]=_.useState(0),i=_.useCallback(()=>{r(s=>s+1),e==null||e(!1)},[e]);return m.jsx(Fj.Provider,{value:i,children:m.jsx(SQ,{onOpenChange:e,...t},n)})}const _l=wQ,ra=_.forwardRef(({className:e,...t},n)=>m.jsx(CQ,{children:m.jsx(jj,{ref:n,className:xe("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg outline-hidden 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",e),...t})}));ra.displayName=jj.displayName;const En=_.forwardRef(({className:e,onSelect:t,...n},r)=>{const i=_.useContext(Fj);return m.jsx(zj,{ref:r,className:xe("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-muted focus:bg-muted data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onSelect:s=>{t==null||t(s),i==null||i()},...n})});En.displayName=zj.displayName;const Hj=_.forwardRef(({className:e,...t},n)=>m.jsx(Bj,{ref:n,className:xe("-mx-1 my-1 h-px bg-border",e),...t}));Hj.displayName=Bj.displayName;function kQ({editorLabel:e,onRename:t,onCopyPath:n,onShowArchived:r,onOpenInFinder:i,onOpenInEditor:s,onHide:o,children:l}){return m.jsxs(bl,{children:[m.jsx(_l,{asChild:!0,children:l}),m.jsxs(ra,{children:[m.jsxs(En,{onSelect:c=>{c.preventDefault(),t()},children:[m.jsx(Ab,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),m.jsxs(En,{onSelect:c=>{c.stopPropagation(),n()},children:[m.jsx(pl,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Copy Path"})]}),m.jsxs(En,{onSelect:c=>{c.stopPropagation(),r()},children:[m.jsx(oC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show Archived"})]}),m.jsxs(En,{onSelect:c=>{c.stopPropagation(),i()},children:[m.jsx(Rb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show in Finder"})]}),m.jsxs(En,{onSelect:c=>{c.stopPropagation(),s()},children:[m.jsx(aC,{className:"h-3.5 w-3.5"}),m.jsxs("span",{className:"text-xs font-medium",children:["Open in ",e]})]}),m.jsxs(En,{onSelect:c=>{c.stopPropagation(),o()},children:[m.jsx(sU,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})]})]})}function EQ({canFork:e,onRename:t,onShare:n,onOpenInFinder:r,onFork:i,onArchive:s,onDelete:o,children:l}){return m.jsxs(bl,{children:[m.jsx(_l,{asChild:!0,children:l}),m.jsxs(ra,{children:[m.jsxs(En,{onSelect:c=>{c.preventDefault(),t()},children:[m.jsx(Ab,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),m.jsxs(En,{onSelect:c=>{c.preventDefault(),n()},children:[m.jsx(hC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Share"})]}),m.jsxs(En,{onSelect:c=>{c.preventDefault(),r()},children:[m.jsx(Rb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Open in Finder"})]}),m.jsxs(En,{disabled:!e,onSelect:c=>{c.preventDefault(),e&&i()},children:[m.jsx(pO,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Fork"})]}),m.jsxs(En,{onSelect:c=>{c.preventDefault(),s()},children:[m.jsx(oC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Archive"})]}),m.jsxs(En,{onSelect:c=>{c.preventDefault(),o()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[m.jsx(kf,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Delete"})]})]})]})}const RQ=new Set(["starting","running"]);function TQ({chat:e,activeChatId:t,nowMs:n,shortcutHint:r=null,showShortcutHint:i=!1,onSelectChat:s,onRenameChat:o,onShareChat:l,onOpenInFinder:c,onForkChat:d,onArchiveChat:f,onDeleteChat:h}){const g=Q5(Z5(e),n),v=i&&r?r:g,y=i&&!!r,x=Nq(e.chatId),w=m.jsxs("div",{"data-chat-id":x,className:xe("group flex items-center gap-2 pl-[9px] pr-0.5 py-0.5 rounded-lg cursor-pointer border-border/0 hover:border-border hover:bg-muted/20 active:scale-[0.985] border transition-all",t===x?"bg-muted hover:bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>s(e.chatId),children:[RQ.has(e.status)?m.jsx(ln,{className:"size-3.5 flex-shrink-0 animate-spin text-logo"}):e.status==="waiting_for_user"?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):e.unread?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,m.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?m.jsx(Nd,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.status!=="idle"||t===x||e.unread?m.jsx("span",{className:"",children:e.title}):m.jsx("span",{className:"text-slate-500 dark:text-slate-400",children:e.title})}),m.jsxs("div",{className:xe("relative h-7 mr-[2px] shrink-0",e.canFork?"w-12":"w-6"),children:[v?y?m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-0.5 text-[11px] text-foreground transition-opacity group-hover:opacity-0",children:m.jsx(q5,{className:"h-4 min-w-4 rounded-sm border-border/50 bg-transparent px-1 text-[10px]",children:r})}):m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-2 text-[11px] text-muted-foreground opacity-60 transition-opacity group-hover:opacity-0",children:v}):null,m.jsxs("div",{className:xe("absolute inset-0 flex items-center justify-end gap-0 opacity-100 mr-[3px]",v?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),children:[e.canFork?m.jsx(qe,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:C=>{C.stopPropagation(),d(e.chatId)},title:"Fork chat",children:m.jsx(pO,{className:"size-3.5"})}):null,m.jsx(qe,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:C=>{C.stopPropagation(),f(e.chatId)},title:"Archive chat",children:m.jsx(oC,{className:"size-3.5"})})]})]})]},e._id);return m.jsx(EQ,{canFork:e.canFork,onRename:()=>o(e.chatId),onShare:()=>l(e.chatId),onOpenInFinder:()=>c(e.localPath),onFork:()=>d(e.chatId),onArchive:()=>f(e.chatId),onDelete:()=>h(e.chatId),children:w})}const AQ=_.memo(TQ);function NQ(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const Yb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Md(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function qC(e){return"nodeType"in e}function xi(e){var t,n;return e?Md(e)?e:qC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function KC(e){const{Document:t}=xi(e);return e instanceof t}function fp(e){return Md(e)?!1:e instanceof xi(e).HTMLElement}function $j(e){return e instanceof xi(e).SVGElement}function Ld(e){return e?Md(e)?e.document:qC(e)?KC(e)?e:fp(e)||$j(e)?e.ownerDocument:document:document:document}const mo=Yb?_.useLayoutEffect:_.useEffect;function YC(e){const t=_.useRef(e);return mo(()=>{t.current=e}),_.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function MQ(){const e=_.useRef(null),t=_.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Lf(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return mo(()=>{n.current!==e&&(n.current=e)},t),n}function pp(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Nv(e){const t=YC(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function rw(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let sx={};function mp(e,t){return _.useMemo(()=>{if(t)return t;const n=sx[e]==null?0:sx[e]+1;return sx[e]=n,e+"-"+n},[e,t])}function Uj(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const l=Object.entries(o);for(const[c,d]of l){const f=s[c];f!=null&&(s[c]=f+e*d)}return s},{...t})}}const Ku=Uj(1),Mv=Uj(-1);function LQ(e){return"clientX"in e&&"clientY"in e}function XC(e){if(!e)return!1;const{KeyboardEvent:t}=xi(e.target);return t&&e instanceof t}function DQ(e){if(!e)return!1;const{TouchEvent:t}=xi(e.target);return t&&e instanceof t}function iw(e){if(DQ(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return LQ(e)?{x:e.clientX,y:e.clientY}:null}const Df=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Df.Translate.toString(e),Df.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),EN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function IQ(e){return e.matches(EN)?e:e.querySelector(EN)}const PQ={display:"none"};function OQ(e){let{id:t,value:n}=e;return wn.createElement("div",{id:t,style:PQ},n)}function jQ(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return wn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function zQ(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Vj=_.createContext(null);function BQ(e){const t=_.useContext(Vj);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function FQ(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:i,event:s}=r;e.forEach(o=>{var l;return(l=o[i])==null?void 0:l.call(o,s)})},[e]),t]}const HQ={draggable:`
661
661
  To pick up a draggable item, press the space bar.
662
662
  While dragging, use the arrow keys to move the item.
663
663
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -25,7 +25,7 @@
25
25
  })()
26
26
  </script>
27
27
  <title>Kanna</title>
28
- <script type="module" crossorigin src="/assets/index-DqIqYlzq.js"></script>
28
+ <script type="module" crossorigin src="/assets/index-BWrXLfF8.js"></script>
29
29
  <link rel="stylesheet" crossorigin href="/assets/index-BujIAIt0.css">
30
30
  </head>
31
31
  <body>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kanna-code",
3
3
  "type": "module",
4
- "version": "0.41.6",
4
+ "version": "0.41.7",
5
5
  "description": "A beautiful web UI for Claude Code",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -633,6 +633,53 @@ describe("DiffStore", () => {
633
633
  expect((await run(["git", "branch", "--show-current"], repoRoot)).trim()).toBe("feature/new")
634
634
  })
635
635
 
636
+ test("syncBranch pull rebases divergent local commits onto the upstream branch", async () => {
637
+ const repoRoot = await createRepo()
638
+ const remoteRoot = await createBareRemote()
639
+ const remoteWorktree = await mkdtemp(path.join(tmpdir(), "kanna-diff-remote-worktree-"))
640
+ tempDirs.push(repoRoot, remoteRoot, remoteWorktree)
641
+
642
+ await writeFile(path.join(repoRoot, "app.txt"), "base\n", "utf8")
643
+ await run(["git", "add", "."], repoRoot)
644
+ await run(["git", "commit", "-m", "base"], repoRoot)
645
+ await run(["git", "branch", "-M", "main"], repoRoot)
646
+ await run(["git", "remote", "add", "origin", remoteRoot], repoRoot)
647
+ await run(["git", "push", "-u", "origin", "main"], repoRoot)
648
+
649
+ await run(["git", "clone", "-b", "main", remoteRoot, remoteWorktree], tmpdir())
650
+ await run(["git", "config", "user.email", "kanna@example.com"], remoteWorktree)
651
+ await run(["git", "config", "user.name", "Kanna"], remoteWorktree)
652
+ await writeFile(path.join(remoteWorktree, "remote.txt"), "remote\n", "utf8")
653
+ await run(["git", "add", "."], remoteWorktree)
654
+ await run(["git", "commit", "-m", "remote change"], remoteWorktree)
655
+ await run(["git", "push"], remoteWorktree)
656
+
657
+ await writeFile(path.join(repoRoot, "local.txt"), "local\n", "utf8")
658
+ await run(["git", "add", "."], repoRoot)
659
+ await run(["git", "commit", "-m", "local change"], repoRoot)
660
+
661
+ const store = new DiffStore(repoRoot)
662
+ await store.initialize()
663
+ const result = await store.syncBranch({
664
+ projectId: "project-1",
665
+ projectPath: repoRoot,
666
+ action: "pull",
667
+ })
668
+
669
+ expect(result).toMatchObject({
670
+ ok: true,
671
+ action: "pull",
672
+ branchName: "main",
673
+ aheadCount: 1,
674
+ behindCount: 0,
675
+ snapshotChanged: true,
676
+ })
677
+ expect((await run(["git", "log", "--format=%s", "-2"], repoRoot)).trim().split("\n")).toEqual([
678
+ "local change",
679
+ "remote change",
680
+ ])
681
+ })
682
+
636
683
  test("previewMergeBranch reports up-to-date and mergeable states", async () => {
637
684
  const repoRoot = await createRepo()
638
685
  tempDirs.push(repoRoot)
@@ -1903,7 +1903,7 @@ export class DiffStore {
1903
1903
  }
1904
1904
 
1905
1905
  const syncResult = args.action === "pull"
1906
- ? await runGit(["pull", "--ff-only"], repo.repoRoot)
1906
+ ? await runGit(["pull", "--rebase", "--autostash"], repo.repoRoot)
1907
1907
  : await runGit(["fetch", "--all", "--prune"], repo.repoRoot)
1908
1908
 
1909
1909
  if (syncResult.exitCode !== 0) {
@@ -1912,10 +1912,7 @@ export class DiffStore {
1912
1912
  let title = args.action === "pull" ? "Pull failed" : "Fetch failed"
1913
1913
  let message = summarizeGitFailure(detail, args.action === "pull" ? "Git could not pull the latest changes." : "Git could not fetch the latest changes.")
1914
1914
 
1915
- if (args.action === "pull" && normalized.includes("not possible to fast-forward")) {
1916
- title = "Pull requires merge or rebase"
1917
- message = "Your branch cannot be fast-forwarded. Rebase or merge manually, then try again."
1918
- } else if (normalized.includes("could not read from remote repository") || normalized.includes("authentication failed") || normalized.includes("permission denied")) {
1915
+ if (normalized.includes("could not read from remote repository") || normalized.includes("authentication failed") || normalized.includes("permission denied")) {
1919
1916
  title = "Remote authentication failed"
1920
1917
  message = "Git could not authenticate with the remote repository."
1921
1918
  }