kanna-code 0.41.2 → 0.41.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -657,11 +657,11 @@ 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},DG="DialogDescriptionWarning",IG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${FO(DG).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},PG=RO,OG=NO,HO=MO,$O=LO,jG=IO,zG=OO,BG=zO;function UO(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=UO(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function VO(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=UO(e))&&(r&&(r+=" "),r+=t);return r}const FG=(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},HG=(e,t)=>({classGroupId:e,validator:t}),WO=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),_v="-",eN=[],$G="arbitrary..",UG=e=>{const t=WG(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return VG(o);const l=o.split(_v),c=l[0]===""&&l.length>1?1:0;return GO(l,c,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const c=r[o],d=n[o];return c?d?FG(d,c):c:d||eN}return n[o]||eN}}},GO=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],s=n.nextPart.get(i);if(s){const d=GO(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}},VG=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?$G+r:void 0})(),WG=e=>{const{theme:t,classGroups:n}=e;return GG(n,t)},GG=(e,t)=>{const n=WO();for(const r in e){const i=e[r];gC(i,n,r,t)}return n},gC=(e,t,n,r)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];qG(o,t,n,r)}},qG=(e,t,n,r)=>{if(typeof e=="string"){KG(e,t,n);return}if(typeof e=="function"){YG(e,t,n,r);return}XG(e,t,n,r)},KG=(e,t,n)=>{const r=e===""?t:qO(t,e);r.classGroupId=n},YG=(e,t,n,r)=>{if(QG(e)){gC(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(HG(n,e))},XG=(e,t,n,r)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[l,c]=i[o];gC(c,qO(t,l),n,r)}},qO=(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=WO(),n.nextPart.set(o,l)),n=l}return n},QG=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,ZG=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)}}},WS="!",tN=":",JG=[],nN=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),eq=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===tN){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(WS)?(g=h.slice(0,-1),v=!0):h.startsWith(WS)&&(g=h.slice(1),v=!0);const y=d&&d>c?d-c:void 0;return nN(s,v,g,y)};if(t){const i=t+tN,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):nN(JG,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},tq=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}},nq=e=>({cache:ZG(e.cacheSize),parseClassName:eq(e),sortModifiers:tq(e),...UG(e)}),rq=/\s+/,iq=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],l=e.trim().split(rq);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 R=g.length===0?"":g.length===1?g[0]:s(g).join(":"),E=v?R+WS:R,T=E+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(E+D)}c=f+(c.length>0?" "+c:c)}return c},sq=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=KO(n))&&(i&&(i+=" "),i+=r);return i},KO=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=KO(e[r]))&&(n&&(n+=" "),n+=t);return n},oq=(e,...t)=>{let n,r,i,s;const o=c=>{const d=t.reduce((f,h)=>h(f),e());return n=nq(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=iq(c,n);return i(c,f),f};return s=o,(...c)=>s(sq(...c))},aq=[],ar=e=>{const t=n=>n[e]||aq;return t.isThemeGetter=!0,t},YO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,XO=/^\((?:(\w[\w-]*):)?(.+)\)$/i,lq=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,cq=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,uq=/\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$/,dq=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,hq=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fq=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Va=e=>lq.test(e),Ht=e=>!!e&&!Number.isNaN(Number(e)),Wa=e=>!!e&&Number.isInteger(Number(e)),Jy=e=>e.endsWith("%")&&Ht(e.slice(0,-1)),Po=e=>cq.test(e),QO=()=>!0,pq=e=>uq.test(e)&&!dq.test(e),vC=()=>!1,mq=e=>hq.test(e),gq=e=>fq.test(e),vq=e=>!nt(e)&&!it(e),bq=e=>wl(e,e5,vC),nt=e=>YO.test(e),Yl=e=>wl(e,t5,pq),rN=e=>wl(e,Eq,Ht),_q=e=>wl(e,r5,QO),yq=e=>wl(e,n5,vC),iN=e=>wl(e,ZO,vC),xq=e=>wl(e,JO,gq),Km=e=>wl(e,i5,mq),it=e=>XO.test(e),Ph=e=>Dc(e,t5),Sq=e=>Dc(e,n5),sN=e=>Dc(e,ZO),wq=e=>Dc(e,e5),Cq=e=>Dc(e,JO),Ym=e=>Dc(e,i5,!0),kq=e=>Dc(e,r5,!0),wl=(e,t,n)=>{const r=YO.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Dc=(e,t,n=!1)=>{const r=XO.exec(e);return r?r[1]?t(r[1]):n:!1},ZO=e=>e==="position"||e==="percentage",JO=e=>e==="image"||e==="url",e5=e=>e==="length"||e==="size"||e==="bg-size",t5=e=>e==="length",Eq=e=>e==="number",n5=e=>e==="family-name",r5=e=>e==="number"||e==="weight",i5=e=>e==="shadow",Rq=()=>{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"),R=ar("animate"),E=()=>["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(),it,nt],N=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],L=()=>[it,nt,c],G=()=>[Va,"full","auto",...L()],z=()=>[Wa,"none","subgrid",it,nt],$=()=>["auto",{span:["full",Wa,it,nt]},Wa,it,nt],H=()=>[Wa,"auto",it,nt],O=()=>["auto","min","max","fr",it,nt],F=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...L()],W=()=>[Va,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],B=()=>[Va,"screen","full","dvw","lvw","svw","min","max","fit",...L()],K=()=>[Va,"screen","full","lh","dvh","lvh","svh","min","max","fit",...L()],I=()=>[e,it,nt],V=()=>[...T(),sN,iN,{position:[it,nt]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],P=()=>["auto","cover","contain",wq,bq,{size:[it,nt]}],ie=()=>[Jy,Ph,Yl],re=()=>["","none","full",d,it,nt],se=()=>["",Ht,Ph,Yl],oe=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[Ht,Jy,sN,iN],ve=()=>["","none",y,it,nt],le=()=>["none",Ht,it,nt],te=()=>["none",Ht,it,nt],Ce=()=>[Ht,it,nt],Fe=()=>[Va,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Po],breakpoint:[Po],color:[QO],container:[Po],"drop-shadow":[Po],ease:["in","out","in-out"],font:[vq],"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",Ht],text:[Po],"text-shadow":[Po],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Va,nt,it,w]}],container:["container"],columns:[{columns:[Ht,nt,it,l]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:[Wa,"auto",it,nt]}],basis:[{basis:[Va,"full","auto",l,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ht,Va,"auto","initial","none",nt]}],grow:[{grow:["",Ht,it,nt]}],shrink:[{shrink:["",Ht,it,nt]}],order:[{order:[Wa,"first","last","none",it,nt]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...F(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...F()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":F()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pbs:[{pbs:L()}],pbe:[{pbe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],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":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...B()]}],"min-inline-size":[{"min-inline":["auto",...B()]}],"max-inline-size":[{"max-inline":["none",...B()]}],"block-size":[{block:["auto",...K()]}],"min-block-size":[{"min-block":["auto",...K()]}],"max-block-size":[{"max-block":["none",...K()]}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,Ph,Yl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,kq,_q]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Jy,nt]}],"font-family":[{font:[Sq,yq,t]}],"font-features":[{"font-features":[nt]}],"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,it,nt]}],"line-clamp":[{"line-clamp":[Ht,"none",it,rN]}],leading:[{leading:[s,...L()]}],"list-image":[{"list-image":["none",it,nt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",it,nt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ht,"from-font","auto",it,Yl]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Ht,"auto",it,nt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",it,nt]}],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",it,nt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:P()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Wa,it,nt],radial:["",it,nt],conic:[Wa,it,nt]},Cq,xq]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-bs":[{"border-bs":se()}],"border-w-be":[{"border-be":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ht,it,nt]}],"outline-w":[{outline:["",Ht,Ph,Yl]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",f,Ym,Km]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",h,Ym,Km]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Ht,Yl]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",g,Ym,Km]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Ht,it,nt]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"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":[Ht]}],"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":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"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":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"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":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"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":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"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":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"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":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"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":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[it,nt]}],"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":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":[Ht]}],"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":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:P()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",it,nt]}],filter:[{filter:["","none",it,nt]}],blur:[{blur:ve()}],brightness:[{brightness:[Ht,it,nt]}],contrast:[{contrast:[Ht,it,nt]}],"drop-shadow":[{"drop-shadow":["","none",v,Ym,Km]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",Ht,it,nt]}],"hue-rotate":[{"hue-rotate":[Ht,it,nt]}],invert:[{invert:["",Ht,it,nt]}],saturate:[{saturate:[Ht,it,nt]}],sepia:[{sepia:["",Ht,it,nt]}],"backdrop-filter":[{"backdrop-filter":["","none",it,nt]}],"backdrop-blur":[{"backdrop-blur":ve()}],"backdrop-brightness":[{"backdrop-brightness":[Ht,it,nt]}],"backdrop-contrast":[{"backdrop-contrast":[Ht,it,nt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ht,it,nt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ht,it,nt]}],"backdrop-invert":[{"backdrop-invert":["",Ht,it,nt]}],"backdrop-opacity":[{"backdrop-opacity":[Ht,it,nt]}],"backdrop-saturate":[{"backdrop-saturate":[Ht,it,nt]}],"backdrop-sepia":[{"backdrop-sepia":["",Ht,it,nt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",it,nt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ht,"initial",it,nt]}],ease:[{ease:["linear","initial",C,it,nt]}],delay:[{delay:[Ht,it,nt]}],animate:[{animate:["none",R,it,nt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,it,nt]}],"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:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:Ce()}],"skew-x":[{"skew-x":Ce()}],"skew-y":[{"skew-y":Ce()}],transform:[{transform:[it,nt,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Fe()}],"translate-x":[{"translate-x":Fe()}],"translate-y":[{"translate-y":Fe()}],"translate-z":[{"translate-z":Fe()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",it,nt]}],"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":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mbs":[{"scroll-mbs":L()}],"scroll-mbe":[{"scroll-mbe":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pbs":[{"scroll-pbs":L()}],"scroll-pbe":[{"scroll-pbe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"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",it,nt]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[Ht,Ph,Yl,rN]}],stroke:[{stroke:["none",...I()]}],"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"]}},Tq=oq(Rq);function ye(...e){return Tq(VO(e))}function df(){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 Aq(e){return e.startsWith("chatId:")?e.slice(7):e}const Tf="data-focus-fallback-ignore",s5="data-allow-focus-retain",yv="kanna:restore-chat-input-focus",bC="data-chat-input",xv="data-chat-selection-zone";function sc(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function o5(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:sc(e,s5):!1}function Nq(e){const t=e;return t!=null&&t.matches?o5(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:sc(e,s5):!1}function oN(e){return!!e.querySelector(`[${Tf}][data-state='open']`)}function Mq(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function Lq(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${bC}]`)).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 aN(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||sc(t,bC)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,c=s??i;return!o||!c||!o.contains(c)||sc(c,Tf)||sc(t,Tf)||l&&(sc(i,xv)||sc(c,xv))||o5(t)?"none":t&&t===c?"restore":Nq(t)?"none":"restore"}const Zo=PG,Dq=OG,a5=_.forwardRef(({className:e,...t},n)=>m.jsx(HO,{ref:n,className:ye("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));a5.displayName=HO.displayName;const Iq={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(Dq,{children:[m.jsx(a5,{}),m.jsxs($O,{ref:i,[Tf]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(yv)),(o=r.onCloseAutoFocus)==null||o.call(r,s)},className:ye("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","max-h-[85vh] flex flex-col",Iq[n],e),...r,children:[t,m.jsxs(BG,{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=$O.displayName;function _C({className:e,...t}){return m.jsx("div",{className:ye("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function Jo({className:e,...t}){return m.jsx(jG,{className:ye("text-lg font-medium leading-none tracking-tight",e),...t})}function Nd({className:e,...t}){return m.jsx(zG,{className:ye("text-sm text-muted-foreground",e),...t})}function ea({className:e,...t}){return m.jsx("div",{className:ye("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function gl({className:e,...t}){return m.jsx("div",{className:ye("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function Pq({className:e,...t}){return m.jsx("button",{className:ye("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","bg-primary text-primary-foreground hover:bg-primary/90","disabled:pointer-events-none disabled:bg-primary/20 disabled:text-primary/60",e),...t})}function Oq({className:e,...t}){return m.jsx("button",{className:ye("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground","disabled:pointer-events-none disabled:text-muted-foreground/50",e),...t})}function jq({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(_C,{children:[m.jsx(Jo,{children:"Shared Link"}),m.jsx(Nd,{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(ml,{className:"h-4 w-4"})})]})}),m.jsx(gl,{children:m.jsxs(Pq,{type:"button",onClick:r,children:[m.jsx(op,{className:"mr-2 h-4 w-4"}),"Open"]})})]})})}const lN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,cN=VO,zq=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return cN(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=lN(f)||lN(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 cN(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},Pb=zq("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:ye(Pb({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:ye("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Or.displayName="Input";const l5=_.createContext(null);function Bq({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(l5.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(Nd,{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(gl,{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 yC(){const e=_.useContext(l5);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const xC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("bg-card text-card-foreground",e),...t}));xC.displayName="Card";const SC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-2",e),...t}));SC.displayName="CardHeader";const c5=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:ye("text-2xl font-semibold leading-none tracking-tight",e),...t}));c5.displayName="CardTitle";const u5=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:ye("text-sm text-muted-foreground",e),...t}));u5.displayName="CardDescription";const wC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("p-6 pt-0",e),...t}));wC.displayName="CardContent";const Fq=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",e),...t}));Fq.displayName="CardFooter";const Hq=["top","right","bottom","left"],vl=Math.min,Bi=Math.max,Sv=Math.round,Xm=Math.floor,co=e=>({x:e,y:e}),$q={left:"right",right:"left",bottom:"top",top:"bottom"};function GS(e,t,n){return Bi(e,vl(t,n))}function ta(e,t){return typeof e=="function"?e(t):e}function na(e){return e.split("-")[0]}function Md(e){return e.split("-")[1]}function CC(e){return e==="x"?"y":"x"}function kC(e){return e==="y"?"height":"width"}function io(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function EC(e){return CC(io(e))}function Uq(e,t,n){n===void 0&&(n=!1);const r=Md(e),i=EC(e),s=kC(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 Vq(e){const t=wv(e);return[qS(e),t,qS(t)]}function qS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const uN=["left","right"],dN=["right","left"],Wq=["top","bottom"],Gq=["bottom","top"];function qq(e,t,n){switch(e){case"top":case"bottom":return n?t?dN:uN:t?uN:dN;case"left":case"right":return t?Wq:Gq;default:return[]}}function Kq(e,t,n,r){const i=Md(e);let s=qq(na(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(qS)))),s}function wv(e){const t=na(e);return $q[t]+e.slice(t.length)}function Yq(e){return{top:0,right:0,bottom:0,left:0,...e}}function d5(e){return typeof e!="number"?Yq(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 hN(e,t,n){let{reference:r,floating:i}=e;const s=io(t),o=EC(t),l=kC(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(Md(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 Xq(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=d5(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})),R=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),T=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},A=Cv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:R,offsetParent:E,strategy:c}):R);return{top:(C.top-A.top+y.top)/T.y,bottom:(A.bottom-C.bottom+y.bottom)/T.y,left:(C.left-A.left+y.left)/T.x,right:(A.right-C.right+y.right)/T.x}}const Qq=50,Zq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:Xq},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}=hN(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:R}=w,{x:E,y:T,data:A,reset:N}=await R({x:f,y:h,initialPlacement:r,placement:g,strategy:i,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});f=E??f,h=T??h,y[C]={...y[C],...A},N&&v<Qq&&(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}=hN(d,g,c)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},Jq=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=d5(f),g={x:n,y:r},v=EC(i),y=kC(v),x=await o.getDimensions(d),w=v==="y",C=w?"top":"left",R=w?"bottom":"right",E=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[E]:0;(!D||!await(o.isElement==null?void 0:o.isElement(N)))&&(D=l.floating[E]||s.floating[y]);const L=T/2-A/2,G=D/2-x[y]/2-1,z=vl(h[C],G),$=vl(h[R],G),H=z,O=D-x[y]-$,F=D/2-x[y]/2+L,U=GS(H,F,O),j=!c.arrow&&Md(i)!=null&&F!==U&&s.reference[y]/2-(F<H?z:$)-x[y]/2<0,W=j?F<H?F-H:F-O:0;return{[v]:g[v]+W,data:{[v]:U,centerOffset:F-U-W,...j&&{alignmentOffset:W}},reset:j}}}),eK=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),R=io(l),E=na(l)===l,T=await(c.isRTL==null?void 0:c.isRTL(d.floating)),A=g||(E||!x?[wv(l)]:Vq(l)),N=y!=="none";!g&&N&&A.push(...Kq(l,x,y,T));const D=[l,...A],L=await c.detectOverflow(t,w),G=[];let z=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(L[C]),h){const F=Uq(i,o,T);G.push(L[F[0]],L[F[1]])}if(z=[...z,{placement:i,overflows:G}],!G.every(F=>F<=0)){var $,H;const F=((($=s.flip)==null?void 0:$.index)||0)+1,U=D[F];if(U&&(!(h==="alignment"?R!==io(U):!1)||z.every(B=>io(B.placement)===R?B.overflows[0]>0:!0)))return{data:{index:F,overflows:z},reset:{placement:U}};let j=(H=z.filter(W=>W.overflows[0]<=0).sort((W,B)=>W.overflows[1]-B.overflows[1])[0])==null?void 0:H.placement;if(!j)switch(v){case"bestFit":{var O;const W=(O=z.filter(B=>{if(N){const K=io(B.placement);return K===R||K==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(K=>K>0).reduce((K,I)=>K+I,0)]).sort((B,K)=>B[1]-K[1])[0])==null?void 0:O[0];W&&(j=W);break}case"initialPlacement":j=l;break}if(i!==j)return{reset:{placement:j}}}return{}}}};function fN(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function pN(e){return Hq.some(t=>e[t]>=0)}const tK=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=fN(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:pN(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=fN(o,n.floating);return{data:{escapedOffsets:l,escaped:pN(l)}}}default:return{}}}}},h5=new Set(["left","top"]);async function nK(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=Md(n),c=io(n)==="y",d=h5.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 rK=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 nK(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}}}}},iK=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:R,y:E}=C;return{x:R,y:E}}},...d}=ta(e,t),f={x:n,y:r},h=await s.detectOverflow(t,d),g=io(na(i)),v=CC(g);let y=f[v],x=f[g];if(o){const C=v==="y"?"top":"left",R=v==="y"?"bottom":"right",E=y+h[C],T=y-h[R];y=GS(E,y,T)}if(l){const C=g==="y"?"top":"left",R=g==="y"?"bottom":"right",E=x+h[C],T=x-h[R];x=GS(E,x,T)}const w=c.fn({...t,[v]:y,[g]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[v]:o,[g]:l}}}}}},sK=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=io(i),g=CC(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 E=g==="y"?"height":"width",T=s.reference[g]-s.floating[E]+w.mainAxis,A=s.reference[g]+s.reference[E]-w.mainAxis;v<T?v=T:v>A&&(v=A)}if(d){var C,R;const E=g==="y"?"width":"height",T=h5.has(na(i)),A=s.reference[h]-s.floating[E]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:w.crossAxis),N=s.reference[h]+s.reference[E]+(T?0:((R=o.offset)==null?void 0:R[h])||0)-(T?w.crossAxis:0);y<A?y=A:y>N&&(y=N)}return{[g]:v,[h]:y}}}},oK=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=Md(i),v=io(i)==="y",{width:y,height:x}=s.floating;let w,C;h==="top"||h==="bottom"?(w=h,C=g===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,w=g==="end"?"top":"bottom");const R=x-f.top-f.bottom,E=y-f.left-f.right,T=vl(x-f[w],R),A=vl(y-f[C],E),N=!t.middlewareData.shift;let D=T,L=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(L=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=R),N&&!g){const z=Bi(f.left,0),$=Bi(f.right,0),H=Bi(f.top,0),O=Bi(f.bottom,0);v?L=y-2*(z!==0||$!==0?z+$:Bi(f.left,f.right)):D=x-2*(H!==0||O!==0?H+O:Bi(f.top,f.bottom))}await c({...t,availableWidth:L,availableHeight:D});const G=await o.getDimensions(l.floating);return y!==G.width||x!==G.height?{reset:{rects:!0}}:{}}}};function Ob(){return typeof window<"u"}function Ld(e){return f5(e)?(e.nodeName||"").toLowerCase():"#document"}function Fi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function vo(e){var t;return(t=(f5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function f5(e){return Ob()?e instanceof Node||e instanceof Fi(e).Node:!1}function Fs(e){return Ob()?e instanceof Element||e instanceof Fi(e).Element:!1}function ca(e){return Ob()?e instanceof HTMLElement||e instanceof Fi(e).HTMLElement:!1}function mN(e){return!Ob()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Fi(e).ShadowRoot}function cp(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Hs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function aK(e){return/^(table|td|th)$/.test(Ld(e))}function jb(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const lK=/transform|translate|scale|rotate|perspective|filter/,cK=/paint|layout|strict|content/,Xl=e=>!!e&&e!=="none";let ex;function RC(e){const t=Fs(e)?Hs(e):e;return Xl(t.transform)||Xl(t.translate)||Xl(t.scale)||Xl(t.rotate)||Xl(t.perspective)||!TC()&&(Xl(t.backdropFilter)||Xl(t.filter))||lK.test(t.willChange||"")||cK.test(t.contain||"")}function uK(e){let t=bl(e);for(;ca(t)&&!ld(t);){if(RC(t))return t;if(jb(t))return null;t=bl(t)}return null}function TC(){return ex==null&&(ex=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ex}function ld(e){return/^(html|body|#document)$/.test(Ld(e))}function Hs(e){return Fi(e).getComputedStyle(e)}function zb(e){return Fs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function bl(e){if(Ld(e)==="html")return e;const t=e.assignedSlot||e.parentNode||mN(e)&&e.host||vo(e);return mN(t)?t.host:t}function p5(e){const t=bl(e);return ld(t)?e.ownerDocument?e.ownerDocument.body:e.body:ca(t)&&cp(t)?t:p5(t)}function Af(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=p5(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Fi(i);if(s){const l=KS(o);return t.concat(o,o.visualViewport||[],cp(i)?i:[],l&&n?Af(l):[])}else return t.concat(i,Af(i,[],n))}function KS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function m5(e){const t=Hs(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 AC(e){return Fs(e)?e:e.contextElement}function Xu(e){const t=AC(e);if(!ca(t))return co(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=m5(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 dK=co(0);function g5(e){const t=Fi(e);return!TC()||!t.visualViewport?dK:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function hK(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Fi(e)?!1:t}function xc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=AC(e);let o=co(1);t&&(r?Fs(r)&&(o=Xu(r)):o=Xu(e));const l=hK(s,n,r)?g5(s):co(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=Fi(s),v=r&&Fs(r)?Fi(r):r;let y=g,x=KS(y);for(;x&&r&&v!==y;){const w=Xu(x),C=x.getBoundingClientRect(),R=Hs(x),E=C.left+(x.clientLeft+parseFloat(R.paddingLeft))*w.x,T=C.top+(x.clientTop+parseFloat(R.paddingTop))*w.y;c*=w.x,d*=w.y,f*=w.x,h*=w.y,c+=E,d+=T,y=Fi(x),x=KS(y)}}return Cv({width:f,height:h,x:c,y:d})}function Bb(e,t){const n=zb(e).scrollLeft;return t?t.left+n:xc(vo(e)).left+n}function v5(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Bb(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function fK(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=vo(r),l=t?jb(t.floating):!1;if(r===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=co(1);const f=co(0),h=ca(r);if((h||!h&&!s)&&((Ld(r)!=="body"||cp(o))&&(c=zb(r)),h)){const v=xc(r);d=Xu(r),f.x=v.x+r.clientLeft,f.y=v.y+r.clientTop}const g=o&&!h&&!s?v5(o,c):co(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 pK(e){return Array.from(e.getClientRects())}function mK(e){const t=vo(e),n=zb(e),r=e.ownerDocument.body,i=Bi(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Bi(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Bb(e);const l=-n.scrollTop;return Hs(r).direction==="rtl"&&(o+=Bi(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const gN=25;function gK(e,t){const n=Fi(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=TC();(!f||f&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const d=Bb(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<=gN&&(s-=y)}else d<=gN&&(s+=d);return{width:s,height:o,x:l,y:c}}function vK(e,t){const n=xc(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ca(e)?Xu(e):co(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 vN(e,t,n){let r;if(t==="viewport")r=gK(e,n);else if(t==="document")r=mK(vo(e));else if(Fs(t))r=vK(t,n);else{const i=g5(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Cv(r)}function b5(e,t){const n=bl(e);return n===t||!Fs(n)||ld(n)?!1:Hs(n).position==="fixed"||b5(n,t)}function bK(e,t){const n=t.get(e);if(n)return n;let r=Af(e,[],!1).filter(l=>Fs(l)&&Ld(l)!=="body"),i=null;const s=Hs(e).position==="fixed";let o=s?bl(e):e;for(;Fs(o)&&!ld(o);){const l=Hs(o),c=RC(o);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||cp(o)&&!c&&b5(e,o))?r=r.filter(f=>f!==o):i=l,o=bl(o)}return t.set(e,r),r}function _K(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?jb(t)?[]:bK(t,this._c):[].concat(n),r],l=vN(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=vN(t,o[g],i);c=Bi(v.top,c),d=vl(v.right,d),f=vl(v.bottom,f),h=Bi(v.left,h)}return{width:d-h,height:f-c,x:h,y:c}}function yK(e){const{width:t,height:n}=m5(e);return{width:t,height:n}}function xK(e,t,n){const r=ca(t),i=vo(t),s=n==="fixed",o=xc(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=co(0);function d(){c.x=Bb(i)}if(r||!r&&!s)if((Ld(t)!=="body"||cp(i))&&(l=zb(t)),r){const v=xc(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?v5(i,l):co(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 tx(e){return Hs(e).position==="static"}function bN(e,t){if(!ca(e)||Hs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return vo(e)===n&&(n=n.ownerDocument.body),n}function _5(e,t){const n=Fi(e);if(jb(e))return n;if(!ca(e)){let i=bl(e);for(;i&&!ld(i);){if(Fs(i)&&!tx(i))return i;i=bl(i)}return n}let r=bN(e,t);for(;r&&aK(r)&&tx(r);)r=bN(r,t);return r&&ld(r)&&tx(r)&&!RC(r)?n:r||uK(e)||n}const SK=async function(e){const t=this.getOffsetParent||_5,n=this.getDimensions,r=await n(e.floating);return{reference:xK(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wK(e){return Hs(e).direction==="rtl"}const CK={convertOffsetParentRelativeRectToViewportRelativeRect:fK,getDocumentElement:vo,getClippingRect:_K,getOffsetParent:_5,getElementRects:SK,getClientRects:pK,getDimensions:yK,getScale:Xu,isElement:Fs,isRTL:wK};function y5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function kK(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=Xm(h),x=Xm(i.clientWidth-(f+g)),w=Xm(i.clientHeight-(h+v)),C=Xm(f),E={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:Bi(0,vl(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&&!y5(d,e.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(A,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(A,E)}n.observe(e)}return o(!0),s}function EK(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=AC(e),f=i||s?[...d?Af(d):[],...t?Af(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?kK(d,n):null;let g=-1,v=null;o&&(v=new ResizeObserver(C=>{let[R]=C;R&&R.target===d&&v&&t&&(v.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=v)==null||E.observe(t)})),n()}),d&&!c&&v.observe(d),t&&v.observe(t));let y,x=c?xc(e):null;c&&w();function w(){const C=xc(e);x&&!y5(x,C)&&n(),x=C,y=requestAnimationFrame(w)}return n(),()=>{var C;f.forEach(R=>{i&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),h==null||h(),(C=v)==null||C.disconnect(),v=null,c&&cancelAnimationFrame(y)}}const RK=rK,TK=iK,AK=eK,NK=oK,MK=tK,_N=Jq,LK=sK,DK=(e,t,n)=>{const r=new Map,i={platform:CK,...n},s={...i.platform,_c:r};return Zq(e,t,{...i,platform:s})};var IK=typeof document<"u",PK=function(){},qg=IK?_.useLayoutEffect:PK;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 x5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yN(e,t){const n=x5(e);return Math.round(t*n)/n}function nx(e){const t=_.useRef(e);return qg(()=>{t.current=e}),t}function OK(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),R=_.useCallback(B=>{B!==N.current&&(N.current=B,x(B))},[]),E=_.useCallback(B=>{B!==D.current&&(D.current=B,C(B))},[]),T=s||y,A=o||w,N=_.useRef(null),D=_.useRef(null),L=_.useRef(f),G=c!=null,z=nx(c),$=nx(i),H=nx(d),O=_.useCallback(()=>{if(!N.current||!D.current)return;const B={placement:t,strategy:n,middleware:g};$.current&&(B.platform=$.current),DK(N.current,D.current,B).then(K=>{const I={...K,isPositioned:H.current!==!1};F.current&&!kv(L.current,I)&&(L.current=I,ps.flushSync(()=>{h(I)}))})},[g,t,n,$,H]);qg(()=>{d===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,h(B=>({...B,isPositioned:!1})))},[d]);const F=_.useRef(!1);qg(()=>(F.current=!0,()=>{F.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:R,setFloating:E}),[R,E]),j=_.useMemo(()=>({reference:T,floating:A}),[T,A]),W=_.useMemo(()=>{const B={position:n,left:0,top:0};if(!j.floating)return B;const K=yN(j.floating,f.x),I=yN(j.floating,f.y);return l?{...B,transform:"translate("+K+"px, "+I+"px)",...x5(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:I}},[n,l,j.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:O,refs:U,elements:j,floatingStyles:W}),[f,O,U,j,W])}const jK=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?_N({element:r.current,padding:i}).fn(n):{}:r?_N({element:r,padding:i}).fn(n):{}}}},zK=(e,t)=>{const n=RK(e);return{name:n.name,fn:n.fn,options:[e,t]}},BK=(e,t)=>{const n=TK(e);return{name:n.name,fn:n.fn,options:[e,t]}},FK=(e,t)=>({fn:LK(e).fn,options:[e,t]}),HK=(e,t)=>{const n=AK(e);return{name:n.name,fn:n.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=jK(e);return{name:n.name,fn:n.fn,options:[e,t]}};var WK="Arrow",S5=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Yt.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"})})});S5.displayName=WK;var GK=S5;function qK(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 NC="Popper",[w5,Cl]=la(NC),[KK,C5]=w5(NC),k5=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(KK,{scope:t,anchor:r,onAnchorChange:i,children:n})};k5.displayName=NC;var E5="PopperAnchor",R5=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=C5(E5,n),o=_.useRef(null),l=hn(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(Yt.div,{...i,ref:l})});R5.displayName=E5;var MC="PopperContent",[YK,XK]=w5(MC),T5=_.forwardRef((e,t)=>{var oe,fe,de,ve,le,te;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=C5(MC,n),[C,R]=_.useState(null),E=hn(t,Ce=>R(Ce)),[T,A]=_.useState(null),N=qK(T),D=(N==null?void 0:N.width)??0,L=(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},$=Array.isArray(d)?d:[d],H=$.length>0,O={padding:z,boundary:$.filter(ZK),altBoundary:H},{refs:F,floatingStyles:U,placement:j,isPositioned:W,middlewareData:B}=OK({strategy:"fixed",placement:G,whileElementsMounted:(...Ce)=>EK(...Ce,{animationFrame:v==="always"}),elements:{reference:w.anchor},middleware:[zK({mainAxis:i+L,alignmentAxis:o}),c&&BK({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?FK():void 0,...O}),c&&HK({...O}),$K({...O,apply:({elements:Ce,rects:Fe,availableWidth:Xe,availableHeight:Ie})=>{const{width:at,height:Ve}=Fe.reference,gt=Ce.floating.style;gt.setProperty("--radix-popper-available-width",`${Xe}px`),gt.setProperty("--radix-popper-available-height",`${Ie}px`),gt.setProperty("--radix-popper-anchor-width",`${at}px`),gt.setProperty("--radix-popper-anchor-height",`${Ve}px`)}}),T&&VK({element:T,padding:l}),JK({arrowWidth:D,arrowHeight:L}),g&&UK({strategy:"referenceHidden",...O})]}),[K,I]=M5(j),V=Bs(y);Gr(()=>{W&&(V==null||V())},[W,V]);const X=(oe=B.arrow)==null?void 0:oe.x,P=(fe=B.arrow)==null?void 0:fe.y,ie=((de=B.arrow)==null?void 0:de.centerOffset)!==0,[re,se]=_.useState();return Gr(()=>{C&&se(window.getComputedStyle(C).zIndex)},[C]),m.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:W?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[(ve=B.transformOrigin)==null?void 0:ve.x,(le=B.transformOrigin)==null?void 0:le.y].join(" "),...((te=B.hide)==null?void 0:te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(YK,{scope:n,placedSide:K,onArrowChange:A,arrowX:X,arrowY:P,shouldHideArrow:ie,children:m.jsx(Yt.div,{"data-side":K,"data-align":I,...x,ref:E,style:{...x.style,animation:W?void 0:"none"}})})})});T5.displayName=MC;var A5="PopperArrow",QK={top:"bottom",right:"left",bottom:"top",left:"right"},N5=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=XK(A5,r),o=QK[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(GK,{...i,ref:n,style:{...i.style,display:"block"}})})});N5.displayName=A5;function ZK(e){return e!==null}var JK=e=>({name:"transformOrigin",options:e,fn(t){var w,C,R;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[d,f]=M5(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((C=i.arrow)==null?void 0:C.x)??0)+l/2,v=(((R=i.arrow)==null?void 0:R.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 M5(e){const[t,n="center"]=e.split("-");return[t,n]}var Fb=k5,up=R5,Hb=T5,$b=N5,L5=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"}),eY="VisuallyHidden",D5=_.forwardRef((e,t)=>m.jsx(Yt.span,{...e,ref:t,style:{...L5,...e.style}}));D5.displayName=eY;var tY=D5,[Ub]=la("Tooltip",[Cl]),Vb=Cl(),I5="TooltipProvider",nY=700,YS="tooltip.open",[rY,LC]=Ub(I5),P5=e=>{const{__scopeTooltip:t,delayDuration:n=nY,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(rY,{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})};P5.displayName=I5;var Nf="Tooltip",[iY,dp]=Ub(Nf),O5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,c=LC(Nf,e.__scopeTooltip),d=Vb(t),[f,h]=_.useState(null),g=Xo(),v=_.useRef(0),y=o??c.disableHoverableContent,x=l??c.delayDuration,w=_.useRef(!1),[C,R]=ad({prop:r,defaultProp:i??!1,onChange:D=>{D?(c.onOpen(),document.dispatchEvent(new CustomEvent(YS))):c.onClose(),s==null||s(D)},caller:Nf}),E=_.useMemo(()=>C?w.current?"delayed-open":"instant-open":"closed",[C]),T=_.useCallback(()=>{window.clearTimeout(v.current),v.current=0,w.current=!1,R(!0)},[R]),A=_.useCallback(()=>{window.clearTimeout(v.current),v.current=0,R(!1)},[R]),N=_.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{w.current=!0,R(!0),v.current=0},x)},[x,R]);return _.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),m.jsx(Fb,{...d,children:m.jsx(iY,{scope:t,contentId:g,open:C,stateAttribute:E,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})})};O5.displayName=Nf;var XS="TooltipTrigger",j5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=dp(XS,n),s=LC(XS,n),o=Vb(n),l=_.useRef(null),c=hn(t,l,i.onTriggerChange),d=_.useRef(!1),f=_.useRef(!1),h=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(up,{asChild:!0,...o,children:m.jsx(Yt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:Qe(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Qe(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Qe(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Qe(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Qe(e.onBlur,i.onClose),onClick:Qe(e.onClick,i.onClose)})})});j5.displayName=XS;var DC="TooltipPortal",[sY,oY]=Ub(DC,{forceMount:void 0}),z5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=dp(DC,t);return m.jsx(sY,{scope:t,forceMount:n,children:m.jsx(xs,{present:n||s.open,children:m.jsx(Ad,{asChild:!0,container:i,children:r})})})};z5.displayName=DC;var cd="TooltipContent",B5=_.forwardRef((e,t)=>{const n=oY(cd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=dp(cd,e.__scopeTooltip);return m.jsx(xs,{present:r||o.open,children:o.disableHoverableContent?m.jsx(F5,{side:i,...s,ref:t}):m.jsx(aY,{side:i,...s,ref:t})})}),aY=_.forwardRef((e,t)=>{const n=dp(cd,e.__scopeTooltip),r=LC(cd,e.__scopeTooltip),i=_.useRef(null),s=hn(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},R=hY(C,w.getBoundingClientRect()),E=fY(C,R),T=pY(x.getBoundingClientRect()),A=gY([...E,...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},R=(c==null?void 0:c.contains(w))||(f==null?void 0:f.contains(w)),E=!mY(C,o);R?g():E&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,o,d,g]),m.jsx(F5,{...e,ref:s})}),[lY,cY]=Ub(Nf,{isInside:!1}),uY=gW("TooltipContent"),F5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,c=dp(cd,n),d=Vb(n),{onClose:f}=c;return _.useEffect(()=>(document.addEventListener(YS,f),()=>document.removeEventListener(YS,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(Td,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs(Hb,{"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(uY,{children:r}),m.jsx(lY,{scope:n,isInside:!0,children:m.jsx(tY,{id:c.contentId,role:"tooltip",children:i||r})})]})})});B5.displayName=cd;var H5="TooltipArrow",dY=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Vb(n);return cY(H5,n).isInside?null:m.jsx($b,{...i,...r,ref:t})});dY.displayName=H5;function hY(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 fY(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 pY(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 mY(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 gY(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),vY(t)}function vY(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 bY=P5,$5=O5,U5=j5,V5=z5,IC=B5;function W5({className:e,...t}){return m.jsx("kbd",{className:ye("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",e),...t})}function _Y({className:e,...t}){return m.jsx("span",{className:ye("inline-flex items-center gap-0.5",e),...t})}const yY="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",xY=bY,uo=$5,ho=U5,Ps=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(V5,{children:m.jsx(IC,{ref:r,sideOffset:t,className:ye("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Ps.displayName=IC.displayName;const Ev=$5,Rv=U5;function G5(e){return e.toUpperCase()}function SY(e){const t=e.split("+");return m.jsx(_Y,{children:t.map((n,r)=>m.jsx(W5,{children:G5(n)},`${n}-${r}`))})}const Mf=_.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(V5,{children:m.jsx(IC,{ref:s,sideOffset:t,className:ye(yY,e),...i,children:o?SY(o):m.jsx("span",{children:typeof n=="string"?G5(n):n})})})});Mf.displayName="HotkeyTooltipContent";const wY="0.41.2",CY={version:wY},Kn="Kanna",xN="kanna",kY=".kanna",EY=".kanna-dev",RY="KANNA_RUNTIME_PROFILE",PC=`kanna/${CY.version}`,TY="[kanna]",AY=`~/${Kn}`;function Wb(){var t;return(t=globalThis.process)==null?void 0:t.env}function NY(e=Wb()){var t;return((t=e==null?void 0:e[RY])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function MY(e=Wb()){return NY(e)==="dev"?EY:kY}function LY(e=Wb()){return`~/${MY(e)}`}function DY(e=Wb()){return`${LY(e)}/keybindings.json`}function Qm(e){return e?`${xN} ${e}`:xN}const SN=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},IY=(e=>e?SN(e):SN),PY=e=>e;function OY(e,t=PY){const n=xn.useSyncExternalStore(e.subscribe,xn.useCallback(()=>t(e.getState()),[e,t]),xn.useCallback(()=>t(e.getInitialState()),[e,t]));return xn.useDebugValue(n),n}const jY=e=>{const t=IY(e),n=r=>OY(t,r);return Object.assign(n,t),n},kl=(e=>jY),q5="always",K5="funk",zY=[{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 BY(e){switch(e){case"never":case"unfocused":case"always":return e;default:return q5}}function FY(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 K5}}const cc=kl()(e=>({chatSoundPreference:q5,chatSoundId:K5,setChatSoundPreference:t=>e({chatSoundPreference:BY(t)}),setChatSoundId:t=>e({chatSoundId:FY(t)})})),HY={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 $Y(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function UY(e){const t=new Audio(HY[e]);return t.preload="auto",t.play()}async function QS(e,t){if(t<=0)return;const n=Array.from({length:t},(r,i)=>new Promise(s=>{window.setTimeout(()=>{UY(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function VY(e,t=document){return e==="never"?!1:e==="always"?!0:$Y(t)}function WY(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 wN(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 GY(e,t){if(!e)return 0;const n=wN(e),r=wN(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 ZS(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const qY=[/^(?:\/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 KY(e){const t=e.trim();for(const n of qY){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function JS(e){return e.split("/").pop()||e}const YY=1440*6e4;function Y5(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=YY,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 X5(e){return e.lastMessageAt??e._creationTime}const Dd=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...i})=>m.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:ye("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...i,children:e});function OC(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,R=xn.useRef(null),E=xn.useRef(new Map).current;return m.jsx(i,{scope:w,itemMap:E,collectionRef:R,children:C})};o.displayName=t;const l=e+"CollectionSlot",c=_c(l),d=xn.forwardRef((x,w)=>{const{scope:C,children:R}=x,E=s(l,C),T=hn(w,E.collectionRef);return m.jsx(c,{ref:T,children:R})});d.displayName=l;const f=e+"CollectionItemSlot",h="data-radix-collection-item",g=_c(f),v=xn.forwardRef((x,w)=>{const{scope:C,children:R,...E}=x,T=xn.useRef(null),A=hn(w,T),N=s(f,C);return xn.useEffect(()=>(N.itemMap.set(T,{ref:T,...E}),()=>void N.itemMap.delete(T))),m.jsx(g,{[h]:"",ref:A,children:R})});v.displayName=f;function y(x){const w=s(e+"CollectionConsumer",x);return xn.useCallback(()=>{const R=w.collectionRef.current;if(!R)return[];const E=Array.from(R.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((N,D)=>E.indexOf(N.ref.current)-E.indexOf(D.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:d,ItemSlot:v},y,r]}var XY=_.createContext(void 0);function jC(e){const t=_.useContext(XY);return e||t||"ltr"}var rx="rovingFocusGroup.onEntryFocus",QY={bubbles:!1,cancelable:!0},hp="RovingFocusGroup",[ew,Q5,ZY]=OC(hp),[JY,Z5]=la(hp,[ZY]),[eX,tX]=JY(hp),J5=_.forwardRef((e,t)=>m.jsx(ew.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(ew.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(nX,{...e,ref:t})})}));J5.displayName=hp;var nX=_.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=hn(t,g),y=jC(s),[x,w]=ad({prop:o,defaultProp:l??null,onChange:c,caller:hp}),[C,R]=_.useState(!1),E=Bs(d),T=Q5(n),A=_.useRef(!1),[N,D]=_.useState(0);return _.useEffect(()=>{const L=g.current;if(L)return L.addEventListener(rx,E),()=>L.removeEventListener(rx,E)},[E]),m.jsx(eX,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:x,onItemFocus:_.useCallback(L=>w(L),[w]),onItemShiftTab:_.useCallback(()=>R(!0),[]),onFocusableItemAdd:_.useCallback(()=>D(L=>L+1),[]),onFocusableItemRemove:_.useCallback(()=>D(L=>L-1),[]),children:m.jsx(Yt.div,{tabIndex:C||N===0?-1:0,"data-orientation":r,...h,ref:v,style:{outline:"none",...e.style},onMouseDown:Qe(e.onMouseDown,()=>{A.current=!0}),onFocus:Qe(e.onFocus,L=>{const G=!A.current;if(L.target===L.currentTarget&&G&&!C){const z=new CustomEvent(rx,QY);if(L.currentTarget.dispatchEvent(z),!z.defaultPrevented){const $=T().filter(j=>j.focusable),H=$.find(j=>j.active),O=$.find(j=>j.id===x),U=[H,O,...$].filter(Boolean).map(j=>j.ref.current);nj(U,f)}}A.current=!1}),onBlur:Qe(e.onBlur,()=>R(!1))})})}),ej="RovingFocusGroupItem",tj=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...l}=e,c=Xo(),d=s||c,f=tX(ej,n),h=f.currentTabStopId===d,g=Q5(n),{onFocusableItemAdd:v,onFocusableItemRemove:y,currentTabStopId:x}=f;return _.useEffect(()=>{if(r)return v(),()=>y()},[r,v,y]),m.jsx(ew.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:m.jsx(Yt.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:Qe(e.onMouseDown,w=>{r?f.onItemFocus(d):w.preventDefault()}),onFocus:Qe(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:Qe(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const C=sX(w,f.orientation,f.dir);if(C!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let E=g().filter(T=>T.focusable).map(T=>T.ref.current);if(C==="last")E.reverse();else if(C==="prev"||C==="next"){C==="prev"&&E.reverse();const T=E.indexOf(w.currentTarget);E=f.loop?oX(E,T+1):E.slice(T+1)}setTimeout(()=>nj(E))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:x!=null}):o})})});tj.displayName=ej;var rX={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iX(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function sX(e,t,n){const r=iX(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return rX[r]}function nj(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function oX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var aX=J5,lX=tj,tw=["Enter"," "],cX=["ArrowDown","PageUp","Home"],rj=["ArrowUp","PageDown","End"],uX=[...cX,...rj],dX={ltr:[...tw,"ArrowRight"],rtl:[...tw,"ArrowLeft"]},hX={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fp="Menu",[Lf,fX,pX]=OC(fp),[Ic,ij]=la(fp,[pX,Cl,Z5]),Gb=Cl(),sj=Z5(),[mX,Pc]=Ic(fp),[gX,pp]=Ic(fp),oj=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,l=Gb(t),[c,d]=_.useState(null),f=_.useRef(!1),h=Bs(s),g=jC(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(Fb,{...l,children:m.jsx(mX,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:m.jsx(gX,{scope:t,onClose:_.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:g,modal:o,children:r})})})};oj.displayName=fp;var vX="MenuAnchor",zC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Gb(n);return m.jsx(up,{...i,...r,ref:t})});zC.displayName=vX;var BC="MenuPortal",[bX,aj]=Ic(BC,{forceMount:void 0}),lj=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Pc(BC,t);return m.jsx(bX,{scope:t,forceMount:n,children:m.jsx(xs,{present:n||s.open,children:m.jsx(Ad,{asChild:!0,container:i,children:r})})})};lj.displayName=BC;var gs="MenuContent",[_X,FC]=Ic(gs),cj=_.forwardRef((e,t)=>{const n=aj(gs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Pc(gs,e.__scopeMenu),o=pp(gs,e.__scopeMenu);return m.jsx(Lf.Provider,{scope:e.__scopeMenu,children:m.jsx(xs,{present:r||s.open,children:m.jsx(Lf.Slot,{scope:e.__scopeMenu,children:o.modal?m.jsx(yX,{...i,ref:t}):m.jsx(xX,{...i,ref:t})})})})}),yX=_.forwardRef((e,t)=>{const n=Pc(gs,e.__scopeMenu),r=_.useRef(null),i=hn(t,r);return _.useEffect(()=>{const s=r.current;if(s)return Db(s)},[]),m.jsx(HC,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Qe(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),xX=_.forwardRef((e,t)=>{const n=Pc(gs,e.__scopeMenu);return m.jsx(HC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),SX=_c("MenuContent.ScrollLock"),HC=_.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=Pc(gs,n),C=pp(gs,n),R=Gb(n),E=sj(n),T=fX(n),[A,N]=_.useState(null),D=_.useRef(null),L=hn(t,D,w.onContentChange),G=_.useRef(0),z=_.useRef(""),$=_.useRef(0),H=_.useRef(null),O=_.useRef("right"),F=_.useRef(0),U=y?lp:_.Fragment,j=y?{as:SX,allowPinchZoom:!0}:void 0,W=K=>{var oe,fe;const I=z.current+K,V=T().filter(de=>!de.disabled),X=document.activeElement,P=(oe=V.find(de=>de.ref.current===X))==null?void 0:oe.textValue,ie=V.map(de=>de.textValue),re=IX(ie,I,P),se=(fe=V.find(de=>de.textValue===re))==null?void 0:fe.ref.current;(function de(ve){z.current=ve,window.clearTimeout(G.current),ve!==""&&(G.current=window.setTimeout(()=>de(""),1e3))})(I),se&&setTimeout(()=>se.focus())};_.useEffect(()=>()=>window.clearTimeout(G.current),[]),Mb();const B=_.useCallback(K=>{var V,X;return O.current===((V=H.current)==null?void 0:V.side)&&OX(K,(X=H.current)==null?void 0:X.area)},[]);return m.jsx(_X,{scope:n,searchRef:z,onItemEnter:_.useCallback(K=>{B(K)&&K.preventDefault()},[B]),onItemLeave:_.useCallback(K=>{var I;B(K)||((I=D.current)==null||I.focus(),N(null))},[B]),onTriggerLeave:_.useCallback(K=>{B(K)&&K.preventDefault()},[B]),pointerGraceTimerRef:$,onPointerGraceIntentChange:_.useCallback(K=>{H.current=K},[]),children:m.jsx(U,{...j,children:m.jsx(ap,{asChild:!0,trapped:i,onMountAutoFocus:Qe(s,K=>{var I;K.preventDefault(),(I=D.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:m.jsx(Td,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:v,children:m.jsx(aX,{asChild:!0,...E,dir:C.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:N,onEntryFocus:Qe(c,K=>{C.isUsingKeyboardRef.current||K.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(Hb,{role:"menu","aria-orientation":"vertical","data-state":kj(w.open),"data-radix-menu-content":"",dir:C.dir,...R,...x,ref:L,style:{outline:"none",...x.style},onKeyDown:Qe(x.onKeyDown,K=>{const V=K.target.closest("[data-radix-menu-content]")===K.currentTarget,X=K.ctrlKey||K.altKey||K.metaKey,P=K.key.length===1;V&&(K.key==="Tab"&&K.preventDefault(),!X&&P&&W(K.key));const ie=D.current;if(K.target!==ie||!uX.includes(K.key))return;K.preventDefault();const se=T().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);rj.includes(K.key)&&se.reverse(),LX(se)}),onBlur:Qe(e.onBlur,K=>{K.currentTarget.contains(K.target)||(window.clearTimeout(G.current),z.current="")}),onPointerMove:Qe(e.onPointerMove,Df(K=>{const I=K.target,V=F.current!==K.clientX;if(K.currentTarget.contains(I)&&V){const X=K.clientX>F.current?"right":"left";O.current=X,F.current=K.clientX}}))})})})})})})});cj.displayName=gs;var wX="MenuGroup",$C=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Yt.div,{role:"group",...r,ref:t})});$C.displayName=wX;var CX="MenuLabel",uj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Yt.div,{...r,ref:t})});uj.displayName=CX;var Tv="MenuItem",CN="menu.itemSelect",qb=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=_.useRef(null),o=pp(Tv,e.__scopeMenu),l=FC(Tv,e.__scopeMenu),c=hn(t,s),d=_.useRef(!1),f=()=>{const h=s.current;if(!n&&h){const g=new CustomEvent(CN,{bubbles:!0,cancelable:!0});h.addEventListener(CN,v=>r==null?void 0:r(v),{once:!0}),pO(h,g),g.defaultPrevented?d.current=!1:o.onClose()}};return m.jsx(dj,{...i,ref:c,disabled:n,onClick:Qe(e.onClick,f),onPointerDown:h=>{var g;(g=e.onPointerDown)==null||g.call(e,h),d.current=!0},onPointerUp:Qe(e.onPointerUp,h=>{var g;d.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:Qe(e.onKeyDown,h=>{const g=l.searchRef.current!=="";n||g&&h.key===" "||tw.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});qb.displayName=Tv;var dj=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=FC(Tv,n),l=sj(n),c=_.useRef(null),d=hn(t,c),[f,h]=_.useState(!1),[g,v]=_.useState("");return _.useEffect(()=>{const y=c.current;y&&v((y.textContent??"").trim())},[s.children]),m.jsx(Lf.ItemSlot,{scope:n,disabled:r,textValue:i??g,children:m.jsx(lX,{asChild:!0,...l,focusable:!r,children:m.jsx(Yt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:Qe(e.onPointerMove,Df(y=>{r?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Qe(e.onPointerLeave,Df(y=>o.onItemLeave(y))),onFocus:Qe(e.onFocus,()=>h(!0)),onBlur:Qe(e.onBlur,()=>h(!1))})})})}),kX="MenuCheckboxItem",hj=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return m.jsx(vj,{scope:e.__scopeMenu,checked:n,children:m.jsx(qb,{role:"menuitemcheckbox","aria-checked":Av(n)?"mixed":n,...i,ref:t,"data-state":VC(n),onSelect:Qe(i.onSelect,()=>r==null?void 0:r(Av(n)?!0:!n),{checkForDefaultPrevented:!1})})})});hj.displayName=kX;var fj="MenuRadioGroup",[EX,RX]=Ic(fj,{value:void 0,onValueChange:()=>{}}),pj=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=Bs(r);return m.jsx(EX,{scope:e.__scopeMenu,value:n,onValueChange:s,children:m.jsx($C,{...i,ref:t})})});pj.displayName=fj;var mj="MenuRadioItem",gj=_.forwardRef((e,t)=>{const{value:n,...r}=e,i=RX(mj,e.__scopeMenu),s=n===i.value;return m.jsx(vj,{scope:e.__scopeMenu,checked:s,children:m.jsx(qb,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":VC(s),onSelect:Qe(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});gj.displayName=mj;var UC="MenuItemIndicator",[vj,TX]=Ic(UC,{checked:!1}),bj=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=TX(UC,n);return m.jsx(xs,{present:r||Av(s.checked)||s.checked===!0,children:m.jsx(Yt.span,{...i,ref:t,"data-state":VC(s.checked)})})});bj.displayName=UC;var AX="MenuSeparator",_j=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Yt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});_j.displayName=AX;var NX="MenuArrow",yj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Gb(n);return m.jsx($b,{...i,...r,ref:t})});yj.displayName=NX;var MX="MenuSub",[iCe,xj]=Ic(MX),Zh="MenuSubTrigger",Sj=_.forwardRef((e,t)=>{const n=Pc(Zh,e.__scopeMenu),r=pp(Zh,e.__scopeMenu),i=xj(Zh,e.__scopeMenu),s=FC(Zh,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(zC,{asChild:!0,...d,children:m.jsx(dj,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":kj(n.open),...e,ref:hC(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:Qe(e.onPointerMove,Df(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:Qe(e.onPointerLeave,Df(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,R=g[w?"left":"right"],E=g[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+C,y:h.clientY},{x:R,y:g.top},{x:E,y:g.top},{x:E,y:g.bottom},{x:R,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:Qe(e.onKeyDown,h=>{var v;const g=s.searchRef.current!=="";e.disabled||g&&h.key===" "||dX[r.dir].includes(h.key)&&(n.onOpenChange(!0),(v=n.content)==null||v.focus(),h.preventDefault())})})})});Sj.displayName=Zh;var wj="MenuSubContent",Cj=_.forwardRef((e,t)=>{const n=aj(gs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Pc(gs,e.__scopeMenu),o=pp(gs,e.__scopeMenu),l=xj(wj,e.__scopeMenu),c=_.useRef(null),d=hn(t,c);return m.jsx(Lf.Provider,{scope:e.__scopeMenu,children:m.jsx(xs,{present:r||s.open,children:m.jsx(Lf.Slot,{scope:e.__scopeMenu,children:m.jsx(HC,{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:Qe(e.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Qe(e.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:Qe(e.onKeyDown,f=>{var v;const h=f.currentTarget.contains(f.target),g=hX[o.dir].includes(f.key);h&&g&&(s.onOpenChange(!1),(v=l.trigger)==null||v.focus(),f.preventDefault())})})})})})});Cj.displayName=wj;function kj(e){return e?"open":"closed"}function Av(e){return e==="indeterminate"}function VC(e){return Av(e)?"indeterminate":e?"checked":"unchecked"}function LX(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function DX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function IX(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=DX(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 PX(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 OX(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return PX(n,t)}function Df(e){return t=>t.pointerType==="mouse"?e(t):void 0}var jX=oj,zX=zC,BX=lj,FX=cj,HX=$C,$X=uj,UX=qb,VX=hj,WX=pj,GX=gj,qX=bj,KX=_j,YX=yj,XX=Sj,QX=Cj,WC="ContextMenu",[ZX]=la(WC,[ij]),ii=ij(),[JX,Ej]=ZX(WC),Rj=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:s=!0}=e,[o,l]=_.useState(!1),c=ii(t),d=Bs(r),f=_.useCallback(h=>{l(h),d(h)},[d]);return m.jsx(JX,{scope:t,open:o,onOpenChange:f,modal:s,children:m.jsx(jX,{...c,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};Rj.displayName=WC;var Tj="ContextMenuTrigger",Aj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,s=Ej(Tj,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(zX,{...o,virtualRef:c}),m.jsx(Yt.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Qe(e.onContextMenu,g=>{f(),h(g),g.preventDefault()}),onPointerDown:r?e.onPointerDown:Qe(e.onPointerDown,Zm(g=>{f(),d.current=window.setTimeout(()=>h(g),700)})),onPointerMove:r?e.onPointerMove:Qe(e.onPointerMove,Zm(f)),onPointerCancel:r?e.onPointerCancel:Qe(e.onPointerCancel,Zm(f)),onPointerUp:r?e.onPointerUp:Qe(e.onPointerUp,Zm(f))})]})});Aj.displayName=Tj;var eQ="ContextMenuPortal",Nj=e=>{const{__scopeContextMenu:t,...n}=e,r=ii(t);return m.jsx(BX,{...r,...n})};Nj.displayName=eQ;var Mj="ContextMenuContent",Lj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Ej(Mj,n),s=ii(n),o=_.useRef(!1);return m.jsx(FX,{...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)"}})});Lj.displayName=Mj;var tQ="ContextMenuGroup",nQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(HX,{...i,...r,ref:t})});nQ.displayName=tQ;var rQ="ContextMenuLabel",iQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx($X,{...i,...r,ref:t})});iQ.displayName=rQ;var sQ="ContextMenuItem",Dj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(UX,{...i,...r,ref:t})});Dj.displayName=sQ;var oQ="ContextMenuCheckboxItem",aQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(VX,{...i,...r,ref:t})});aQ.displayName=oQ;var lQ="ContextMenuRadioGroup",cQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(WX,{...i,...r,ref:t})});cQ.displayName=lQ;var uQ="ContextMenuRadioItem",dQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(GX,{...i,...r,ref:t})});dQ.displayName=uQ;var hQ="ContextMenuItemIndicator",fQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(qX,{...i,...r,ref:t})});fQ.displayName=hQ;var pQ="ContextMenuSeparator",Ij=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(KX,{...i,...r,ref:t})});Ij.displayName=pQ;var mQ="ContextMenuArrow",gQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(YX,{...i,...r,ref:t})});gQ.displayName=mQ;var vQ="ContextMenuSubTrigger",bQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(XX,{...i,...r,ref:t})});bQ.displayName=vQ;var _Q="ContextMenuSubContent",yQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(QX,{...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)"}})});yQ.displayName=_Q;function Zm(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var xQ=Rj,SQ=Aj,wQ=Nj,Pj=Lj,Oj=Dj,jj=Ij;const zj=_.createContext(null);function _l({onOpenChange:e,...t}){const[n,r]=_.useState(0),i=_.useCallback(()=>{r(s=>s+1),e==null||e(!1)},[e]);return m.jsx(zj.Provider,{value:i,children:m.jsx(xQ,{onOpenChange:e,...t},n)})}const yl=SQ,ra=_.forwardRef(({className:e,...t},n)=>m.jsx(wQ,{children:m.jsx(Pj,{ref:n,className:ye("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=Pj.displayName;const Cn=_.forwardRef(({className:e,onSelect:t,...n},r)=>{const i=_.useContext(zj);return m.jsx(Oj,{ref:r,className:ye("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})});Cn.displayName=Oj.displayName;const Bj=_.forwardRef(({className:e,...t},n)=>m.jsx(jj,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",e),...t}));Bj.displayName=jj.displayName;function CQ({editorLabel:e,onRename:t,onCopyPath:n,onShowArchived:r,onOpenInFinder:i,onOpenInEditor:s,onHide:o,children:l}){return m.jsxs(_l,{children:[m.jsx(yl,{asChild:!0,children:l}),m.jsxs(ra,{children:[m.jsxs(Cn,{onSelect:c=>{c.preventDefault(),t()},children:[m.jsx(Tb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),m.jsxs(Cn,{onSelect:c=>{c.stopPropagation(),n()},children:[m.jsx(ml,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Copy Path"})]}),m.jsxs(Cn,{onSelect:c=>{c.stopPropagation(),r()},children:[m.jsx(sC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show Archived"})]}),m.jsxs(Cn,{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(Cn,{onSelect:c=>{c.stopPropagation(),s()},children:[m.jsx(oC,{className:"h-3.5 w-3.5"}),m.jsxs("span",{className:"text-xs font-medium",children:["Open in ",e]})]}),m.jsxs(Cn,{onSelect:c=>{c.stopPropagation(),o()},children:[m.jsx(rU,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})]})]})}function kQ({canFork:e,onRename:t,onShare:n,onOpenInFinder:r,onFork:i,onArchive:s,onDelete:o,children:l}){return m.jsxs(_l,{children:[m.jsx(yl,{asChild:!0,children:l}),m.jsxs(ra,{children:[m.jsxs(Cn,{onSelect:c=>{c.preventDefault(),t()},children:[m.jsx(Tb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),m.jsxs(Cn,{onSelect:c=>{c.preventDefault(),n()},children:[m.jsx(dC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Share"})]}),m.jsxs(Cn,{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(Cn,{disabled:!e,onSelect:c=>{c.preventDefault(),e&&i()},children:[m.jsx(hO,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Fork"})]}),m.jsxs(Cn,{onSelect:c=>{c.preventDefault(),s()},children:[m.jsx(sC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Archive"})]}),m.jsxs(Cn,{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(Rf,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Delete"})]})]})]})}const EQ=new Set(["starting","running"]);function RQ({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=Y5(X5(e),n),v=i&&r?r:g,y=i&&!!r,x=Aq(e.chatId),w=m.jsxs("div",{"data-chat-id":x,className:ye("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:[EQ.has(e.status)?m.jsx(dn,{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(Dd,{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:ye("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(W5,{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:ye("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(hO,{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(sC,{className:"size-3.5"})})]})]})]},e._id);return m.jsx(kQ,{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 TQ=_.memo(RQ);function AQ(){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 Kb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Id(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function GC(e){return"nodeType"in e}function yi(e){var t,n;return e?Id(e)?e:GC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function qC(e){const{Document:t}=yi(e);return e instanceof t}function mp(e){return Id(e)?!1:e instanceof yi(e).HTMLElement}function Fj(e){return e instanceof yi(e).SVGElement}function Pd(e){return e?Id(e)?e.document:GC(e)?qC(e)?e:mp(e)||Fj(e)?e.ownerDocument:document:document:document}const mo=Kb?_.useLayoutEffect:_.useEffect;function KC(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 NQ(){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 If(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return mo(()=>{n.current!==e&&(n.current=e)},t),n}function gp(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Nv(e){const t=KC(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function nw(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let ix={};function vp(e,t){return _.useMemo(()=>{if(t)return t;const n=ix[e]==null?0:ix[e]+1;return ix[e]=n,e+"-"+n},[e,t])}function Hj(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 Qu=Hj(1),Mv=Hj(-1);function MQ(e){return"clientX"in e&&"clientY"in e}function YC(e){if(!e)return!1;const{KeyboardEvent:t}=yi(e.target);return t&&e instanceof t}function LQ(e){if(!e)return!1;const{TouchEvent:t}=yi(e.target);return t&&e instanceof t}function rw(e){if(LQ(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 MQ(e)?{x:e.clientX,y:e.clientY}:null}const Pf=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[Pf.Translate.toString(e),Pf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),kN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function DQ(e){return e.matches(kN)?e:e.querySelector(kN)}const IQ={display:"none"};function PQ(e){let{id:t,value:n}=e;return xn.createElement("div",{id:t,style:IQ},n)}function OQ(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 xn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function jQ(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const $j=_.createContext(null);function zQ(e){const t=_.useContext($j);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function BQ(){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 FQ={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},DG="DialogDescriptionWarning",IG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${FO(DG).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},PG=RO,OG=NO,HO=MO,$O=LO,jG=IO,zG=OO,BG=zO;function UO(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=UO(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function VO(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=UO(e))&&(r&&(r+=" "),r+=t);return r}const FG=(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},HG=(e,t)=>({classGroupId:e,validator:t}),WO=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),_v="-",eN=[],$G="arbitrary..",UG=e=>{const t=WG(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return VG(o);const l=o.split(_v),c=l[0]===""&&l.length>1?1:0;return GO(l,c,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const c=r[o],d=n[o];return c?d?FG(d,c):c:d||eN}return n[o]||eN}}},GO=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],s=n.nextPart.get(i);if(s){const d=GO(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}},VG=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?$G+r:void 0})(),WG=e=>{const{theme:t,classGroups:n}=e;return GG(n,t)},GG=(e,t)=>{const n=WO();for(const r in e){const i=e[r];gC(i,n,r,t)}return n},gC=(e,t,n,r)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];qG(o,t,n,r)}},qG=(e,t,n,r)=>{if(typeof e=="string"){KG(e,t,n);return}if(typeof e=="function"){YG(e,t,n,r);return}XG(e,t,n,r)},KG=(e,t,n)=>{const r=e===""?t:qO(t,e);r.classGroupId=n},YG=(e,t,n,r)=>{if(QG(e)){gC(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(HG(n,e))},XG=(e,t,n,r)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[l,c]=i[o];gC(c,qO(t,l),n,r)}},qO=(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=WO(),n.nextPart.set(o,l)),n=l}return n},QG=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,ZG=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)}}},WS="!",tN=":",JG=[],nN=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),eq=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===tN){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(WS)?(g=h.slice(0,-1),v=!0):h.startsWith(WS)&&(g=h.slice(1),v=!0);const y=d&&d>c?d-c:void 0;return nN(s,v,g,y)};if(t){const i=t+tN,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):nN(JG,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},tq=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}},nq=e=>({cache:ZG(e.cacheSize),parseClassName:eq(e),sortModifiers:tq(e),...UG(e)}),rq=/\s+/,iq=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],l=e.trim().split(rq);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 R=g.length===0?"":g.length===1?g[0]:s(g).join(":"),E=v?R+WS:R,T=E+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(E+D)}c=f+(c.length>0?" "+c:c)}return c},sq=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=KO(n))&&(i&&(i+=" "),i+=r);return i},KO=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=KO(e[r]))&&(n&&(n+=" "),n+=t);return n},oq=(e,...t)=>{let n,r,i,s;const o=c=>{const d=t.reduce((f,h)=>h(f),e());return n=nq(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=iq(c,n);return i(c,f),f};return s=o,(...c)=>s(sq(...c))},aq=[],ar=e=>{const t=n=>n[e]||aq;return t.isThemeGetter=!0,t},YO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,XO=/^\((?:(\w[\w-]*):)?(.+)\)$/i,lq=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,cq=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,uq=/\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$/,dq=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,hq=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fq=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Va=e=>lq.test(e),Ht=e=>!!e&&!Number.isNaN(Number(e)),Wa=e=>!!e&&Number.isInteger(Number(e)),Jy=e=>e.endsWith("%")&&Ht(e.slice(0,-1)),Po=e=>cq.test(e),QO=()=>!0,pq=e=>uq.test(e)&&!dq.test(e),vC=()=>!1,mq=e=>hq.test(e),gq=e=>fq.test(e),vq=e=>!nt(e)&&!it(e),bq=e=>wl(e,e5,vC),nt=e=>YO.test(e),Yl=e=>wl(e,t5,pq),rN=e=>wl(e,Eq,Ht),_q=e=>wl(e,r5,QO),yq=e=>wl(e,n5,vC),iN=e=>wl(e,ZO,vC),xq=e=>wl(e,JO,gq),Km=e=>wl(e,i5,mq),it=e=>XO.test(e),Ph=e=>Dc(e,t5),Sq=e=>Dc(e,n5),sN=e=>Dc(e,ZO),wq=e=>Dc(e,e5),Cq=e=>Dc(e,JO),Ym=e=>Dc(e,i5,!0),kq=e=>Dc(e,r5,!0),wl=(e,t,n)=>{const r=YO.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Dc=(e,t,n=!1)=>{const r=XO.exec(e);return r?r[1]?t(r[1]):n:!1},ZO=e=>e==="position"||e==="percentage",JO=e=>e==="image"||e==="url",e5=e=>e==="length"||e==="size"||e==="bg-size",t5=e=>e==="length",Eq=e=>e==="number",n5=e=>e==="family-name",r5=e=>e==="number"||e==="weight",i5=e=>e==="shadow",Rq=()=>{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"),R=ar("animate"),E=()=>["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(),it,nt],N=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],L=()=>[it,nt,c],G=()=>[Va,"full","auto",...L()],z=()=>[Wa,"none","subgrid",it,nt],$=()=>["auto",{span:["full",Wa,it,nt]},Wa,it,nt],H=()=>[Wa,"auto",it,nt],O=()=>["auto","min","max","fr",it,nt],F=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...L()],W=()=>[Va,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],B=()=>[Va,"screen","full","dvw","lvw","svw","min","max","fit",...L()],K=()=>[Va,"screen","full","lh","dvh","lvh","svh","min","max","fit",...L()],I=()=>[e,it,nt],V=()=>[...T(),sN,iN,{position:[it,nt]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],P=()=>["auto","cover","contain",wq,bq,{size:[it,nt]}],ie=()=>[Jy,Ph,Yl],re=()=>["","none","full",d,it,nt],se=()=>["",Ht,Ph,Yl],oe=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[Ht,Jy,sN,iN],ve=()=>["","none",y,it,nt],le=()=>["none",Ht,it,nt],te=()=>["none",Ht,it,nt],Ce=()=>[Ht,it,nt],Fe=()=>[Va,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Po],breakpoint:[Po],color:[QO],container:[Po],"drop-shadow":[Po],ease:["in","out","in-out"],font:[vq],"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",Ht],text:[Po],"text-shadow":[Po],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Va,nt,it,w]}],container:["container"],columns:[{columns:[Ht,nt,it,l]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:[Wa,"auto",it,nt]}],basis:[{basis:[Va,"full","auto",l,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ht,Va,"auto","initial","none",nt]}],grow:[{grow:["",Ht,it,nt]}],shrink:[{shrink:["",Ht,it,nt]}],order:[{order:[Wa,"first","last","none",it,nt]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...F(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...F()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":F()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pbs:[{pbs:L()}],pbe:[{pbe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],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":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...B()]}],"min-inline-size":[{"min-inline":["auto",...B()]}],"max-inline-size":[{"max-inline":["none",...B()]}],"block-size":[{block:["auto",...K()]}],"min-block-size":[{"min-block":["auto",...K()]}],"max-block-size":[{"max-block":["none",...K()]}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,Ph,Yl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,kq,_q]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Jy,nt]}],"font-family":[{font:[Sq,yq,t]}],"font-features":[{"font-features":[nt]}],"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,it,nt]}],"line-clamp":[{"line-clamp":[Ht,"none",it,rN]}],leading:[{leading:[s,...L()]}],"list-image":[{"list-image":["none",it,nt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",it,nt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ht,"from-font","auto",it,Yl]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Ht,"auto",it,nt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",it,nt]}],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",it,nt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:P()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Wa,it,nt],radial:["",it,nt],conic:[Wa,it,nt]},Cq,xq]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-bs":[{"border-bs":se()}],"border-w-be":[{"border-be":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ht,it,nt]}],"outline-w":[{outline:["",Ht,Ph,Yl]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",f,Ym,Km]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",h,Ym,Km]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Ht,Yl]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",g,Ym,Km]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Ht,it,nt]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"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":[Ht]}],"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":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"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":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"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":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"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":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"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":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"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":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"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":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[it,nt]}],"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":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":[Ht]}],"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":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:P()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",it,nt]}],filter:[{filter:["","none",it,nt]}],blur:[{blur:ve()}],brightness:[{brightness:[Ht,it,nt]}],contrast:[{contrast:[Ht,it,nt]}],"drop-shadow":[{"drop-shadow":["","none",v,Ym,Km]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",Ht,it,nt]}],"hue-rotate":[{"hue-rotate":[Ht,it,nt]}],invert:[{invert:["",Ht,it,nt]}],saturate:[{saturate:[Ht,it,nt]}],sepia:[{sepia:["",Ht,it,nt]}],"backdrop-filter":[{"backdrop-filter":["","none",it,nt]}],"backdrop-blur":[{"backdrop-blur":ve()}],"backdrop-brightness":[{"backdrop-brightness":[Ht,it,nt]}],"backdrop-contrast":[{"backdrop-contrast":[Ht,it,nt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ht,it,nt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ht,it,nt]}],"backdrop-invert":[{"backdrop-invert":["",Ht,it,nt]}],"backdrop-opacity":[{"backdrop-opacity":[Ht,it,nt]}],"backdrop-saturate":[{"backdrop-saturate":[Ht,it,nt]}],"backdrop-sepia":[{"backdrop-sepia":["",Ht,it,nt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",it,nt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ht,"initial",it,nt]}],ease:[{ease:["linear","initial",C,it,nt]}],delay:[{delay:[Ht,it,nt]}],animate:[{animate:["none",R,it,nt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,it,nt]}],"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:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:Ce()}],"skew-x":[{"skew-x":Ce()}],"skew-y":[{"skew-y":Ce()}],transform:[{transform:[it,nt,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Fe()}],"translate-x":[{"translate-x":Fe()}],"translate-y":[{"translate-y":Fe()}],"translate-z":[{"translate-z":Fe()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",it,nt]}],"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":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mbs":[{"scroll-mbs":L()}],"scroll-mbe":[{"scroll-mbe":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pbs":[{"scroll-pbs":L()}],"scroll-pbe":[{"scroll-pbe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"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",it,nt]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[Ht,Ph,Yl,rN]}],stroke:[{stroke:["none",...I()]}],"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"]}},Tq=oq(Rq);function ye(...e){return Tq(VO(e))}function df(){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 Aq(e){return e.startsWith("chatId:")?e.slice(7):e}const Tf="data-focus-fallback-ignore",s5="data-allow-focus-retain",yv="kanna:restore-chat-input-focus",bC="data-chat-input",xv="data-chat-selection-zone";function sc(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function o5(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:sc(e,s5):!1}function Nq(e){const t=e;return t!=null&&t.matches?o5(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:sc(e,s5):!1}function oN(e){return!!e.querySelector(`[${Tf}][data-state='open']`)}function Mq(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function Lq(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${bC}]`)).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 aN(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||sc(t,bC)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,c=s??i;return!o||!c||!o.contains(c)||sc(c,Tf)||sc(t,Tf)||l&&(sc(i,xv)||sc(c,xv))||o5(t)?"none":t&&t===c?"restore":Nq(t)?"none":"restore"}const Zo=PG,Dq=OG,a5=_.forwardRef(({className:e,...t},n)=>m.jsx(HO,{ref:n,className:ye("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));a5.displayName=HO.displayName;const Iq={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(Dq,{children:[m.jsx(a5,{}),m.jsxs($O,{ref:i,[Tf]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(yv)),(o=r.onCloseAutoFocus)==null||o.call(r,s)},className:ye("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","max-h-[85vh] flex flex-col",Iq[n],e),...r,children:[t,m.jsxs(BG,{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=$O.displayName;function _C({className:e,...t}){return m.jsx("div",{className:ye("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function Jo({className:e,...t}){return m.jsx(jG,{className:ye("text-lg font-medium leading-none tracking-tight",e),...t})}function Nd({className:e,...t}){return m.jsx(zG,{className:ye("text-sm text-muted-foreground",e),...t})}function ea({className:e,...t}){return m.jsx("div",{className:ye("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function gl({className:e,...t}){return m.jsx("div",{className:ye("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function Pq({className:e,...t}){return m.jsx("button",{className:ye("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","bg-primary text-primary-foreground hover:bg-primary/90","disabled:pointer-events-none disabled:bg-primary/20 disabled:text-primary/60",e),...t})}function Oq({className:e,...t}){return m.jsx("button",{className:ye("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground","disabled:pointer-events-none disabled:text-muted-foreground/50",e),...t})}function jq({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(_C,{children:[m.jsx(Jo,{children:"Shared Link"}),m.jsx(Nd,{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(ml,{className:"h-4 w-4"})})]})}),m.jsx(gl,{children:m.jsxs(Pq,{type:"button",onClick:r,children:[m.jsx(op,{className:"mr-2 h-4 w-4"}),"Open"]})})]})})}const lN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,cN=VO,zq=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return cN(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=lN(f)||lN(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 cN(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},Pb=zq("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:ye(Pb({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:ye("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Or.displayName="Input";const l5=_.createContext(null);function Bq({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(l5.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(Nd,{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(gl,{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 yC(){const e=_.useContext(l5);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const xC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("bg-card text-card-foreground",e),...t}));xC.displayName="Card";const SC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-2",e),...t}));SC.displayName="CardHeader";const c5=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:ye("text-2xl font-semibold leading-none tracking-tight",e),...t}));c5.displayName="CardTitle";const u5=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:ye("text-sm text-muted-foreground",e),...t}));u5.displayName="CardDescription";const wC=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("p-6 pt-0",e),...t}));wC.displayName="CardContent";const Fq=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",e),...t}));Fq.displayName="CardFooter";const Hq=["top","right","bottom","left"],vl=Math.min,Bi=Math.max,Sv=Math.round,Xm=Math.floor,co=e=>({x:e,y:e}),$q={left:"right",right:"left",bottom:"top",top:"bottom"};function GS(e,t,n){return Bi(e,vl(t,n))}function ta(e,t){return typeof e=="function"?e(t):e}function na(e){return e.split("-")[0]}function Md(e){return e.split("-")[1]}function CC(e){return e==="x"?"y":"x"}function kC(e){return e==="y"?"height":"width"}function io(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function EC(e){return CC(io(e))}function Uq(e,t,n){n===void 0&&(n=!1);const r=Md(e),i=EC(e),s=kC(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 Vq(e){const t=wv(e);return[qS(e),t,qS(t)]}function qS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const uN=["left","right"],dN=["right","left"],Wq=["top","bottom"],Gq=["bottom","top"];function qq(e,t,n){switch(e){case"top":case"bottom":return n?t?dN:uN:t?uN:dN;case"left":case"right":return t?Wq:Gq;default:return[]}}function Kq(e,t,n,r){const i=Md(e);let s=qq(na(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(qS)))),s}function wv(e){const t=na(e);return $q[t]+e.slice(t.length)}function Yq(e){return{top:0,right:0,bottom:0,left:0,...e}}function d5(e){return typeof e!="number"?Yq(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 hN(e,t,n){let{reference:r,floating:i}=e;const s=io(t),o=EC(t),l=kC(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(Md(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 Xq(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=d5(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})),R=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),T=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},A=Cv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:R,offsetParent:E,strategy:c}):R);return{top:(C.top-A.top+y.top)/T.y,bottom:(A.bottom-C.bottom+y.bottom)/T.y,left:(C.left-A.left+y.left)/T.x,right:(A.right-C.right+y.right)/T.x}}const Qq=50,Zq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:Xq},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}=hN(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:R}=w,{x:E,y:T,data:A,reset:N}=await R({x:f,y:h,initialPlacement:r,placement:g,strategy:i,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});f=E??f,h=T??h,y[C]={...y[C],...A},N&&v<Qq&&(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}=hN(d,g,c)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},Jq=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=d5(f),g={x:n,y:r},v=EC(i),y=kC(v),x=await o.getDimensions(d),w=v==="y",C=w?"top":"left",R=w?"bottom":"right",E=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[E]:0;(!D||!await(o.isElement==null?void 0:o.isElement(N)))&&(D=l.floating[E]||s.floating[y]);const L=T/2-A/2,G=D/2-x[y]/2-1,z=vl(h[C],G),$=vl(h[R],G),H=z,O=D-x[y]-$,F=D/2-x[y]/2+L,U=GS(H,F,O),j=!c.arrow&&Md(i)!=null&&F!==U&&s.reference[y]/2-(F<H?z:$)-x[y]/2<0,W=j?F<H?F-H:F-O:0;return{[v]:g[v]+W,data:{[v]:U,centerOffset:F-U-W,...j&&{alignmentOffset:W}},reset:j}}}),eK=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),R=io(l),E=na(l)===l,T=await(c.isRTL==null?void 0:c.isRTL(d.floating)),A=g||(E||!x?[wv(l)]:Vq(l)),N=y!=="none";!g&&N&&A.push(...Kq(l,x,y,T));const D=[l,...A],L=await c.detectOverflow(t,w),G=[];let z=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(L[C]),h){const F=Uq(i,o,T);G.push(L[F[0]],L[F[1]])}if(z=[...z,{placement:i,overflows:G}],!G.every(F=>F<=0)){var $,H;const F=((($=s.flip)==null?void 0:$.index)||0)+1,U=D[F];if(U&&(!(h==="alignment"?R!==io(U):!1)||z.every(B=>io(B.placement)===R?B.overflows[0]>0:!0)))return{data:{index:F,overflows:z},reset:{placement:U}};let j=(H=z.filter(W=>W.overflows[0]<=0).sort((W,B)=>W.overflows[1]-B.overflows[1])[0])==null?void 0:H.placement;if(!j)switch(v){case"bestFit":{var O;const W=(O=z.filter(B=>{if(N){const K=io(B.placement);return K===R||K==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(K=>K>0).reduce((K,I)=>K+I,0)]).sort((B,K)=>B[1]-K[1])[0])==null?void 0:O[0];W&&(j=W);break}case"initialPlacement":j=l;break}if(i!==j)return{reset:{placement:j}}}return{}}}};function fN(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function pN(e){return Hq.some(t=>e[t]>=0)}const tK=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=fN(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:pN(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=fN(o,n.floating);return{data:{escapedOffsets:l,escaped:pN(l)}}}default:return{}}}}},h5=new Set(["left","top"]);async function nK(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=Md(n),c=io(n)==="y",d=h5.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 rK=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 nK(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}}}}},iK=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:R,y:E}=C;return{x:R,y:E}}},...d}=ta(e,t),f={x:n,y:r},h=await s.detectOverflow(t,d),g=io(na(i)),v=CC(g);let y=f[v],x=f[g];if(o){const C=v==="y"?"top":"left",R=v==="y"?"bottom":"right",E=y+h[C],T=y-h[R];y=GS(E,y,T)}if(l){const C=g==="y"?"top":"left",R=g==="y"?"bottom":"right",E=x+h[C],T=x-h[R];x=GS(E,x,T)}const w=c.fn({...t,[v]:y,[g]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[v]:o,[g]:l}}}}}},sK=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=io(i),g=CC(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 E=g==="y"?"height":"width",T=s.reference[g]-s.floating[E]+w.mainAxis,A=s.reference[g]+s.reference[E]-w.mainAxis;v<T?v=T:v>A&&(v=A)}if(d){var C,R;const E=g==="y"?"width":"height",T=h5.has(na(i)),A=s.reference[h]-s.floating[E]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:w.crossAxis),N=s.reference[h]+s.reference[E]+(T?0:((R=o.offset)==null?void 0:R[h])||0)-(T?w.crossAxis:0);y<A?y=A:y>N&&(y=N)}return{[g]:v,[h]:y}}}},oK=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=Md(i),v=io(i)==="y",{width:y,height:x}=s.floating;let w,C;h==="top"||h==="bottom"?(w=h,C=g===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,w=g==="end"?"top":"bottom");const R=x-f.top-f.bottom,E=y-f.left-f.right,T=vl(x-f[w],R),A=vl(y-f[C],E),N=!t.middlewareData.shift;let D=T,L=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(L=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=R),N&&!g){const z=Bi(f.left,0),$=Bi(f.right,0),H=Bi(f.top,0),O=Bi(f.bottom,0);v?L=y-2*(z!==0||$!==0?z+$:Bi(f.left,f.right)):D=x-2*(H!==0||O!==0?H+O:Bi(f.top,f.bottom))}await c({...t,availableWidth:L,availableHeight:D});const G=await o.getDimensions(l.floating);return y!==G.width||x!==G.height?{reset:{rects:!0}}:{}}}};function Ob(){return typeof window<"u"}function Ld(e){return f5(e)?(e.nodeName||"").toLowerCase():"#document"}function Fi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function vo(e){var t;return(t=(f5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function f5(e){return Ob()?e instanceof Node||e instanceof Fi(e).Node:!1}function Fs(e){return Ob()?e instanceof Element||e instanceof Fi(e).Element:!1}function ca(e){return Ob()?e instanceof HTMLElement||e instanceof Fi(e).HTMLElement:!1}function mN(e){return!Ob()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Fi(e).ShadowRoot}function cp(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Hs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function aK(e){return/^(table|td|th)$/.test(Ld(e))}function jb(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const lK=/transform|translate|scale|rotate|perspective|filter/,cK=/paint|layout|strict|content/,Xl=e=>!!e&&e!=="none";let ex;function RC(e){const t=Fs(e)?Hs(e):e;return Xl(t.transform)||Xl(t.translate)||Xl(t.scale)||Xl(t.rotate)||Xl(t.perspective)||!TC()&&(Xl(t.backdropFilter)||Xl(t.filter))||lK.test(t.willChange||"")||cK.test(t.contain||"")}function uK(e){let t=bl(e);for(;ca(t)&&!ld(t);){if(RC(t))return t;if(jb(t))return null;t=bl(t)}return null}function TC(){return ex==null&&(ex=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ex}function ld(e){return/^(html|body|#document)$/.test(Ld(e))}function Hs(e){return Fi(e).getComputedStyle(e)}function zb(e){return Fs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function bl(e){if(Ld(e)==="html")return e;const t=e.assignedSlot||e.parentNode||mN(e)&&e.host||vo(e);return mN(t)?t.host:t}function p5(e){const t=bl(e);return ld(t)?e.ownerDocument?e.ownerDocument.body:e.body:ca(t)&&cp(t)?t:p5(t)}function Af(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=p5(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Fi(i);if(s){const l=KS(o);return t.concat(o,o.visualViewport||[],cp(i)?i:[],l&&n?Af(l):[])}else return t.concat(i,Af(i,[],n))}function KS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function m5(e){const t=Hs(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 AC(e){return Fs(e)?e:e.contextElement}function Xu(e){const t=AC(e);if(!ca(t))return co(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=m5(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 dK=co(0);function g5(e){const t=Fi(e);return!TC()||!t.visualViewport?dK:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function hK(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Fi(e)?!1:t}function xc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=AC(e);let o=co(1);t&&(r?Fs(r)&&(o=Xu(r)):o=Xu(e));const l=hK(s,n,r)?g5(s):co(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=Fi(s),v=r&&Fs(r)?Fi(r):r;let y=g,x=KS(y);for(;x&&r&&v!==y;){const w=Xu(x),C=x.getBoundingClientRect(),R=Hs(x),E=C.left+(x.clientLeft+parseFloat(R.paddingLeft))*w.x,T=C.top+(x.clientTop+parseFloat(R.paddingTop))*w.y;c*=w.x,d*=w.y,f*=w.x,h*=w.y,c+=E,d+=T,y=Fi(x),x=KS(y)}}return Cv({width:f,height:h,x:c,y:d})}function Bb(e,t){const n=zb(e).scrollLeft;return t?t.left+n:xc(vo(e)).left+n}function v5(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Bb(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function fK(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=vo(r),l=t?jb(t.floating):!1;if(r===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=co(1);const f=co(0),h=ca(r);if((h||!h&&!s)&&((Ld(r)!=="body"||cp(o))&&(c=zb(r)),h)){const v=xc(r);d=Xu(r),f.x=v.x+r.clientLeft,f.y=v.y+r.clientTop}const g=o&&!h&&!s?v5(o,c):co(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 pK(e){return Array.from(e.getClientRects())}function mK(e){const t=vo(e),n=zb(e),r=e.ownerDocument.body,i=Bi(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Bi(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Bb(e);const l=-n.scrollTop;return Hs(r).direction==="rtl"&&(o+=Bi(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const gN=25;function gK(e,t){const n=Fi(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=TC();(!f||f&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const d=Bb(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<=gN&&(s-=y)}else d<=gN&&(s+=d);return{width:s,height:o,x:l,y:c}}function vK(e,t){const n=xc(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ca(e)?Xu(e):co(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 vN(e,t,n){let r;if(t==="viewport")r=gK(e,n);else if(t==="document")r=mK(vo(e));else if(Fs(t))r=vK(t,n);else{const i=g5(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Cv(r)}function b5(e,t){const n=bl(e);return n===t||!Fs(n)||ld(n)?!1:Hs(n).position==="fixed"||b5(n,t)}function bK(e,t){const n=t.get(e);if(n)return n;let r=Af(e,[],!1).filter(l=>Fs(l)&&Ld(l)!=="body"),i=null;const s=Hs(e).position==="fixed";let o=s?bl(e):e;for(;Fs(o)&&!ld(o);){const l=Hs(o),c=RC(o);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||cp(o)&&!c&&b5(e,o))?r=r.filter(f=>f!==o):i=l,o=bl(o)}return t.set(e,r),r}function _K(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?jb(t)?[]:bK(t,this._c):[].concat(n),r],l=vN(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=vN(t,o[g],i);c=Bi(v.top,c),d=vl(v.right,d),f=vl(v.bottom,f),h=Bi(v.left,h)}return{width:d-h,height:f-c,x:h,y:c}}function yK(e){const{width:t,height:n}=m5(e);return{width:t,height:n}}function xK(e,t,n){const r=ca(t),i=vo(t),s=n==="fixed",o=xc(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=co(0);function d(){c.x=Bb(i)}if(r||!r&&!s)if((Ld(t)!=="body"||cp(i))&&(l=zb(t)),r){const v=xc(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?v5(i,l):co(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 tx(e){return Hs(e).position==="static"}function bN(e,t){if(!ca(e)||Hs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return vo(e)===n&&(n=n.ownerDocument.body),n}function _5(e,t){const n=Fi(e);if(jb(e))return n;if(!ca(e)){let i=bl(e);for(;i&&!ld(i);){if(Fs(i)&&!tx(i))return i;i=bl(i)}return n}let r=bN(e,t);for(;r&&aK(r)&&tx(r);)r=bN(r,t);return r&&ld(r)&&tx(r)&&!RC(r)?n:r||uK(e)||n}const SK=async function(e){const t=this.getOffsetParent||_5,n=this.getDimensions,r=await n(e.floating);return{reference:xK(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wK(e){return Hs(e).direction==="rtl"}const CK={convertOffsetParentRelativeRectToViewportRelativeRect:fK,getDocumentElement:vo,getClippingRect:_K,getOffsetParent:_5,getElementRects:SK,getClientRects:pK,getDimensions:yK,getScale:Xu,isElement:Fs,isRTL:wK};function y5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function kK(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=Xm(h),x=Xm(i.clientWidth-(f+g)),w=Xm(i.clientHeight-(h+v)),C=Xm(f),E={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:Bi(0,vl(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&&!y5(d,e.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(A,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(A,E)}n.observe(e)}return o(!0),s}function EK(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=AC(e),f=i||s?[...d?Af(d):[],...t?Af(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?kK(d,n):null;let g=-1,v=null;o&&(v=new ResizeObserver(C=>{let[R]=C;R&&R.target===d&&v&&t&&(v.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=v)==null||E.observe(t)})),n()}),d&&!c&&v.observe(d),t&&v.observe(t));let y,x=c?xc(e):null;c&&w();function w(){const C=xc(e);x&&!y5(x,C)&&n(),x=C,y=requestAnimationFrame(w)}return n(),()=>{var C;f.forEach(R=>{i&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),h==null||h(),(C=v)==null||C.disconnect(),v=null,c&&cancelAnimationFrame(y)}}const RK=rK,TK=iK,AK=eK,NK=oK,MK=tK,_N=Jq,LK=sK,DK=(e,t,n)=>{const r=new Map,i={platform:CK,...n},s={...i.platform,_c:r};return Zq(e,t,{...i,platform:s})};var IK=typeof document<"u",PK=function(){},qg=IK?_.useLayoutEffect:PK;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 x5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yN(e,t){const n=x5(e);return Math.round(t*n)/n}function nx(e){const t=_.useRef(e);return qg(()=>{t.current=e}),t}function OK(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),R=_.useCallback(B=>{B!==N.current&&(N.current=B,x(B))},[]),E=_.useCallback(B=>{B!==D.current&&(D.current=B,C(B))},[]),T=s||y,A=o||w,N=_.useRef(null),D=_.useRef(null),L=_.useRef(f),G=c!=null,z=nx(c),$=nx(i),H=nx(d),O=_.useCallback(()=>{if(!N.current||!D.current)return;const B={placement:t,strategy:n,middleware:g};$.current&&(B.platform=$.current),DK(N.current,D.current,B).then(K=>{const I={...K,isPositioned:H.current!==!1};F.current&&!kv(L.current,I)&&(L.current=I,ps.flushSync(()=>{h(I)}))})},[g,t,n,$,H]);qg(()=>{d===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,h(B=>({...B,isPositioned:!1})))},[d]);const F=_.useRef(!1);qg(()=>(F.current=!0,()=>{F.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:R,setFloating:E}),[R,E]),j=_.useMemo(()=>({reference:T,floating:A}),[T,A]),W=_.useMemo(()=>{const B={position:n,left:0,top:0};if(!j.floating)return B;const K=yN(j.floating,f.x),I=yN(j.floating,f.y);return l?{...B,transform:"translate("+K+"px, "+I+"px)",...x5(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:I}},[n,l,j.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:O,refs:U,elements:j,floatingStyles:W}),[f,O,U,j,W])}const jK=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?_N({element:r.current,padding:i}).fn(n):{}:r?_N({element:r,padding:i}).fn(n):{}}}},zK=(e,t)=>{const n=RK(e);return{name:n.name,fn:n.fn,options:[e,t]}},BK=(e,t)=>{const n=TK(e);return{name:n.name,fn:n.fn,options:[e,t]}},FK=(e,t)=>({fn:LK(e).fn,options:[e,t]}),HK=(e,t)=>{const n=AK(e);return{name:n.name,fn:n.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=jK(e);return{name:n.name,fn:n.fn,options:[e,t]}};var WK="Arrow",S5=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Yt.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"})})});S5.displayName=WK;var GK=S5;function qK(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 NC="Popper",[w5,Cl]=la(NC),[KK,C5]=w5(NC),k5=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(KK,{scope:t,anchor:r,onAnchorChange:i,children:n})};k5.displayName=NC;var E5="PopperAnchor",R5=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=C5(E5,n),o=_.useRef(null),l=hn(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(Yt.div,{...i,ref:l})});R5.displayName=E5;var MC="PopperContent",[YK,XK]=w5(MC),T5=_.forwardRef((e,t)=>{var oe,fe,de,ve,le,te;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=C5(MC,n),[C,R]=_.useState(null),E=hn(t,Ce=>R(Ce)),[T,A]=_.useState(null),N=qK(T),D=(N==null?void 0:N.width)??0,L=(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},$=Array.isArray(d)?d:[d],H=$.length>0,O={padding:z,boundary:$.filter(ZK),altBoundary:H},{refs:F,floatingStyles:U,placement:j,isPositioned:W,middlewareData:B}=OK({strategy:"fixed",placement:G,whileElementsMounted:(...Ce)=>EK(...Ce,{animationFrame:v==="always"}),elements:{reference:w.anchor},middleware:[zK({mainAxis:i+L,alignmentAxis:o}),c&&BK({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?FK():void 0,...O}),c&&HK({...O}),$K({...O,apply:({elements:Ce,rects:Fe,availableWidth:Xe,availableHeight:Ie})=>{const{width:at,height:Ve}=Fe.reference,gt=Ce.floating.style;gt.setProperty("--radix-popper-available-width",`${Xe}px`),gt.setProperty("--radix-popper-available-height",`${Ie}px`),gt.setProperty("--radix-popper-anchor-width",`${at}px`),gt.setProperty("--radix-popper-anchor-height",`${Ve}px`)}}),T&&VK({element:T,padding:l}),JK({arrowWidth:D,arrowHeight:L}),g&&UK({strategy:"referenceHidden",...O})]}),[K,I]=M5(j),V=Bs(y);Gr(()=>{W&&(V==null||V())},[W,V]);const X=(oe=B.arrow)==null?void 0:oe.x,P=(fe=B.arrow)==null?void 0:fe.y,ie=((de=B.arrow)==null?void 0:de.centerOffset)!==0,[re,se]=_.useState();return Gr(()=>{C&&se(window.getComputedStyle(C).zIndex)},[C]),m.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:W?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[(ve=B.transformOrigin)==null?void 0:ve.x,(le=B.transformOrigin)==null?void 0:le.y].join(" "),...((te=B.hide)==null?void 0:te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(YK,{scope:n,placedSide:K,onArrowChange:A,arrowX:X,arrowY:P,shouldHideArrow:ie,children:m.jsx(Yt.div,{"data-side":K,"data-align":I,...x,ref:E,style:{...x.style,animation:W?void 0:"none"}})})})});T5.displayName=MC;var A5="PopperArrow",QK={top:"bottom",right:"left",bottom:"top",left:"right"},N5=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=XK(A5,r),o=QK[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(GK,{...i,ref:n,style:{...i.style,display:"block"}})})});N5.displayName=A5;function ZK(e){return e!==null}var JK=e=>({name:"transformOrigin",options:e,fn(t){var w,C,R;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[d,f]=M5(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((C=i.arrow)==null?void 0:C.x)??0)+l/2,v=(((R=i.arrow)==null?void 0:R.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 M5(e){const[t,n="center"]=e.split("-");return[t,n]}var Fb=k5,up=R5,Hb=T5,$b=N5,L5=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"}),eY="VisuallyHidden",D5=_.forwardRef((e,t)=>m.jsx(Yt.span,{...e,ref:t,style:{...L5,...e.style}}));D5.displayName=eY;var tY=D5,[Ub]=la("Tooltip",[Cl]),Vb=Cl(),I5="TooltipProvider",nY=700,YS="tooltip.open",[rY,LC]=Ub(I5),P5=e=>{const{__scopeTooltip:t,delayDuration:n=nY,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(rY,{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})};P5.displayName=I5;var Nf="Tooltip",[iY,dp]=Ub(Nf),O5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,c=LC(Nf,e.__scopeTooltip),d=Vb(t),[f,h]=_.useState(null),g=Xo(),v=_.useRef(0),y=o??c.disableHoverableContent,x=l??c.delayDuration,w=_.useRef(!1),[C,R]=ad({prop:r,defaultProp:i??!1,onChange:D=>{D?(c.onOpen(),document.dispatchEvent(new CustomEvent(YS))):c.onClose(),s==null||s(D)},caller:Nf}),E=_.useMemo(()=>C?w.current?"delayed-open":"instant-open":"closed",[C]),T=_.useCallback(()=>{window.clearTimeout(v.current),v.current=0,w.current=!1,R(!0)},[R]),A=_.useCallback(()=>{window.clearTimeout(v.current),v.current=0,R(!1)},[R]),N=_.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{w.current=!0,R(!0),v.current=0},x)},[x,R]);return _.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),m.jsx(Fb,{...d,children:m.jsx(iY,{scope:t,contentId:g,open:C,stateAttribute:E,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})})};O5.displayName=Nf;var XS="TooltipTrigger",j5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=dp(XS,n),s=LC(XS,n),o=Vb(n),l=_.useRef(null),c=hn(t,l,i.onTriggerChange),d=_.useRef(!1),f=_.useRef(!1),h=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(up,{asChild:!0,...o,children:m.jsx(Yt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:Qe(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Qe(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Qe(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Qe(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Qe(e.onBlur,i.onClose),onClick:Qe(e.onClick,i.onClose)})})});j5.displayName=XS;var DC="TooltipPortal",[sY,oY]=Ub(DC,{forceMount:void 0}),z5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=dp(DC,t);return m.jsx(sY,{scope:t,forceMount:n,children:m.jsx(xs,{present:n||s.open,children:m.jsx(Ad,{asChild:!0,container:i,children:r})})})};z5.displayName=DC;var cd="TooltipContent",B5=_.forwardRef((e,t)=>{const n=oY(cd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=dp(cd,e.__scopeTooltip);return m.jsx(xs,{present:r||o.open,children:o.disableHoverableContent?m.jsx(F5,{side:i,...s,ref:t}):m.jsx(aY,{side:i,...s,ref:t})})}),aY=_.forwardRef((e,t)=>{const n=dp(cd,e.__scopeTooltip),r=LC(cd,e.__scopeTooltip),i=_.useRef(null),s=hn(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},R=hY(C,w.getBoundingClientRect()),E=fY(C,R),T=pY(x.getBoundingClientRect()),A=gY([...E,...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},R=(c==null?void 0:c.contains(w))||(f==null?void 0:f.contains(w)),E=!mY(C,o);R?g():E&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,o,d,g]),m.jsx(F5,{...e,ref:s})}),[lY,cY]=Ub(Nf,{isInside:!1}),uY=gW("TooltipContent"),F5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,c=dp(cd,n),d=Vb(n),{onClose:f}=c;return _.useEffect(()=>(document.addEventListener(YS,f),()=>document.removeEventListener(YS,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(Td,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs(Hb,{"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(uY,{children:r}),m.jsx(lY,{scope:n,isInside:!0,children:m.jsx(tY,{id:c.contentId,role:"tooltip",children:i||r})})]})})});B5.displayName=cd;var H5="TooltipArrow",dY=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Vb(n);return cY(H5,n).isInside?null:m.jsx($b,{...i,...r,ref:t})});dY.displayName=H5;function hY(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 fY(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 pY(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 mY(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 gY(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),vY(t)}function vY(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 bY=P5,$5=O5,U5=j5,V5=z5,IC=B5;function W5({className:e,...t}){return m.jsx("kbd",{className:ye("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",e),...t})}function _Y({className:e,...t}){return m.jsx("span",{className:ye("inline-flex items-center gap-0.5",e),...t})}const yY="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",xY=bY,uo=$5,ho=U5,Ps=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(V5,{children:m.jsx(IC,{ref:r,sideOffset:t,className:ye("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Ps.displayName=IC.displayName;const Ev=$5,Rv=U5;function G5(e){return e.toUpperCase()}function SY(e){const t=e.split("+");return m.jsx(_Y,{children:t.map((n,r)=>m.jsx(W5,{children:G5(n)},`${n}-${r}`))})}const Mf=_.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(V5,{children:m.jsx(IC,{ref:s,sideOffset:t,className:ye(yY,e),...i,children:o?SY(o):m.jsx("span",{children:typeof n=="string"?G5(n):n})})})});Mf.displayName="HotkeyTooltipContent";const wY="0.41.3",CY={version:wY},Kn="Kanna",xN="kanna",kY=".kanna",EY=".kanna-dev",RY="KANNA_RUNTIME_PROFILE",PC=`kanna/${CY.version}`,TY="[kanna]",AY=`~/${Kn}`;function Wb(){var t;return(t=globalThis.process)==null?void 0:t.env}function NY(e=Wb()){var t;return((t=e==null?void 0:e[RY])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function MY(e=Wb()){return NY(e)==="dev"?EY:kY}function LY(e=Wb()){return`~/${MY(e)}`}function DY(e=Wb()){return`${LY(e)}/keybindings.json`}function Qm(e){return e?`${xN} ${e}`:xN}const SN=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},IY=(e=>e?SN(e):SN),PY=e=>e;function OY(e,t=PY){const n=xn.useSyncExternalStore(e.subscribe,xn.useCallback(()=>t(e.getState()),[e,t]),xn.useCallback(()=>t(e.getInitialState()),[e,t]));return xn.useDebugValue(n),n}const jY=e=>{const t=IY(e),n=r=>OY(t,r);return Object.assign(n,t),n},kl=(e=>jY),q5="always",K5="funk",zY=[{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 BY(e){switch(e){case"never":case"unfocused":case"always":return e;default:return q5}}function FY(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 K5}}const cc=kl()(e=>({chatSoundPreference:q5,chatSoundId:K5,setChatSoundPreference:t=>e({chatSoundPreference:BY(t)}),setChatSoundId:t=>e({chatSoundId:FY(t)})})),HY={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 $Y(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function UY(e){const t=new Audio(HY[e]);return t.preload="auto",t.play()}async function QS(e,t){if(t<=0)return;const n=Array.from({length:t},(r,i)=>new Promise(s=>{window.setTimeout(()=>{UY(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function VY(e,t=document){return e==="never"?!1:e==="always"?!0:$Y(t)}function WY(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 wN(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 GY(e,t){if(!e)return 0;const n=wN(e),r=wN(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 ZS(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const qY=[/^(?:\/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 KY(e){const t=e.trim();for(const n of qY){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function JS(e){return e.split("/").pop()||e}const YY=1440*6e4;function Y5(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=YY,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 X5(e){return e.lastMessageAt??e._creationTime}const Dd=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...i})=>m.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:ye("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...i,children:e});function OC(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,R=xn.useRef(null),E=xn.useRef(new Map).current;return m.jsx(i,{scope:w,itemMap:E,collectionRef:R,children:C})};o.displayName=t;const l=e+"CollectionSlot",c=_c(l),d=xn.forwardRef((x,w)=>{const{scope:C,children:R}=x,E=s(l,C),T=hn(w,E.collectionRef);return m.jsx(c,{ref:T,children:R})});d.displayName=l;const f=e+"CollectionItemSlot",h="data-radix-collection-item",g=_c(f),v=xn.forwardRef((x,w)=>{const{scope:C,children:R,...E}=x,T=xn.useRef(null),A=hn(w,T),N=s(f,C);return xn.useEffect(()=>(N.itemMap.set(T,{ref:T,...E}),()=>void N.itemMap.delete(T))),m.jsx(g,{[h]:"",ref:A,children:R})});v.displayName=f;function y(x){const w=s(e+"CollectionConsumer",x);return xn.useCallback(()=>{const R=w.collectionRef.current;if(!R)return[];const E=Array.from(R.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((N,D)=>E.indexOf(N.ref.current)-E.indexOf(D.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:d,ItemSlot:v},y,r]}var XY=_.createContext(void 0);function jC(e){const t=_.useContext(XY);return e||t||"ltr"}var rx="rovingFocusGroup.onEntryFocus",QY={bubbles:!1,cancelable:!0},hp="RovingFocusGroup",[ew,Q5,ZY]=OC(hp),[JY,Z5]=la(hp,[ZY]),[eX,tX]=JY(hp),J5=_.forwardRef((e,t)=>m.jsx(ew.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(ew.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(nX,{...e,ref:t})})}));J5.displayName=hp;var nX=_.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=hn(t,g),y=jC(s),[x,w]=ad({prop:o,defaultProp:l??null,onChange:c,caller:hp}),[C,R]=_.useState(!1),E=Bs(d),T=Q5(n),A=_.useRef(!1),[N,D]=_.useState(0);return _.useEffect(()=>{const L=g.current;if(L)return L.addEventListener(rx,E),()=>L.removeEventListener(rx,E)},[E]),m.jsx(eX,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:x,onItemFocus:_.useCallback(L=>w(L),[w]),onItemShiftTab:_.useCallback(()=>R(!0),[]),onFocusableItemAdd:_.useCallback(()=>D(L=>L+1),[]),onFocusableItemRemove:_.useCallback(()=>D(L=>L-1),[]),children:m.jsx(Yt.div,{tabIndex:C||N===0?-1:0,"data-orientation":r,...h,ref:v,style:{outline:"none",...e.style},onMouseDown:Qe(e.onMouseDown,()=>{A.current=!0}),onFocus:Qe(e.onFocus,L=>{const G=!A.current;if(L.target===L.currentTarget&&G&&!C){const z=new CustomEvent(rx,QY);if(L.currentTarget.dispatchEvent(z),!z.defaultPrevented){const $=T().filter(j=>j.focusable),H=$.find(j=>j.active),O=$.find(j=>j.id===x),U=[H,O,...$].filter(Boolean).map(j=>j.ref.current);nj(U,f)}}A.current=!1}),onBlur:Qe(e.onBlur,()=>R(!1))})})}),ej="RovingFocusGroupItem",tj=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...l}=e,c=Xo(),d=s||c,f=tX(ej,n),h=f.currentTabStopId===d,g=Q5(n),{onFocusableItemAdd:v,onFocusableItemRemove:y,currentTabStopId:x}=f;return _.useEffect(()=>{if(r)return v(),()=>y()},[r,v,y]),m.jsx(ew.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:m.jsx(Yt.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:Qe(e.onMouseDown,w=>{r?f.onItemFocus(d):w.preventDefault()}),onFocus:Qe(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:Qe(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const C=sX(w,f.orientation,f.dir);if(C!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let E=g().filter(T=>T.focusable).map(T=>T.ref.current);if(C==="last")E.reverse();else if(C==="prev"||C==="next"){C==="prev"&&E.reverse();const T=E.indexOf(w.currentTarget);E=f.loop?oX(E,T+1):E.slice(T+1)}setTimeout(()=>nj(E))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:x!=null}):o})})});tj.displayName=ej;var rX={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iX(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function sX(e,t,n){const r=iX(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return rX[r]}function nj(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function oX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var aX=J5,lX=tj,tw=["Enter"," "],cX=["ArrowDown","PageUp","Home"],rj=["ArrowUp","PageDown","End"],uX=[...cX,...rj],dX={ltr:[...tw,"ArrowRight"],rtl:[...tw,"ArrowLeft"]},hX={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fp="Menu",[Lf,fX,pX]=OC(fp),[Ic,ij]=la(fp,[pX,Cl,Z5]),Gb=Cl(),sj=Z5(),[mX,Pc]=Ic(fp),[gX,pp]=Ic(fp),oj=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,l=Gb(t),[c,d]=_.useState(null),f=_.useRef(!1),h=Bs(s),g=jC(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(Fb,{...l,children:m.jsx(mX,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:m.jsx(gX,{scope:t,onClose:_.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:g,modal:o,children:r})})})};oj.displayName=fp;var vX="MenuAnchor",zC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Gb(n);return m.jsx(up,{...i,...r,ref:t})});zC.displayName=vX;var BC="MenuPortal",[bX,aj]=Ic(BC,{forceMount:void 0}),lj=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Pc(BC,t);return m.jsx(bX,{scope:t,forceMount:n,children:m.jsx(xs,{present:n||s.open,children:m.jsx(Ad,{asChild:!0,container:i,children:r})})})};lj.displayName=BC;var gs="MenuContent",[_X,FC]=Ic(gs),cj=_.forwardRef((e,t)=>{const n=aj(gs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Pc(gs,e.__scopeMenu),o=pp(gs,e.__scopeMenu);return m.jsx(Lf.Provider,{scope:e.__scopeMenu,children:m.jsx(xs,{present:r||s.open,children:m.jsx(Lf.Slot,{scope:e.__scopeMenu,children:o.modal?m.jsx(yX,{...i,ref:t}):m.jsx(xX,{...i,ref:t})})})})}),yX=_.forwardRef((e,t)=>{const n=Pc(gs,e.__scopeMenu),r=_.useRef(null),i=hn(t,r);return _.useEffect(()=>{const s=r.current;if(s)return Db(s)},[]),m.jsx(HC,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Qe(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),xX=_.forwardRef((e,t)=>{const n=Pc(gs,e.__scopeMenu);return m.jsx(HC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),SX=_c("MenuContent.ScrollLock"),HC=_.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=Pc(gs,n),C=pp(gs,n),R=Gb(n),E=sj(n),T=fX(n),[A,N]=_.useState(null),D=_.useRef(null),L=hn(t,D,w.onContentChange),G=_.useRef(0),z=_.useRef(""),$=_.useRef(0),H=_.useRef(null),O=_.useRef("right"),F=_.useRef(0),U=y?lp:_.Fragment,j=y?{as:SX,allowPinchZoom:!0}:void 0,W=K=>{var oe,fe;const I=z.current+K,V=T().filter(de=>!de.disabled),X=document.activeElement,P=(oe=V.find(de=>de.ref.current===X))==null?void 0:oe.textValue,ie=V.map(de=>de.textValue),re=IX(ie,I,P),se=(fe=V.find(de=>de.textValue===re))==null?void 0:fe.ref.current;(function de(ve){z.current=ve,window.clearTimeout(G.current),ve!==""&&(G.current=window.setTimeout(()=>de(""),1e3))})(I),se&&setTimeout(()=>se.focus())};_.useEffect(()=>()=>window.clearTimeout(G.current),[]),Mb();const B=_.useCallback(K=>{var V,X;return O.current===((V=H.current)==null?void 0:V.side)&&OX(K,(X=H.current)==null?void 0:X.area)},[]);return m.jsx(_X,{scope:n,searchRef:z,onItemEnter:_.useCallback(K=>{B(K)&&K.preventDefault()},[B]),onItemLeave:_.useCallback(K=>{var I;B(K)||((I=D.current)==null||I.focus(),N(null))},[B]),onTriggerLeave:_.useCallback(K=>{B(K)&&K.preventDefault()},[B]),pointerGraceTimerRef:$,onPointerGraceIntentChange:_.useCallback(K=>{H.current=K},[]),children:m.jsx(U,{...j,children:m.jsx(ap,{asChild:!0,trapped:i,onMountAutoFocus:Qe(s,K=>{var I;K.preventDefault(),(I=D.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:m.jsx(Td,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:v,children:m.jsx(aX,{asChild:!0,...E,dir:C.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:N,onEntryFocus:Qe(c,K=>{C.isUsingKeyboardRef.current||K.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(Hb,{role:"menu","aria-orientation":"vertical","data-state":kj(w.open),"data-radix-menu-content":"",dir:C.dir,...R,...x,ref:L,style:{outline:"none",...x.style},onKeyDown:Qe(x.onKeyDown,K=>{const V=K.target.closest("[data-radix-menu-content]")===K.currentTarget,X=K.ctrlKey||K.altKey||K.metaKey,P=K.key.length===1;V&&(K.key==="Tab"&&K.preventDefault(),!X&&P&&W(K.key));const ie=D.current;if(K.target!==ie||!uX.includes(K.key))return;K.preventDefault();const se=T().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);rj.includes(K.key)&&se.reverse(),LX(se)}),onBlur:Qe(e.onBlur,K=>{K.currentTarget.contains(K.target)||(window.clearTimeout(G.current),z.current="")}),onPointerMove:Qe(e.onPointerMove,Df(K=>{const I=K.target,V=F.current!==K.clientX;if(K.currentTarget.contains(I)&&V){const X=K.clientX>F.current?"right":"left";O.current=X,F.current=K.clientX}}))})})})})})})});cj.displayName=gs;var wX="MenuGroup",$C=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Yt.div,{role:"group",...r,ref:t})});$C.displayName=wX;var CX="MenuLabel",uj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Yt.div,{...r,ref:t})});uj.displayName=CX;var Tv="MenuItem",CN="menu.itemSelect",qb=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=_.useRef(null),o=pp(Tv,e.__scopeMenu),l=FC(Tv,e.__scopeMenu),c=hn(t,s),d=_.useRef(!1),f=()=>{const h=s.current;if(!n&&h){const g=new CustomEvent(CN,{bubbles:!0,cancelable:!0});h.addEventListener(CN,v=>r==null?void 0:r(v),{once:!0}),pO(h,g),g.defaultPrevented?d.current=!1:o.onClose()}};return m.jsx(dj,{...i,ref:c,disabled:n,onClick:Qe(e.onClick,f),onPointerDown:h=>{var g;(g=e.onPointerDown)==null||g.call(e,h),d.current=!0},onPointerUp:Qe(e.onPointerUp,h=>{var g;d.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:Qe(e.onKeyDown,h=>{const g=l.searchRef.current!=="";n||g&&h.key===" "||tw.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});qb.displayName=Tv;var dj=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=FC(Tv,n),l=sj(n),c=_.useRef(null),d=hn(t,c),[f,h]=_.useState(!1),[g,v]=_.useState("");return _.useEffect(()=>{const y=c.current;y&&v((y.textContent??"").trim())},[s.children]),m.jsx(Lf.ItemSlot,{scope:n,disabled:r,textValue:i??g,children:m.jsx(lX,{asChild:!0,...l,focusable:!r,children:m.jsx(Yt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:Qe(e.onPointerMove,Df(y=>{r?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Qe(e.onPointerLeave,Df(y=>o.onItemLeave(y))),onFocus:Qe(e.onFocus,()=>h(!0)),onBlur:Qe(e.onBlur,()=>h(!1))})})})}),kX="MenuCheckboxItem",hj=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return m.jsx(vj,{scope:e.__scopeMenu,checked:n,children:m.jsx(qb,{role:"menuitemcheckbox","aria-checked":Av(n)?"mixed":n,...i,ref:t,"data-state":VC(n),onSelect:Qe(i.onSelect,()=>r==null?void 0:r(Av(n)?!0:!n),{checkForDefaultPrevented:!1})})})});hj.displayName=kX;var fj="MenuRadioGroup",[EX,RX]=Ic(fj,{value:void 0,onValueChange:()=>{}}),pj=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=Bs(r);return m.jsx(EX,{scope:e.__scopeMenu,value:n,onValueChange:s,children:m.jsx($C,{...i,ref:t})})});pj.displayName=fj;var mj="MenuRadioItem",gj=_.forwardRef((e,t)=>{const{value:n,...r}=e,i=RX(mj,e.__scopeMenu),s=n===i.value;return m.jsx(vj,{scope:e.__scopeMenu,checked:s,children:m.jsx(qb,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":VC(s),onSelect:Qe(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});gj.displayName=mj;var UC="MenuItemIndicator",[vj,TX]=Ic(UC,{checked:!1}),bj=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=TX(UC,n);return m.jsx(xs,{present:r||Av(s.checked)||s.checked===!0,children:m.jsx(Yt.span,{...i,ref:t,"data-state":VC(s.checked)})})});bj.displayName=UC;var AX="MenuSeparator",_j=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Yt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});_j.displayName=AX;var NX="MenuArrow",yj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Gb(n);return m.jsx($b,{...i,...r,ref:t})});yj.displayName=NX;var MX="MenuSub",[iCe,xj]=Ic(MX),Zh="MenuSubTrigger",Sj=_.forwardRef((e,t)=>{const n=Pc(Zh,e.__scopeMenu),r=pp(Zh,e.__scopeMenu),i=xj(Zh,e.__scopeMenu),s=FC(Zh,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(zC,{asChild:!0,...d,children:m.jsx(dj,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":kj(n.open),...e,ref:hC(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:Qe(e.onPointerMove,Df(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:Qe(e.onPointerLeave,Df(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,R=g[w?"left":"right"],E=g[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+C,y:h.clientY},{x:R,y:g.top},{x:E,y:g.top},{x:E,y:g.bottom},{x:R,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:Qe(e.onKeyDown,h=>{var v;const g=s.searchRef.current!=="";e.disabled||g&&h.key===" "||dX[r.dir].includes(h.key)&&(n.onOpenChange(!0),(v=n.content)==null||v.focus(),h.preventDefault())})})})});Sj.displayName=Zh;var wj="MenuSubContent",Cj=_.forwardRef((e,t)=>{const n=aj(gs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Pc(gs,e.__scopeMenu),o=pp(gs,e.__scopeMenu),l=xj(wj,e.__scopeMenu),c=_.useRef(null),d=hn(t,c);return m.jsx(Lf.Provider,{scope:e.__scopeMenu,children:m.jsx(xs,{present:r||s.open,children:m.jsx(Lf.Slot,{scope:e.__scopeMenu,children:m.jsx(HC,{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:Qe(e.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Qe(e.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:Qe(e.onKeyDown,f=>{var v;const h=f.currentTarget.contains(f.target),g=hX[o.dir].includes(f.key);h&&g&&(s.onOpenChange(!1),(v=l.trigger)==null||v.focus(),f.preventDefault())})})})})})});Cj.displayName=wj;function kj(e){return e?"open":"closed"}function Av(e){return e==="indeterminate"}function VC(e){return Av(e)?"indeterminate":e?"checked":"unchecked"}function LX(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function DX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function IX(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=DX(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 PX(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 OX(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return PX(n,t)}function Df(e){return t=>t.pointerType==="mouse"?e(t):void 0}var jX=oj,zX=zC,BX=lj,FX=cj,HX=$C,$X=uj,UX=qb,VX=hj,WX=pj,GX=gj,qX=bj,KX=_j,YX=yj,XX=Sj,QX=Cj,WC="ContextMenu",[ZX]=la(WC,[ij]),ii=ij(),[JX,Ej]=ZX(WC),Rj=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:s=!0}=e,[o,l]=_.useState(!1),c=ii(t),d=Bs(r),f=_.useCallback(h=>{l(h),d(h)},[d]);return m.jsx(JX,{scope:t,open:o,onOpenChange:f,modal:s,children:m.jsx(jX,{...c,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};Rj.displayName=WC;var Tj="ContextMenuTrigger",Aj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,s=Ej(Tj,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(zX,{...o,virtualRef:c}),m.jsx(Yt.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Qe(e.onContextMenu,g=>{f(),h(g),g.preventDefault()}),onPointerDown:r?e.onPointerDown:Qe(e.onPointerDown,Zm(g=>{f(),d.current=window.setTimeout(()=>h(g),700)})),onPointerMove:r?e.onPointerMove:Qe(e.onPointerMove,Zm(f)),onPointerCancel:r?e.onPointerCancel:Qe(e.onPointerCancel,Zm(f)),onPointerUp:r?e.onPointerUp:Qe(e.onPointerUp,Zm(f))})]})});Aj.displayName=Tj;var eQ="ContextMenuPortal",Nj=e=>{const{__scopeContextMenu:t,...n}=e,r=ii(t);return m.jsx(BX,{...r,...n})};Nj.displayName=eQ;var Mj="ContextMenuContent",Lj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Ej(Mj,n),s=ii(n),o=_.useRef(!1);return m.jsx(FX,{...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)"}})});Lj.displayName=Mj;var tQ="ContextMenuGroup",nQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(HX,{...i,...r,ref:t})});nQ.displayName=tQ;var rQ="ContextMenuLabel",iQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx($X,{...i,...r,ref:t})});iQ.displayName=rQ;var sQ="ContextMenuItem",Dj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(UX,{...i,...r,ref:t})});Dj.displayName=sQ;var oQ="ContextMenuCheckboxItem",aQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(VX,{...i,...r,ref:t})});aQ.displayName=oQ;var lQ="ContextMenuRadioGroup",cQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(WX,{...i,...r,ref:t})});cQ.displayName=lQ;var uQ="ContextMenuRadioItem",dQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(GX,{...i,...r,ref:t})});dQ.displayName=uQ;var hQ="ContextMenuItemIndicator",fQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(qX,{...i,...r,ref:t})});fQ.displayName=hQ;var pQ="ContextMenuSeparator",Ij=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(KX,{...i,...r,ref:t})});Ij.displayName=pQ;var mQ="ContextMenuArrow",gQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(YX,{...i,...r,ref:t})});gQ.displayName=mQ;var vQ="ContextMenuSubTrigger",bQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(XX,{...i,...r,ref:t})});bQ.displayName=vQ;var _Q="ContextMenuSubContent",yQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=ii(n);return m.jsx(QX,{...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)"}})});yQ.displayName=_Q;function Zm(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var xQ=Rj,SQ=Aj,wQ=Nj,Pj=Lj,Oj=Dj,jj=Ij;const zj=_.createContext(null);function _l({onOpenChange:e,...t}){const[n,r]=_.useState(0),i=_.useCallback(()=>{r(s=>s+1),e==null||e(!1)},[e]);return m.jsx(zj.Provider,{value:i,children:m.jsx(xQ,{onOpenChange:e,...t},n)})}const yl=SQ,ra=_.forwardRef(({className:e,...t},n)=>m.jsx(wQ,{children:m.jsx(Pj,{ref:n,className:ye("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=Pj.displayName;const Cn=_.forwardRef(({className:e,onSelect:t,...n},r)=>{const i=_.useContext(zj);return m.jsx(Oj,{ref:r,className:ye("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})});Cn.displayName=Oj.displayName;const Bj=_.forwardRef(({className:e,...t},n)=>m.jsx(jj,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",e),...t}));Bj.displayName=jj.displayName;function CQ({editorLabel:e,onRename:t,onCopyPath:n,onShowArchived:r,onOpenInFinder:i,onOpenInEditor:s,onHide:o,children:l}){return m.jsxs(_l,{children:[m.jsx(yl,{asChild:!0,children:l}),m.jsxs(ra,{children:[m.jsxs(Cn,{onSelect:c=>{c.preventDefault(),t()},children:[m.jsx(Tb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),m.jsxs(Cn,{onSelect:c=>{c.stopPropagation(),n()},children:[m.jsx(ml,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Copy Path"})]}),m.jsxs(Cn,{onSelect:c=>{c.stopPropagation(),r()},children:[m.jsx(sC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show Archived"})]}),m.jsxs(Cn,{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(Cn,{onSelect:c=>{c.stopPropagation(),s()},children:[m.jsx(oC,{className:"h-3.5 w-3.5"}),m.jsxs("span",{className:"text-xs font-medium",children:["Open in ",e]})]}),m.jsxs(Cn,{onSelect:c=>{c.stopPropagation(),o()},children:[m.jsx(rU,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})]})]})}function kQ({canFork:e,onRename:t,onShare:n,onOpenInFinder:r,onFork:i,onArchive:s,onDelete:o,children:l}){return m.jsxs(_l,{children:[m.jsx(yl,{asChild:!0,children:l}),m.jsxs(ra,{children:[m.jsxs(Cn,{onSelect:c=>{c.preventDefault(),t()},children:[m.jsx(Tb,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),m.jsxs(Cn,{onSelect:c=>{c.preventDefault(),n()},children:[m.jsx(dC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Share"})]}),m.jsxs(Cn,{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(Cn,{disabled:!e,onSelect:c=>{c.preventDefault(),e&&i()},children:[m.jsx(hO,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Fork"})]}),m.jsxs(Cn,{onSelect:c=>{c.preventDefault(),s()},children:[m.jsx(sC,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Archive"})]}),m.jsxs(Cn,{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(Rf,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Delete"})]})]})]})}const EQ=new Set(["starting","running"]);function RQ({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=Y5(X5(e),n),v=i&&r?r:g,y=i&&!!r,x=Aq(e.chatId),w=m.jsxs("div",{"data-chat-id":x,className:ye("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:[EQ.has(e.status)?m.jsx(dn,{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(Dd,{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:ye("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(W5,{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:ye("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(hO,{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(sC,{className:"size-3.5"})})]})]})]},e._id);return m.jsx(kQ,{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 TQ=_.memo(RQ);function AQ(){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 Kb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Id(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function GC(e){return"nodeType"in e}function yi(e){var t,n;return e?Id(e)?e:GC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function qC(e){const{Document:t}=yi(e);return e instanceof t}function mp(e){return Id(e)?!1:e instanceof yi(e).HTMLElement}function Fj(e){return e instanceof yi(e).SVGElement}function Pd(e){return e?Id(e)?e.document:GC(e)?qC(e)?e:mp(e)||Fj(e)?e.ownerDocument:document:document:document}const mo=Kb?_.useLayoutEffect:_.useEffect;function KC(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 NQ(){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 If(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return mo(()=>{n.current!==e&&(n.current=e)},t),n}function gp(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Nv(e){const t=KC(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function nw(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let ix={};function vp(e,t){return _.useMemo(()=>{if(t)return t;const n=ix[e]==null?0:ix[e]+1;return ix[e]=n,e+"-"+n},[e,t])}function Hj(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 Qu=Hj(1),Mv=Hj(-1);function MQ(e){return"clientX"in e&&"clientY"in e}function YC(e){if(!e)return!1;const{KeyboardEvent:t}=yi(e.target);return t&&e instanceof t}function LQ(e){if(!e)return!1;const{TouchEvent:t}=yi(e.target);return t&&e instanceof t}function rw(e){if(LQ(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 MQ(e)?{x:e.clientX,y:e.clientY}:null}const Pf=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[Pf.Translate.toString(e),Pf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),kN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function DQ(e){return e.matches(kN)?e:e.querySelector(kN)}const IQ={display:"none"};function PQ(e){let{id:t,value:n}=e;return xn.createElement("div",{id:t,style:IQ},n)}function OQ(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 xn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function jQ(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const $j=_.createContext(null);function zQ(e){const t=_.useContext($j);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function BQ(){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 FQ={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.
664
- `},HQ={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function $Q(e){let{announcements:t=HQ,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=FQ}=e;const{announce:s,announcement:o}=jQ(),l=vp("DndLiveRegion"),[c,d]=_.useState(!1);if(_.useEffect(()=>{d(!0)},[]),zQ(_.useMemo(()=>({onDragStart(h){let{active:g}=h;s(t.onDragStart({active:g}))},onDragMove(h){let{active:g,over:v}=h;t.onDragMove&&s(t.onDragMove({active:g,over:v}))},onDragOver(h){let{active:g,over:v}=h;s(t.onDragOver({active:g,over:v}))},onDragEnd(h){let{active:g,over:v}=h;s(t.onDragEnd({active:g,over:v}))},onDragCancel(h){let{active:g,over:v}=h;s(t.onDragCancel({active:g,over:v}))}}),[s,t])),!c)return null;const f=xn.createElement(xn.Fragment,null,xn.createElement(PQ,{id:r,value:i.draggable}),xn.createElement(OQ,{id:l,announcement:o}));return n?ps.createPortal(f,n):f}var hr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(hr||(hr={}));function Lv(){}function EN(e,t){return _.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function UQ(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const $s=Object.freeze({x:0,y:0});function VQ(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function WQ(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function GQ(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function qQ(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function RN(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const TN=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=RN(t,t.left,t.top),s=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const d=VQ(RN(c),i);s.push({id:l,data:{droppableContainer:o,value:d}})}}return s.sort(WQ)};function KQ(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),o=i-r,l=s-n;if(r<i&&n<s){const c=t.width*t.height,d=e.width*e.height,f=o*l,h=f/(c+d-f);return Number(h.toFixed(4))}return 0}const YQ=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const s of r){const{id:o}=s,l=n.get(o);if(l){const c=KQ(l,t);c>0&&i.push({id:o,data:{droppableContainer:s,value:c}})}}return i.sort(GQ)};function XQ(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Uj(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:$s}function QQ(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];return i.reduce((o,l)=>({...o,top:o.top+e*l.y,bottom:o.bottom+e*l.y,left:o.left+e*l.x,right:o.right+e*l.x}),{...n})}}const ZQ=QQ(1);function JQ(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function eZ(e,t,n){const r=JQ(t);if(!r)return e;const{scaleX:i,scaleY:s,x:o,y:l}=r,c=e.left-o-(1-i)*parseFloat(n),d=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),f=i?e.width/i:e.width,h=s?e.height/s:e.height;return{width:f,height:h,top:d,right:c+f,bottom:d+h,left:c}}const tZ={ignoreTransform:!1};function Od(e,t){t===void 0&&(t=tZ);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:f}=yi(e).getComputedStyle(e);d&&(n=eZ(n,d,f))}const{top:r,left:i,width:s,height:o,bottom:l,right:c}=n;return{top:r,left:i,width:s,height:o,bottom:l,right:c}}function AN(e){return Od(e,{ignoreTransform:!0})}function nZ(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function rZ(e,t){return t===void 0&&(t=yi(e).getComputedStyle(e)),t.position==="fixed"}function iZ(e,t){t===void 0&&(t=yi(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const s=t[i];return typeof s=="string"?n.test(s):!1})}function XC(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(qC(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!mp(i)||Fj(i)||n.includes(i))return n;const s=yi(e).getComputedStyle(i);return i!==e&&iZ(i,s)&&n.push(i),rZ(i,s)?n:r(i.parentNode)}return e?r(e):n}function Vj(e){const[t]=XC(e,1);return t??null}function sx(e){return!Kb||!e?null:Id(e)?e:GC(e)?qC(e)||e===Pd(e).scrollingElement?window:mp(e)?e:null:null}function Wj(e){return Id(e)?e.scrollX:e.scrollLeft}function Gj(e){return Id(e)?e.scrollY:e.scrollTop}function iw(e){return{x:Wj(e),y:Gj(e)}}var _r;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(_r||(_r={}));function qj(e){return!Kb||!e?!1:e===document.scrollingElement}function Kj(e){const t={x:0,y:0},n=qj(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,o=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:i,isLeft:s,isBottom:o,isRight:l,maxScroll:r,minScroll:t}}const sZ={x:.2,y:.2};function oZ(e,t,n,r,i){let{top:s,left:o,right:l,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=sZ);const{isTop:d,isBottom:f,isLeft:h,isRight:g}=Kj(e),v={x:0,y:0},y={x:0,y:0},x={height:t.height*i.y,width:t.width*i.x};return!d&&s<=t.top+x.height?(v.y=_r.Backward,y.y=r*Math.abs((t.top+x.height-s)/x.height)):!f&&c>=t.bottom-x.height&&(v.y=_r.Forward,y.y=r*Math.abs((t.bottom-x.height-c)/x.height)),!g&&l>=t.right-x.width?(v.x=_r.Forward,y.x=r*Math.abs((t.right-x.width-l)/x.width)):!h&&o<=t.left+x.width&&(v.x=_r.Backward,y.x=r*Math.abs((t.left+x.width-o)/x.width)),{direction:v,speed:y}}function aZ(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:o}=window;return{top:0,left:0,right:s,bottom:o,width:s,height:o}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Yj(e){return e.reduce((t,n)=>Qu(t,iw(n)),$s)}function lZ(e){return e.reduce((t,n)=>t+Wj(n),0)}function cZ(e){return e.reduce((t,n)=>t+Gj(n),0)}function uZ(e,t){if(t===void 0&&(t=Od),!e)return;const{top:n,left:r,bottom:i,right:s}=t(e);Vj(e)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const dZ=[["x",["left","right"],lZ],["y",["top","bottom"],cZ]];class QC{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=XC(n),i=Yj(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,o,l]of dZ)for(const c of o)Object.defineProperty(this,c,{get:()=>{const d=l(r),f=i[s]-d;return this.rect[c]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class hf{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function hZ(e){const{EventTarget:t}=yi(e);return e instanceof t?e:Pd(e)}function ox(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var cs;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(cs||(cs={}));function NN(e){e.preventDefault()}function fZ(e){e.stopPropagation()}var un;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(un||(un={}));const Xj={start:[un.Space,un.Enter],cancel:[un.Esc],end:[un.Space,un.Enter,un.Tab]},pZ=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case un.Right:return{...n,x:n.x+25};case un.Left:return{...n,x:n.x-25};case un.Down:return{...n,y:n.y+25};case un.Up:return{...n,y:n.y-25}}};class ZC{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new hf(Pd(n)),this.windowListeners=new hf(yi(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(cs.Resize,this.handleCancel),this.windowListeners.add(cs.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(cs.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&uZ(r),n($s)}handleKeyDown(t){if(YC(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=Xj,coordinateGetter:o=pZ,scrollBehavior:l="smooth"}=i,{code:c}=t;if(s.end.includes(c)){this.handleEnd(t);return}if(s.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=r.current,f=d?{x:d.left,y:d.top}:$s;this.referenceCoordinates||(this.referenceCoordinates=f);const h=o(t,{active:n,context:r.current,currentCoordinates:f});if(h){const g=Mv(h,f),v={x:0,y:0},{scrollableAncestors:y}=r.current;for(const x of y){const w=t.code,{isTop:C,isRight:R,isLeft:E,isBottom:T,maxScroll:A,minScroll:N}=Kj(x),D=aZ(x),L={x:Math.min(w===un.Right?D.right-D.width/2:D.right,Math.max(w===un.Right?D.left:D.left+D.width/2,h.x)),y:Math.min(w===un.Down?D.bottom-D.height/2:D.bottom,Math.max(w===un.Down?D.top:D.top+D.height/2,h.y))},G=w===un.Right&&!R||w===un.Left&&!E,z=w===un.Down&&!T||w===un.Up&&!C;if(G&&L.x!==h.x){const $=x.scrollLeft+g.x,H=w===un.Right&&$<=A.x||w===un.Left&&$>=N.x;if(H&&!g.y){x.scrollTo({left:$,behavior:l});return}H?v.x=x.scrollLeft-$:v.x=w===un.Right?x.scrollLeft-A.x:x.scrollLeft-N.x,v.x&&x.scrollBy({left:-v.x,behavior:l});break}else if(z&&L.y!==h.y){const $=x.scrollTop+g.y,H=w===un.Down&&$<=A.y||w===un.Up&&$>=N.y;if(H&&!g.x){x.scrollTo({top:$,behavior:l});return}H?v.y=x.scrollTop-$:v.y=w===un.Down?x.scrollTop-A.y:x.scrollTop-N.y,v.y&&x.scrollBy({top:-v.y,behavior:l});break}}this.handleMove(t,Qu(Mv(h,this.referenceCoordinates),v))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ZC.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Xj,onActivation:i}=t,{active:s}=n;const{code:o}=e.nativeEvent;if(r.start.includes(o)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function MN(e){return!!(e&&"distance"in e)}function LN(e){return!!(e&&"delay"in e)}class JC{constructor(t,n,r){var i;r===void 0&&(r=hZ(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:o}=s;this.props=t,this.events=n,this.document=Pd(o),this.documentListeners=new hf(this.document),this.listeners=new hf(r),this.windowListeners=new hf(yi(o)),this.initialCoordinates=(i=rw(s))!=null?i:$s,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(cs.Resize,this.handleCancel),this.windowListeners.add(cs.DragStart,NN),this.windowListeners.add(cs.VisibilityChange,this.handleCancel),this.windowListeners.add(cs.ContextMenu,NN),this.documentListeners.add(cs.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(LN(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(MN(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(cs.Click,fZ,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(cs.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:s}=this,{onMove:o,options:{activationConstraint:l}}=s;if(!i)return;const c=(n=rw(t))!=null?n:$s,d=Mv(i,c);if(!r&&l){if(MN(l)){if(l.tolerance!=null&&ox(d,l.tolerance))return this.handleCancel();if(ox(d,l.distance))return this.handleStart()}if(LN(l)&&ox(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===un.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const mZ={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ek extends JC{constructor(t){const{event:n}=t,r=Pd(n.target);super(t,mZ,r)}}ek.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const gZ={move:{name:"mousemove"},end:{name:"mouseup"}};var sw;(function(e){e[e.RightClick=2]="RightClick"})(sw||(sw={}));class vZ extends JC{constructor(t){super(t,gZ,Pd(t.event.target))}}vZ.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===sw.RightClick?!1:(r==null||r({event:n}),!0)}}];const ax={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class bZ extends JC{constructor(t){super(t,ax)}static setup(){return window.addEventListener(ax.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ax.move.name,t)};function t(){}}}bZ.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var ff;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ff||(ff={}));var Dv;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Dv||(Dv={}));function _Z(e){let{acceleration:t,activator:n=ff.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:o=5,order:l=Dv.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:f,delta:h,threshold:g}=e;const v=xZ({delta:h,disabled:!s}),[y,x]=NQ(),w=_.useRef({x:0,y:0}),C=_.useRef({x:0,y:0}),R=_.useMemo(()=>{switch(n){case ff.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case ff.DraggableRect:return i}},[n,i,c]),E=_.useRef(null),T=_.useCallback(()=>{const N=E.current;if(!N)return;const D=w.current.x*C.current.x,L=w.current.y*C.current.y;N.scrollBy(D,L)},[]),A=_.useMemo(()=>l===Dv.TreeOrder?[...d].reverse():d,[l,d]);_.useEffect(()=>{if(!s||!d.length||!R){x();return}for(const N of A){if((r==null?void 0:r(N))===!1)continue;const D=d.indexOf(N),L=f[D];if(!L)continue;const{direction:G,speed:z}=oZ(N,L,R,t,g);for(const $ of["x","y"])v[$][G[$]]||(z[$]=0,G[$]=0);if(z.x>0||z.y>0){x(),E.current=N,y(T,o),w.current=z,C.current=G;return}}w.current={x:0,y:0},C.current={x:0,y:0},x()},[t,T,r,x,s,o,JSON.stringify(R),JSON.stringify(v),y,d,A,f,JSON.stringify(g)])}const yZ={x:{[_r.Backward]:!1,[_r.Forward]:!1},y:{[_r.Backward]:!1,[_r.Forward]:!1}};function xZ(e){let{delta:t,disabled:n}=e;const r=nw(t);return gp(i=>{if(n||!r||!i)return yZ;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[_r.Backward]:i.x[_r.Backward]||s.x===-1,[_r.Forward]:i.x[_r.Forward]||s.x===1},y:{[_r.Backward]:i.y[_r.Backward]||s.y===-1,[_r.Forward]:i.y[_r.Forward]||s.y===1}}},[n,t,r])}function SZ(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return gp(i=>{var s;return t==null?null:(s=r??i)!=null?s:null},[r,t])}function wZ(e,t){return _.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,s=i.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,r)}));return[...n,...s]},[]),[e,t])}var Of;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Of||(Of={}));var ow;(function(e){e.Optimized="optimized"})(ow||(ow={}));const DN=new Map;function CZ(e,t){let{dragging:n,dependencies:r,config:i}=t;const[s,o]=_.useState(null),{frequency:l,measure:c,strategy:d}=i,f=_.useRef(e),h=w(),g=If(h),v=_.useCallback(function(C){C===void 0&&(C=[]),!g.current&&o(R=>R===null?C:R.concat(C.filter(E=>!R.includes(E))))},[g]),y=_.useRef(null),x=gp(C=>{if(h&&!n)return DN;if(!C||C===DN||f.current!==e||s!=null){const R=new Map;for(let E of e){if(!E)continue;if(s&&s.length>0&&!s.includes(E.id)&&E.rect.current){R.set(E.id,E.rect.current);continue}const T=E.node.current,A=T?new QC(c(T),T):null;E.rect.current=A,A&&R.set(E.id,A)}return R}return C},[e,s,n,h,c]);return _.useEffect(()=>{f.current=e},[e]),_.useEffect(()=>{h||v()},[n,h]),_.useEffect(()=>{s&&s.length>0&&o(null)},[JSON.stringify(s)]),_.useEffect(()=>{h||typeof l!="number"||y.current!==null||(y.current=setTimeout(()=>{v(),y.current=null},l))},[l,h,v,...r]),{droppableRects:x,measureDroppableContainers:v,measuringScheduled:s!=null};function w(){switch(d){case Of.Always:return!1;case Of.BeforeDragging:return n;default:return!n}}}function Qj(e,t){return gp(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function kZ(e,t){return Qj(e,t)}function EZ(e){let{callback:t,disabled:n}=e;const r=KC(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return _.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Yb(e){let{callback:t,disabled:n}=e;const r=KC(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return _.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function RZ(e){return new QC(Od(e),e)}function IN(e,t,n){t===void 0&&(t=RZ);const[r,i]=_.useState(null);function s(){i(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??n)!=null?d:null}const f=t(e);return JSON.stringify(c)===JSON.stringify(f)?c:f})}const o=EZ({callback(c){if(e)for(const d of c){const{type:f,target:h}=d;if(f==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),l=Yb({callback:s});return mo(()=>{s(),e?(l==null||l.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),o==null||o.disconnect())},[e]),r}function TZ(e){const t=Qj(e);return Uj(e,t)}const PN=[];function AZ(e){const t=_.useRef(e),n=gp(r=>e?r&&r!==PN&&e&&t.current&&e.parentNode===t.current.parentNode?r:XC(e):PN,[e]);return _.useEffect(()=>{t.current=e},[e]),n}function NZ(e){const[t,n]=_.useState(null),r=_.useRef(e),i=_.useCallback(s=>{const o=sx(s.target);o&&n(l=>l?(l.set(o,iw(o)),new Map(l)):null)},[]);return _.useEffect(()=>{const s=r.current;if(e!==s){o(s);const l=e.map(c=>{const d=sx(c);return d?(d.addEventListener("scroll",i,{passive:!0}),[d,iw(d)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{o(e),o(s)};function o(l){l.forEach(c=>{const d=sx(c);d==null||d.removeEventListener("scroll",i)})}},[i,e]),_.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,o)=>Qu(s,o),$s):Yj(e):$s,[e,t])}function ON(e,t){t===void 0&&(t=[]);const n=_.useRef(null);return _.useEffect(()=>{n.current=null},t),_.useEffect(()=>{const r=e!==$s;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Mv(e,n.current):$s}function MZ(e){_.useEffect(()=>{if(!Kb)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function LZ(e,t){return _.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=o=>{s(o,t)},n},{}),[e,t])}function Zj(e){return _.useMemo(()=>e?nZ(e):null,[e])}const jN=[];function DZ(e,t){t===void 0&&(t=Od);const[n]=e,r=Zj(n?yi(n):null),[i,s]=_.useState(jN);function o(){s(()=>e.length?e.map(c=>qj(c)?r:new QC(t(c),c)):jN)}const l=Yb({callback:o});return mo(()=>{l==null||l.disconnect(),o(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),i}function IZ(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return mp(t)?t:e}function PZ(e){let{measure:t}=e;const[n,r]=_.useState(null),i=_.useCallback(d=>{for(const{target:f}of d)if(mp(f)){r(h=>{const g=t(f);return h?{...h,width:g.width,height:g.height}:g});break}},[t]),s=Yb({callback:i}),o=_.useCallback(d=>{const f=IZ(d);s==null||s.disconnect(),f&&(s==null||s.observe(f)),r(f?t(f):null)},[t,s]),[l,c]=Nv(o);return _.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const OZ=[{sensor:ek,options:{}},{sensor:ZC,options:{}}],jZ={current:{}},Kg={draggable:{measure:AN},droppable:{measure:AN,strategy:Of.WhileDragging,frequency:ow.Optimized},dragOverlay:{measure:Od}};class pf extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const zZ={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new pf,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Lv},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Kg,measureDroppableContainers:Lv,windowRect:null,measuringScheduled:!1},BZ={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Lv,draggableNodes:new Map,over:null,measureDroppableContainers:Lv},Xb=_.createContext(BZ),Jj=_.createContext(zZ);function FZ(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new pf}}}function HZ(e,t){switch(t.type){case hr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case hr.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case hr.DragEnd:case hr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case hr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new pf(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case hr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const o=new pf(e.droppable.containers);return o.set(n,{...s,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case hr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new pf(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function $Z(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=_.useContext(Xb),s=nw(r),o=nw(n==null?void 0:n.id);return _.useEffect(()=>{if(!t&&!r&&s&&o!=null){if(!YC(s)||document.activeElement===s.target)return;const l=i.get(o);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[c.current,d.current]){if(!f)continue;const h=DQ(f);if(h){h.focus();break}}})}},[r,t,i,o,s]),null}function UZ(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,s)=>s({transform:i,...r}),n):n}function VZ(e){return _.useMemo(()=>({draggable:{...Kg.draggable,...e==null?void 0:e.draggable},droppable:{...Kg.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Kg.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function WZ(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const s=_.useRef(!1),{x:o,y:l}=typeof i=="boolean"?{x:i,y:i}:i;mo(()=>{if(!o&&!l||!t){s.current=!1;return}if(s.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const f=n(d),h=Uj(f,r);if(o||(h.x=0),l||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const g=Vj(d);g&&g.scrollBy({top:h.y,left:h.x})}},[t,o,l,r,n])}const e3=_.createContext({...$s,scaleX:1,scaleY:1});var tl;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(tl||(tl={}));const GZ=_.memo(function(t){var n,r,i,s;let{id:o,accessibility:l,autoScroll:c=!0,children:d,sensors:f=OZ,collisionDetection:h=YQ,measuring:g,modifiers:v,...y}=t;const x=_.useReducer(HZ,void 0,FZ),[w,C]=x,[R,E]=BQ(),[T,A]=_.useState(tl.Uninitialized),N=T===tl.Initialized,{draggable:{active:D,nodes:L,translate:G},droppable:{containers:z}}=w,$=D!=null?L.get(D):null,H=_.useRef({initial:null,translated:null}),O=_.useMemo(()=>{var mt;return D!=null?{id:D,data:(mt=$==null?void 0:$.data)!=null?mt:jZ,rect:H}:null},[D,$]),F=_.useRef(null),[U,j]=_.useState(null),[W,B]=_.useState(null),K=If(y,Object.values(y)),I=vp("DndDescribedBy",o),V=_.useMemo(()=>z.getEnabled(),[z]),X=VZ(g),{droppableRects:P,measureDroppableContainers:ie,measuringScheduled:re}=CZ(V,{dragging:N,dependencies:[G.x,G.y],config:X.droppable}),se=SZ(L,D),oe=_.useMemo(()=>W?rw(W):null,[W]),fe=Lt(),de=kZ(se,X.draggable.measure);WZ({activeNode:D!=null?L.get(D):null,config:fe.layoutShiftCompensation,initialRect:de,measure:X.draggable.measure});const ve=IN(se,X.draggable.measure,de),le=IN(se?se.parentElement:null),te=_.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:z,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ce=z.getNodeFor((n=te.current.over)==null?void 0:n.id),Fe=PZ({measure:X.dragOverlay.measure}),Xe=(r=Fe.nodeRef.current)!=null?r:se,Ie=N?(i=Fe.rect)!=null?i:ve:null,at=!!(Fe.nodeRef.current&&Fe.rect),Ve=TZ(at?null:ve),gt=Zj(Xe?yi(Xe):null),It=AZ(N?Ce??se:null),et=DZ(It),Ct=UZ(v,{transform:{x:G.x-Ve.x,y:G.y-Ve.y,scaleX:1,scaleY:1},activatorEvent:W,active:O,activeNodeRect:ve,containerNodeRect:le,draggingNodeRect:Ie,over:te.current.over,overlayNodeRect:Fe.rect,scrollableAncestors:It,scrollableAncestorRects:et,windowRect:gt}),Wt=oe?Qu(oe,G):null,vt=NZ(It),At=ON(vt),me=ON(vt,[ve]),Se=Qu(Ct,At),He=Ie?ZQ(Ie,Ct):null,Ge=O&&He?h({active:O,collisionRect:He,droppableRects:P,droppableContainers:V,pointerCoordinates:Wt}):null,ht=qQ(Ge,"id"),[Be,bt]=_.useState(null),we=at?Ct:Qu(Ct,me),Ue=XQ(we,(s=Be==null?void 0:Be.rect)!=null?s:null,ve),Ye=_.useRef(null),Me=_.useCallback((mt,je)=>{let{sensor:ct,options:kt}=je;if(F.current==null)return;const ft=L.get(F.current);if(!ft)return;const xt=mt.nativeEvent,en=new ct({active:F.current,activeNode:ft,event:xt,options:kt,context:te,onAbort(tt){if(!L.get(tt))return;const{onDragAbort:ut}=K.current,Ne={id:tt};ut==null||ut(Ne),R({type:"onDragAbort",event:Ne})},onPending(tt,Ze,ut,Ne){if(!L.get(tt))return;const{onDragPending:rt}=K.current,De={id:tt,constraint:Ze,initialCoordinates:ut,offset:Ne};rt==null||rt(De),R({type:"onDragPending",event:De})},onStart(tt){const Ze=F.current;if(Ze==null)return;const ut=L.get(Ze);if(!ut)return;const{onDragStart:Ne}=K.current,ke={activatorEvent:xt,active:{id:Ze,data:ut.data,rect:H}};ps.unstable_batchedUpdates(()=>{Ne==null||Ne(ke),A(tl.Initializing),C({type:hr.DragStart,initialCoordinates:tt,active:Ze}),R({type:"onDragStart",event:ke}),j(Ye.current),B(xt)})},onMove(tt){C({type:hr.DragMove,coordinates:tt})},onEnd:Te(hr.DragEnd),onCancel:Te(hr.DragCancel)});Ye.current=en;function Te(tt){return async function(){const{active:ut,collisions:Ne,over:ke,scrollAdjustedTranslate:rt}=te.current;let De=null;if(ut&&rt){const{cancelDrop:zt}=K.current;De={activatorEvent:xt,active:ut,collisions:Ne,delta:rt,over:ke},tt===hr.DragEnd&&typeof zt=="function"&&await Promise.resolve(zt(De))&&(tt=hr.DragCancel)}F.current=null,ps.unstable_batchedUpdates(()=>{C({type:tt}),A(tl.Uninitialized),bt(null),j(null),B(null),Ye.current=null;const zt=tt===hr.DragEnd?"onDragEnd":"onDragCancel";if(De){const Vt=K.current[zt];Vt==null||Vt(De),R({type:zt,event:De})}})}}},[L]),lt=_.useCallback((mt,je)=>(ct,kt)=>{const ft=ct.nativeEvent,xt=L.get(kt);if(F.current!==null||!xt||ft.dndKit||ft.defaultPrevented)return;const en={active:xt};mt(ct,je.options,en)===!0&&(ft.dndKit={capturedBy:je.sensor},F.current=kt,Me(ct,je))},[L,Me]),ce=wZ(f,lt);MZ(f),mo(()=>{ve&&T===tl.Initializing&&A(tl.Initialized)},[ve,T]),_.useEffect(()=>{const{onDragMove:mt}=K.current,{active:je,activatorEvent:ct,collisions:kt,over:ft}=te.current;if(!je||!ct)return;const xt={active:je,activatorEvent:ct,collisions:kt,delta:{x:Se.x,y:Se.y},over:ft};ps.unstable_batchedUpdates(()=>{mt==null||mt(xt),R({type:"onDragMove",event:xt})})},[Se.x,Se.y]),_.useEffect(()=>{const{active:mt,activatorEvent:je,collisions:ct,droppableContainers:kt,scrollAdjustedTranslate:ft}=te.current;if(!mt||F.current==null||!je||!ft)return;const{onDragOver:xt}=K.current,en=kt.get(ht),Te=en&&en.rect.current?{id:en.id,rect:en.rect.current,data:en.data,disabled:en.disabled}:null,tt={active:mt,activatorEvent:je,collisions:ct,delta:{x:ft.x,y:ft.y},over:Te};ps.unstable_batchedUpdates(()=>{bt(Te),xt==null||xt(tt),R({type:"onDragOver",event:tt})})},[ht]),mo(()=>{te.current={activatorEvent:W,active:O,activeNode:se,collisionRect:He,collisions:Ge,droppableRects:P,draggableNodes:L,draggingNode:Xe,draggingNodeRect:Ie,droppableContainers:z,over:Be,scrollableAncestors:It,scrollAdjustedTranslate:Se},H.current={initial:Ie,translated:He}},[O,se,Ge,He,L,Xe,Ie,P,z,Be,It,Se]),_Z({...fe,delta:G,draggingRect:He,pointerCoordinates:Wt,scrollableAncestors:It,scrollableAncestorRects:et});const We=_.useMemo(()=>({active:O,activeNode:se,activeNodeRect:ve,activatorEvent:W,collisions:Ge,containerNodeRect:le,dragOverlay:Fe,draggableNodes:L,droppableContainers:z,droppableRects:P,over:Be,measureDroppableContainers:ie,scrollableAncestors:It,scrollableAncestorRects:et,measuringConfiguration:X,measuringScheduled:re,windowRect:gt}),[O,se,ve,W,Ge,le,Fe,L,z,P,Be,ie,It,et,X,re,gt]),_t=_.useMemo(()=>({activatorEvent:W,activators:ce,active:O,activeNodeRect:ve,ariaDescribedById:{draggable:I},dispatch:C,draggableNodes:L,over:Be,measureDroppableContainers:ie}),[W,ce,O,ve,C,I,L,Be,ie]);return xn.createElement($j.Provider,{value:E},xn.createElement(Xb.Provider,{value:_t},xn.createElement(Jj.Provider,{value:We},xn.createElement(e3.Provider,{value:Ue},d)),xn.createElement($Z,{disabled:(l==null?void 0:l.restoreFocus)===!1})),xn.createElement($Q,{...l,hiddenTextDescribedById:I}));function Lt(){const mt=(U==null?void 0:U.autoScrollEnabled)===!1,je=typeof c=="object"?c.enabled===!1:c===!1,ct=N&&!mt&&!je;return typeof c=="object"?{...c,enabled:ct}:{enabled:ct}}}),qZ=_.createContext(null),zN="button",KZ="Draggable";function YZ(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const s=vp(KZ),{activators:o,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:f,draggableNodes:h,over:g}=_.useContext(Xb),{role:v=zN,roleDescription:y="draggable",tabIndex:x=0}=i??{},w=(c==null?void 0:c.id)===t,C=_.useContext(w?e3:qZ),[R,E]=Nv(),[T,A]=Nv(),N=LZ(o,t),D=If(n);mo(()=>(h.set(t,{id:t,key:s,node:R,activatorNode:T,data:D}),()=>{const G=h.get(t);G&&G.key===s&&h.delete(t)}),[h,t]);const L=_.useMemo(()=>({role:v,tabIndex:x,"aria-disabled":r,"aria-pressed":w&&v===zN?!0:void 0,"aria-roledescription":y,"aria-describedby":f.draggable}),[r,v,x,w,y,f.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:L,isDragging:w,listeners:r?void 0:N,node:R,over:g,setNodeRef:E,setActivatorNodeRef:A,transform:C}}function XZ(){return _.useContext(Jj)}const QZ="Droppable",ZZ={timeout:25};function JZ(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const s=vp(QZ),{active:o,dispatch:l,over:c,measureDroppableContainers:d}=_.useContext(Xb),f=_.useRef({disabled:n}),h=_.useRef(!1),g=_.useRef(null),v=_.useRef(null),{disabled:y,updateMeasurementsFor:x,timeout:w}={...ZZ,...i},C=If(x??r),R=_.useCallback(()=>{if(!h.current){h.current=!0;return}v.current!=null&&clearTimeout(v.current),v.current=setTimeout(()=>{d(Array.isArray(C.current)?C.current:[C.current]),v.current=null},w)},[w]),E=Yb({callback:R,disabled:y||!o}),T=_.useCallback((L,G)=>{E&&(G&&(E.unobserve(G),h.current=!1),L&&E.observe(L))},[E]),[A,N]=Nv(T),D=If(t);return _.useEffect(()=>{!E||!A.current||(E.disconnect(),h.current=!1,E.observe(A.current))},[A,E]),_.useEffect(()=>(l({type:hr.RegisterDroppable,element:{id:r,key:s,disabled:n,node:A,rect:g,data:D}}),()=>l({type:hr.UnregisterDroppable,key:s,id:r})),[r]),_.useEffect(()=>{n!==f.current.disabled&&(l({type:hr.SetDroppableDisabled,id:r,key:s,disabled:n}),f.current.disabled=n)},[r,s,n,l]),{active:o,rect:g,isOver:(c==null?void 0:c.id)===r,node:A,over:c,setNodeRef:N}}function tk(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function eJ(e,t){return e.reduce((n,r,i)=>{const s=t.get(r);return s&&(n[i]=s),n},Array(e.length))}function Jm(e){return e!==null&&e>=0}function tJ(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function nJ(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const t3=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const s=tk(t,r,n),o=t[i],l=s[i];return!l||!o?null:{x:l.left-o.left,y:l.top-o.top,scaleX:l.width/o.width,scaleY:l.height/o.height}},eg={scaleX:1,scaleY:1},rJ=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:s,overIndex:o}=e;const l=(t=s[n])!=null?t:r;if(!l)return null;if(i===n){const d=s[o];return d?{x:0,y:n<o?d.top+d.height-(l.top+l.height):d.top-l.top,...eg}:null}const c=iJ(s,i,n);return i>n&&i<=o?{x:0,y:-l.height-c,...eg}:i<n&&i>=o?{x:0,y:l.height+c,...eg}:{x:0,y:0,...eg}};function iJ(e,t,n){const r=e[t],i=e[t-1],s=e[t+1];return r?n<t?i?r.top-(i.top+i.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const n3="Sortable",r3=xn.createContext({activeIndex:-1,containerId:n3,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:t3,disabled:{draggable:!1,droppable:!1}});function sJ(e){let{children:t,id:n,items:r,strategy:i=t3,disabled:s=!1}=e;const{active:o,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:f}=XZ(),h=vp(n3,n),g=l.rect!==null,v=_.useMemo(()=>r.map(N=>typeof N=="object"&&"id"in N?N.id:N),[r]),y=o!=null,x=o?v.indexOf(o.id):-1,w=d?v.indexOf(d.id):-1,C=_.useRef(v),R=!tJ(v,C.current),E=w!==-1&&x===-1||R,T=nJ(s);mo(()=>{R&&y&&f(v)},[R,v,y,f]),_.useEffect(()=>{C.current=v},[v]);const A=_.useMemo(()=>({activeIndex:x,containerId:h,disabled:T,disableTransforms:E,items:v,overIndex:w,useDragOverlay:g,sortedRects:eJ(v,c),strategy:i}),[x,h,T.draggable,T.droppable,E,v,w,c,g,i]);return xn.createElement(r3.Provider,{value:A},t)}const oJ=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return tk(n,r,i).indexOf(t)},aJ=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:s,newIndex:o,previousItems:l,previousContainerId:c,transition:d}=e;return!d||!r||l!==s&&i===o?!1:n?!0:o!==i&&t===c},lJ={duration:200,easing:"ease"},i3="transform",cJ=Pf.Transition.toString({property:i3,duration:0,easing:"linear"}),uJ={roleDescription:"sortable"};function dJ(e){let{disabled:t,index:n,node:r,rect:i}=e;const[s,o]=_.useState(null),l=_.useRef(n);return mo(()=>{if(!t&&n!==l.current&&r.current){const c=i.current;if(c){const d=Od(r.current,{ignoreTransform:!0}),f={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(f.x||f.y)&&o(f)}}n!==l.current&&(l.current=n)},[t,n,r,i]),_.useEffect(()=>{s&&o(null)},[s]),s}function hJ(e){let{animateLayoutChanges:t=aJ,attributes:n,disabled:r,data:i,getNewIndex:s=oJ,id:o,strategy:l,resizeObserverConfig:c,transition:d=lJ}=e;const{items:f,containerId:h,activeIndex:g,disabled:v,disableTransforms:y,sortedRects:x,overIndex:w,useDragOverlay:C,strategy:R}=_.useContext(r3),E=fJ(r,v),T=f.indexOf(o),A=_.useMemo(()=>({sortable:{containerId:h,index:T,items:f},...i}),[h,i,T,f]),N=_.useMemo(()=>f.slice(f.indexOf(o)),[f,o]),{rect:D,node:L,isOver:G,setNodeRef:z}=JZ({id:o,data:A,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...c}}),{active:$,activatorEvent:H,activeNodeRect:O,attributes:F,setNodeRef:U,listeners:j,isDragging:W,over:B,setActivatorNodeRef:K,transform:I}=YZ({id:o,data:A,attributes:{...uJ,...n},disabled:E.draggable}),V=AQ(z,U),X=!!$,P=X&&!y&&Jm(g)&&Jm(w),ie=!C&&W,re=ie&&P?I:null,oe=P?re??(l??R)({rects:x,activeNodeRect:O,activeIndex:g,overIndex:w,index:T}):null,fe=Jm(g)&&Jm(w)?s({id:o,items:f,activeIndex:g,overIndex:w}):T,de=$==null?void 0:$.id,ve=_.useRef({activeId:de,items:f,newIndex:fe,containerId:h}),le=f!==ve.current.items,te=t({active:$,containerId:h,isDragging:W,isSorting:X,id:o,index:T,items:f,newIndex:ve.current.newIndex,previousItems:ve.current.items,previousContainerId:ve.current.containerId,transition:d,wasDragging:ve.current.activeId!=null}),Ce=dJ({disabled:!te,index:T,node:L,rect:D});return _.useEffect(()=>{X&&ve.current.newIndex!==fe&&(ve.current.newIndex=fe),h!==ve.current.containerId&&(ve.current.containerId=h),f!==ve.current.items&&(ve.current.items=f)},[X,fe,h,f]),_.useEffect(()=>{if(de===ve.current.activeId)return;if(de!=null&&ve.current.activeId==null){ve.current.activeId=de;return}const Xe=setTimeout(()=>{ve.current.activeId=de},50);return()=>clearTimeout(Xe)},[de]),{active:$,activeIndex:g,attributes:F,data:A,rect:D,index:T,newIndex:fe,items:f,isOver:G,isSorting:X,isDragging:W,listeners:j,node:L,overIndex:w,over:B,setNodeRef:V,setActivatorNodeRef:K,setDroppableNodeRef:z,setDraggableNodeRef:U,transform:Ce??oe,transition:Fe()};function Fe(){if(Ce||le&&ve.current.newIndex===T)return cJ;if(!(ie&&!YC(H)||!d)&&(X||te))return Pf.Transition.toString({...d,property:i3})}}function fJ(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}un.Down,un.Right,un.Up,un.Left;const pJ=20,s3="(min-width: 768px)";function mJ(e){if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};const t=window.matchMedia(s3);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function gJ(){return typeof window>"u"||typeof window.matchMedia!="function"?!0:window.matchMedia(s3).matches}function vJ(){return _.useSyncExternalStore(mJ,gJ,()=>!0)}function bJ(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();e.currentTarget.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:t.left+t.width/2,clientY:t.bottom,view:window}))}function BN(e){return e.top+e.height/2}function _J({localPath:e,onNewLocalChat:t,isConnected:n,startingLocalPath:r}){const i=!n||r===e;return m.jsxs("button",{type:"button",disabled:i,title:n?"New Chat":`Start ${Kn} to connect`,className:ye("group flex w-full items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg text-left cursor-pointer border-border/0 hover:border-border hover:bg-muted/20 active:scale-[0.985] border transition-all","border-border/0 dark:hover:border-slate-400/10",i&&"cursor-not-allowed opacity-50 active:scale-100"),onClick:()=>t(e),children:[m.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px] text-slate-500 dark:text-slate-400",children:"New Chat"}),m.jsx("div",{className:"h-7 w-6 mr-[2px] shrink-0","aria-hidden":!0})]})}function yJ({activeId:e,groupIds:t,collisionRect:n,droppableRects:r}){const i=t.indexOf(e);if(i===-1)return null;const s=r.get(e);if(!s)return null;const o=n.top+pJ;if(n.top>s.top){for(let l=t.length-1;l>i;l--){const c=r.get(t[l]);if(c&&o>=BN(c))return t[l]}return e}if(n.top<s.top){for(let l=0;l<i;l++){const c=r.get(t[l]);if(c&&o<=BN(c))return t[l]}return e}return e}const xJ=_.memo(function({group:t,isReorderEnabled:n,editorLabel:r,collapsedSections:i,expandedGroups:s,onToggleSection:o,onToggleExpandedGroup:l,renderChatRow:c,onShowArchivedProject:d,onNewLocalChat:f,onCopyPath:h,onOpenExternalPath:g,onRenameProject:v,onHideProject:y,isConnected:x,startingLocalPath:w}){const{groupKey:C,localPath:R,title:E}=t,T=s.has(C),A=t.chats.length===0,N=t.olderChats.length>0,D=!!(y&&h&&g),{attributes:L,listeners:G,setNodeRef:z,setActivatorNodeRef:$,transform:H,transition:O,isDragging:F}=hJ({id:C,disabled:!n}),U={transform:Pf.Translate.toString(H?{...H,x:0}:null),transition:F?void 0:O},j=m.jsxs("div",{ref:$,className:ye("sticky top-0 bg-background dark:bg-card z-10 relative p-[10px] flex items-center justify-between","md:cursor-grab md:active:cursor-grabbing md:select-none md:touch-none",F&&"cursor-grabbing"),onClick:()=>o(C),...n?G:void 0,children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"relative size-3.5 shrink-0 cursor-pointer",children:m.jsx(pl,{className:`translate-y-[1px] size-3.5 shrink-0 text-slate-400 transition-all duration-200 ${!i.has(C)&&"rotate-90"}`})}),m.jsxs(uo,{children:[m.jsx(ho,{asChild:!0,children:m.jsx("span",{className:"truncate max-w-[150px] whitespace-nowrap text-sm ",children:E||JS(R)})}),m.jsx(Ps,{side:"right",sideOffset:4,children:R})]})]}),(D||f)&&m.jsxs("div",{className:"absolute right-2 flex items-center gap-[1px] opacity-100 md:opacity-0 md:group-hover/section:opacity-100",children:[D?m.jsxs(uo,{children:[m.jsx(ho,{asChild:!0,children:m.jsx(qe,{variant:"ghost",size:"icon",className:"h-5.5 w-5.5 !rounded",onClick:bJ,children:m.jsx(Eb,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),m.jsx(Ps,{side:"right",sideOffset:4,children:"More"})]}):null,f?m.jsxs(uo,{children:[m.jsx(ho,{asChild:!0,children:m.jsx(qe,{variant:"ghost",size:"icon",className:ye("h-5.5 w-5.5 !rounded",(!x||w===R)&&"opacity-50 cursor-not-allowed"),disabled:!x||w===R,onClick:W=>{W.stopPropagation(),f(R)},children:w===R?m.jsx(dn,{className:"size-4 text-slate-500 dark:text-slate-400 animate-spin"}):m.jsx(uC,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),m.jsx(Ps,{side:"right",sideOffset:4,children:x?"New Chat":`Start ${Kn} to connect`})]}):null]})]});return m.jsxs("div",{ref:z,style:U,className:ye("group/section",F&&"opacity-50 shadow-lg z-50 relative"),...n?L:void 0,children:[D?m.jsx(CQ,{editorLabel:r,onRename:()=>v==null?void 0:v(C,t.sidebarTitle,t.realTitle||JS(R)),onCopyPath:()=>h==null?void 0:h(R),onShowArchived:()=>d==null?void 0:d(C),onOpenInFinder:()=>g==null?void 0:g("open_finder",R),onOpenInEditor:()=>g==null?void 0:g("open_editor",R),onHide:()=>y==null?void 0:y(C),children:j}):j,!i.has(C)&&(A?!!f:t.previewChats.length>0||N)&&m.jsx("div",{className:"space-y-[2px] mb-3",children:A&&f?m.jsx(_J,{localPath:R,onNewLocalChat:f,isConnected:x,startingLocalPath:w}):m.jsxs(m.Fragment,{children:[t.previewChats.map(c),N&&T?m.jsx("button",{onClick:()=>l(C),className:"pl-2.5 py-1 text-xs text-muted-foreground/60 hover:text-foreground/60 transition-colors flex flex-row items-center gap-2 justify-center",children:"Show less"}):null,T?t.olderChats.map(c):null,N&&!T?m.jsx("button",{onClick:()=>l(C),className:"pl-2.5 py-1 text-xs text-muted-foreground/60 hover:text-foreground/60 transition-colors flex flex-row items-center gap-1 justify-center",children:"Show more"}):null]})})]})}),SJ=function({projectGroups:t,editorLabel:n,collapsedSections:r,expandedGroups:i,onToggleSection:s,onToggleExpandedGroup:o,renderChatRow:l,onShowArchivedProject:c,onNewLocalChat:d,onCopyPath:f,onOpenExternalPath:h,onRenameProject:g,onHideProject:v,onReorderGroups:y,isConnected:x,startingLocalPath:w}){const C=vJ(),R=UQ(EN(ek,{activationConstraint:{distance:2}}),EN(ZC)),E=_.useMemo(()=>t.map(N=>N.groupKey),[t]),T=_.useMemo(()=>N=>{const D=yJ({activeId:String(N.active.id),groupIds:E,collisionRect:N.collisionRect,droppableRects:N.droppableRects});if(!D)return TN(N);const L=N.droppableContainers.find(G=>G.id===D);return L?[{id:L.id,data:{droppableContainer:L,value:0}}]:TN(N)},[E]);function A(N){if(!C)return;const{active:D,over:L}=N;if(L&&D.id!==L.id&&y){const G=E.indexOf(D.id),z=E.indexOf(L.id);if(G!==-1&&z!==-1){const $=tk(E,G,z);y($)}}}return m.jsx(GZ,{sensors:R,collisionDetection:T,onDragEnd:A,children:m.jsx(sJ,{items:E,strategy:rJ,children:t.map(N=>m.jsx(xJ,{group:N,isReorderEnabled:C,editorLabel:n,collapsedSections:r,expandedGroups:i,onToggleSection:s,onToggleExpandedGroup:o,renderChatRow:l,onShowArchivedProject:c,onNewLocalChat:d,onCopyPath:f,onOpenExternalPath:h,onRenameProject:g,onHideProject:v,isConnected:x,startingLocalPath:w},N.groupKey))})})},wJ=_.memo(SJ),CJ="gpt-5.4-mini",kJ="moonshotai/kimi-k2.5:nitro",Iv=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"max",label:"Max"}],aw=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"XHigh"}],Pv={reasoningEffort:"high",contextWindow:"200k"},lw={reasoningEffort:"high",fastMode:!1};function FN(e){return Iv.some(t=>t.id===e)}function HN(e){return aw.some(t=>t.id===e)}const cw=[{id:"200k",label:"200k"},{id:"1m",label:"1M"}],mf=[{id:"claude",label:"Claude",defaultModel:"claude-sonnet-4-6",defaultEffort:"high",supportsPlanMode:!0,models:[{id:"claude-opus-4-7",label:"Opus 4.7",supportsEffort:!0,aliases:["opus"],contextWindowOptions:[...cw],supportsMaxReasoningEffort:!0},{id:"claude-sonnet-4-6",label:"Sonnet 4.6",supportsEffort:!0,aliases:["sonnet"],contextWindowOptions:[...cw]},{id:"claude-haiku-4-5-20251001",label:"Haiku 4.5",supportsEffort:!0,aliases:["haiku"]}],efforts:[...Iv]},{id:"codex",label:"Codex",defaultModel:"gpt-5.5",supportsPlanMode:!0,models:[{id:"gpt-5.5",label:"GPT-5.5",supportsEffort:!1},{id:"gpt-5.4",label:"GPT-5.4",supportsEffort:!1},{id:"gpt-5.3-codex",label:"GPT-5.3 Codex",supportsEffort:!1,aliases:["gpt-5-codex"]},{id:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark",supportsEffort:!1}],efforts:[]}];function nk(e){const t=mf.find(n=>n.id===e);if(!t)throw new Error(`Unknown provider: ${e}`);return t}function EJ(e,t){if(t)return nk(e).models.find(n=>{var r;return n.id===t||((r=n.aliases)==null?void 0:r.includes(t))})}function rk(e,t,n){var r;return((r=EJ(e,t))==null?void 0:r.id)??n??nk(e).defaultModel}function RJ(e,t="claude-opus-4-7"){return rk("claude",e,t)}function TJ(e,t="gpt-5.5"){return rk("codex",e,t)}function AJ(e,t){const n=rk(e,t);return nk(e).models.find(r=>r.id===n)}function o3(e){return AJ("claude",e)}function a3(e){var t;return!!((t=o3(e))!=null&&t.supportsMaxReasoningEffort)}function NJ(e){var t;return((t=o3(e))==null?void 0:t.contextWindowOptions)??[]}function ik(e,t){const n=NJ(e);return n.length===0?Pv.contextWindow:n.some(r=>r.id===t)?t:Pv.contextWindow}function MJ(e){switch(e){case"1m":return 1e6;case"200k":default:return 2e5}}const Ns={toggleEmbeddedTerminal:["cmd+j","ctrl+`"],toggleRightSidebar:["cmd+b","ctrl+b"],openInFinder:["cmd+alt+f","ctrl+alt+f"],openInEditor:["cmd+shift+o","ctrl+shift+o"],addSplitTerminal:["cmd+/","ctrl+/"],jumpToSidebarChat:["cmd+alt"],createChatInCurrentProject:["cmd+alt+n"],openAddProject:["cmd+alt+o"]},l3={toggleEmbeddedTerminal:"Toggle Embedded Terminal",toggleRightSidebar:"Toggle Right Sidebar",openInFinder:"Open In Finder",openInEditor:"Open In Editor",addSplitTerminal:"Add Split Terminal",jumpToSidebarChat:"Jump To Sidebar Chat",createChatInCurrentProject:"New Chat In Current Project",openAddProject:"Open Add Project"};function lx(e){return(e??[]).join(", ")}function Ga(e){return e.split(",").map(t=>t.trim()).map(t=>t.toLowerCase()).filter(Boolean)}const LJ=new Map([["cmd","meta"],["meta","meta"],["ctrl","ctrl"],["control","ctrl"],["alt","alt"],["option","alt"],["shift","shift"]]);function c3(e,t){const n=IJ(e);return n?PJ(t,n.key)&&t.ctrlKey===n.ctrl&&t.metaKey===n.meta&&t.altKey===n.alt&&t.shiftKey===n.shift:!1}function Oh(e,t,n){return Qb(e,t).some(i=>c3(i,n))}function DJ(e,t,n){return Qb(e,t).find(r=>c3(r,n))??null}function Qb(e,t){return(e==null?void 0:e.bindings[t])??Ns[t]}function sk(e){return{bindings:{toggleEmbeddedTerminal:(e==null?void 0:e.bindings.toggleEmbeddedTerminal)??Ns.toggleEmbeddedTerminal,toggleRightSidebar:(e==null?void 0:e.bindings.toggleRightSidebar)??Ns.toggleRightSidebar,openInFinder:(e==null?void 0:e.bindings.openInFinder)??Ns.openInFinder,openInEditor:(e==null?void 0:e.bindings.openInEditor)??Ns.openInEditor,addSplitTerminal:(e==null?void 0:e.bindings.addSplitTerminal)??Ns.addSplitTerminal,jumpToSidebarChat:(e==null?void 0:e.bindings.jumpToSidebarChat)??Ns.jumpToSidebarChat,createChatInCurrentProject:(e==null?void 0:e.bindings.createChatInCurrentProject)??Ns.createChatInCurrentProject,openAddProject:(e==null?void 0:e.bindings.openAddProject)??Ns.openAddProject},warning:(e==null?void 0:e.warning)??null,filePathDisplay:(e==null?void 0:e.filePathDisplay)??""}}function IJ(e){const t=e.split("+").map(r=>r.trim()).filter(Boolean);if(t.length===0)return null;const n={key:"",ctrl:!1,meta:!1,alt:!1,shift:!1};for(const r of t){const i=r.toLowerCase(),s=LJ.get(i);if(s==="ctrl"){n.ctrl=!0;continue}if(s==="meta"){n.meta=!0;continue}if(s==="alt"){n.alt=!0;continue}if(s==="shift"){n.shift=!0;continue}if(n.key)return null;n.key=i}return n.key?n:null}function PJ(e,t){if(e.key.toLowerCase()===t)return!0;const n=OJ(t);return n?e.code===n:!1}function OJ(e){if(e.length===1&&e>="a"&&e<="z")return`Key${e.toUpperCase()}`;if(e.length===1&&e>="0"&&e<="9")return`Digit${e}`;switch(e){case"/":return"Slash";case"`":return"Backquote";default:return null}}const u3=9;function jJ(e,t,n){const r=[];for(const i of e){if(t.has(i.groupKey))continue;const s=n.has(i.groupKey)?[...i.previewChats,...i.olderChats]:i.previewChats;for(const o of s)r.push({chat:o,visibleIndex:r.length+1})}return r}function zJ(e,t){if(!uw(e,t)||!t.code.startsWith("Digit"))return null;const n=Number(t.code.slice(5));return Number.isInteger(n)&&n>=1&&n<=u3?n:null}function BJ(e,t){return FJ(e,t)?String(t):null}function uw(e,t){return Qb(e,"jumpToSidebarChat").some(n=>HJ(n,t))}function $N(e,t,n){return DJ(e,t,n)!==null}function FJ(e,t){return t<1||t>u3?null:Qb(e,"jumpToSidebarChat")[0]??null}function HJ(e,t){const n=e.split("+").map(l=>l.trim().toLowerCase()).filter(Boolean);let r=!1,i=!1,s=!1,o=!1;for(const l of n){if(l==="cmd"||l==="meta"){r=!0;continue}if(l==="alt"||l==="option"){i=!0;continue}if(l==="ctrl"||l==="control"){s=!0;continue}l==="shift"&&(o=!0)}return t.metaKey===r&&t.altKey===i&&t.ctrlKey===s&&t.shiftKey===o}const d3="kanna:sidebar-width",Zu=275,h3=220,f3=520;function gf(e){return Number.isFinite(e)?Math.min(f3,Math.max(h3,Math.round(e))):Zu}function $J(){if(typeof window>"u")return Zu;const e=window.localStorage.getItem(d3);return e?gf(Number(e)):Zu}function cx(e){typeof window>"u"||window.localStorage.setItem(d3,String(gf(e)))}function UJ({data:e,activeChatId:t,connectionStatus:n,ready:r,open:i,collapsed:s,showMobileOpenButton:o,onOpen:l,onClose:c,onCollapse:d,onExpand:f,onCreateChat:h,onForkChat:g,currentProjectId:v,keybindings:y,onRenameChat:x,onShareChat:w,onArchiveChat:C,onOpenArchivedChat:R,onDeleteChat:E,onOpenAddProjectModal:T,onCopyPath:A,onOpenExternalPath:N,onRenameProject:D,onHideProject:L,onReorderProjectGroups:G,editorLabel:z,updateSnapshot:$,onOpenChangelog:H}){var bt;const O=Us(),F=Ed(),U=_.useRef(null),j=_.useRef(null),W=_.useRef(new Set),[B,K]=_.useState(new Set),[I,V]=_.useState(new Set),[X,P]=_.useState(()=>Date.now()),[ie,re]=_.useState(!1),[se,oe]=_.useState($J),[fe,de]=_.useState(!1),[ve,le]=_.useState(null),te=_.useMemo(()=>sk(y),[y]),Ce=_.useMemo(()=>jJ(e.projectGroups,B,I),[B,e.projectGroups,I]),Fe=_.useRef(Ce),Xe=_.useMemo(()=>new Map(Ce.map(we=>[we.chat.chatId,we.visibleIndex])),[Ce]),Ie=_.useMemo(()=>new Map(e.projectGroups.map(we=>[we.localPath,we.groupKey])),[e.projectGroups]),at=Ce.length,Ve=_.useMemo(()=>e.projectGroups.find(we=>we.groupKey===ve)??null,[ve,e.projectGroups]);_.useEffect(()=>{Fe.current=Ce},[Ce]),_.useEffect(()=>{K(we=>{const Ue=new Set,Ye=new Set(e.projectGroups.map(lt=>lt.groupKey)),Me=W.current;for(const lt of we)Ye.has(lt)&&Ue.add(lt);W.current=new Set([...Me].filter(lt=>Ye.has(lt)));for(const lt of e.projectGroups)W.current.has(lt.groupKey)||(W.current.add(lt.groupKey),lt.defaultCollapsed&&Ue.add(lt.groupKey));return Ue.size===we.size&&[...Ue].every(lt=>we.has(lt))?we:Ue})},[e.projectGroups]);const gt=_.useCallback(we=>{K(Ue=>{const Ye=new Set(Ue);return Ye.has(we)?Ye.delete(we):Ye.add(we),Ye})},[]),It=_.useCallback(we=>{V(Ue=>{const Ye=new Set(Ue);return Ye.has(we)?Ye.delete(we):Ye.add(we),Ye})},[]),et=_.useCallback(we=>{const Ue=Xe.get(we.chatId);return m.jsx(TQ,{chat:we,activeChatId:t,nowMs:X,shortcutHint:Ue?BJ(te,Ue):null,showShortcutHint:ie,onSelectChat:Ye=>{F(`/chat/${Ye}`),c()},onRenameChat:()=>x(we),onShareChat:()=>w(we.chatId),onOpenInFinder:()=>N("open_finder",we.localPath),onForkChat:()=>g(we),onArchiveChat:()=>C(we),onDeleteChat:()=>E(we)},we._id)},[t,F,X,C,c,E,g,N,x,w,te,ie,Xe]);_.useEffect(()=>{const we=window.setInterval(()=>{P(Date.now())},3e4);return()=>window.clearInterval(we)},[]),_.useEffect(()=>{function we(Me){var We;if(re(uw(te,Me)),$N(te,"createChatInCurrentProject",Me)){if(!v)return;Me.preventDefault(),h(v);return}if($N(te,"openAddProject",Me)){Me.preventDefault(),F("/"),c(),T();return}const lt=zJ(te,Me);if(lt===null)return;const ce=(We=Fe.current[lt-1])==null?void 0:We.chat;ce&&(Me.preventDefault(),F(`/chat/${ce.chatId}`),c())}function Ue(Me){re(uw(te,Me))}function Ye(){re(!1)}return window.addEventListener("keydown",we),window.addEventListener("keyup",Ue),window.addEventListener("blur",Ye),()=>{window.removeEventListener("keydown",we),window.removeEventListener("keyup",Ue),window.removeEventListener("blur",Ye)}},[v,F,c,h,T,te]),_.useEffect(()=>{!t||!U.current||requestAnimationFrame(()=>{const we=U.current,Ue=we==null?void 0:we.querySelector(`[data-chat-id="${t}"]`);if(!Ue||!we)return;const Ye=Ue.getBoundingClientRect(),Me=we.getBoundingClientRect();if(Ye.top<Me.top+38){const lt=Ye.top-Me.top+we.scrollTop;we.scrollTo({top:lt-38,behavior:"smooth"})}else if(Ye.bottom>Me.bottom){const lt=Ye.top+Ye.height/2-Me.top+we.scrollTop,ce=we.clientHeight/2;we.scrollTo({top:lt-ce,behavior:"smooth"})}})},[t]),_.useEffect(()=>{if(!fe)return;const we=document.body.style.cursor,Ue=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";function Ye(lt){const ce=j.current;ce&&oe(gf(ce.width+lt.clientX-ce.pointerX))}function Me(){de(!1),j.current=null,oe(lt=>{const ce=gf(lt);return cx(ce),ce})}return window.addEventListener("pointermove",Ye),window.addEventListener("pointerup",Me,{once:!0}),()=>{window.removeEventListener("pointermove",Ye),window.removeEventListener("pointerup",Me),document.body.style.cursor=we,document.body.style.userSelect=Ue}},[fe]);const Ct=at>0,Wt=O.pathname==="/",vt=O.pathname.startsWith("/settings"),At=Wt||vt,me=n==="connecting"||!r,Se=me?"Connecting":n==="connected"?"Connected":"Disconnected",He=n==="connected"?"bg-emerald-500":"bg-amber-500",Ge=($==null?void 0:$.updateAvailable)===!0,ht=$?$.latestVersion===`${$.currentVersion}-dev`:!1,Be=($==null?void 0:$.status)==="updating"||($==null?void 0:$.status)==="restart_pending";return m.jsxs(m.Fragment,{children:[!i&&o&&m.jsx(qe,{variant:"ghost",size:"icon",className:"fixed top-3 left-3 z-50 md:hidden",onClick:l,children:m.jsx(lC,{className:"h-5 w-5"})}),s&&At&&m.jsx("div",{className:"hidden md:flex fixed left-0 top-0 h-full z-40 items-start pt-4 pl-5 border-l border-border/0",children:m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Ku,{className:"size-6 text-logo"}),m.jsx(qe,{variant:"ghost",size:"icon",onClick:f,title:"Expand sidebar",children:m.jsx(HS,{className:"h-5 w-5"})})]})}),m.jsxs("div",{"data-sidebar":"open",className:ye("fixed inset-0 z-50 bg-background dark:bg-card flex flex-col h-[100dvh] select-none","md:relative md:inset-auto md:w-[var(--sidebar-width)] md:mr-0 md:h-[calc(100dvh-16px)] md:my-2 md:ml-2 md:border md:border-border md:rounded-2xl",i?"flex":"hidden md:flex",s&&"md:hidden"),style:{"--sidebar-width":`${se}px`},children:[m.jsxs("div",{className:"px-[5px] h-[64px] md:h-auto md:py-1 border-b grid grid-cols-[40px_minmax(0,1fr)_40px] items-center md:pl-3 md:pr-1 md:flex md:justify-between",children:[m.jsx("div",{className:"md:hidden",children:m.jsx(qe,{variant:"ghost",size:"icon",className:"size-10 rounded-lg hover:!border-border/0",onClick:c,title:"Close sidebar",children:m.jsx(aa,{className:"h-5 w-5"})})}),m.jsxs("div",{className:"flex items-center justify-self-center gap-2 md:justify-self-auto",children:[m.jsxs("button",{type:"button",onClick:d,title:"Collapse sidebar",className:"hidden md:flex group/sidebar-collapse relative items-center justify-center h-5 w-5 sm:h-6 sm:w-6",children:[m.jsx(Ku,{className:"absolute inset-0.5 h-4 w-4 sm:h-5 sm:w-5 text-logo transition-all duration-200 ease-out opacity-100 scale-100 group-hover/sidebar-collapse:opacity-0 group-hover/sidebar-collapse:scale-0"}),m.jsx(HS,{className:"absolute inset-0 h-4 w-4 sm:h-6 sm:w-6 text-slate-500 dark:text-slate-400 transition-all duration-200 ease-out opacity-0 scale-0 group-hover/sidebar-collapse:opacity-100 group-hover/sidebar-collapse:scale-80 hover:opacity-50"})]}),m.jsx(Ku,{className:"h-5 w-5 sm:h-6 sm:w-6 text-logo md:hidden"}),m.jsx("span",{className:"font-logo text-base uppercase sm:text-md text-slate-600 dark:text-slate-100",children:Kn})]}),m.jsxs("div",{className:"flex items-center justify-self-end md:justify-self-auto",children:[m.jsx(qe,{variant:"ghost",size:"icon",onClick:()=>{F("/"),c()},className:"size-10 rounded-lg hover:!border-border/0 md:hidden",title:"New project",children:m.jsx(od,{className:"h-5 w-5"})}),ht?m.jsx("span",{className:"mr-1 hidden md:inline-flex items-center rounded-full border border-border bg-muted px-2 py-0.5 text-[11px] font-bold tracking-wider text-muted-foreground",title:"Development build",children:"DEV"}):Ge?m.jsxs(qe,{variant:"outline",size:"sm",className:"hidden md:inline-flex rounded-full !h-auto mr-1 py-0.5 px-2 bg-logo/20 hover:bg-logo text-logo border-logo/20 hover:text-foreground hover:border-logo/20 text-[11px] font-bold tracking-wider",onClick:H,disabled:Be,title:$!=null&&$.latestVersion?`Update to ${$.latestVersion}`:"Update Kanna",children:[Be?m.jsx(dn,{className:"mr-1.5 h-3 w-3 animate-spin"}):null,"UPDATE"]}):null,m.jsx(qe,{variant:"ghost",size:"icon",onClick:()=>{F("/"),c()},className:"hidden md:inline-flex size-10 rounded-lg hover:!border-border/0",title:"New project",children:m.jsx(od,{className:"size-4"})})]})]}),m.jsx("div",{ref:U,className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden scrollbar-hide",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:m.jsxs("div",{className:"p-[7px]",children:[!Ct&&me?m.jsx("div",{className:"space-y-5 px-1 pt-3",children:[0,1,2].map(we=>m.jsxs("div",{className:"space-y-2 animate-pulse",children:[m.jsx("div",{className:"h-4 w-28 rounded bg-muted"}),m.jsx("div",{className:"space-y-1",children:[0,1,2].map(Ue=>m.jsxs("div",{className:"flex items-center gap-2 rounded-md px-3 py-2",children:[m.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-muted"}),m.jsx("div",{className:ye("h-3.5 rounded bg-muted",Ue===0?"w-32":Ue===1?"w-40":"w-28")})]},Ue))})]},we))}):null,!Ct&&!me&&e.projectGroups.length===0?m.jsx("p",{className:"text-sm text-slate-400 p-2 mt-6 text-center",children:"No conversations yet"}):null,m.jsx(wJ,{projectGroups:e.projectGroups,editorLabel:z,onReorderGroups:G,collapsedSections:B,expandedGroups:I,onToggleSection:gt,onToggleExpandedGroup:It,renderChatRow:et,onShowArchivedProject:le,onNewLocalChat:we=>{const Ue=Ie.get(we);Ue&&h(Ue)},onCopyPath:A,onOpenExternalPath:N,onRenameProject:D,onHideProject:L,isConnected:n==="connected"})]})}),m.jsx("div",{className:"border-t border-border p-2",children:m.jsx("button",{type:"button",onClick:()=>{F("/settings/general"),c()},className:ye("w-full rounded-xl rounded-t-md border px-3 py-2 text-left transition-colors",vt?"bg-muted border-border":"border-border/0 hover:bg-muted hover:border-border active:bg-muted/80"),children:m.jsxs("div",{className:"flex items- justify-between gap-2",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(LV,{className:"h-4 w-4 text-muted-foreground"}),m.jsx("span",{className:"text-sm",children:"Settings"})]}),m.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[m.jsx("span",{children:Se}),me?m.jsx(dn,{className:"h-2 w-2 animate-spin"}):m.jsx("span",{className:ye("h-2 w-2 rounded-full",He)})]})]})})}),m.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",tabIndex:0,title:"Resize sidebar",className:ye("hidden md:block absolute -right-1 top-3 bottom-3 z-20 w-2 cursor-col-resize rounded-full","focus-visible:outline-none"),onPointerDown:we=>{we.preventDefault(),j.current={pointerX:we.clientX,width:se},de(!0)},onDoubleClick:()=>{oe(Zu),cx(Zu)},onKeyDown:we=>{let Ue=null;if(we.key==="ArrowLeft"?Ue=se-16:we.key==="ArrowRight"?Ue=se+16:we.key==="Home"?Ue=h3:we.key==="End"?Ue=f3:we.key==="Enter"&&(Ue=Zu),Ue===null)return;we.preventDefault();const Ye=gf(Ue);oe(Ye),cx(Ye)}})]}),m.jsx(Zo,{open:!!Ve,onOpenChange:we=>{we||le(null)},children:m.jsxs(po,{size:"md",children:[m.jsxs(_C,{children:[m.jsx(Jo,{children:"Archived Chats"}),m.jsx(Nd,{children:(Ve==null?void 0:Ve.localPath)??""})]}),m.jsx(ea,{className:"space-y-1",children:(bt=Ve==null?void 0:Ve.archivedChats)!=null&&bt.length?Ve.archivedChats.map(we=>m.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-3 rounded-lg border border-border/0 px-3 py-2 text-left transition-colors hover:border-border hover:bg-muted",onClick:()=>{R(we.chatId),le(null),c()},children:[m.jsx("span",{className:"min-w-0 truncate text-sm",children:we.title}),m.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Y5(X5(we),X)})]},we.chatId)):m.jsx("p",{className:"px-1 py-3 text-sm text-muted-foreground",children:"No archived chats"})})]})}),i?m.jsx("div",{className:"fixed inset-0 bg-black/40 z-40 md:hidden",onClick:c}):null]})}const VJ=_.memo(UJ),ok=1e3,dw=500,hw=5e3,ak=450,fw=250,pw=900,mw="cursor";function ud(e){switch(e){case"vscode":return"code {path}";case"xcode":return"xed {path}";case"windsurf":return"windsurf {path}";case"custom":return"cursor {path}";case"cursor":default:return"cursor {path}"}}function WJ(e){switch(e){case"vscode":return"VS Code";case"xcode":return"Xcode";case"windsurf":return"Windsurf";case"custom":return"Custom";case"cursor":default:return"Cursor"}}function GJ(e){return Number.isFinite(e)?Math.min(hw,Math.max(dw,Math.round(e))):ok}function qJ(e){return Number.isFinite(e)?Math.min(pw,Math.max(fw,Math.round(e))):ak}function KJ(e){switch(e){case"vscode":case"xcode":case"windsurf":case"custom":case"cursor":return e;default:return mw}}function UN(e,t){const n=e==null?void 0:e.trim();return n&&n.length>0?n:ud(t)}const Zr=kl()(e=>({scrollbackLines:ok,minColumnWidth:ak,editorPreset:mw,editorCommandTemplate:ud(mw),setScrollbackLines:t=>e({scrollbackLines:GJ(t)}),setMinColumnWidth:t=>e({minColumnWidth:qJ(t)}),setEditorPreset:t=>e(n=>{const r=KJ(t);return{editorPreset:r,editorCommandTemplate:r==="custom"?UN(n.editorCommandTemplate,r):ud(r)}}),setEditorCommandTemplate:t=>e(n=>({editorCommandTemplate:UN(t,n.editorPreset)}))})),lk=[{value:"cursor",label:"Cursor"},{value:"xcode",label:"Xcode"},{value:"windsurf",label:"Windsurf"},{value:"custom",label:"Custom"}],al={cursor:"/editor-icons/cursor.png",defaultApp:"/editor-icons/default-app.png",finder:"/editor-icons/finder.png",preview:"/editor-icons/preview.png",xcode:"/editor-icons/xcode.png",terminal:"/editor-icons/terminal.png",windsurf:"/editor-icons/windsurf.png",custom:"/editor-icons/custom.png"};function ll({src:e,className:t}){return m.jsx("img",{src:e,alt:"","aria-hidden":"true",draggable:!1,className:t})}function p3({preset:e,className:t}){switch(e){case"xcode":return m.jsx(ll,{src:al.xcode,className:t});case"windsurf":return m.jsx(ll,{src:al.windsurf,className:t});case"custom":return m.jsx(ll,{src:al.custom,className:t});case"cursor":case"vscode":default:return m.jsx(ll,{src:al.cursor,className:t})}}function YJ({className:e}){return m.jsx(ll,{src:al.finder,className:e})}function XJ({className:e}){return m.jsx(ll,{src:al.preview,className:e})}function QJ({className:e}){return m.jsx(ll,{src:al.defaultApp,className:e})}function ZJ({className:e}){return m.jsx(Rb,{className:e})}function JJ({className:e}){return m.jsx(ll,{src:al.terminal,className:e})}function VN(e,[t,n]){return Math.min(n,Math.max(t,e))}function eee(e){const t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var tee=[" ","Enter","ArrowUp","ArrowDown"],nee=[" ","Enter"],Sc="Select",[Zb,Jb,ree]=OC(Sc),[jd]=la(Sc,[ree,Cl]),e0=Cl(),[iee,El]=jd(Sc),[see,oee]=jd(Sc),m3=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:l,onValueChange:c,dir:d,name:f,autoComplete:h,disabled:g,required:v,form:y}=e,x=e0(t),[w,C]=_.useState(null),[R,E]=_.useState(null),[T,A]=_.useState(!1),N=jC(d),[D,L]=ad({prop:r,defaultProp:i??!1,onChange:s,caller:Sc}),[G,z]=ad({prop:o,defaultProp:l,onChange:c,caller:Sc}),$=_.useRef(null),H=w?y||!!w.closest("form"):!0,[O,F]=_.useState(new Set),U=Array.from(O).map(j=>j.props.value).join(";");return m.jsx(Fb,{...x,children:m.jsxs(iee,{required:v,scope:t,trigger:w,onTriggerChange:C,valueNode:R,onValueNodeChange:E,valueNodeHasChildren:T,onValueNodeHasChildrenChange:A,contentId:Xo(),value:G,onValueChange:z,open:D,onOpenChange:L,dir:N,triggerPointerDownPosRef:$,disabled:g,children:[m.jsx(Zb.Provider,{scope:t,children:m.jsx(see,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(j=>{F(W=>new Set(W).add(j))},[]),onNativeOptionRemove:_.useCallback(j=>{F(W=>{const B=new Set(W);return B.delete(j),B})},[]),children:n})}),H?m.jsxs(F3,{"aria-hidden":!0,required:v,tabIndex:-1,name:f,autoComplete:h,value:G,onChange:j=>z(j.target.value),disabled:g,form:y,children:[G===void 0?m.jsx("option",{value:""}):null,Array.from(O)]},U):null]})})};m3.displayName=Sc;var g3="SelectTrigger",v3=_.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,s=e0(n),o=El(g3,n),l=o.disabled||r,c=hn(t,o.onTriggerChange),d=Jb(n),f=_.useRef("touch"),[h,g,v]=$3(x=>{const w=d().filter(E=>!E.disabled),C=w.find(E=>E.value===o.value),R=U3(w,x,C);R!==void 0&&o.onValueChange(R.value)}),y=x=>{l||(o.onOpenChange(!0),v()),x&&(o.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})};return m.jsx(up,{asChild:!0,...s,children:m.jsx(Yt.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":H3(o.value)?"":void 0,...i,ref:c,onClick:Qe(i.onClick,x=>{x.currentTarget.focus(),f.current!=="mouse"&&y(x)}),onPointerDown:Qe(i.onPointerDown,x=>{f.current=x.pointerType;const w=x.target;w.hasPointerCapture(x.pointerId)&&w.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(y(x),x.preventDefault())}),onKeyDown:Qe(i.onKeyDown,x=>{const w=h.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&g(x.key),!(w&&x.key===" ")&&tee.includes(x.key)&&(y(),x.preventDefault())})})})});v3.displayName=g3;var b3="SelectValue",_3=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:o="",...l}=e,c=El(b3,n),{onValueNodeHasChildrenChange:d}=c,f=s!==void 0,h=hn(t,c.onValueNodeChange);return Gr(()=>{d(f)},[d,f]),m.jsx(Yt.span,{...l,ref:h,style:{pointerEvents:"none"},children:H3(c.value)?m.jsx(m.Fragment,{children:o}):s})});_3.displayName=b3;var aee="SelectIcon",y3=_.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return m.jsx(Yt.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});y3.displayName=aee;var lee="SelectPortal",x3=e=>m.jsx(Ad,{asChild:!0,...e});x3.displayName=lee;var wc="SelectContent",S3=_.forwardRef((e,t)=>{const n=El(wc,e.__scopeSelect),[r,i]=_.useState();if(Gr(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?ps.createPortal(m.jsx(w3,{scope:e.__scopeSelect,children:m.jsx(Zb.Slot,{scope:e.__scopeSelect,children:m.jsx("div",{children:e.children})})}),s):null}return m.jsx(C3,{...e,ref:t})});S3.displayName=wc;var As=10,[w3,Rl]=jd(wc),cee="SelectContentImpl",uee=_c("SelectContent.RemoveScroll"),C3=_.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:g,collisionPadding:v,sticky:y,hideWhenDetached:x,avoidCollisions:w,...C}=e,R=El(wc,n),[E,T]=_.useState(null),[A,N]=_.useState(null),D=hn(t,oe=>T(oe)),[L,G]=_.useState(null),[z,$]=_.useState(null),H=Jb(n),[O,F]=_.useState(!1),U=_.useRef(!1);_.useEffect(()=>{if(E)return Db(E)},[E]),Mb();const j=_.useCallback(oe=>{const[fe,...de]=H().map(te=>te.ref.current),[ve]=de.slice(-1),le=document.activeElement;for(const te of oe)if(te===le||(te==null||te.scrollIntoView({block:"nearest"}),te===fe&&A&&(A.scrollTop=0),te===ve&&A&&(A.scrollTop=A.scrollHeight),te==null||te.focus(),document.activeElement!==le))return},[H,A]),W=_.useCallback(()=>j([L,E]),[j,L,E]);_.useEffect(()=>{O&&W()},[O,W]);const{onOpenChange:B,triggerPointerDownPosRef:K}=R;_.useEffect(()=>{if(E){let oe={x:0,y:0};const fe=ve=>{var le,te;oe={x:Math.abs(Math.round(ve.pageX)-(((le=K.current)==null?void 0:le.x)??0)),y:Math.abs(Math.round(ve.pageY)-(((te=K.current)==null?void 0:te.y)??0))}},de=ve=>{oe.x<=10&&oe.y<=10?ve.preventDefault():E.contains(ve.target)||B(!1),document.removeEventListener("pointermove",fe),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",fe),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",fe),document.removeEventListener("pointerup",de,{capture:!0})}}},[E,B,K]),_.useEffect(()=>{const oe=()=>B(!1);return window.addEventListener("blur",oe),window.addEventListener("resize",oe),()=>{window.removeEventListener("blur",oe),window.removeEventListener("resize",oe)}},[B]);const[I,V]=$3(oe=>{const fe=H().filter(le=>!le.disabled),de=fe.find(le=>le.ref.current===document.activeElement),ve=U3(fe,oe,de);ve&&setTimeout(()=>ve.ref.current.focus())}),X=_.useCallback((oe,fe,de)=>{const ve=!U.current&&!de;(R.value!==void 0&&R.value===fe||ve)&&(G(oe),ve&&(U.current=!0))},[R.value]),P=_.useCallback(()=>E==null?void 0:E.focus(),[E]),ie=_.useCallback((oe,fe,de)=>{const ve=!U.current&&!de;(R.value!==void 0&&R.value===fe||ve)&&$(oe)},[R.value]),re=r==="popper"?gw:k3,se=re===gw?{side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:g,collisionPadding:v,sticky:y,hideWhenDetached:x,avoidCollisions:w}:{};return m.jsx(w3,{scope:n,content:E,viewport:A,onViewportChange:N,itemRefCallback:X,selectedItem:L,onItemLeave:P,itemTextRefCallback:ie,focusSelectedItem:W,selectedItemText:z,position:r,isPositioned:O,searchRef:I,children:m.jsx(lp,{as:uee,allowPinchZoom:!0,children:m.jsx(ap,{asChild:!0,trapped:R.open,onMountAutoFocus:oe=>{oe.preventDefault()},onUnmountAutoFocus:Qe(i,oe=>{var fe;(fe=R.trigger)==null||fe.focus({preventScroll:!0}),oe.preventDefault()}),children:m.jsx(Td,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:oe=>oe.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:m.jsx(re,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:oe=>oe.preventDefault(),...C,...se,onPlaced:()=>F(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:Qe(C.onKeyDown,oe=>{const fe=oe.ctrlKey||oe.altKey||oe.metaKey;if(oe.key==="Tab"&&oe.preventDefault(),!fe&&oe.key.length===1&&V(oe.key),["ArrowUp","ArrowDown","Home","End"].includes(oe.key)){let ve=H().filter(le=>!le.disabled).map(le=>le.ref.current);if(["ArrowUp","End"].includes(oe.key)&&(ve=ve.slice().reverse()),["ArrowUp","ArrowDown"].includes(oe.key)){const le=oe.target,te=ve.indexOf(le);ve=ve.slice(te+1)}setTimeout(()=>j(ve)),oe.preventDefault()}})})})})})})});C3.displayName=cee;var dee="SelectItemAlignedPosition",k3=_.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,s=El(wc,n),o=Rl(wc,n),[l,c]=_.useState(null),[d,f]=_.useState(null),h=hn(t,D=>f(D)),g=Jb(n),v=_.useRef(!1),y=_.useRef(!0),{viewport:x,selectedItem:w,selectedItemText:C,focusSelectedItem:R}=o,E=_.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&x&&w&&C){const D=s.trigger.getBoundingClientRect(),L=d.getBoundingClientRect(),G=s.valueNode.getBoundingClientRect(),z=C.getBoundingClientRect();if(s.dir!=="rtl"){const le=z.left-L.left,te=G.left-le,Ce=D.left-te,Fe=D.width+Ce,Xe=Math.max(Fe,L.width),Ie=window.innerWidth-As,at=VN(te,[As,Math.max(As,Ie-Xe)]);l.style.minWidth=Fe+"px",l.style.left=at+"px"}else{const le=L.right-z.right,te=window.innerWidth-G.right-le,Ce=window.innerWidth-D.right-te,Fe=D.width+Ce,Xe=Math.max(Fe,L.width),Ie=window.innerWidth-As,at=VN(te,[As,Math.max(As,Ie-Xe)]);l.style.minWidth=Fe+"px",l.style.right=at+"px"}const $=g(),H=window.innerHeight-As*2,O=x.scrollHeight,F=window.getComputedStyle(d),U=parseInt(F.borderTopWidth,10),j=parseInt(F.paddingTop,10),W=parseInt(F.borderBottomWidth,10),B=parseInt(F.paddingBottom,10),K=U+j+O+B+W,I=Math.min(w.offsetHeight*5,K),V=window.getComputedStyle(x),X=parseInt(V.paddingTop,10),P=parseInt(V.paddingBottom,10),ie=D.top+D.height/2-As,re=H-ie,se=w.offsetHeight/2,oe=w.offsetTop+se,fe=U+j+oe,de=K-fe;if(fe<=ie){const le=$.length>0&&w===$[$.length-1].ref.current;l.style.bottom="0px";const te=d.clientHeight-x.offsetTop-x.offsetHeight,Ce=Math.max(re,se+(le?P:0)+te+W),Fe=fe+Ce;l.style.height=Fe+"px"}else{const le=$.length>0&&w===$[0].ref.current;l.style.top="0px";const Ce=Math.max(ie,U+x.offsetTop+(le?X:0)+se)+de;l.style.height=Ce+"px",x.scrollTop=fe-ie+x.offsetTop}l.style.margin=`${As}px 0`,l.style.minHeight=I+"px",l.style.maxHeight=H+"px",r==null||r(),requestAnimationFrame(()=>v.current=!0)}},[g,s.trigger,s.valueNode,l,d,x,w,C,s.dir,r]);Gr(()=>E(),[E]);const[T,A]=_.useState();Gr(()=>{d&&A(window.getComputedStyle(d).zIndex)},[d]);const N=_.useCallback(D=>{D&&y.current===!0&&(E(),R==null||R(),y.current=!1)},[E,R]);return m.jsx(fee,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:v,onScrollButtonChange:N,children:m.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:m.jsx(Yt.div,{...i,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});k3.displayName=dee;var hee="SelectPopperPosition",gw=_.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=As,...s}=e,o=e0(n);return m.jsx(Hb,{...o,...s,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});gw.displayName=hee;var[fee,ck]=jd(wc,{}),vw="SelectViewport",E3=_.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,s=Rl(vw,n),o=ck(vw,n),l=hn(t,s.onViewportChange),c=_.useRef(0);return m.jsxs(m.Fragment,{children:[m.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),m.jsx(Zb.Slot,{scope:n,children:m.jsx(Yt.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Qe(i.onScroll,d=>{const f=d.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&h){const v=Math.abs(c.current-f.scrollTop);if(v>0){const y=window.innerHeight-As*2,x=parseFloat(h.style.minHeight),w=parseFloat(h.style.height),C=Math.max(x,w);if(C<y){const R=C+v,E=Math.min(y,R),T=R-E;h.style.height=E+"px",h.style.bottom==="0px"&&(f.scrollTop=T>0?T:0,h.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});E3.displayName=vw;var R3="SelectGroup",[pee,mee]=jd(R3),T3=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=Xo();return m.jsx(pee,{scope:n,id:i,children:m.jsx(Yt.div,{role:"group","aria-labelledby":i,...r,ref:t})})});T3.displayName=R3;var A3="SelectLabel",N3=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=mee(A3,n);return m.jsx(Yt.div,{id:i.id,...r,ref:t})});N3.displayName=A3;var Ov="SelectItem",[gee,M3]=jd(Ov),L3=_.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...o}=e,l=El(Ov,n),c=Rl(Ov,n),d=l.value===r,[f,h]=_.useState(s??""),[g,v]=_.useState(!1),y=hn(t,R=>{var E;return(E=c.itemRefCallback)==null?void 0:E.call(c,R,r,i)}),x=Xo(),w=_.useRef("touch"),C=()=>{i||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return m.jsx(gee,{scope:n,value:r,disabled:i,textId:x,isSelected:d,onItemTextChange:_.useCallback(R=>{h(E=>E||((R==null?void 0:R.textContent)??"").trim())},[]),children:m.jsx(Zb.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:m.jsx(Yt.div,{role:"option","aria-labelledby":x,"data-highlighted":g?"":void 0,"aria-selected":d&&g,"data-state":d?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:y,onFocus:Qe(o.onFocus,()=>v(!0)),onBlur:Qe(o.onBlur,()=>v(!1)),onClick:Qe(o.onClick,()=>{w.current!=="mouse"&&C()}),onPointerUp:Qe(o.onPointerUp,()=>{w.current==="mouse"&&C()}),onPointerDown:Qe(o.onPointerDown,R=>{w.current=R.pointerType}),onPointerMove:Qe(o.onPointerMove,R=>{var E;w.current=R.pointerType,i?(E=c.onItemLeave)==null||E.call(c):w.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Qe(o.onPointerLeave,R=>{var E;R.currentTarget===document.activeElement&&((E=c.onItemLeave)==null||E.call(c))}),onKeyDown:Qe(o.onKeyDown,R=>{var T;((T=c.searchRef)==null?void 0:T.current)!==""&&R.key===" "||(nee.includes(R.key)&&C(),R.key===" "&&R.preventDefault())})})})})});L3.displayName=Ov;var Jh="SelectItemText",D3=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...s}=e,o=El(Jh,n),l=Rl(Jh,n),c=M3(Jh,n),d=oee(Jh,n),[f,h]=_.useState(null),g=hn(t,C=>h(C),c.onItemTextChange,C=>{var R;return(R=l.itemTextRefCallback)==null?void 0:R.call(l,C,c.value,c.disabled)}),v=f==null?void 0:f.textContent,y=_.useMemo(()=>m.jsx("option",{value:c.value,disabled:c.disabled,children:v},c.value),[c.disabled,c.value,v]),{onNativeOptionAdd:x,onNativeOptionRemove:w}=d;return Gr(()=>(x(y),()=>w(y)),[x,w,y]),m.jsxs(m.Fragment,{children:[m.jsx(Yt.span,{id:c.textId,...s,ref:g}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ps.createPortal(s.children,o.valueNode):null]})});D3.displayName=Jh;var I3="SelectItemIndicator",P3=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return M3(I3,n).isSelected?m.jsx(Yt.span,{"aria-hidden":!0,...r,ref:t}):null});P3.displayName=I3;var bw="SelectScrollUpButton",O3=_.forwardRef((e,t)=>{const n=Rl(bw,e.__scopeSelect),r=ck(bw,e.__scopeSelect),[i,s]=_.useState(!1),o=hn(t,r.onScrollButtonChange);return Gr(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;s(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?m.jsx(z3,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});O3.displayName=bw;var _w="SelectScrollDownButton",j3=_.forwardRef((e,t)=>{const n=Rl(_w,e.__scopeSelect),r=ck(_w,e.__scopeSelect),[i,s]=_.useState(!1),o=hn(t,r.onScrollButtonChange);return Gr(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;s(f)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?m.jsx(z3,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});j3.displayName=_w;var z3=_.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,s=Rl("SelectScrollButton",n),o=_.useRef(null),l=Jb(n),c=_.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return _.useEffect(()=>()=>c(),[c]),Gr(()=>{var f;const d=l().find(h=>h.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[l]),m.jsx(Yt.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Qe(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Qe(i.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Qe(i.onPointerLeave,()=>{c()})})}),vee="SelectSeparator",B3=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return m.jsx(Yt.div,{"aria-hidden":!0,...r,ref:t})});B3.displayName=vee;var yw="SelectArrow",bee=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=e0(n),s=El(yw,n),o=Rl(yw,n);return s.open&&o.position==="popper"?m.jsx($b,{...i,...r,ref:t}):null});bee.displayName=yw;var _ee="SelectBubbleInput",F3=_.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=_.useRef(null),s=hn(r,i),o=eee(t);return _.useEffect(()=>{const l=i.current;if(!l)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&f){const h=new Event("change",{bubbles:!0});f.call(l,t),l.dispatchEvent(h)}},[o,t]),m.jsx(Yt.select,{...n,style:{...L5,...n.style},ref:s,defaultValue:t})});F3.displayName=_ee;function H3(e){return e===""||e===void 0}function $3(e){const t=Bs(e),n=_.useRef(""),r=_.useRef(0),i=_.useCallback(o=>{const l=n.current+o;t(l),(function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),s=_.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function U3(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=yee(e,Math.max(s,0));i.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.textValue.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function yee(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var xee=m3,V3=v3,See=_3,wee=y3,Cee=x3,W3=S3,kee=E3,Eee=T3,G3=N3,q3=L3,Ree=D3,Tee=P3,K3=O3,Y3=j3,X3=B3;const rl=xee,Fu=Eee,oc=See,Wo=_.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(V3,{ref:r,className:ye("flex h-9 w-full items-center justify-between gap-2 rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none transition-colors","placeholder:text-muted-foreground","focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50","[&>span]:line-clamp-1",e),...n,children:[t,m.jsx(wee,{asChild:!0,children:m.jsx(Rd,{className:"h-4 w-4 shrink-0 opacity-50"})})]}));Wo.displayName=V3.displayName;const Q3=_.forwardRef(({className:e,...t},n)=>m.jsx(K3,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",e),...t,children:m.jsx(tO,{className:"h-4 w-4"})}));Q3.displayName=K3.displayName;const Z3=_.forwardRef(({className:e,...t},n)=>m.jsx(Y3,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",e),...t,children:m.jsx(Rd,{className:"h-4 w-4"})}));Z3.displayName=Y3.displayName;const Go=_.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>m.jsx(Cee,{children:m.jsxs(W3,{ref:i,className:ye("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border bg-background text-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[m.jsx(Q3,{}),m.jsx(kee,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),m.jsx(Z3,{})]})}));Go.displayName=W3.displayName;const Aee=_.forwardRef(({className:e,...t},n)=>m.jsx(G3,{ref:n,className:ye("px-2 py-1.5 text-sm font-semibold",e),...t}));Aee.displayName=G3.displayName;const Ls=_.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(q3,{ref:r,className:ye("relative flex w-full cursor-default select-none items-center rounded-md py-1.5 pl-2 pr-8 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[m.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(Tee,{children:m.jsx(ri,{className:"h-4 w-4"})})}),m.jsx(Ree,{children:t})]}));Ls.displayName=q3.displayName;const Nee=_.forwardRef(({className:e,...t},n)=>m.jsx(X3,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",e),...t}));Nee.displayName=X3.displayName;const WN="kanna:last-open-external",J3="py-2 pl-2 pr-8",Mee="rounded-md text-sm font-normal focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground",Lee="flex items-center gap-3",Dee="h-5 w-5 shrink-0";function e4({value:e,label:t,isMac:n}){return m.jsxs("span",{className:Lee,children:[m.jsx(t4,{value:e,isMac:n,className:Dee}),m.jsx("span",{children:t})]})}function Iee(e,t){return{preset:e,commandTemplate:e==="custom"&&(t==null?void 0:t.trim())||ud(e)}}function Pee(e,t){var r;if(e==="finder")return t?"Finder":"Folder";if(e==="terminal")return"Terminal";if(e==="preview")return"Preview";if(e==="default")return"Default App";const n=e.replace("editor:","");return n==="vscode"?"VS Code":((r=lk.find(i=>i.value===n))==null?void 0:r.label)??"Editor"}function t4({value:e,isMac:t,className:n}){return e==="finder"?t?m.jsx(YJ,{className:n}):m.jsx(ZJ,{className:n}):e==="terminal"?m.jsx(JJ,{className:n}):e==="preview"?m.jsx(XJ,{className:n}):e==="default"?m.jsx(QJ,{className:n}):m.jsx(p3,{preset:e.replace("editor:",""),className:n})}function Oee(e,t){if(e==="finder"||e==="terminal"||e==="preview"||e==="default")return e;if(e!=null&&e.startsWith("editor:")){const n=e.slice(7);if(n==="vscode"||lk.some(r=>r.value===n))return e}return t}function n4({editorPreset:e,isMac:t,includeFinder:n=!0,includeTerminal:r=!1,includePreview:i=!1,includeDefault:s=!1,menuKind:o="context"}){const l=[{value:"editor:cursor",label:"Cursor"},{value:"editor:xcode",label:"Xcode"},{value:"editor:windsurf",label:"Windsurf"},...e==="custom"?[{value:"editor:custom",label:"Custom"}]:[]],c=`editor:${e}`,d=[...l.filter(f=>f.value===c),...l.filter(f=>f.value!==c)];return o==="navbar"?[...d.filter(f=>f.value===c),...n?[{value:"finder",label:t?"Finder":"Folder"}]:[],...r?[{value:"terminal",label:"Terminal"}]:[],...d.filter(f=>f.value!==c)]:[...d,...i&&t?[{value:"preview",label:"Preview"}]:[],...n?[{value:"finder",label:t?"Finder":"Folder"}]:[],...r?[{value:"terminal",label:"Terminal"}]:[],...s?[{value:"default",label:"Default App"}]:[]]}function r4(e){if(e.value==="finder"){e.onOpenExternal("open_finder");return}if(e.value==="terminal"){e.onOpenExternal("open_terminal");return}if(e.value==="preview"){e.onOpenExternal("open_preview");return}if(e.value==="default"){e.onOpenExternal("open_default");return}const t=e.value.replace("editor:","");e.onOpenExternal("open_editor",Iee(t,e.editorCommandTemplate))}function jee({isMac:e,editorPreset:t,editorCommandTemplate:n,finderShortcut:r,editorShortcut:i,onOpenExternal:s}){const o=`editor:${t}`,[l,c]=_.useState(o);_.useEffect(()=>{c(Oee(window.localStorage.getItem(WN),o))},[o]);const d=_.useMemo(()=>n4({editorPreset:t,isMac:e,includeFinder:!0,includeTerminal:!0,menuKind:"navbar"}),[t,e]);function f(h){c(h),window.localStorage.setItem(WN,h),r4({value:h,editorCommandTemplate:n,onOpenExternal:s})}return m.jsxs("div",{className:"grid grid-cols-[1fr_auto]",children:[m.jsxs(Ev,{children:[m.jsx(Rv,{asChild:!0,children:m.jsx(qe,{variant:"ghost",size:"none",onClick:()=>f(l),title:`Open in ${Pee(l,e)}`,className:"border-0 p-1 py-[3px] pr-0 hover:!border-border/0 hover:!bg-transparent",children:m.jsx(t4,{value:l,isMac:e,className:"size-5.5"})})}),m.jsx(Mf,{side:"bottom",shortcut:l==="finder"?r:l===`editor:${t}`?i:void 0})]}),m.jsxs(rl,{value:void 0,onValueChange:h=>f(h),children:[m.jsx(Wo,{"aria-label":"Choose open destination",className:"!h-auto !py-0 !pl-0.5 !pr-1 border-0 bg-transparent hover:bg-transparent focus:ring-0 focus:ring-offset-0 [&>svg]:hidden",children:m.jsx("div",{className:"flex items-center justify-center size-5",children:m.jsx(Rd,{className:"h-4 w-4 opacity-60"})})}),m.jsx(Go,{align:"end",children:m.jsx(Fu,{children:d.map(h=>m.jsx(Ls,{value:h.value,className:J3,children:m.jsx(e4,{value:h.value,label:h.label,isMac:e})},h.value))})})]})]})}function zee({isMac:e,editorPreset:t,editorCommandTemplate:n,includeFinder:r=!0,includeTerminal:i=!1,includePreview:s=!1,includeDefault:o=!1,onOpenExternal:l}){const c=n4({editorPreset:t,isMac:e,includeFinder:r,includeTerminal:i,includePreview:s,includeDefault:o});return m.jsx(ra,{className:"rounded-lg p-1",children:c.map(d=>m.jsx(Cn,{className:`${J3} ${Mee}`,onSelect:f=>{f.preventDefault(),r4({value:d.value,editorCommandTemplate:n,onOpenExternal:l})},children:m.jsx(e4,{value:d.value,label:d.label,isMac:e})},d.value))})}function Bee(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();e.currentTarget.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:t.left+t.width/2,clientY:t.bottom,view:window}))}function Fee({showOnDesktop:e,onToggleEmbeddedTerminal:t,onExportTranscript:n,canExportTranscript:r,isExportingTranscript:i,exportTranscriptComplete:s}){return!t&&!n?null:m.jsxs(_l,{children:[m.jsx(yl,{asChild:!0,children:m.jsx(qe,{variant:"ghost",size:"none",onClick:Bee,title:"More actions",className:ye("border border-border/0 hover:!border-border/0 px-1.5 h-9 hover:!bg-transparent",e?"flex":"flex md:hidden"),children:m.jsx(Eb,{strokeWidth:2,className:"h-4.5"})})}),m.jsxs(ra,{children:[t?m.jsxs(Cn,{onSelect:o=>{o.preventDefault(),t()},children:[m.jsx(Ab,{strokeWidth:2,className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Toggle Terminal"})]}):null,n?m.jsxs(Cn,{disabled:!r||i,onSelect:o=>{o.preventDefault(),!(!r||i)&&n()},children:[i?m.jsx(dn,{className:"h-3.5 w-3.5 animate-spin"}):s?m.jsx(ri,{className:"h-3.5 w-3.5 text-emerald-400"}):m.jsx(dC,{strokeWidth:2,className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Share Chat"})]}):null]})]})}function Hee({sidebarCollapsed:e,onOpenSidebar:t,onExpandSidebar:n,onNewChat:r,localPath:i,embeddedTerminalVisible:s=!1,onToggleEmbeddedTerminal:o,rightPanel:l="hidden",onToggleGitPanel:c,onToggleBrowserPanel:d,onOpenExternal:f,onExportTranscript:h,canExportTranscript:g=!1,isExportingTranscript:v=!1,exportTranscriptComplete:y=!1,editorPreset:x="cursor",editorCommandTemplate:w,platform:C="darwin",finderShortcut:R,editorShortcut:E,terminalShortcut:T,rightSidebarShortcut:A,branchName:N,hasGitRepo:D=!0,gitStatus:L="unknown",isTranscriptViewportNarrow:G=!0}){const z=D?L==="unknown"?null:N??"Detached HEAD":"Setup Git",$=C==="darwin",H=l!=="hidden",O=l==="browser"?d:l==="git"?c:void 0,F=l==="hidden"||l==="git",U=l==="hidden"||l==="browser";return m.jsx(SC,{className:ye("absolute top-0 left-0 right-0 z-10 md:pt-[9px] lg:pb-[9px] pl-1 pr-2 border-border/0 flex items-center justify-center",G?"bg-background border-b border-border":"bg-transparent"),children:m.jsxs("div",{className:"relative flex items-center gap-2 w-full",children:[m.jsxs("div",{className:`h-[30px] flex items-center gap-0 flex-shrink-0 border border-border/0 rounded-[9px] ${e?"px-1.5 border-border":""} px-[2px] backdrop-blur-lg`,children:[m.jsx(qe,{variant:"ghost",size:"icon",className:"md:hidden !h-[auto] hover:!border-border/0 hover:!bg-transparent",onClick:t,children:m.jsx(lC,{className:"size-4"})}),e&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"hidden md:flex items-center justify-center w-[36px] h-[36px]",children:m.jsx(Ku,{className:"h-4 w-4 sm:h-5 sm:w-5 text-logo ml-1 hidden md:block"})}),m.jsx(qe,{variant:"ghost",size:"icon",className:"hidden md:flex hover:!border-border/0 hover:!bg-transparent",onClick:n,title:"Expand sidebar",children:m.jsx(HS,{className:"size-4"})})]}),m.jsx(qe,{variant:"ghost",size:"icon",className:"hover:!border-border/0 hover:!bg-transparent",onClick:r,title:"Compose",children:m.jsx(uC,{className:"size-4"})})]}),m.jsx("div",{className:"flex-1 min-w-0"}),i&&(f||o||c||d||h)?m.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[f?m.jsx("div",{className:"hidden md:block border border-border/70 rounded-[9px] backdrop-blur-lg",children:m.jsx(jee,{isMac:$,editorPreset:x,editorCommandTemplate:w,finderShortcut:R,editorShortcut:E,onOpenExternal:f})}):null,o||c||d||h?m.jsxs("div",{className:"flex items-center rounded-[9px] h-[30px] backdrop-blur-lg",children:[m.jsx(Fee,{showOnDesktop:H,onToggleEmbeddedTerminal:o,onExportTranscript:h,canExportTranscript:g,isExportingTranscript:v,exportTranscriptComplete:y}),o?m.jsxs(Ev,{children:[m.jsx(Rv,{asChild:!0,children:m.jsx(qe,{variant:"ghost",size:"none",onClick:o,className:ye(H?"hidden":"hidden md:flex","border border-border/0 hover:!border-border/0 px-1.5 h-9 hover:!bg-transparent",s&&"text-foreground"),children:m.jsx(Ab,{strokeWidth:2,className:"h-4"})})}),m.jsx(Mf,{side:"bottom",shortcut:T})]}):null,h?m.jsx(qe,{variant:"ghost",size:"none",onClick:h,disabled:!g||v,title:"Share chat","aria-label":"Share chat",className:ye(H?"hidden":"hidden md:flex","border border-border/0 hover:!border-border/0 px-1.5 h-9 hover:!bg-transparent disabled:opacity-50"),children:v?m.jsx(dn,{className:"h-4 animate-spin"}):y?m.jsx(ri,{className:"h-4 text-emerald-400"}):m.jsx(dC,{strokeWidth:2,className:"h-4"})}):null,d&&F?m.jsx(qe,{variant:"ghost",size:"none",onClick:d,title:"Browser","aria-label":"Browser",className:ye("border border-border/0 hover:!border-border/0 px-1.5 h-9 hover:!bg-transparent"),children:m.jsx(aC,{strokeWidth:2.25,className:"h-4"})}):null,c&&U?m.jsxs(Ev,{children:[m.jsx(Rv,{asChild:!0,children:m.jsxs(qe,{variant:"ghost",size:"none",onClick:c,className:ye("border flex flex-row items-center gap-1.5 h-9 border-border/0 hover:!border-border/0 hover:!bg-transparent",H?"w-[38px] justify-center px-0":"pl-1.5 pr-2"),children:[m.jsx(lc,{strokeWidth:2.25,className:"h-4"}),z&&!H?m.jsx("div",{className:"font-[13px] max-w-[140px] truncate hidden md:block",children:z}):null]})}),m.jsx(Mf,{side:"bottom",shortcut:A})]}):null,H&&O?m.jsx(qe,{variant:"ghost",size:"none",onClick:O,title:"Collapse sidebar","aria-label":"Collapse sidebar",className:"border border-border/0 hover:!border-border/0 px-1.5 h-9 hover:!bg-transparent text-foreground",children:m.jsx(uV,{strokeWidth:2.25,className:"h-4"})}):null]}):null]}):null]})})}let jv=null,jh=null;const zv=new Map,ux=new Map;function $ee(e){return e.filter(t=>t.status>=200&&t.status<400)}function dx(){return jv}function Uee(e,t){return jh||(jh=e.command({type:"browser.listLocalHttpServers",projectId:t}).then(n=>{const r=$ee(n);return jv=r,r}).finally(()=>{jh=null}),jh)}function Vee(e){const t=(jv??[]).filter(n=>n.port!==e);return jv=t,t}function GN(e){return zv.get(e)}function Wee(e,t){const n=ux.get(t);if(n)return n;const r=e.command({type:"project.readQuickActions",projectId:t}).then(i=>(zv.set(t,i),i)).finally(()=>{ux.delete(t)});return ux.set(t,r),r}function Gee(e,t,n){return zv.set(t,n),e.command({type:"project.writeQuickActions",projectId:t,quickActions:n}).then(r=>(zv.set(t,r),r))}function qee(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var s;const o=c=>c===null?null:JSON.parse(c,void 0),l=(s=n.getItem(i))!=null?s:null;return l instanceof Promise?l.then(o):o(l)},setItem:(i,s)=>n.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>n.removeItem(i)}}const xw=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return xw(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return xw(r)(n)}}}},Kee=(e,t)=>(n,r,i)=>{let s={storage:qee(()=>window.localStorage),partialize:w=>w,version:0,merge:(w,C)=>({...C,...w}),...t},o=!1,l=0;const c=new Set,d=new Set;let f=s.storage;if(!f)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...w)},r,i);const h=()=>{const w=s.partialize({...r()});return f.setItem(s.name,{state:w,version:s.version})},g=i.setState;i.setState=(w,C)=>(g(w,C),h());const v=e((...w)=>(n(...w),h()),r,i);i.getInitialState=()=>v;let y;const x=()=>{var w,C;if(!f)return;const R=++l;o=!1,c.forEach(T=>{var A;return T((A=r())!=null?A:v)});const E=((C=s.onRehydrateStorage)==null?void 0:C.call(s,(w=r())!=null?w:v))||void 0;return xw(f.getItem.bind(f))(s.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==s.version){if(s.migrate){const A=s.migrate(T.state,T.version);return A instanceof Promise?A.then(N=>[!0,N]):[!0,A]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var A;if(R!==l)return;const[N,D]=T;if(y=s.merge(D,(A=r())!=null?A:v),n(y,!0),N)return h()}).then(()=>{R===l&&(E==null||E(y,void 0),y=r(),o=!0,d.forEach(T=>T(y)))}).catch(T=>{R===l&&(E==null||E(void 0,T))})};return i.persist={setOptions:w=>{s={...s,...w},w.storage&&(f=w.storage)},clearStorage:()=>{f==null||f.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>x(),hasHydrated:()=>o,onHydrate:w=>(c.add(w),()=>{c.delete(w)}),onFinishHydration:w=>(d.add(w),()=>{d.delete(w)})},s.skipHydration||x(),y||v},t0=Kee,dd=420,Bv=370;function Yee(e){return Number.isFinite(e)?Math.max(Bv,e):dd}function Xee(){return{rightPanel:"hidden"}}function zh(){return{viewMode:"history",collapsedPaths:{},summary:"",description:""}}function Qee(){return{address:"",history:[],historyIndex:-1,zoom:1}}function Sw(e){const t=e.trim();return t?/^[a-z][a-z\d+.-]*:\/\//i.test(t)?t:`http://${t}`:""}function i4(e){return Number.isFinite(e)?Math.min(2,Math.max(.5,Math.round(e*10)/10)):1}function hx(e,t){return e[t]??Xee()}function tg(e,t){return e[t]??Qee()}function Zee(e){if(!e||typeof e!="object")return{size:dd,projects:{},projectUi:{},projectBrowser:{}};const t=e,n=Object.fromEntries(Object.entries(t.projects??{}).map(([i,s])=>[i,{rightPanel:s.rightPanel??(s.isVisible?"git":"hidden")}])),r=Object.fromEntries(Object.entries(t.projectBrowser??{}).map(([i,s])=>{const o=Sw(s.address??""),l=(s.history??[]).map(Sw).filter(Boolean),c=Math.min(l.length-1,Math.max(-1,s.historyIndex??l.length-1));return[i,{address:o,history:l,historyIndex:c,zoom:i4(s.zoom??1)}]}));return{size:dd,projects:n,projectUi:t.projectUi??{},projectBrowser:r}}const br=kl()(t0(e=>({size:dd,projects:{},projectUi:{},projectBrowser:{},togglePanel:(t,n)=>e(r=>({projects:{...r.projects,[t]:{...hx(r.projects,t),rightPanel:hx(r.projects,t).rightPanel===n?"hidden":n}}})),hidePanel:t=>e(n=>({projects:{...n.projects,[t]:{...hx(n.projects,t),rightPanel:"hidden"}}})),setSize:t=>e({size:Yee(t)}),navigateBrowser:(t,n)=>e(r=>{const i=tg(r.projectBrowser,t),s=Sw(n);if(!s)return{projectBrowser:{...r.projectBrowser,[t]:{...i,address:""}}};if(i.address===s)return r;const o=i.history.slice(0,i.historyIndex+1),l=o[o.length-1]===s?o:[...o,s];return{projectBrowser:{...r.projectBrowser,[t]:{...i,address:s,history:l,historyIndex:l.length-1}}}}),goBrowserBack:t=>e(n=>{const r=tg(n.projectBrowser,t),i=Math.max(0,r.historyIndex-1);return i===r.historyIndex||!r.history[i]?n:{projectBrowser:{...n.projectBrowser,[t]:{...r,address:r.history[i],historyIndex:i}}}}),goBrowserForward:t=>e(n=>{const r=tg(n.projectBrowser,t),i=Math.min(r.history.length-1,r.historyIndex+1);return i===r.historyIndex||!r.history[i]?n:{projectBrowser:{...n.projectBrowser,[t]:{...r,address:r.history[i],historyIndex:i}}}}),setBrowserZoom:(t,n)=>e(r=>{const i=tg(r.projectBrowser,t),s=i4(n);return i.zoom===s?r:{projectBrowser:{...r.projectBrowser,[t]:{...i,zoom:s}}}}),reconcileCollapsedPaths:(t,n)=>e(r=>{const i=r.projectUi[t]??zh(),s=Object.fromEntries(n.map(o=>[o,i.collapsedPaths[o]??!0]));return Object.keys(i.collapsedPaths).length===Object.keys(s).length&&Object.entries(s).every(([o,l])=>i.collapsedPaths[o]===l)?r:{projectUi:{...r.projectUi,[t]:{...i,collapsedPaths:s}}}}),toggleCollapsedPath:(t,n)=>e(r=>{const i=r.projectUi[t]??zh();return{projectUi:{...r.projectUi,[t]:{...i,collapsedPaths:{...i.collapsedPaths,[n]:!(i.collapsedPaths[n]??!0)}}}}}),setViewMode:(t,n)=>e(r=>{const i=r.projectUi[t]??zh();return i.viewMode===n?r:{projectUi:{...r.projectUi,[t]:{...i,viewMode:n}}}}),setCommitDraft:(t,n)=>e(r=>{const i=r.projectUi[t]??zh();return i.summary===n.summary&&i.description===n.description?r:{projectUi:{...r.projectUi,[t]:{...i,summary:n.summary,description:n.description}}}}),clearCommitDraft:t=>e(n=>{const r=n.projectUi[t]??zh();return!r.summary&&!r.description?n:{projectUi:{...n.projectUi,[t]:{...r,summary:"",description:""}}}}),clearProject:t=>e(n=>{const{[t]:r,...i}=n.projects,{[t]:s,...o}=n.projectUi,{[t]:l,...c}=n.projectBrowser;return{projects:i,projectUi:o,projectBrowser:c}})}),{name:"right-sidebar-layouts",version:7,migrate:Zee})),Jee={rightPanel:"hidden"};function ete(e){const t=e.match(/^\/(?:Users|home)\/[^/]+(?=\/|$)/),n=t==null?void 0:t[0];return n&&e===n?"~":n&&e.startsWith(`${n}/`)?`~/${e.slice(n.length+1)}`:e}function tte(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();e.currentTarget.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:t.left+t.width/2,clientY:t.bottom,view:window}))}function ng({label:e,disabled:t,onClick:n,children:r}){return m.jsx(qe,{type:"button",variant:"ghost",size:"none",title:e,"aria-label":e,disabled:t,onClick:n,className:"h-8 w-8 shrink-0 border-border/0 text-muted-foreground hover:!border-border/0 hover:!bg-transparent hover:text-foreground disabled:opacity-40",children:r})}function nte({projectId:e,socket:t,onRunQuickAction:n}){const r=br(le=>le.projectBrowser[e]),i=br(le=>le.navigateBrowser),s=br(le=>le.setBrowserZoom),o=_.useRef(null),l=(r==null?void 0:r.address)??"",c=(r==null?void 0:r.zoom)??1,[d,f]=_.useState(l),[h,g]=_.useState(0),[v,y]=_.useState(()=>dx()??[]),[x,w]=_.useState(!1),[C,R]=_.useState(null),[E,T]=_.useState(()=>GN(e)??[]),[A,N]=_.useState(null),[D,L]=_.useState(""),[G,z]=_.useState(!1),[$,H]=_.useState(!1),[O,F]=_.useState(!1),U=_.useRef([]),j=v.filter(le=>le.sameProject),W=v.filter(le=>!le.sameProject),B=j.length===0,I=O||B?v:j,V=_.useCallback((le={})=>{const te=dx()!==null;le.silent||w(!0),R(null),Uee(t,e).then(y).catch(Ce=>R(Ce instanceof Error?Ce.message:String(Ce))).finally(()=>{(!le.silent||!te)&&w(!1)})},[e,t]),X=_.useCallback(le=>{y(Vee(le.port)),t.command({type:"browser.killLocalHttpServer",port:le.port}).then(()=>V({silent:!0})).catch(te=>R(te instanceof Error?te.message:String(te)))},[V,t]),P=_.useCallback(le=>{T(le),N(null),Gee(t,e,le).then(T).catch(te=>N(te instanceof Error?te.message:String(te)))},[e,t]),ie=_.useCallback(le=>{var Ce,Fe;le.preventDefault();const te=D.trim();te&&(P([...E,{id:((Fe=(Ce=globalThis.crypto)==null?void 0:Ce.randomUUID)==null?void 0:Fe.call(Ce))??`quick-action-${Date.now()}`,label:te,command:te}]),L(""),z(!1))},[D,E,P]),re=_.useCallback(le=>{P(E.filter(te=>te.id!==le))},[E,P]),se=_.useCallback(le=>{le.currentTarget.contains(le.relatedTarget)||z(!1)},[]),oe=_.useCallback(le=>{n(le),U.current.forEach(te=>window.clearTimeout(te)),U.current=[1e3,2e3].map(te=>window.setTimeout(()=>{V({silent:!0})},te))},[n,V]);_.useEffect(()=>{f(l)},[l]),_.useEffect(()=>{if(l)return;const le=dx();y(le||[]),V({silent:!!le})},[l,V]),_.useEffect(()=>{const le=GN(e);T(le||[]),N(null),Wee(t,e).then(T).catch(te=>N(te instanceof Error?te.message:String(te)))},[e,t]),_.useEffect(()=>{if(l)return;const le=window.setInterval(()=>{document.visibilityState==="visible"&&V({silent:!0})},7e3);return()=>window.clearInterval(le)},[l,V]),_.useEffect(()=>()=>{U.current.forEach(le=>window.clearTimeout(le)),U.current=[]},[]);const fe=m.jsxs("div",{className:"space-y-1.5",children:[m.jsxs("div",{className:"flex items-center gap-2 pl-1 text-sm font-medium mb-3",children:[m.jsx(aW,{className:"h-4 w-4 text-muted-foreground"}),m.jsx("span",{children:"Quick Actions"}),m.jsx(qe,{type:"button",variant:"ghost",size:"none","aria-label":"Add quick action",title:"Add quick action",onClick:()=>z(le=>!le),className:"ml-auto h-6 w-6 border-border/0 text-muted-foreground hover:!border-border/0 hover:!bg-transparent hover:text-foreground",children:m.jsx(od,{className:"h-4 w-4"})})]}),G?m.jsxs("form",{onSubmit:ie,onBlur:se,className:"relative flex h-[42px] min-w-0 items-center rounded-xl border border-border/70 px-3",children:[m.jsx(Or,{value:D,onChange:le=>L(le.target.value),placeholder:"bun run dev",className:"h-auto min-w-0 flex-1 border-0 bg-transparent p-0 pr-10 text-sm font-medium shadow-none outline-none focus-visible:ring-0 focus-visible:ring-offset-0",autoFocus:!0}),m.jsx(qe,{type:"submit",variant:"ghost",size:"none",disabled:!D.trim(),className:"absolute right-1.5 top-1/2 h-6 -translate-y-1/2 rounded-md px-2 text-xs text-muted-foreground hover:!bg-muted/40 hover:text-foreground",children:m.jsx(nO,{className:"h-3.5 w-3.5"})})]}):null,A?m.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:A}):null,E.length===0?m.jsx("div",{className:"rounded-md border border-dashed border-border/70 px-3 py-3 text-xs text-muted-foreground",children:"No quick actions."}):E.map(le=>m.jsxs(_l,{children:[m.jsx(yl,{asChild:!0,children:m.jsxs("div",{role:"button",tabIndex:0,onClick:()=>oe(le.command),onKeyDown:te=>{te.key!=="Enter"&&te.key!==" "||(te.preventDefault(),oe(le.command))},className:"flex min-w-0 cursor-pointer items-center gap-2 rounded-xl border border-border/70 px-3 pr-[10px] py-2 outline-none hover:bg-muted/40 focus-visible:outline-none active:outline-none",title:le.command,children:[m.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-sm font-medium text-foreground",children:le.label}),m.jsx(qe,{type:"button",variant:"ghost",size:"none","aria-label":"Run quick action",title:"Run quick action",onClick:te=>{te.stopPropagation(),oe(le.command)},className:"h-6 w-6 shrink-0 border-border/0 text-muted-foreground hover:!border-border/0 hover:!bg-transparent hover:text-foreground",children:m.jsx(_V,{className:"h-3.5 w-3.5"})})]})}),m.jsx(ra,{children:m.jsxs(Cn,{onSelect:te=>{te.preventDefault(),re(le.id)},className:"text-destructive focus:text-destructive",children:[m.jsx(Rf,{className:"h-3.5 w-3.5"}),m.jsx("span",{children:"Delete"})]})})]},le.id))]});function de(le){le.preventDefault(),i(e,d)}function ve(){if(!l){V();return}g(le=>le+1)}return m.jsx("div",{className:"h-full min-h-0 border-l border-border bg-background md:min-w-[370px]",children:m.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[m.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-2 py-2",children:[m.jsx(ng,{label:"Home",onClick:()=>i(e,""),children:m.jsx(BU,{className:"h-4 w-4"})}),m.jsx(ng,{label:"Refresh",onClick:ve,children:m.jsx(dO,{className:"h-4 w-4"})}),m.jsxs("form",{onSubmit:de,className:"group relative min-w-0 flex-1",children:[m.jsx(Or,{value:d,onChange:le=>f(le.target.value),placeholder:"Enter a URL",className:"h-7 rounded-[9px] px-[28px] text-xs text-muted-foreground focus:text-foreground hover:text-foreground text-center border-border/0 bg-background hover:bg-card focus:bg-card hover:border-border/50 focus:border-border/50 transition-all"}),l?m.jsx(qe,{type:"button",variant:"ghost",size:"none",title:"Open external","aria-label":"Open external",onClick:()=>window.open(l,"_blank","noopener,noreferrer"),className:"absolute right-1 top-1/2 h-6 w-6 -translate-y-1/2 border-border/0 text-muted-foreground opacity-0 hover:!border-border/0 hover:!bg-transparent hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100",children:m.jsx(op,{className:"h-3.5 w-3.5"})}):null]}),m.jsxs(uo,{open:$,children:[m.jsx(ho,{asChild:!0,children:m.jsxs("div",{className:"flex shrink-0 items-center gap-0",onMouseEnter:()=>H(!0),onMouseLeave:()=>H(!1),onFocus:()=>H(!0),onBlur:le=>{le.currentTarget.contains(le.relatedTarget)||H(!1)},children:[m.jsx(ng,{label:"Zoom out",onClick:()=>s(e,c-.1),children:m.jsx(uO,{className:"h-4 w-4"})}),m.jsx(ng,{label:"Zoom in",onClick:()=>s(e,c+.1),children:m.jsx(od,{className:"h-4 w-4"})})]})}),m.jsxs(Ps,{side:"bottom",children:[Math.round(c*100),"%"]})]})]}),m.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:l?m.jsx("div",{className:"h-full w-full overflow-auto bg-muted/20",children:m.jsx("iframe",{ref:o,src:l,title:"Browser panel",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-same-origin allow-scripts",className:"h-full w-full origin-top-left border-0 bg-background",style:{width:`${100/c}%`,height:`${100/c}%`,transform:`scale(${c})`}},`${l}-${h}`)}):m.jsx("div",{className:"h-full overflow-y-auto p-3 ",children:m.jsxs("div",{className:"h-full mx-auto max-w-[450px] flex flex-col",style:{justifyContent:"safe center"},children:[m.jsxs("div",{className:"pl-1 mb-3 flex items-center gap-2 text-sm font-medium",children:[m.jsx(aC,{className:"h-4 w-4 text-muted-foreground"}),m.jsx("span",{children:"Local Servers"})]}),m.jsxs("div",{className:"space-y-4",children:[C?m.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:C}):x?m.jsx("div",{className:"space-y-1.5 animate-pulse",children:[0,1,2].map(le=>m.jsxs("div",{className:"flex w-full min-w-0 flex-col rounded-md border border-border/70 px-3 py-2",children:[m.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[m.jsx("div",{className:le===1?"h-4 w-36 rounded bg-muted":"h-4 w-28 rounded bg-muted"}),m.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-muted"}),m.jsx("div",{className:"ml-auto h-6 w-6 rounded bg-muted"})]}),m.jsxs("div",{className:"mt-1.5 flex w-full min-w-0 items-center gap-3",children:[m.jsx("div",{className:le===2?"h-3 w-32 rounded bg-muted":"h-3 w-40 rounded bg-muted"}),m.jsx("div",{className:"ml-auto h-3 w-[42%] rounded bg-muted"})]})]},le))}):v.length===0?m.jsx("div",{className:"flex h-40 items-center justify-center px-6 text-center text-sm text-muted-foreground",children:"No local HTTP servers found."}):m.jsxs("div",{className:"space-y-1.5",children:[I.map(le=>m.jsxs(_l,{children:[m.jsx(yl,{asChild:!0,children:m.jsxs("div",{role:"button",tabIndex:0,onClick:()=>i(e,le.address),onKeyDown:te=>{te.key!=="Enter"&&te.key!==" "||(te.preventDefault(),i(e,le.address))},className:"flex w-full min-w-0 cursor-pointer flex-col rounded-xl border border-border/70 px-3 py-1.5 pb-2.5 text-left outline-none hover:border-border hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[m.jsxs("span",{className:"flex w-full min-w-0 items-center gap-2",children:[m.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[m.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-foreground",children:le.title}),le.sameProject?m.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-400"}):null]}),m.jsx(qe,{type:"button",variant:"ghost",size:"none","aria-label":"Server actions",title:"Server actions",onClick:tte,className:"!h-auto !w-auto shrink-0 border-border/0 text-muted-foreground hover:!border-border/0 hover:!bg-transparent hover:text-foreground",children:m.jsx(Eb,{className:"w-4"})})]}),m.jsxs("span",{className:"flex w-full min-w-0 items-center gap-3",children:[m.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:le.address}),le.ownerPath?m.jsx("span",{className:"max-w-[45%] shrink-0 truncate text-right text-[11px] text-muted-foreground/70",children:ete(le.ownerPath)}):null]})]})}),m.jsxs(ra,{children:[m.jsxs(Cn,{onSelect:te=>{te.preventDefault(),window.open(le.address,"_blank","noopener,noreferrer")},children:[m.jsx(HV,{className:"h-3.5 w-3.5"}),m.jsx("span",{children:"Open in New Tab"})]}),m.jsxs(Cn,{onSelect:te=>{te.preventDefault(),X(le)},className:"text-destructive focus:text-destructive",children:[m.jsx(Rf,{className:"h-3.5 w-3.5"}),m.jsx("span",{children:"Kill Process"})]})]})]},le.address)),W.length>0&&!B?m.jsx(qe,{type:"button",variant:"ghost",size:"none",onClick:()=>F(le=>!le),className:"h-8 w-fit rounded-md px-2 text-xs text-muted-foreground hover:!bg-muted/40",children:O?"Hide other projects":`Other projects (${W.length})`}):null]}),fe,m.jsx("div",{className:"h-3"})]})]})})})]})})}const rte=_.memo(nte),ite={position:"absolute",top:0,bottom:0,textAlign:"center"},ste={display:"contents"};function qN(){return null}const Fv="diffs-container",ote=/(?=^From [a-f0-9]+ .+$)/m,Yg=/(?=^diff --git)/gm,KN=/(?=^---\s+\S)/gm,ate=/(?=^@@ )/gm,lte=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,fx=new RegExp("(?<=\\n)"),cte=/^(---|\+\+\+)\s+([^\t\r\n]+)/,ute=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,dte=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,hte=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,uk="header-prefix",dk="header-metadata",hk="header-custom",so={dark:"pierre-dark",light:"pierre-light"},s4="data-theme-css",o4="data-unsafe-css",Ju=1,fte={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},pte=Object.freeze({fromStart:0,fromEnd:0}),YN={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},mte={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function jf(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function gte(e,t){return typeof window>"u"&&t!=null?m.jsxs(m.Fragment,{children:[m.jsx("template",{shadowrootmode:"open",dangerouslySetInnerHTML:{__html:t}}),e]}):m.jsx(m.Fragment,{children:e})}const vte=_.createContext(void 0);function bte(){return _.useContext(vte)}const gc=new Map,px=new Map,ww=new Map,Cw=new Set;function XN(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let r;if(typeof n=="string"){if(r=gc.get(n),r==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else r=n,n=n.name,gc.has(n)||gc.set(n,r);Cw.has(n)||(Cw.add(n),t.loadThemeSync(r))}}const _te="modulepreload",yte=function(e){return"/"+e},QN={},Y=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(d){return Promise.all(d.map(f=>Promise.resolve(f).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(n.map(d=>{if(d=yte(d),d in QN)return;QN[d]=!0;const f=d.endsWith(".css"),h=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const g=document.createElement("link");if(g.rel=f?"stylesheet":_te,f||(g.as="script"),g.crossOrigin="",g.href=d,c&&g.setAttribute("nonce",c),document.head.appendChild(g),f)return new Promise((v,y)=>{g.addEventListener("load",v),g.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},zf=new Map,mx=new Map,xte=new Map,kw=new Set;function ZN(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(kw.has(n.name))continue;let r=zf.get(n.name);r==null&&(r=n,zf.set(n.name,r)),kw.add(r.name),t.loadLanguageSync(r.data)}}function a4(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}let nr=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function Ste(e){return fk(e)}function fk(e){return Array.isArray(e)?wte(e):e instanceof RegExp?e:typeof e=="object"?Cte(e):e}function wte(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=fk(e[n]);return t}function Cte(e){let t={};for(let n in e)t[n]=fk(e[n]);return t}function l4(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function c4(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?c4(e.substring(0,e.length-1)):e.substr(~t+1)}var gx=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,rg=class{static hasCaptures(e){return e===null?!1:(gx.lastIndex=0,gx.test(e))}static replaceCaptures(e,t,n){return e.replace(gx,(r,i,s,o)=>{let l=n[parseInt(i||s,10)];if(l){let c=t.substring(l.start,l.end);for(;c[0]===".";)c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function u4(e,t){return e<t?-1:e>t?1:0}function d4(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let i=0;i<n;i++){let s=u4(e[i],t[i]);if(s!==0)return s}return 0}return n-r}function JN(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function h4(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var f4=class{constructor(e){ee(this,"cache",new Map);this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},Hv=class{constructor(e,t,n){ee(this,"_cachedMatchRoot",new f4(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Rte(e),t)}static createFromParsedTheme(e,t){return Ate(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(i=>kte(e.parent,i.parentScopes));return r?new p4(r.fontStyle,r.foreground,r.background):null}},vx=class Xg{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Xg(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Xg(n,t[r]);return n}push(t){return new Xg(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function kte(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Ete(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Ete(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var p4=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Rte(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let i=0,s=t.length;i<s;i++){let o=t[i];if(!o.settings)continue;let l;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),l=h.split(",")}else Array.isArray(o.scope)?l=o.scope:l=[""];let c=-1;if(typeof o.settings.fontStyle=="string"){c=0;let h=o.settings.fontStyle.split(" ");for(let g=0,v=h.length;g<v;g++)switch(h[g]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let d=null;typeof o.settings.foreground=="string"&&JN(o.settings.foreground)&&(d=o.settings.foreground);let f=null;typeof o.settings.background=="string"&&JN(o.settings.background)&&(f=o.settings.background);for(let h=0,g=l.length;h<g;h++){let y=l[h].trim().split(" "),x=y[y.length-1],w=null;y.length>1&&(w=y.slice(0,y.length-1),w.reverse()),n[r++]=new Tte(x,w,i,c,d,f)}}return n}var Tte=class{constructor(e,t,n,r,i,s){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=s}},Vr=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(Vr||{});function Ate(e,t){e.sort((c,d)=>{let f=u4(c.scope,d.scope);return f!==0||(f=d4(c.parentScopes,d.parentScopes),f!==0)?f:c.index-d.index});let n=0,r="#000000",i="#ffffff";for(;e.length>=1&&e[0].scope==="";){let c=e.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(i=c.background)}let s=new Nte(t),o=new p4(n,s.getId(r),s.getId(i)),l=new Lte(new Ew(0,null,-1,0,0),[]);for(let c=0,d=e.length;c<d;c++){let f=e[c];l.insert(0,f.scope,f.parentScopes,f.fontStyle,s.getId(f.foreground),s.getId(f.background))}return new Hv(s,o,l)}var Nte=class{constructor(e){ee(this,"_isFrozen");ee(this,"_lastColorId");ee(this,"_id2color");ee(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Mte=Object.freeze([]),Ew=class m4{constructor(t,n,r,i,s){ee(this,"scopeDepth");ee(this,"parentScopes");ee(this,"fontStyle");ee(this,"foreground");ee(this,"background");this.scopeDepth=t,this.parentScopes=n||Mte,this.fontStyle=r,this.foreground=i,this.background=s}clone(){return new m4(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,i=t.length;r<i;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,i){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),i!==0&&(this.background=i)}},Lte=class Rw{constructor(t,n=[],r={}){ee(this,"_rulesWithParentScopes");this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,i=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[i]===">"&&i++,!(r>=t.parentScopes.length||i>=n.parentScopes.length);){const s=n.parentScopes[i].length-t.parentScopes[r].length;if(s!==0)return s;r++,i++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),i,s;if(r===-1?(i=t,s=""):(i=t.substring(0,r),s=t.substring(r+1)),this._children.hasOwnProperty(i))return this._children[i].match(s)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Rw._cmpBySpecificity),n}insert(t,n,r,i,s,o){if(n===""){this._doInsertHere(t,r,i,s,o);return}let l=n.indexOf("."),c,d;l===-1?(c=n,d=""):(c=n.substring(0,l),d=n.substring(l+1));let f;this._children.hasOwnProperty(c)?f=this._children[c]:(f=new Rw(this._mainRule.clone(),Ew.cloneArr(this._rulesWithParentScopes)),this._children[c]=f),f.insert(t+1,d,r,i,s,o)}_doInsertHere(t,n,r,i,s){if(n===null){this._mainRule.acceptOverwrite(t,r,i,s);return}for(let o=0,l=this._rulesWithParentScopes.length;o<l;o++){let c=this._rulesWithParentScopes[o];if(d4(c.parentScopes,n)===0){c.acceptOverwrite(t,r,i,s);return}}r===-1&&(r=this._mainRule.fontStyle),i===0&&(i=this._mainRule.foreground),s===0&&(s=this._mainRule.background),this._rulesWithParentScopes.push(new Ew(t,n,r,i,s))}},hd=class as{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=as.getLanguageId(t),r=as.getTokenType(t),i=as.getFontStyle(t),s=as.getForeground(t),o=as.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:s,background:o})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,i,s,o,l){let c=as.getLanguageId(t),d=as.getTokenType(t),f=as.containsBalancedBrackets(t)?1:0,h=as.getFontStyle(t),g=as.getForeground(t),v=as.getBackground(t);return n!==0&&(c=n),r!==8&&(d=r),i!==null&&(f=i?1:0),s!==-1&&(h=s),o!==0&&(g=o),l!==0&&(v=l),(c<<0|d<<8|f<<10|h<<11|g<<15|v<<24)>>>0}};function $v(e,t){const n=[],r=Dte(e);let i=r.next();for(;i!==null;){let c=0;if(i.length===2&&i.charAt(1)===":"){switch(i.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let d=o();if(n.push({matcher:d,priority:c}),i!==",")break;i=r.next()}return n;function s(){if(i==="-"){i=r.next();const c=s();return d=>!!c&&!c(d)}if(i==="("){i=r.next();const c=l();return i===")"&&(i=r.next()),c}if(eM(i)){const c=[];do c.push(i),i=r.next();while(eM(i));return d=>t(c,d)}return null}function o(){const c=[];let d=s();for(;d;)c.push(d),d=s();return f=>c.every(h=>h(f))}function l(){const c=[];let d=o();for(;d&&(c.push(d),i==="|"||i===",");){do i=r.next();while(i==="|"||i===",");d=o()}return f=>c.some(h=>h(f))}}function eM(e){return!!e&&!!e.match(/[\w\.:]+/)}function Dte(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function g4(e){typeof e.dispose=="function"&&e.dispose()}var Bf=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Ite=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Pte=class{constructor(){ee(this,"_references",[]);ee(this,"_seenReferenceKeys",new Set);ee(this,"visitedRule",new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Ote=class{constructor(e,t){ee(this,"seenFullScopeRequests",new Set);ee(this,"seenPartialScopeRequests",new Set);ee(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Bf(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new Pte;for(const n of e)jte(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Bf){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function jte(e,t,n,r){const i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const s=n.lookup(t);e instanceof Bf?Qg({baseGrammar:s,selfGrammar:i},r):Tw(e.ruleName,{baseGrammar:s,selfGrammar:i,repository:i.repository},r);const o=n.injections(e.scopeName);if(o)for(const l of o)r.add(new Bf(l))}function Tw(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];Uv([r],t,n)}}function Qg(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Uv(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Uv(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Uv(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const i=r.repository?l4({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Uv(r.patterns,{...t,repository:i},n);const s=r.include;if(!s)continue;const o=v4(s);switch(o.kind){case 0:Qg({...t,selfGrammar:t.baseGrammar},n);break;case 1:Qg(t,n);break;case 2:Tw(o.ruleName,{...t,repository:i},n);break;case 3:case 4:const l=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(l){const c={baseGrammar:t.baseGrammar,selfGrammar:l,repository:i};o.kind===4?Tw(o.ruleName,c,n):Qg(c,n)}else o.kind===4?n.add(new Ite(o.scopeName,o.ruleName)):n.add(new Bf(o.scopeName));break}}}var zte=class{constructor(){ee(this,"kind",0)}},Bte=class{constructor(){ee(this,"kind",1)}},Fte=class{constructor(e){ee(this,"kind",2);this.ruleName=e}},Hte=class{constructor(e){ee(this,"kind",3);this.scopeName=e}},$te=class{constructor(e,t){ee(this,"kind",4);this.scopeName=e,this.ruleName=t}};function v4(e){if(e==="$base")return new zte;if(e==="$self")return new Bte;const t=e.indexOf("#");if(t===-1)return new Hte(e);if(t===0)return new Fte(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new $te(n,r)}}var Ute=/\\(\d+)/,tM=/\\(\d+)/g,Vte=-1,b4=-2;var bp=class{constructor(e,t,n,r){ee(this,"$location");ee(this,"id");ee(this,"_nameIsCapturing");ee(this,"_name");ee(this,"_contentNameIsCapturing");ee(this,"_contentName");this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=rg.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=rg.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${c4(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:rg.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:rg.replaceCaptures(this._contentName,e,t)}},Wte=class extends bp{constructor(t,n,r,i,s){super(t,n,r,i);ee(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,n){throw new Error("Not supported!")}compile(t,n){throw new Error("Not supported!")}compileAG(t,n,r,i){throw new Error("Not supported!")}},Gte=class extends bp{constructor(t,n,r,i,s){super(t,n,r,null);ee(this,"_match");ee(this,"captures");ee(this,"_cachedCompiledPatterns");this._match=new Ff(i,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t).compileAG(t,r,i)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Hf,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},nM=class extends bp{constructor(t,n,r,i,s){super(t,n,r,i);ee(this,"hasMissingPatterns");ee(this,"patterns");ee(this,"_cachedCompiledPatterns");this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,n){for(const r of this.patterns)t.getRule(r).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t).compileAG(t,r,i)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Hf,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Aw=class extends bp{constructor(t,n,r,i,s,o,l,c,d,f){super(t,n,r,i);ee(this,"_begin");ee(this,"beginCaptures");ee(this,"_end");ee(this,"endHasBackReferences");ee(this,"endCaptures");ee(this,"applyEndPatternLast");ee(this,"hasMissingPatterns");ee(this,"patterns");ee(this,"_cachedCompiledPatterns");this._begin=new Ff(s,this.id),this.beginCaptures=o,this._end=new Ff(l||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,this.applyEndPatternLast=d||!1,this.patterns=f.patterns,this.hasMissingPatterns=f.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t,n).compileAG(t,r,i)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Hf;for(const r of this.patterns)t.getRule(r).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},Vv=class extends bp{constructor(t,n,r,i,s,o,l,c,d){super(t,n,r,i);ee(this,"_begin");ee(this,"beginCaptures");ee(this,"whileCaptures");ee(this,"_while");ee(this,"whileHasBackReferences");ee(this,"hasMissingPatterns");ee(this,"patterns");ee(this,"_cachedCompiledPatterns");ee(this,"_cachedCompiledWhilePatterns");this._begin=new Ff(s,this.id),this.beginCaptures=o,this.whileCaptures=c,this._while=new Ff(l,b4),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t).compileAG(t,r,i)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Hf;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,r,i){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,r,i)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Hf,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||"￿"),this._cachedCompiledWhilePatterns}},_4=class Hr{static createCaptureRule(t,n,r,i,s){return t.registerRule(o=>new Wte(n,o,r,i,s))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new Gte(t.$vscodeTextmateLocation,t.id,t.name,t.match,Hr._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=l4({},r,t.repository));let s=t.patterns;return typeof s>"u"&&t.include&&(s=[{include:t.include}]),new nM(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Hr._compilePatterns(s,n,r))}return t.while?new Vv(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Hr._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,Hr._compileCaptures(t.whileCaptures||t.captures,n,r),Hr._compilePatterns(t.patterns,n,r)):new Aw(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Hr._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,Hr._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,Hr._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let s=0;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const l=parseInt(o,10);l>s&&(s=l)}for(let o=0;o<=s;o++)i[o]=null;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const l=parseInt(o,10);let c=0;t[o].patterns&&(c=Hr.getCompiledRuleId(t[o],n,r)),i[l]=Hr.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,c)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let s=0,o=t.length;s<o;s++){const l=t[s];let c=-1;if(l.include){const d=v4(l.include);switch(d.kind){case 0:case 1:c=Hr.getCompiledRuleId(r[l.include],n,r);break;case 2:let f=r[d.ruleName];f&&(c=Hr.getCompiledRuleId(f,n,r));break;case 3:case 4:const h=d.scopeName,g=d.kind===4?d.ruleName:null,v=n.getExternalGrammar(h,r);if(v)if(g){let y=v.repository[g];y&&(c=Hr.getCompiledRuleId(y,n,v.repository))}else c=Hr.getCompiledRuleId(v.repository.$self,n,v.repository);break}}else c=Hr.getCompiledRuleId(l,n,r);if(c!==-1){const d=n.getRule(c);let f=!1;if((d instanceof nM||d instanceof Aw||d instanceof Vv)&&d.hasMissingPatterns&&d.patterns.length===0&&(f=!0),f)continue;i.push(c)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},Ff=class y4{constructor(t,n){ee(this,"source");ee(this,"ruleId");ee(this,"hasAnchor");ee(this,"hasBackReferences");ee(this,"_anchorCache");if(t&&typeof t=="string"){const r=t.length;let i=0,s=[],o=!1;for(let l=0;l<r;l++)if(t.charAt(l)==="\\"&&l+1<r){const d=t.charAt(l+1);d==="z"?(s.push(t.substring(i,l)),s.push("$(?!\\n)(?<!\\n)"),i=l+2):(d==="A"||d==="G")&&(o=!0),l++}this.hasAnchor=o,i===0?this.source=t:(s.push(t.substring(i,r)),this.source=s.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=Ute.test(this.source):this.hasBackReferences=!1}clone(){return new y4(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(i=>t.substring(i.start,i.end));return tM.lastIndex=0,this.source.replace(tM,(i,s)=>h4(r[parseInt(s,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],i=[],s,o,l,c;for(s=0,o=this.source.length;s<o;s++)l=this.source.charAt(s),t[s]=l,n[s]=l,r[s]=l,i[s]=l,l==="\\"&&s+1<o&&(c=this.source.charAt(s+1),c==="A"?(t[s+1]="￿",n[s+1]="￿",r[s+1]="A",i[s+1]="A"):c==="G"?(t[s+1]="￿",n[s+1]="G",r[s+1]="￿",i[s+1]="G"):(t[s+1]=c,n[s+1]=c,r[s+1]=c,i[s+1]=c),s++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:i.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Hf=class{constructor(){ee(this,"_items");ee(this,"_hasAnchors");ee(this,"_cached");ee(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new rM(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(i=>i.resolveAnchors(t,n));return new rM(e,r,this._items.map(i=>i.ruleId))}},rM=class{constructor(e,t,n){ee(this,"scanner");this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
664
+ `},HQ={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function $Q(e){let{announcements:t=HQ,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=FQ}=e;const{announce:s,announcement:o}=jQ(),l=vp("DndLiveRegion"),[c,d]=_.useState(!1);if(_.useEffect(()=>{d(!0)},[]),zQ(_.useMemo(()=>({onDragStart(h){let{active:g}=h;s(t.onDragStart({active:g}))},onDragMove(h){let{active:g,over:v}=h;t.onDragMove&&s(t.onDragMove({active:g,over:v}))},onDragOver(h){let{active:g,over:v}=h;s(t.onDragOver({active:g,over:v}))},onDragEnd(h){let{active:g,over:v}=h;s(t.onDragEnd({active:g,over:v}))},onDragCancel(h){let{active:g,over:v}=h;s(t.onDragCancel({active:g,over:v}))}}),[s,t])),!c)return null;const f=xn.createElement(xn.Fragment,null,xn.createElement(PQ,{id:r,value:i.draggable}),xn.createElement(OQ,{id:l,announcement:o}));return n?ps.createPortal(f,n):f}var hr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(hr||(hr={}));function Lv(){}function EN(e,t){return _.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function UQ(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const $s=Object.freeze({x:0,y:0});function VQ(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function WQ(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function GQ(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function qQ(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function RN(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const TN=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=RN(t,t.left,t.top),s=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const d=VQ(RN(c),i);s.push({id:l,data:{droppableContainer:o,value:d}})}}return s.sort(WQ)};function KQ(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),o=i-r,l=s-n;if(r<i&&n<s){const c=t.width*t.height,d=e.width*e.height,f=o*l,h=f/(c+d-f);return Number(h.toFixed(4))}return 0}const YQ=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const s of r){const{id:o}=s,l=n.get(o);if(l){const c=KQ(l,t);c>0&&i.push({id:o,data:{droppableContainer:s,value:c}})}}return i.sort(GQ)};function XQ(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Uj(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:$s}function QQ(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];return i.reduce((o,l)=>({...o,top:o.top+e*l.y,bottom:o.bottom+e*l.y,left:o.left+e*l.x,right:o.right+e*l.x}),{...n})}}const ZQ=QQ(1);function JQ(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function eZ(e,t,n){const r=JQ(t);if(!r)return e;const{scaleX:i,scaleY:s,x:o,y:l}=r,c=e.left-o-(1-i)*parseFloat(n),d=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),f=i?e.width/i:e.width,h=s?e.height/s:e.height;return{width:f,height:h,top:d,right:c+f,bottom:d+h,left:c}}const tZ={ignoreTransform:!1};function Od(e,t){t===void 0&&(t=tZ);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:f}=yi(e).getComputedStyle(e);d&&(n=eZ(n,d,f))}const{top:r,left:i,width:s,height:o,bottom:l,right:c}=n;return{top:r,left:i,width:s,height:o,bottom:l,right:c}}function AN(e){return Od(e,{ignoreTransform:!0})}function nZ(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function rZ(e,t){return t===void 0&&(t=yi(e).getComputedStyle(e)),t.position==="fixed"}function iZ(e,t){t===void 0&&(t=yi(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const s=t[i];return typeof s=="string"?n.test(s):!1})}function XC(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(qC(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!mp(i)||Fj(i)||n.includes(i))return n;const s=yi(e).getComputedStyle(i);return i!==e&&iZ(i,s)&&n.push(i),rZ(i,s)?n:r(i.parentNode)}return e?r(e):n}function Vj(e){const[t]=XC(e,1);return t??null}function sx(e){return!Kb||!e?null:Id(e)?e:GC(e)?qC(e)||e===Pd(e).scrollingElement?window:mp(e)?e:null:null}function Wj(e){return Id(e)?e.scrollX:e.scrollLeft}function Gj(e){return Id(e)?e.scrollY:e.scrollTop}function iw(e){return{x:Wj(e),y:Gj(e)}}var _r;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(_r||(_r={}));function qj(e){return!Kb||!e?!1:e===document.scrollingElement}function Kj(e){const t={x:0,y:0},n=qj(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,o=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:i,isLeft:s,isBottom:o,isRight:l,maxScroll:r,minScroll:t}}const sZ={x:.2,y:.2};function oZ(e,t,n,r,i){let{top:s,left:o,right:l,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=sZ);const{isTop:d,isBottom:f,isLeft:h,isRight:g}=Kj(e),v={x:0,y:0},y={x:0,y:0},x={height:t.height*i.y,width:t.width*i.x};return!d&&s<=t.top+x.height?(v.y=_r.Backward,y.y=r*Math.abs((t.top+x.height-s)/x.height)):!f&&c>=t.bottom-x.height&&(v.y=_r.Forward,y.y=r*Math.abs((t.bottom-x.height-c)/x.height)),!g&&l>=t.right-x.width?(v.x=_r.Forward,y.x=r*Math.abs((t.right-x.width-l)/x.width)):!h&&o<=t.left+x.width&&(v.x=_r.Backward,y.x=r*Math.abs((t.left+x.width-o)/x.width)),{direction:v,speed:y}}function aZ(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:o}=window;return{top:0,left:0,right:s,bottom:o,width:s,height:o}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Yj(e){return e.reduce((t,n)=>Qu(t,iw(n)),$s)}function lZ(e){return e.reduce((t,n)=>t+Wj(n),0)}function cZ(e){return e.reduce((t,n)=>t+Gj(n),0)}function uZ(e,t){if(t===void 0&&(t=Od),!e)return;const{top:n,left:r,bottom:i,right:s}=t(e);Vj(e)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const dZ=[["x",["left","right"],lZ],["y",["top","bottom"],cZ]];class QC{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=XC(n),i=Yj(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,o,l]of dZ)for(const c of o)Object.defineProperty(this,c,{get:()=>{const d=l(r),f=i[s]-d;return this.rect[c]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class hf{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function hZ(e){const{EventTarget:t}=yi(e);return e instanceof t?e:Pd(e)}function ox(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var cs;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(cs||(cs={}));function NN(e){e.preventDefault()}function fZ(e){e.stopPropagation()}var un;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(un||(un={}));const Xj={start:[un.Space,un.Enter],cancel:[un.Esc],end:[un.Space,un.Enter,un.Tab]},pZ=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case un.Right:return{...n,x:n.x+25};case un.Left:return{...n,x:n.x-25};case un.Down:return{...n,y:n.y+25};case un.Up:return{...n,y:n.y-25}}};class ZC{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new hf(Pd(n)),this.windowListeners=new hf(yi(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(cs.Resize,this.handleCancel),this.windowListeners.add(cs.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(cs.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&uZ(r),n($s)}handleKeyDown(t){if(YC(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=Xj,coordinateGetter:o=pZ,scrollBehavior:l="smooth"}=i,{code:c}=t;if(s.end.includes(c)){this.handleEnd(t);return}if(s.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=r.current,f=d?{x:d.left,y:d.top}:$s;this.referenceCoordinates||(this.referenceCoordinates=f);const h=o(t,{active:n,context:r.current,currentCoordinates:f});if(h){const g=Mv(h,f),v={x:0,y:0},{scrollableAncestors:y}=r.current;for(const x of y){const w=t.code,{isTop:C,isRight:R,isLeft:E,isBottom:T,maxScroll:A,minScroll:N}=Kj(x),D=aZ(x),L={x:Math.min(w===un.Right?D.right-D.width/2:D.right,Math.max(w===un.Right?D.left:D.left+D.width/2,h.x)),y:Math.min(w===un.Down?D.bottom-D.height/2:D.bottom,Math.max(w===un.Down?D.top:D.top+D.height/2,h.y))},G=w===un.Right&&!R||w===un.Left&&!E,z=w===un.Down&&!T||w===un.Up&&!C;if(G&&L.x!==h.x){const $=x.scrollLeft+g.x,H=w===un.Right&&$<=A.x||w===un.Left&&$>=N.x;if(H&&!g.y){x.scrollTo({left:$,behavior:l});return}H?v.x=x.scrollLeft-$:v.x=w===un.Right?x.scrollLeft-A.x:x.scrollLeft-N.x,v.x&&x.scrollBy({left:-v.x,behavior:l});break}else if(z&&L.y!==h.y){const $=x.scrollTop+g.y,H=w===un.Down&&$<=A.y||w===un.Up&&$>=N.y;if(H&&!g.x){x.scrollTo({top:$,behavior:l});return}H?v.y=x.scrollTop-$:v.y=w===un.Down?x.scrollTop-A.y:x.scrollTop-N.y,v.y&&x.scrollBy({top:-v.y,behavior:l});break}}this.handleMove(t,Qu(Mv(h,this.referenceCoordinates),v))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ZC.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Xj,onActivation:i}=t,{active:s}=n;const{code:o}=e.nativeEvent;if(r.start.includes(o)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function MN(e){return!!(e&&"distance"in e)}function LN(e){return!!(e&&"delay"in e)}class JC{constructor(t,n,r){var i;r===void 0&&(r=hZ(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:o}=s;this.props=t,this.events=n,this.document=Pd(o),this.documentListeners=new hf(this.document),this.listeners=new hf(r),this.windowListeners=new hf(yi(o)),this.initialCoordinates=(i=rw(s))!=null?i:$s,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(cs.Resize,this.handleCancel),this.windowListeners.add(cs.DragStart,NN),this.windowListeners.add(cs.VisibilityChange,this.handleCancel),this.windowListeners.add(cs.ContextMenu,NN),this.documentListeners.add(cs.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(LN(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(MN(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(cs.Click,fZ,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(cs.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:s}=this,{onMove:o,options:{activationConstraint:l}}=s;if(!i)return;const c=(n=rw(t))!=null?n:$s,d=Mv(i,c);if(!r&&l){if(MN(l)){if(l.tolerance!=null&&ox(d,l.tolerance))return this.handleCancel();if(ox(d,l.distance))return this.handleStart()}if(LN(l)&&ox(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===un.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const mZ={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ek extends JC{constructor(t){const{event:n}=t,r=Pd(n.target);super(t,mZ,r)}}ek.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const gZ={move:{name:"mousemove"},end:{name:"mouseup"}};var sw;(function(e){e[e.RightClick=2]="RightClick"})(sw||(sw={}));class vZ extends JC{constructor(t){super(t,gZ,Pd(t.event.target))}}vZ.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===sw.RightClick?!1:(r==null||r({event:n}),!0)}}];const ax={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class bZ extends JC{constructor(t){super(t,ax)}static setup(){return window.addEventListener(ax.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ax.move.name,t)};function t(){}}}bZ.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var ff;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ff||(ff={}));var Dv;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Dv||(Dv={}));function _Z(e){let{acceleration:t,activator:n=ff.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:o=5,order:l=Dv.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:f,delta:h,threshold:g}=e;const v=xZ({delta:h,disabled:!s}),[y,x]=NQ(),w=_.useRef({x:0,y:0}),C=_.useRef({x:0,y:0}),R=_.useMemo(()=>{switch(n){case ff.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case ff.DraggableRect:return i}},[n,i,c]),E=_.useRef(null),T=_.useCallback(()=>{const N=E.current;if(!N)return;const D=w.current.x*C.current.x,L=w.current.y*C.current.y;N.scrollBy(D,L)},[]),A=_.useMemo(()=>l===Dv.TreeOrder?[...d].reverse():d,[l,d]);_.useEffect(()=>{if(!s||!d.length||!R){x();return}for(const N of A){if((r==null?void 0:r(N))===!1)continue;const D=d.indexOf(N),L=f[D];if(!L)continue;const{direction:G,speed:z}=oZ(N,L,R,t,g);for(const $ of["x","y"])v[$][G[$]]||(z[$]=0,G[$]=0);if(z.x>0||z.y>0){x(),E.current=N,y(T,o),w.current=z,C.current=G;return}}w.current={x:0,y:0},C.current={x:0,y:0},x()},[t,T,r,x,s,o,JSON.stringify(R),JSON.stringify(v),y,d,A,f,JSON.stringify(g)])}const yZ={x:{[_r.Backward]:!1,[_r.Forward]:!1},y:{[_r.Backward]:!1,[_r.Forward]:!1}};function xZ(e){let{delta:t,disabled:n}=e;const r=nw(t);return gp(i=>{if(n||!r||!i)return yZ;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[_r.Backward]:i.x[_r.Backward]||s.x===-1,[_r.Forward]:i.x[_r.Forward]||s.x===1},y:{[_r.Backward]:i.y[_r.Backward]||s.y===-1,[_r.Forward]:i.y[_r.Forward]||s.y===1}}},[n,t,r])}function SZ(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return gp(i=>{var s;return t==null?null:(s=r??i)!=null?s:null},[r,t])}function wZ(e,t){return _.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,s=i.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,r)}));return[...n,...s]},[]),[e,t])}var Of;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Of||(Of={}));var ow;(function(e){e.Optimized="optimized"})(ow||(ow={}));const DN=new Map;function CZ(e,t){let{dragging:n,dependencies:r,config:i}=t;const[s,o]=_.useState(null),{frequency:l,measure:c,strategy:d}=i,f=_.useRef(e),h=w(),g=If(h),v=_.useCallback(function(C){C===void 0&&(C=[]),!g.current&&o(R=>R===null?C:R.concat(C.filter(E=>!R.includes(E))))},[g]),y=_.useRef(null),x=gp(C=>{if(h&&!n)return DN;if(!C||C===DN||f.current!==e||s!=null){const R=new Map;for(let E of e){if(!E)continue;if(s&&s.length>0&&!s.includes(E.id)&&E.rect.current){R.set(E.id,E.rect.current);continue}const T=E.node.current,A=T?new QC(c(T),T):null;E.rect.current=A,A&&R.set(E.id,A)}return R}return C},[e,s,n,h,c]);return _.useEffect(()=>{f.current=e},[e]),_.useEffect(()=>{h||v()},[n,h]),_.useEffect(()=>{s&&s.length>0&&o(null)},[JSON.stringify(s)]),_.useEffect(()=>{h||typeof l!="number"||y.current!==null||(y.current=setTimeout(()=>{v(),y.current=null},l))},[l,h,v,...r]),{droppableRects:x,measureDroppableContainers:v,measuringScheduled:s!=null};function w(){switch(d){case Of.Always:return!1;case Of.BeforeDragging:return n;default:return!n}}}function Qj(e,t){return gp(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function kZ(e,t){return Qj(e,t)}function EZ(e){let{callback:t,disabled:n}=e;const r=KC(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return _.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Yb(e){let{callback:t,disabled:n}=e;const r=KC(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return _.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function RZ(e){return new QC(Od(e),e)}function IN(e,t,n){t===void 0&&(t=RZ);const[r,i]=_.useState(null);function s(){i(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??n)!=null?d:null}const f=t(e);return JSON.stringify(c)===JSON.stringify(f)?c:f})}const o=EZ({callback(c){if(e)for(const d of c){const{type:f,target:h}=d;if(f==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),l=Yb({callback:s});return mo(()=>{s(),e?(l==null||l.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),o==null||o.disconnect())},[e]),r}function TZ(e){const t=Qj(e);return Uj(e,t)}const PN=[];function AZ(e){const t=_.useRef(e),n=gp(r=>e?r&&r!==PN&&e&&t.current&&e.parentNode===t.current.parentNode?r:XC(e):PN,[e]);return _.useEffect(()=>{t.current=e},[e]),n}function NZ(e){const[t,n]=_.useState(null),r=_.useRef(e),i=_.useCallback(s=>{const o=sx(s.target);o&&n(l=>l?(l.set(o,iw(o)),new Map(l)):null)},[]);return _.useEffect(()=>{const s=r.current;if(e!==s){o(s);const l=e.map(c=>{const d=sx(c);return d?(d.addEventListener("scroll",i,{passive:!0}),[d,iw(d)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{o(e),o(s)};function o(l){l.forEach(c=>{const d=sx(c);d==null||d.removeEventListener("scroll",i)})}},[i,e]),_.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,o)=>Qu(s,o),$s):Yj(e):$s,[e,t])}function ON(e,t){t===void 0&&(t=[]);const n=_.useRef(null);return _.useEffect(()=>{n.current=null},t),_.useEffect(()=>{const r=e!==$s;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Mv(e,n.current):$s}function MZ(e){_.useEffect(()=>{if(!Kb)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function LZ(e,t){return _.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=o=>{s(o,t)},n},{}),[e,t])}function Zj(e){return _.useMemo(()=>e?nZ(e):null,[e])}const jN=[];function DZ(e,t){t===void 0&&(t=Od);const[n]=e,r=Zj(n?yi(n):null),[i,s]=_.useState(jN);function o(){s(()=>e.length?e.map(c=>qj(c)?r:new QC(t(c),c)):jN)}const l=Yb({callback:o});return mo(()=>{l==null||l.disconnect(),o(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),i}function IZ(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return mp(t)?t:e}function PZ(e){let{measure:t}=e;const[n,r]=_.useState(null),i=_.useCallback(d=>{for(const{target:f}of d)if(mp(f)){r(h=>{const g=t(f);return h?{...h,width:g.width,height:g.height}:g});break}},[t]),s=Yb({callback:i}),o=_.useCallback(d=>{const f=IZ(d);s==null||s.disconnect(),f&&(s==null||s.observe(f)),r(f?t(f):null)},[t,s]),[l,c]=Nv(o);return _.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const OZ=[{sensor:ek,options:{}},{sensor:ZC,options:{}}],jZ={current:{}},Kg={draggable:{measure:AN},droppable:{measure:AN,strategy:Of.WhileDragging,frequency:ow.Optimized},dragOverlay:{measure:Od}};class pf extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const zZ={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new pf,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Lv},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Kg,measureDroppableContainers:Lv,windowRect:null,measuringScheduled:!1},BZ={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Lv,draggableNodes:new Map,over:null,measureDroppableContainers:Lv},Xb=_.createContext(BZ),Jj=_.createContext(zZ);function FZ(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new pf}}}function HZ(e,t){switch(t.type){case hr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case hr.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case hr.DragEnd:case hr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case hr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new pf(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case hr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const o=new pf(e.droppable.containers);return o.set(n,{...s,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case hr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new pf(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function $Z(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=_.useContext(Xb),s=nw(r),o=nw(n==null?void 0:n.id);return _.useEffect(()=>{if(!t&&!r&&s&&o!=null){if(!YC(s)||document.activeElement===s.target)return;const l=i.get(o);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[c.current,d.current]){if(!f)continue;const h=DQ(f);if(h){h.focus();break}}})}},[r,t,i,o,s]),null}function UZ(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,s)=>s({transform:i,...r}),n):n}function VZ(e){return _.useMemo(()=>({draggable:{...Kg.draggable,...e==null?void 0:e.draggable},droppable:{...Kg.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Kg.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function WZ(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const s=_.useRef(!1),{x:o,y:l}=typeof i=="boolean"?{x:i,y:i}:i;mo(()=>{if(!o&&!l||!t){s.current=!1;return}if(s.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const f=n(d),h=Uj(f,r);if(o||(h.x=0),l||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const g=Vj(d);g&&g.scrollBy({top:h.y,left:h.x})}},[t,o,l,r,n])}const e3=_.createContext({...$s,scaleX:1,scaleY:1});var tl;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(tl||(tl={}));const GZ=_.memo(function(t){var n,r,i,s;let{id:o,accessibility:l,autoScroll:c=!0,children:d,sensors:f=OZ,collisionDetection:h=YQ,measuring:g,modifiers:v,...y}=t;const x=_.useReducer(HZ,void 0,FZ),[w,C]=x,[R,E]=BQ(),[T,A]=_.useState(tl.Uninitialized),N=T===tl.Initialized,{draggable:{active:D,nodes:L,translate:G},droppable:{containers:z}}=w,$=D!=null?L.get(D):null,H=_.useRef({initial:null,translated:null}),O=_.useMemo(()=>{var mt;return D!=null?{id:D,data:(mt=$==null?void 0:$.data)!=null?mt:jZ,rect:H}:null},[D,$]),F=_.useRef(null),[U,j]=_.useState(null),[W,B]=_.useState(null),K=If(y,Object.values(y)),I=vp("DndDescribedBy",o),V=_.useMemo(()=>z.getEnabled(),[z]),X=VZ(g),{droppableRects:P,measureDroppableContainers:ie,measuringScheduled:re}=CZ(V,{dragging:N,dependencies:[G.x,G.y],config:X.droppable}),se=SZ(L,D),oe=_.useMemo(()=>W?rw(W):null,[W]),fe=Lt(),de=kZ(se,X.draggable.measure);WZ({activeNode:D!=null?L.get(D):null,config:fe.layoutShiftCompensation,initialRect:de,measure:X.draggable.measure});const ve=IN(se,X.draggable.measure,de),le=IN(se?se.parentElement:null),te=_.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:z,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ce=z.getNodeFor((n=te.current.over)==null?void 0:n.id),Fe=PZ({measure:X.dragOverlay.measure}),Xe=(r=Fe.nodeRef.current)!=null?r:se,Ie=N?(i=Fe.rect)!=null?i:ve:null,at=!!(Fe.nodeRef.current&&Fe.rect),Ve=TZ(at?null:ve),gt=Zj(Xe?yi(Xe):null),It=AZ(N?Ce??se:null),et=DZ(It),Ct=UZ(v,{transform:{x:G.x-Ve.x,y:G.y-Ve.y,scaleX:1,scaleY:1},activatorEvent:W,active:O,activeNodeRect:ve,containerNodeRect:le,draggingNodeRect:Ie,over:te.current.over,overlayNodeRect:Fe.rect,scrollableAncestors:It,scrollableAncestorRects:et,windowRect:gt}),Wt=oe?Qu(oe,G):null,vt=NZ(It),At=ON(vt),me=ON(vt,[ve]),Se=Qu(Ct,At),He=Ie?ZQ(Ie,Ct):null,Ge=O&&He?h({active:O,collisionRect:He,droppableRects:P,droppableContainers:V,pointerCoordinates:Wt}):null,ht=qQ(Ge,"id"),[Be,bt]=_.useState(null),we=at?Ct:Qu(Ct,me),Ue=XQ(we,(s=Be==null?void 0:Be.rect)!=null?s:null,ve),Ye=_.useRef(null),Me=_.useCallback((mt,je)=>{let{sensor:ct,options:kt}=je;if(F.current==null)return;const ft=L.get(F.current);if(!ft)return;const xt=mt.nativeEvent,en=new ct({active:F.current,activeNode:ft,event:xt,options:kt,context:te,onAbort(tt){if(!L.get(tt))return;const{onDragAbort:ut}=K.current,Ne={id:tt};ut==null||ut(Ne),R({type:"onDragAbort",event:Ne})},onPending(tt,Ze,ut,Ne){if(!L.get(tt))return;const{onDragPending:rt}=K.current,De={id:tt,constraint:Ze,initialCoordinates:ut,offset:Ne};rt==null||rt(De),R({type:"onDragPending",event:De})},onStart(tt){const Ze=F.current;if(Ze==null)return;const ut=L.get(Ze);if(!ut)return;const{onDragStart:Ne}=K.current,ke={activatorEvent:xt,active:{id:Ze,data:ut.data,rect:H}};ps.unstable_batchedUpdates(()=>{Ne==null||Ne(ke),A(tl.Initializing),C({type:hr.DragStart,initialCoordinates:tt,active:Ze}),R({type:"onDragStart",event:ke}),j(Ye.current),B(xt)})},onMove(tt){C({type:hr.DragMove,coordinates:tt})},onEnd:Te(hr.DragEnd),onCancel:Te(hr.DragCancel)});Ye.current=en;function Te(tt){return async function(){const{active:ut,collisions:Ne,over:ke,scrollAdjustedTranslate:rt}=te.current;let De=null;if(ut&&rt){const{cancelDrop:zt}=K.current;De={activatorEvent:xt,active:ut,collisions:Ne,delta:rt,over:ke},tt===hr.DragEnd&&typeof zt=="function"&&await Promise.resolve(zt(De))&&(tt=hr.DragCancel)}F.current=null,ps.unstable_batchedUpdates(()=>{C({type:tt}),A(tl.Uninitialized),bt(null),j(null),B(null),Ye.current=null;const zt=tt===hr.DragEnd?"onDragEnd":"onDragCancel";if(De){const Vt=K.current[zt];Vt==null||Vt(De),R({type:zt,event:De})}})}}},[L]),lt=_.useCallback((mt,je)=>(ct,kt)=>{const ft=ct.nativeEvent,xt=L.get(kt);if(F.current!==null||!xt||ft.dndKit||ft.defaultPrevented)return;const en={active:xt};mt(ct,je.options,en)===!0&&(ft.dndKit={capturedBy:je.sensor},F.current=kt,Me(ct,je))},[L,Me]),ce=wZ(f,lt);MZ(f),mo(()=>{ve&&T===tl.Initializing&&A(tl.Initialized)},[ve,T]),_.useEffect(()=>{const{onDragMove:mt}=K.current,{active:je,activatorEvent:ct,collisions:kt,over:ft}=te.current;if(!je||!ct)return;const xt={active:je,activatorEvent:ct,collisions:kt,delta:{x:Se.x,y:Se.y},over:ft};ps.unstable_batchedUpdates(()=>{mt==null||mt(xt),R({type:"onDragMove",event:xt})})},[Se.x,Se.y]),_.useEffect(()=>{const{active:mt,activatorEvent:je,collisions:ct,droppableContainers:kt,scrollAdjustedTranslate:ft}=te.current;if(!mt||F.current==null||!je||!ft)return;const{onDragOver:xt}=K.current,en=kt.get(ht),Te=en&&en.rect.current?{id:en.id,rect:en.rect.current,data:en.data,disabled:en.disabled}:null,tt={active:mt,activatorEvent:je,collisions:ct,delta:{x:ft.x,y:ft.y},over:Te};ps.unstable_batchedUpdates(()=>{bt(Te),xt==null||xt(tt),R({type:"onDragOver",event:tt})})},[ht]),mo(()=>{te.current={activatorEvent:W,active:O,activeNode:se,collisionRect:He,collisions:Ge,droppableRects:P,draggableNodes:L,draggingNode:Xe,draggingNodeRect:Ie,droppableContainers:z,over:Be,scrollableAncestors:It,scrollAdjustedTranslate:Se},H.current={initial:Ie,translated:He}},[O,se,Ge,He,L,Xe,Ie,P,z,Be,It,Se]),_Z({...fe,delta:G,draggingRect:He,pointerCoordinates:Wt,scrollableAncestors:It,scrollableAncestorRects:et});const We=_.useMemo(()=>({active:O,activeNode:se,activeNodeRect:ve,activatorEvent:W,collisions:Ge,containerNodeRect:le,dragOverlay:Fe,draggableNodes:L,droppableContainers:z,droppableRects:P,over:Be,measureDroppableContainers:ie,scrollableAncestors:It,scrollableAncestorRects:et,measuringConfiguration:X,measuringScheduled:re,windowRect:gt}),[O,se,ve,W,Ge,le,Fe,L,z,P,Be,ie,It,et,X,re,gt]),_t=_.useMemo(()=>({activatorEvent:W,activators:ce,active:O,activeNodeRect:ve,ariaDescribedById:{draggable:I},dispatch:C,draggableNodes:L,over:Be,measureDroppableContainers:ie}),[W,ce,O,ve,C,I,L,Be,ie]);return xn.createElement($j.Provider,{value:E},xn.createElement(Xb.Provider,{value:_t},xn.createElement(Jj.Provider,{value:We},xn.createElement(e3.Provider,{value:Ue},d)),xn.createElement($Z,{disabled:(l==null?void 0:l.restoreFocus)===!1})),xn.createElement($Q,{...l,hiddenTextDescribedById:I}));function Lt(){const mt=(U==null?void 0:U.autoScrollEnabled)===!1,je=typeof c=="object"?c.enabled===!1:c===!1,ct=N&&!mt&&!je;return typeof c=="object"?{...c,enabled:ct}:{enabled:ct}}}),qZ=_.createContext(null),zN="button",KZ="Draggable";function YZ(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const s=vp(KZ),{activators:o,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:f,draggableNodes:h,over:g}=_.useContext(Xb),{role:v=zN,roleDescription:y="draggable",tabIndex:x=0}=i??{},w=(c==null?void 0:c.id)===t,C=_.useContext(w?e3:qZ),[R,E]=Nv(),[T,A]=Nv(),N=LZ(o,t),D=If(n);mo(()=>(h.set(t,{id:t,key:s,node:R,activatorNode:T,data:D}),()=>{const G=h.get(t);G&&G.key===s&&h.delete(t)}),[h,t]);const L=_.useMemo(()=>({role:v,tabIndex:x,"aria-disabled":r,"aria-pressed":w&&v===zN?!0:void 0,"aria-roledescription":y,"aria-describedby":f.draggable}),[r,v,x,w,y,f.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:L,isDragging:w,listeners:r?void 0:N,node:R,over:g,setNodeRef:E,setActivatorNodeRef:A,transform:C}}function XZ(){return _.useContext(Jj)}const QZ="Droppable",ZZ={timeout:25};function JZ(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const s=vp(QZ),{active:o,dispatch:l,over:c,measureDroppableContainers:d}=_.useContext(Xb),f=_.useRef({disabled:n}),h=_.useRef(!1),g=_.useRef(null),v=_.useRef(null),{disabled:y,updateMeasurementsFor:x,timeout:w}={...ZZ,...i},C=If(x??r),R=_.useCallback(()=>{if(!h.current){h.current=!0;return}v.current!=null&&clearTimeout(v.current),v.current=setTimeout(()=>{d(Array.isArray(C.current)?C.current:[C.current]),v.current=null},w)},[w]),E=Yb({callback:R,disabled:y||!o}),T=_.useCallback((L,G)=>{E&&(G&&(E.unobserve(G),h.current=!1),L&&E.observe(L))},[E]),[A,N]=Nv(T),D=If(t);return _.useEffect(()=>{!E||!A.current||(E.disconnect(),h.current=!1,E.observe(A.current))},[A,E]),_.useEffect(()=>(l({type:hr.RegisterDroppable,element:{id:r,key:s,disabled:n,node:A,rect:g,data:D}}),()=>l({type:hr.UnregisterDroppable,key:s,id:r})),[r]),_.useEffect(()=>{n!==f.current.disabled&&(l({type:hr.SetDroppableDisabled,id:r,key:s,disabled:n}),f.current.disabled=n)},[r,s,n,l]),{active:o,rect:g,isOver:(c==null?void 0:c.id)===r,node:A,over:c,setNodeRef:N}}function tk(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function eJ(e,t){return e.reduce((n,r,i)=>{const s=t.get(r);return s&&(n[i]=s),n},Array(e.length))}function Jm(e){return e!==null&&e>=0}function tJ(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function nJ(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const t3=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const s=tk(t,r,n),o=t[i],l=s[i];return!l||!o?null:{x:l.left-o.left,y:l.top-o.top,scaleX:l.width/o.width,scaleY:l.height/o.height}},eg={scaleX:1,scaleY:1},rJ=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:s,overIndex:o}=e;const l=(t=s[n])!=null?t:r;if(!l)return null;if(i===n){const d=s[o];return d?{x:0,y:n<o?d.top+d.height-(l.top+l.height):d.top-l.top,...eg}:null}const c=iJ(s,i,n);return i>n&&i<=o?{x:0,y:-l.height-c,...eg}:i<n&&i>=o?{x:0,y:l.height+c,...eg}:{x:0,y:0,...eg}};function iJ(e,t,n){const r=e[t],i=e[t-1],s=e[t+1];return r?n<t?i?r.top-(i.top+i.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const n3="Sortable",r3=xn.createContext({activeIndex:-1,containerId:n3,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:t3,disabled:{draggable:!1,droppable:!1}});function sJ(e){let{children:t,id:n,items:r,strategy:i=t3,disabled:s=!1}=e;const{active:o,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:f}=XZ(),h=vp(n3,n),g=l.rect!==null,v=_.useMemo(()=>r.map(N=>typeof N=="object"&&"id"in N?N.id:N),[r]),y=o!=null,x=o?v.indexOf(o.id):-1,w=d?v.indexOf(d.id):-1,C=_.useRef(v),R=!tJ(v,C.current),E=w!==-1&&x===-1||R,T=nJ(s);mo(()=>{R&&y&&f(v)},[R,v,y,f]),_.useEffect(()=>{C.current=v},[v]);const A=_.useMemo(()=>({activeIndex:x,containerId:h,disabled:T,disableTransforms:E,items:v,overIndex:w,useDragOverlay:g,sortedRects:eJ(v,c),strategy:i}),[x,h,T.draggable,T.droppable,E,v,w,c,g,i]);return xn.createElement(r3.Provider,{value:A},t)}const oJ=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return tk(n,r,i).indexOf(t)},aJ=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:s,newIndex:o,previousItems:l,previousContainerId:c,transition:d}=e;return!d||!r||l!==s&&i===o?!1:n?!0:o!==i&&t===c},lJ={duration:200,easing:"ease"},i3="transform",cJ=Pf.Transition.toString({property:i3,duration:0,easing:"linear"}),uJ={roleDescription:"sortable"};function dJ(e){let{disabled:t,index:n,node:r,rect:i}=e;const[s,o]=_.useState(null),l=_.useRef(n);return mo(()=>{if(!t&&n!==l.current&&r.current){const c=i.current;if(c){const d=Od(r.current,{ignoreTransform:!0}),f={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(f.x||f.y)&&o(f)}}n!==l.current&&(l.current=n)},[t,n,r,i]),_.useEffect(()=>{s&&o(null)},[s]),s}function hJ(e){let{animateLayoutChanges:t=aJ,attributes:n,disabled:r,data:i,getNewIndex:s=oJ,id:o,strategy:l,resizeObserverConfig:c,transition:d=lJ}=e;const{items:f,containerId:h,activeIndex:g,disabled:v,disableTransforms:y,sortedRects:x,overIndex:w,useDragOverlay:C,strategy:R}=_.useContext(r3),E=fJ(r,v),T=f.indexOf(o),A=_.useMemo(()=>({sortable:{containerId:h,index:T,items:f},...i}),[h,i,T,f]),N=_.useMemo(()=>f.slice(f.indexOf(o)),[f,o]),{rect:D,node:L,isOver:G,setNodeRef:z}=JZ({id:o,data:A,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...c}}),{active:$,activatorEvent:H,activeNodeRect:O,attributes:F,setNodeRef:U,listeners:j,isDragging:W,over:B,setActivatorNodeRef:K,transform:I}=YZ({id:o,data:A,attributes:{...uJ,...n},disabled:E.draggable}),V=AQ(z,U),X=!!$,P=X&&!y&&Jm(g)&&Jm(w),ie=!C&&W,re=ie&&P?I:null,oe=P?re??(l??R)({rects:x,activeNodeRect:O,activeIndex:g,overIndex:w,index:T}):null,fe=Jm(g)&&Jm(w)?s({id:o,items:f,activeIndex:g,overIndex:w}):T,de=$==null?void 0:$.id,ve=_.useRef({activeId:de,items:f,newIndex:fe,containerId:h}),le=f!==ve.current.items,te=t({active:$,containerId:h,isDragging:W,isSorting:X,id:o,index:T,items:f,newIndex:ve.current.newIndex,previousItems:ve.current.items,previousContainerId:ve.current.containerId,transition:d,wasDragging:ve.current.activeId!=null}),Ce=dJ({disabled:!te,index:T,node:L,rect:D});return _.useEffect(()=>{X&&ve.current.newIndex!==fe&&(ve.current.newIndex=fe),h!==ve.current.containerId&&(ve.current.containerId=h),f!==ve.current.items&&(ve.current.items=f)},[X,fe,h,f]),_.useEffect(()=>{if(de===ve.current.activeId)return;if(de!=null&&ve.current.activeId==null){ve.current.activeId=de;return}const Xe=setTimeout(()=>{ve.current.activeId=de},50);return()=>clearTimeout(Xe)},[de]),{active:$,activeIndex:g,attributes:F,data:A,rect:D,index:T,newIndex:fe,items:f,isOver:G,isSorting:X,isDragging:W,listeners:j,node:L,overIndex:w,over:B,setNodeRef:V,setActivatorNodeRef:K,setDroppableNodeRef:z,setDraggableNodeRef:U,transform:Ce??oe,transition:Fe()};function Fe(){if(Ce||le&&ve.current.newIndex===T)return cJ;if(!(ie&&!YC(H)||!d)&&(X||te))return Pf.Transition.toString({...d,property:i3})}}function fJ(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}un.Down,un.Right,un.Up,un.Left;const pJ=20,s3="(min-width: 768px)";function mJ(e){if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};const t=window.matchMedia(s3);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function gJ(){return typeof window>"u"||typeof window.matchMedia!="function"?!0:window.matchMedia(s3).matches}function vJ(){return _.useSyncExternalStore(mJ,gJ,()=>!0)}function bJ(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();e.currentTarget.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:t.left+t.width/2,clientY:t.bottom,view:window}))}function BN(e){return e.top+e.height/2}function _J({localPath:e,onNewLocalChat:t,isConnected:n,startingLocalPath:r}){const i=!n||r===e;return m.jsxs("button",{type:"button",disabled:i,title:n?"New Chat":`Start ${Kn} to connect`,className:ye("group flex w-full items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg text-left cursor-pointer border-border/0 hover:border-border hover:bg-muted/20 active:scale-[0.985] border transition-all","border-border/0 dark:hover:border-slate-400/10",i&&"cursor-not-allowed opacity-50 active:scale-100"),onClick:()=>t(e),children:[m.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px] text-slate-500 dark:text-slate-400",children:"New Chat"}),m.jsx("div",{className:"h-7 w-6 mr-[2px] shrink-0","aria-hidden":!0})]})}function yJ({activeId:e,groupIds:t,collisionRect:n,droppableRects:r}){const i=t.indexOf(e);if(i===-1)return null;const s=r.get(e);if(!s)return null;const o=n.top+pJ;if(n.top>s.top){for(let l=t.length-1;l>i;l--){const c=r.get(t[l]);if(c&&o>=BN(c))return t[l]}return e}if(n.top<s.top){for(let l=0;l<i;l++){const c=r.get(t[l]);if(c&&o<=BN(c))return t[l]}return e}return e}const xJ=_.memo(function({group:t,isReorderEnabled:n,editorLabel:r,collapsedSections:i,expandedGroups:s,onToggleSection:o,onToggleExpandedGroup:l,renderChatRow:c,onShowArchivedProject:d,onNewLocalChat:f,onCopyPath:h,onOpenExternalPath:g,onRenameProject:v,onHideProject:y,isConnected:x,startingLocalPath:w}){const{groupKey:C,localPath:R,title:E}=t,T=s.has(C),A=t.chats.length===0,N=t.olderChats.length>0,D=!!(y&&h&&g),{attributes:L,listeners:G,setNodeRef:z,setActivatorNodeRef:$,transform:H,transition:O,isDragging:F}=hJ({id:C,disabled:!n}),U={transform:Pf.Translate.toString(H?{...H,x:0}:null),transition:F?void 0:O},j=m.jsxs("div",{ref:$,className:ye("sticky top-0 bg-background dark:bg-card z-10 relative p-[10px] flex items-center justify-between","md:cursor-grab md:active:cursor-grabbing md:select-none md:touch-none",F&&"cursor-grabbing"),onClick:()=>o(C),...n?G:void 0,children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"relative size-3.5 shrink-0 cursor-pointer",children:m.jsx(pl,{className:`translate-y-[1px] size-3.5 shrink-0 text-slate-400 transition-all duration-200 ${!i.has(C)&&"rotate-90"}`})}),m.jsxs(uo,{children:[m.jsx(ho,{asChild:!0,children:m.jsx("span",{className:"truncate max-w-[150px] whitespace-nowrap text-sm ",children:E||JS(R)})}),m.jsx(Ps,{side:"right",sideOffset:4,children:R})]})]}),(D||f)&&m.jsxs("div",{className:"absolute right-2 flex items-center gap-[1px] opacity-100 md:opacity-0 md:group-hover/section:opacity-100",children:[D?m.jsxs(uo,{children:[m.jsx(ho,{asChild:!0,children:m.jsx(qe,{variant:"ghost",size:"icon",className:"h-5.5 w-5.5 !rounded",onClick:bJ,children:m.jsx(Eb,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),m.jsx(Ps,{side:"right",sideOffset:4,children:"More"})]}):null,f?m.jsxs(uo,{children:[m.jsx(ho,{asChild:!0,children:m.jsx(qe,{variant:"ghost",size:"icon",className:ye("h-5.5 w-5.5 !rounded",(!x||w===R)&&"opacity-50 cursor-not-allowed"),disabled:!x||w===R,onClick:W=>{W.stopPropagation(),f(R)},children:w===R?m.jsx(dn,{className:"size-4 text-slate-500 dark:text-slate-400 animate-spin"}):m.jsx(uC,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),m.jsx(Ps,{side:"right",sideOffset:4,children:x?"New Chat":`Start ${Kn} to connect`})]}):null]})]});return m.jsxs("div",{ref:z,style:U,className:ye("group/section",F&&"opacity-50 shadow-lg z-50 relative"),...n?L:void 0,children:[D?m.jsx(CQ,{editorLabel:r,onRename:()=>v==null?void 0:v(C,t.sidebarTitle,t.realTitle||JS(R)),onCopyPath:()=>h==null?void 0:h(R),onShowArchived:()=>d==null?void 0:d(C),onOpenInFinder:()=>g==null?void 0:g("open_finder",R),onOpenInEditor:()=>g==null?void 0:g("open_editor",R),onHide:()=>y==null?void 0:y(C),children:j}):j,!i.has(C)&&(A?!!f:t.previewChats.length>0||N)&&m.jsx("div",{className:"space-y-[2px] mb-3",children:A&&f?m.jsx(_J,{localPath:R,onNewLocalChat:f,isConnected:x,startingLocalPath:w}):m.jsxs(m.Fragment,{children:[t.previewChats.map(c),N&&T?m.jsx("button",{onClick:()=>l(C),className:"pl-2.5 py-1 text-xs text-muted-foreground/60 hover:text-foreground/60 transition-colors flex flex-row items-center gap-2 justify-center",children:"Show less"}):null,T?t.olderChats.map(c):null,N&&!T?m.jsx("button",{onClick:()=>l(C),className:"pl-2.5 py-1 text-xs text-muted-foreground/60 hover:text-foreground/60 transition-colors flex flex-row items-center gap-1 justify-center",children:"Show more"}):null]})})]})}),SJ=function({projectGroups:t,editorLabel:n,collapsedSections:r,expandedGroups:i,onToggleSection:s,onToggleExpandedGroup:o,renderChatRow:l,onShowArchivedProject:c,onNewLocalChat:d,onCopyPath:f,onOpenExternalPath:h,onRenameProject:g,onHideProject:v,onReorderGroups:y,isConnected:x,startingLocalPath:w}){const C=vJ(),R=UQ(EN(ek,{activationConstraint:{distance:2}}),EN(ZC)),E=_.useMemo(()=>t.map(N=>N.groupKey),[t]),T=_.useMemo(()=>N=>{const D=yJ({activeId:String(N.active.id),groupIds:E,collisionRect:N.collisionRect,droppableRects:N.droppableRects});if(!D)return TN(N);const L=N.droppableContainers.find(G=>G.id===D);return L?[{id:L.id,data:{droppableContainer:L,value:0}}]:TN(N)},[E]);function A(N){if(!C)return;const{active:D,over:L}=N;if(L&&D.id!==L.id&&y){const G=E.indexOf(D.id),z=E.indexOf(L.id);if(G!==-1&&z!==-1){const $=tk(E,G,z);y($)}}}return m.jsx(GZ,{sensors:R,collisionDetection:T,onDragEnd:A,children:m.jsx(sJ,{items:E,strategy:rJ,children:t.map(N=>m.jsx(xJ,{group:N,isReorderEnabled:C,editorLabel:n,collapsedSections:r,expandedGroups:i,onToggleSection:s,onToggleExpandedGroup:o,renderChatRow:l,onShowArchivedProject:c,onNewLocalChat:d,onCopyPath:f,onOpenExternalPath:h,onRenameProject:g,onHideProject:v,isConnected:x,startingLocalPath:w},N.groupKey))})})},wJ=_.memo(SJ),CJ="gpt-5.4-mini",kJ="moonshotai/kimi-k2.5:nitro",Iv=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"max",label:"Max"}],aw=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"XHigh"}],Pv={reasoningEffort:"high",contextWindow:"200k"},lw={reasoningEffort:"high",fastMode:!1};function FN(e){return Iv.some(t=>t.id===e)}function HN(e){return aw.some(t=>t.id===e)}const cw=[{id:"200k",label:"200k"},{id:"1m",label:"1M"}],mf=[{id:"claude",label:"Claude",defaultModel:"claude-sonnet-4-6",defaultEffort:"high",supportsPlanMode:!0,models:[{id:"claude-opus-4-7",label:"Opus 4.7",supportsEffort:!0,aliases:["opus"],contextWindowOptions:[...cw],supportsMaxReasoningEffort:!0},{id:"claude-sonnet-4-6",label:"Sonnet 4.6",supportsEffort:!0,aliases:["sonnet"],contextWindowOptions:[...cw]},{id:"claude-haiku-4-5-20251001",label:"Haiku 4.5",supportsEffort:!0,aliases:["haiku"]}],efforts:[...Iv]},{id:"codex",label:"Codex",defaultModel:"gpt-5.5",supportsPlanMode:!0,models:[{id:"gpt-5.5",label:"GPT-5.5",supportsEffort:!1},{id:"gpt-5.4",label:"GPT-5.4",supportsEffort:!1},{id:"gpt-5.3-codex",label:"GPT-5.3 Codex",supportsEffort:!1,aliases:["gpt-5-codex"]},{id:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark",supportsEffort:!1}],efforts:[]}];function nk(e){const t=mf.find(n=>n.id===e);if(!t)throw new Error(`Unknown provider: ${e}`);return t}function EJ(e,t){if(t)return nk(e).models.find(n=>{var r;return n.id===t||((r=n.aliases)==null?void 0:r.includes(t))})}function rk(e,t,n){var r;return((r=EJ(e,t))==null?void 0:r.id)??n??nk(e).defaultModel}function RJ(e,t="claude-opus-4-7"){return rk("claude",e,t)}function TJ(e,t="gpt-5.5"){return rk("codex",e,t)}function AJ(e,t){const n=rk(e,t);return nk(e).models.find(r=>r.id===n)}function o3(e){return AJ("claude",e)}function a3(e){var t;return!!((t=o3(e))!=null&&t.supportsMaxReasoningEffort)}function NJ(e){var t;return((t=o3(e))==null?void 0:t.contextWindowOptions)??[]}function ik(e,t){const n=NJ(e);return n.length===0?Pv.contextWindow:n.some(r=>r.id===t)?t:Pv.contextWindow}function MJ(e){switch(e){case"1m":return 1e6;case"200k":default:return 2e5}}const Ns={toggleEmbeddedTerminal:["cmd+j","ctrl+`"],toggleRightSidebar:["cmd+b","ctrl+b"],openInFinder:["cmd+alt+f","ctrl+alt+f"],openInEditor:["cmd+shift+o","ctrl+shift+o"],addSplitTerminal:["cmd+/","ctrl+/"],jumpToSidebarChat:["cmd+alt"],createChatInCurrentProject:["cmd+alt+n"],openAddProject:["cmd+alt+o"]},l3={toggleEmbeddedTerminal:"Toggle Embedded Terminal",toggleRightSidebar:"Toggle Right Sidebar",openInFinder:"Open In Finder",openInEditor:"Open In Editor",addSplitTerminal:"Add Split Terminal",jumpToSidebarChat:"Jump To Sidebar Chat",createChatInCurrentProject:"New Chat In Current Project",openAddProject:"Open Add Project"};function lx(e){return(e??[]).join(", ")}function Ga(e){return e.split(",").map(t=>t.trim()).map(t=>t.toLowerCase()).filter(Boolean)}const LJ=new Map([["cmd","meta"],["meta","meta"],["ctrl","ctrl"],["control","ctrl"],["alt","alt"],["option","alt"],["shift","shift"]]);function c3(e,t){const n=IJ(e);return n?PJ(t,n.key)&&t.ctrlKey===n.ctrl&&t.metaKey===n.meta&&t.altKey===n.alt&&t.shiftKey===n.shift:!1}function Oh(e,t,n){return Qb(e,t).some(i=>c3(i,n))}function DJ(e,t,n){return Qb(e,t).find(r=>c3(r,n))??null}function Qb(e,t){return(e==null?void 0:e.bindings[t])??Ns[t]}function sk(e){return{bindings:{toggleEmbeddedTerminal:(e==null?void 0:e.bindings.toggleEmbeddedTerminal)??Ns.toggleEmbeddedTerminal,toggleRightSidebar:(e==null?void 0:e.bindings.toggleRightSidebar)??Ns.toggleRightSidebar,openInFinder:(e==null?void 0:e.bindings.openInFinder)??Ns.openInFinder,openInEditor:(e==null?void 0:e.bindings.openInEditor)??Ns.openInEditor,addSplitTerminal:(e==null?void 0:e.bindings.addSplitTerminal)??Ns.addSplitTerminal,jumpToSidebarChat:(e==null?void 0:e.bindings.jumpToSidebarChat)??Ns.jumpToSidebarChat,createChatInCurrentProject:(e==null?void 0:e.bindings.createChatInCurrentProject)??Ns.createChatInCurrentProject,openAddProject:(e==null?void 0:e.bindings.openAddProject)??Ns.openAddProject},warning:(e==null?void 0:e.warning)??null,filePathDisplay:(e==null?void 0:e.filePathDisplay)??""}}function IJ(e){const t=e.split("+").map(r=>r.trim()).filter(Boolean);if(t.length===0)return null;const n={key:"",ctrl:!1,meta:!1,alt:!1,shift:!1};for(const r of t){const i=r.toLowerCase(),s=LJ.get(i);if(s==="ctrl"){n.ctrl=!0;continue}if(s==="meta"){n.meta=!0;continue}if(s==="alt"){n.alt=!0;continue}if(s==="shift"){n.shift=!0;continue}if(n.key)return null;n.key=i}return n.key?n:null}function PJ(e,t){if(e.key.toLowerCase()===t)return!0;const n=OJ(t);return n?e.code===n:!1}function OJ(e){if(e.length===1&&e>="a"&&e<="z")return`Key${e.toUpperCase()}`;if(e.length===1&&e>="0"&&e<="9")return`Digit${e}`;switch(e){case"/":return"Slash";case"`":return"Backquote";default:return null}}const u3=9;function jJ(e,t,n){const r=[];for(const i of e){if(t.has(i.groupKey))continue;const s=n.has(i.groupKey)?[...i.previewChats,...i.olderChats]:i.previewChats;for(const o of s)r.push({chat:o,visibleIndex:r.length+1})}return r}function zJ(e,t){if(!uw(e,t)||!t.code.startsWith("Digit"))return null;const n=Number(t.code.slice(5));return Number.isInteger(n)&&n>=1&&n<=u3?n:null}function BJ(e,t){return FJ(e,t)?String(t):null}function uw(e,t){return Qb(e,"jumpToSidebarChat").some(n=>HJ(n,t))}function $N(e,t,n){return DJ(e,t,n)!==null}function FJ(e,t){return t<1||t>u3?null:Qb(e,"jumpToSidebarChat")[0]??null}function HJ(e,t){const n=e.split("+").map(l=>l.trim().toLowerCase()).filter(Boolean);let r=!1,i=!1,s=!1,o=!1;for(const l of n){if(l==="cmd"||l==="meta"){r=!0;continue}if(l==="alt"||l==="option"){i=!0;continue}if(l==="ctrl"||l==="control"){s=!0;continue}l==="shift"&&(o=!0)}return t.metaKey===r&&t.altKey===i&&t.ctrlKey===s&&t.shiftKey===o}const d3="kanna:sidebar-width",Zu=275,h3=220,f3=520;function gf(e){return Number.isFinite(e)?Math.min(f3,Math.max(h3,Math.round(e))):Zu}function $J(){if(typeof window>"u")return Zu;const e=window.localStorage.getItem(d3);return e?gf(Number(e)):Zu}function cx(e){typeof window>"u"||window.localStorage.setItem(d3,String(gf(e)))}function UJ({data:e,activeChatId:t,connectionStatus:n,ready:r,open:i,collapsed:s,showMobileOpenButton:o,onOpen:l,onClose:c,onCollapse:d,onExpand:f,onCreateChat:h,onForkChat:g,currentProjectId:v,keybindings:y,onRenameChat:x,onShareChat:w,onArchiveChat:C,onOpenArchivedChat:R,onDeleteChat:E,onOpenAddProjectModal:T,onCopyPath:A,onOpenExternalPath:N,onRenameProject:D,onHideProject:L,onReorderProjectGroups:G,editorLabel:z,updateSnapshot:$,onOpenChangelog:H}){var bt;const O=Us(),F=Ed(),U=_.useRef(null),j=_.useRef(null),W=_.useRef(new Set),[B,K]=_.useState(new Set),[I,V]=_.useState(new Set),[X,P]=_.useState(()=>Date.now()),[ie,re]=_.useState(!1),[se,oe]=_.useState($J),[fe,de]=_.useState(!1),[ve,le]=_.useState(null),te=_.useMemo(()=>sk(y),[y]),Ce=_.useMemo(()=>jJ(e.projectGroups,B,I),[B,e.projectGroups,I]),Fe=_.useRef(Ce),Xe=_.useMemo(()=>new Map(Ce.map(we=>[we.chat.chatId,we.visibleIndex])),[Ce]),Ie=_.useMemo(()=>new Map(e.projectGroups.map(we=>[we.localPath,we.groupKey])),[e.projectGroups]),at=Ce.length,Ve=_.useMemo(()=>e.projectGroups.find(we=>we.groupKey===ve)??null,[ve,e.projectGroups]);_.useEffect(()=>{Fe.current=Ce},[Ce]),_.useEffect(()=>{K(we=>{const Ue=new Set,Ye=new Set(e.projectGroups.map(lt=>lt.groupKey)),Me=W.current;for(const lt of we)Ye.has(lt)&&Ue.add(lt);W.current=new Set([...Me].filter(lt=>Ye.has(lt)));for(const lt of e.projectGroups)W.current.has(lt.groupKey)||(W.current.add(lt.groupKey),lt.defaultCollapsed&&Ue.add(lt.groupKey));return Ue.size===we.size&&[...Ue].every(lt=>we.has(lt))?we:Ue})},[e.projectGroups]);const gt=_.useCallback(we=>{K(Ue=>{const Ye=new Set(Ue);return Ye.has(we)?Ye.delete(we):Ye.add(we),Ye})},[]),It=_.useCallback(we=>{V(Ue=>{const Ye=new Set(Ue);return Ye.has(we)?Ye.delete(we):Ye.add(we),Ye})},[]),et=_.useCallback(we=>{const Ue=Xe.get(we.chatId);return m.jsx(TQ,{chat:we,activeChatId:t,nowMs:X,shortcutHint:Ue?BJ(te,Ue):null,showShortcutHint:ie,onSelectChat:Ye=>{F(`/chat/${Ye}`),c()},onRenameChat:()=>x(we),onShareChat:()=>w(we.chatId),onOpenInFinder:()=>N("open_finder",we.localPath),onForkChat:()=>g(we),onArchiveChat:()=>C(we),onDeleteChat:()=>E(we)},we._id)},[t,F,X,C,c,E,g,N,x,w,te,ie,Xe]);_.useEffect(()=>{const we=window.setInterval(()=>{P(Date.now())},3e4);return()=>window.clearInterval(we)},[]),_.useEffect(()=>{function we(Me){var We;if(re(uw(te,Me)),$N(te,"createChatInCurrentProject",Me)){if(!v)return;Me.preventDefault(),h(v);return}if($N(te,"openAddProject",Me)){Me.preventDefault(),F("/"),c(),T();return}const lt=zJ(te,Me);if(lt===null)return;const ce=(We=Fe.current[lt-1])==null?void 0:We.chat;ce&&(Me.preventDefault(),F(`/chat/${ce.chatId}`),c())}function Ue(Me){re(uw(te,Me))}function Ye(){re(!1)}return window.addEventListener("keydown",we),window.addEventListener("keyup",Ue),window.addEventListener("blur",Ye),()=>{window.removeEventListener("keydown",we),window.removeEventListener("keyup",Ue),window.removeEventListener("blur",Ye)}},[v,F,c,h,T,te]),_.useEffect(()=>{!t||!U.current||requestAnimationFrame(()=>{const we=U.current,Ue=we==null?void 0:we.querySelector(`[data-chat-id="${t}"]`);if(!Ue||!we)return;const Ye=Ue.getBoundingClientRect(),Me=we.getBoundingClientRect();if(Ye.top<Me.top+38){const lt=Ye.top-Me.top+we.scrollTop;we.scrollTo({top:lt-38,behavior:"smooth"})}else if(Ye.bottom>Me.bottom){const lt=Ye.top+Ye.height/2-Me.top+we.scrollTop,ce=we.clientHeight/2;we.scrollTo({top:lt-ce,behavior:"smooth"})}})},[t]),_.useEffect(()=>{if(!fe)return;const we=document.body.style.cursor,Ue=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";function Ye(lt){const ce=j.current;ce&&oe(gf(ce.width+lt.clientX-ce.pointerX))}function Me(){de(!1),j.current=null,oe(lt=>{const ce=gf(lt);return cx(ce),ce})}return window.addEventListener("pointermove",Ye),window.addEventListener("pointerup",Me,{once:!0}),()=>{window.removeEventListener("pointermove",Ye),window.removeEventListener("pointerup",Me),document.body.style.cursor=we,document.body.style.userSelect=Ue}},[fe]);const Ct=at>0,Wt=O.pathname==="/",vt=O.pathname.startsWith("/settings"),At=Wt||vt,me=n==="connecting"||!r,Se=me?"Connecting":n==="connected"?"Connected":"Disconnected",He=n==="connected"?"bg-emerald-500":"bg-amber-500",Ge=($==null?void 0:$.updateAvailable)===!0,ht=$?$.latestVersion===`${$.currentVersion}-dev`:!1,Be=($==null?void 0:$.status)==="updating"||($==null?void 0:$.status)==="restart_pending";return m.jsxs(m.Fragment,{children:[!i&&o&&m.jsx(qe,{variant:"ghost",size:"icon",className:"fixed top-3 left-3 z-50 md:hidden",onClick:l,children:m.jsx(lC,{className:"h-5 w-5"})}),s&&At&&m.jsx("div",{className:"hidden md:flex fixed left-0 top-0 h-full z-40 items-start pt-4 pl-5 border-l border-border/0",children:m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Ku,{className:"size-6 text-logo"}),m.jsx(qe,{variant:"ghost",size:"icon",onClick:f,title:"Expand sidebar",children:m.jsx(HS,{className:"h-5 w-5"})})]})}),m.jsxs("div",{"data-sidebar":"open",className:ye("fixed inset-0 z-50 bg-background dark:bg-card flex flex-col h-[100dvh] select-none","md:relative md:inset-auto md:w-[var(--sidebar-width)] md:mr-0 md:h-[calc(100dvh-16px)] md:my-2 md:ml-2 md:border md:border-border md:rounded-2xl",i?"flex":"hidden md:flex",s&&"md:hidden"),style:{"--sidebar-width":`${se}px`},children:[m.jsxs("div",{className:"px-[5px] h-[64px] md:h-auto md:py-1 border-b grid grid-cols-[40px_minmax(0,1fr)_40px] items-center md:pl-3 md:pr-1 md:flex md:justify-between",children:[m.jsx("div",{className:"md:hidden",children:m.jsx(qe,{variant:"ghost",size:"icon",className:"size-10 rounded-lg hover:!border-border/0",onClick:c,title:"Close sidebar",children:m.jsx(aa,{className:"h-5 w-5"})})}),m.jsxs("div",{className:"flex items-center justify-self-center gap-2 md:justify-self-auto",children:[m.jsxs("button",{type:"button",onClick:d,title:"Collapse sidebar",className:"hidden md:flex group/sidebar-collapse relative items-center justify-center h-5 w-5 sm:h-6 sm:w-6",children:[m.jsx(Ku,{className:"absolute inset-0.5 h-4 w-4 sm:h-5 sm:w-5 text-logo transition-all duration-200 ease-out opacity-100 scale-100 group-hover/sidebar-collapse:opacity-0 group-hover/sidebar-collapse:scale-0"}),m.jsx(HS,{className:"absolute inset-0 h-4 w-4 sm:h-6 sm:w-6 text-slate-500 dark:text-slate-400 transition-all duration-200 ease-out opacity-0 scale-0 group-hover/sidebar-collapse:opacity-100 group-hover/sidebar-collapse:scale-80 hover:opacity-50"})]}),m.jsx(Ku,{className:"h-5 w-5 sm:h-6 sm:w-6 text-logo md:hidden"}),m.jsx("span",{className:"font-logo text-base uppercase sm:text-md text-slate-600 dark:text-slate-100",children:Kn})]}),m.jsxs("div",{className:"flex items-center justify-self-end md:justify-self-auto",children:[m.jsx(qe,{variant:"ghost",size:"icon",onClick:()=>{F("/"),c()},className:"size-10 rounded-lg hover:!border-border/0 md:hidden",title:"New project",children:m.jsx(od,{className:"h-5 w-5"})}),ht?m.jsx("span",{className:"mr-1 hidden md:inline-flex items-center rounded-full border border-border bg-muted px-2 py-0.5 text-[11px] font-bold tracking-wider text-muted-foreground",title:"Development build",children:"DEV"}):Ge?m.jsxs(qe,{variant:"outline",size:"sm",className:"hidden md:inline-flex rounded-full !h-auto mr-1 py-0.5 px-2 bg-logo/20 hover:bg-logo text-logo border-logo/20 hover:text-foreground hover:border-logo/20 text-[11px] font-bold tracking-wider",onClick:H,disabled:Be,title:$!=null&&$.latestVersion?`Update to ${$.latestVersion}`:"Update Kanna",children:[Be?m.jsx(dn,{className:"mr-1.5 h-3 w-3 animate-spin"}):null,"UPDATE"]}):null,m.jsx(qe,{variant:"ghost",size:"icon",onClick:()=>{F("/"),c()},className:"hidden md:inline-flex size-10 rounded-lg hover:!border-border/0",title:"New project",children:m.jsx(od,{className:"size-4"})})]})]}),m.jsx("div",{ref:U,className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden scrollbar-hide",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:m.jsxs("div",{className:"p-[7px]",children:[!Ct&&me?m.jsx("div",{className:"space-y-5 px-1 pt-3",children:[0,1,2].map(we=>m.jsxs("div",{className:"space-y-2 animate-pulse",children:[m.jsx("div",{className:"h-4 w-28 rounded bg-muted"}),m.jsx("div",{className:"space-y-1",children:[0,1,2].map(Ue=>m.jsxs("div",{className:"flex items-center gap-2 rounded-md px-3 py-2",children:[m.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-muted"}),m.jsx("div",{className:ye("h-3.5 rounded bg-muted",Ue===0?"w-32":Ue===1?"w-40":"w-28")})]},Ue))})]},we))}):null,!Ct&&!me&&e.projectGroups.length===0?m.jsx("p",{className:"text-sm text-slate-400 p-2 mt-6 text-center",children:"No conversations yet"}):null,m.jsx(wJ,{projectGroups:e.projectGroups,editorLabel:z,onReorderGroups:G,collapsedSections:B,expandedGroups:I,onToggleSection:gt,onToggleExpandedGroup:It,renderChatRow:et,onShowArchivedProject:le,onNewLocalChat:we=>{const Ue=Ie.get(we);Ue&&h(Ue)},onCopyPath:A,onOpenExternalPath:N,onRenameProject:D,onHideProject:L,isConnected:n==="connected"})]})}),m.jsx("div",{className:"border-t border-border p-2",children:m.jsx("button",{type:"button",onClick:()=>{F("/settings/general"),c()},className:ye("w-full rounded-xl rounded-t-md border px-3 py-2 text-left transition-colors",vt?"bg-muted border-border":"border-border/0 hover:bg-muted hover:border-border active:bg-muted/80"),children:m.jsxs("div",{className:"flex items- justify-between gap-2",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(LV,{className:"h-4 w-4 text-muted-foreground"}),m.jsx("span",{className:"text-sm",children:"Settings"})]}),m.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[m.jsx("span",{children:Se}),me?m.jsx(dn,{className:"h-2 w-2 animate-spin"}):m.jsx("span",{className:ye("h-2 w-2 rounded-full",He)})]})]})})}),m.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",tabIndex:0,title:"Resize sidebar",className:ye("hidden md:block absolute -right-1 top-3 bottom-3 z-20 w-2 cursor-col-resize rounded-full","focus-visible:outline-none"),onPointerDown:we=>{we.preventDefault(),j.current={pointerX:we.clientX,width:se},de(!0)},onDoubleClick:()=>{oe(Zu),cx(Zu)},onKeyDown:we=>{let Ue=null;if(we.key==="ArrowLeft"?Ue=se-16:we.key==="ArrowRight"?Ue=se+16:we.key==="Home"?Ue=h3:we.key==="End"?Ue=f3:we.key==="Enter"&&(Ue=Zu),Ue===null)return;we.preventDefault();const Ye=gf(Ue);oe(Ye),cx(Ye)}})]}),m.jsx(Zo,{open:!!Ve,onOpenChange:we=>{we||le(null)},children:m.jsxs(po,{size:"md",children:[m.jsxs(_C,{children:[m.jsx(Jo,{children:"Archived Chats"}),m.jsx(Nd,{children:(Ve==null?void 0:Ve.localPath)??""})]}),m.jsx(ea,{className:"space-y-1",children:(bt=Ve==null?void 0:Ve.archivedChats)!=null&&bt.length?Ve.archivedChats.map(we=>m.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-3 rounded-lg border border-border/0 px-3 py-2 text-left transition-colors hover:border-border hover:bg-muted",onClick:()=>{R(we.chatId),le(null),c()},children:[m.jsx("span",{className:"min-w-0 truncate text-sm",children:we.title}),m.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Y5(X5(we),X)})]},we.chatId)):m.jsx("p",{className:"px-1 py-3 text-sm text-muted-foreground",children:"No archived chats"})})]})}),i?m.jsx("div",{className:"fixed inset-0 bg-black/40 z-40 md:hidden",onClick:c}):null]})}const VJ=_.memo(UJ),ok=1e3,dw=500,hw=5e3,ak=450,fw=250,pw=900,mw="cursor";function ud(e){switch(e){case"vscode":return"code {path}";case"xcode":return"xed {path}";case"windsurf":return"windsurf {path}";case"custom":return"cursor {path}";case"cursor":default:return"cursor {path}"}}function WJ(e){switch(e){case"vscode":return"VS Code";case"xcode":return"Xcode";case"windsurf":return"Windsurf";case"custom":return"Custom";case"cursor":default:return"Cursor"}}function GJ(e){return Number.isFinite(e)?Math.min(hw,Math.max(dw,Math.round(e))):ok}function qJ(e){return Number.isFinite(e)?Math.min(pw,Math.max(fw,Math.round(e))):ak}function KJ(e){switch(e){case"vscode":case"xcode":case"windsurf":case"custom":case"cursor":return e;default:return mw}}function UN(e,t){const n=e==null?void 0:e.trim();return n&&n.length>0?n:ud(t)}const Zr=kl()(e=>({scrollbackLines:ok,minColumnWidth:ak,editorPreset:mw,editorCommandTemplate:ud(mw),setScrollbackLines:t=>e({scrollbackLines:GJ(t)}),setMinColumnWidth:t=>e({minColumnWidth:qJ(t)}),setEditorPreset:t=>e(n=>{const r=KJ(t);return{editorPreset:r,editorCommandTemplate:r==="custom"?UN(n.editorCommandTemplate,r):ud(r)}}),setEditorCommandTemplate:t=>e(n=>({editorCommandTemplate:UN(t,n.editorPreset)}))})),lk=[{value:"cursor",label:"Cursor"},{value:"xcode",label:"Xcode"},{value:"windsurf",label:"Windsurf"},{value:"custom",label:"Custom"}],al={cursor:"/editor-icons/cursor.png",defaultApp:"/editor-icons/default-app.png",finder:"/editor-icons/finder.png",preview:"/editor-icons/preview.png",xcode:"/editor-icons/xcode.png",terminal:"/editor-icons/terminal.png",windsurf:"/editor-icons/windsurf.png",custom:"/editor-icons/custom.png"};function ll({src:e,className:t}){return m.jsx("img",{src:e,alt:"","aria-hidden":"true",draggable:!1,className:t})}function p3({preset:e,className:t}){switch(e){case"xcode":return m.jsx(ll,{src:al.xcode,className:t});case"windsurf":return m.jsx(ll,{src:al.windsurf,className:t});case"custom":return m.jsx(ll,{src:al.custom,className:t});case"cursor":case"vscode":default:return m.jsx(ll,{src:al.cursor,className:t})}}function YJ({className:e}){return m.jsx(ll,{src:al.finder,className:e})}function XJ({className:e}){return m.jsx(ll,{src:al.preview,className:e})}function QJ({className:e}){return m.jsx(ll,{src:al.defaultApp,className:e})}function ZJ({className:e}){return m.jsx(Rb,{className:e})}function JJ({className:e}){return m.jsx(ll,{src:al.terminal,className:e})}function VN(e,[t,n]){return Math.min(n,Math.max(t,e))}function eee(e){const t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var tee=[" ","Enter","ArrowUp","ArrowDown"],nee=[" ","Enter"],Sc="Select",[Zb,Jb,ree]=OC(Sc),[jd]=la(Sc,[ree,Cl]),e0=Cl(),[iee,El]=jd(Sc),[see,oee]=jd(Sc),m3=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:l,onValueChange:c,dir:d,name:f,autoComplete:h,disabled:g,required:v,form:y}=e,x=e0(t),[w,C]=_.useState(null),[R,E]=_.useState(null),[T,A]=_.useState(!1),N=jC(d),[D,L]=ad({prop:r,defaultProp:i??!1,onChange:s,caller:Sc}),[G,z]=ad({prop:o,defaultProp:l,onChange:c,caller:Sc}),$=_.useRef(null),H=w?y||!!w.closest("form"):!0,[O,F]=_.useState(new Set),U=Array.from(O).map(j=>j.props.value).join(";");return m.jsx(Fb,{...x,children:m.jsxs(iee,{required:v,scope:t,trigger:w,onTriggerChange:C,valueNode:R,onValueNodeChange:E,valueNodeHasChildren:T,onValueNodeHasChildrenChange:A,contentId:Xo(),value:G,onValueChange:z,open:D,onOpenChange:L,dir:N,triggerPointerDownPosRef:$,disabled:g,children:[m.jsx(Zb.Provider,{scope:t,children:m.jsx(see,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(j=>{F(W=>new Set(W).add(j))},[]),onNativeOptionRemove:_.useCallback(j=>{F(W=>{const B=new Set(W);return B.delete(j),B})},[]),children:n})}),H?m.jsxs(F3,{"aria-hidden":!0,required:v,tabIndex:-1,name:f,autoComplete:h,value:G,onChange:j=>z(j.target.value),disabled:g,form:y,children:[G===void 0?m.jsx("option",{value:""}):null,Array.from(O)]},U):null]})})};m3.displayName=Sc;var g3="SelectTrigger",v3=_.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,s=e0(n),o=El(g3,n),l=o.disabled||r,c=hn(t,o.onTriggerChange),d=Jb(n),f=_.useRef("touch"),[h,g,v]=$3(x=>{const w=d().filter(E=>!E.disabled),C=w.find(E=>E.value===o.value),R=U3(w,x,C);R!==void 0&&o.onValueChange(R.value)}),y=x=>{l||(o.onOpenChange(!0),v()),x&&(o.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})};return m.jsx(up,{asChild:!0,...s,children:m.jsx(Yt.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":H3(o.value)?"":void 0,...i,ref:c,onClick:Qe(i.onClick,x=>{x.currentTarget.focus(),f.current!=="mouse"&&y(x)}),onPointerDown:Qe(i.onPointerDown,x=>{f.current=x.pointerType;const w=x.target;w.hasPointerCapture(x.pointerId)&&w.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(y(x),x.preventDefault())}),onKeyDown:Qe(i.onKeyDown,x=>{const w=h.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&g(x.key),!(w&&x.key===" ")&&tee.includes(x.key)&&(y(),x.preventDefault())})})})});v3.displayName=g3;var b3="SelectValue",_3=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:o="",...l}=e,c=El(b3,n),{onValueNodeHasChildrenChange:d}=c,f=s!==void 0,h=hn(t,c.onValueNodeChange);return Gr(()=>{d(f)},[d,f]),m.jsx(Yt.span,{...l,ref:h,style:{pointerEvents:"none"},children:H3(c.value)?m.jsx(m.Fragment,{children:o}):s})});_3.displayName=b3;var aee="SelectIcon",y3=_.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return m.jsx(Yt.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});y3.displayName=aee;var lee="SelectPortal",x3=e=>m.jsx(Ad,{asChild:!0,...e});x3.displayName=lee;var wc="SelectContent",S3=_.forwardRef((e,t)=>{const n=El(wc,e.__scopeSelect),[r,i]=_.useState();if(Gr(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?ps.createPortal(m.jsx(w3,{scope:e.__scopeSelect,children:m.jsx(Zb.Slot,{scope:e.__scopeSelect,children:m.jsx("div",{children:e.children})})}),s):null}return m.jsx(C3,{...e,ref:t})});S3.displayName=wc;var As=10,[w3,Rl]=jd(wc),cee="SelectContentImpl",uee=_c("SelectContent.RemoveScroll"),C3=_.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:g,collisionPadding:v,sticky:y,hideWhenDetached:x,avoidCollisions:w,...C}=e,R=El(wc,n),[E,T]=_.useState(null),[A,N]=_.useState(null),D=hn(t,oe=>T(oe)),[L,G]=_.useState(null),[z,$]=_.useState(null),H=Jb(n),[O,F]=_.useState(!1),U=_.useRef(!1);_.useEffect(()=>{if(E)return Db(E)},[E]),Mb();const j=_.useCallback(oe=>{const[fe,...de]=H().map(te=>te.ref.current),[ve]=de.slice(-1),le=document.activeElement;for(const te of oe)if(te===le||(te==null||te.scrollIntoView({block:"nearest"}),te===fe&&A&&(A.scrollTop=0),te===ve&&A&&(A.scrollTop=A.scrollHeight),te==null||te.focus(),document.activeElement!==le))return},[H,A]),W=_.useCallback(()=>j([L,E]),[j,L,E]);_.useEffect(()=>{O&&W()},[O,W]);const{onOpenChange:B,triggerPointerDownPosRef:K}=R;_.useEffect(()=>{if(E){let oe={x:0,y:0};const fe=ve=>{var le,te;oe={x:Math.abs(Math.round(ve.pageX)-(((le=K.current)==null?void 0:le.x)??0)),y:Math.abs(Math.round(ve.pageY)-(((te=K.current)==null?void 0:te.y)??0))}},de=ve=>{oe.x<=10&&oe.y<=10?ve.preventDefault():E.contains(ve.target)||B(!1),document.removeEventListener("pointermove",fe),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",fe),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",fe),document.removeEventListener("pointerup",de,{capture:!0})}}},[E,B,K]),_.useEffect(()=>{const oe=()=>B(!1);return window.addEventListener("blur",oe),window.addEventListener("resize",oe),()=>{window.removeEventListener("blur",oe),window.removeEventListener("resize",oe)}},[B]);const[I,V]=$3(oe=>{const fe=H().filter(le=>!le.disabled),de=fe.find(le=>le.ref.current===document.activeElement),ve=U3(fe,oe,de);ve&&setTimeout(()=>ve.ref.current.focus())}),X=_.useCallback((oe,fe,de)=>{const ve=!U.current&&!de;(R.value!==void 0&&R.value===fe||ve)&&(G(oe),ve&&(U.current=!0))},[R.value]),P=_.useCallback(()=>E==null?void 0:E.focus(),[E]),ie=_.useCallback((oe,fe,de)=>{const ve=!U.current&&!de;(R.value!==void 0&&R.value===fe||ve)&&$(oe)},[R.value]),re=r==="popper"?gw:k3,se=re===gw?{side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:g,collisionPadding:v,sticky:y,hideWhenDetached:x,avoidCollisions:w}:{};return m.jsx(w3,{scope:n,content:E,viewport:A,onViewportChange:N,itemRefCallback:X,selectedItem:L,onItemLeave:P,itemTextRefCallback:ie,focusSelectedItem:W,selectedItemText:z,position:r,isPositioned:O,searchRef:I,children:m.jsx(lp,{as:uee,allowPinchZoom:!0,children:m.jsx(ap,{asChild:!0,trapped:R.open,onMountAutoFocus:oe=>{oe.preventDefault()},onUnmountAutoFocus:Qe(i,oe=>{var fe;(fe=R.trigger)==null||fe.focus({preventScroll:!0}),oe.preventDefault()}),children:m.jsx(Td,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:oe=>oe.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:m.jsx(re,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:oe=>oe.preventDefault(),...C,...se,onPlaced:()=>F(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:Qe(C.onKeyDown,oe=>{const fe=oe.ctrlKey||oe.altKey||oe.metaKey;if(oe.key==="Tab"&&oe.preventDefault(),!fe&&oe.key.length===1&&V(oe.key),["ArrowUp","ArrowDown","Home","End"].includes(oe.key)){let ve=H().filter(le=>!le.disabled).map(le=>le.ref.current);if(["ArrowUp","End"].includes(oe.key)&&(ve=ve.slice().reverse()),["ArrowUp","ArrowDown"].includes(oe.key)){const le=oe.target,te=ve.indexOf(le);ve=ve.slice(te+1)}setTimeout(()=>j(ve)),oe.preventDefault()}})})})})})})});C3.displayName=cee;var dee="SelectItemAlignedPosition",k3=_.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,s=El(wc,n),o=Rl(wc,n),[l,c]=_.useState(null),[d,f]=_.useState(null),h=hn(t,D=>f(D)),g=Jb(n),v=_.useRef(!1),y=_.useRef(!0),{viewport:x,selectedItem:w,selectedItemText:C,focusSelectedItem:R}=o,E=_.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&x&&w&&C){const D=s.trigger.getBoundingClientRect(),L=d.getBoundingClientRect(),G=s.valueNode.getBoundingClientRect(),z=C.getBoundingClientRect();if(s.dir!=="rtl"){const le=z.left-L.left,te=G.left-le,Ce=D.left-te,Fe=D.width+Ce,Xe=Math.max(Fe,L.width),Ie=window.innerWidth-As,at=VN(te,[As,Math.max(As,Ie-Xe)]);l.style.minWidth=Fe+"px",l.style.left=at+"px"}else{const le=L.right-z.right,te=window.innerWidth-G.right-le,Ce=window.innerWidth-D.right-te,Fe=D.width+Ce,Xe=Math.max(Fe,L.width),Ie=window.innerWidth-As,at=VN(te,[As,Math.max(As,Ie-Xe)]);l.style.minWidth=Fe+"px",l.style.right=at+"px"}const $=g(),H=window.innerHeight-As*2,O=x.scrollHeight,F=window.getComputedStyle(d),U=parseInt(F.borderTopWidth,10),j=parseInt(F.paddingTop,10),W=parseInt(F.borderBottomWidth,10),B=parseInt(F.paddingBottom,10),K=U+j+O+B+W,I=Math.min(w.offsetHeight*5,K),V=window.getComputedStyle(x),X=parseInt(V.paddingTop,10),P=parseInt(V.paddingBottom,10),ie=D.top+D.height/2-As,re=H-ie,se=w.offsetHeight/2,oe=w.offsetTop+se,fe=U+j+oe,de=K-fe;if(fe<=ie){const le=$.length>0&&w===$[$.length-1].ref.current;l.style.bottom="0px";const te=d.clientHeight-x.offsetTop-x.offsetHeight,Ce=Math.max(re,se+(le?P:0)+te+W),Fe=fe+Ce;l.style.height=Fe+"px"}else{const le=$.length>0&&w===$[0].ref.current;l.style.top="0px";const Ce=Math.max(ie,U+x.offsetTop+(le?X:0)+se)+de;l.style.height=Ce+"px",x.scrollTop=fe-ie+x.offsetTop}l.style.margin=`${As}px 0`,l.style.minHeight=I+"px",l.style.maxHeight=H+"px",r==null||r(),requestAnimationFrame(()=>v.current=!0)}},[g,s.trigger,s.valueNode,l,d,x,w,C,s.dir,r]);Gr(()=>E(),[E]);const[T,A]=_.useState();Gr(()=>{d&&A(window.getComputedStyle(d).zIndex)},[d]);const N=_.useCallback(D=>{D&&y.current===!0&&(E(),R==null||R(),y.current=!1)},[E,R]);return m.jsx(fee,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:v,onScrollButtonChange:N,children:m.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:m.jsx(Yt.div,{...i,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});k3.displayName=dee;var hee="SelectPopperPosition",gw=_.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=As,...s}=e,o=e0(n);return m.jsx(Hb,{...o,...s,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});gw.displayName=hee;var[fee,ck]=jd(wc,{}),vw="SelectViewport",E3=_.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,s=Rl(vw,n),o=ck(vw,n),l=hn(t,s.onViewportChange),c=_.useRef(0);return m.jsxs(m.Fragment,{children:[m.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),m.jsx(Zb.Slot,{scope:n,children:m.jsx(Yt.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Qe(i.onScroll,d=>{const f=d.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&h){const v=Math.abs(c.current-f.scrollTop);if(v>0){const y=window.innerHeight-As*2,x=parseFloat(h.style.minHeight),w=parseFloat(h.style.height),C=Math.max(x,w);if(C<y){const R=C+v,E=Math.min(y,R),T=R-E;h.style.height=E+"px",h.style.bottom==="0px"&&(f.scrollTop=T>0?T:0,h.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});E3.displayName=vw;var R3="SelectGroup",[pee,mee]=jd(R3),T3=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=Xo();return m.jsx(pee,{scope:n,id:i,children:m.jsx(Yt.div,{role:"group","aria-labelledby":i,...r,ref:t})})});T3.displayName=R3;var A3="SelectLabel",N3=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=mee(A3,n);return m.jsx(Yt.div,{id:i.id,...r,ref:t})});N3.displayName=A3;var Ov="SelectItem",[gee,M3]=jd(Ov),L3=_.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...o}=e,l=El(Ov,n),c=Rl(Ov,n),d=l.value===r,[f,h]=_.useState(s??""),[g,v]=_.useState(!1),y=hn(t,R=>{var E;return(E=c.itemRefCallback)==null?void 0:E.call(c,R,r,i)}),x=Xo(),w=_.useRef("touch"),C=()=>{i||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return m.jsx(gee,{scope:n,value:r,disabled:i,textId:x,isSelected:d,onItemTextChange:_.useCallback(R=>{h(E=>E||((R==null?void 0:R.textContent)??"").trim())},[]),children:m.jsx(Zb.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:m.jsx(Yt.div,{role:"option","aria-labelledby":x,"data-highlighted":g?"":void 0,"aria-selected":d&&g,"data-state":d?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:y,onFocus:Qe(o.onFocus,()=>v(!0)),onBlur:Qe(o.onBlur,()=>v(!1)),onClick:Qe(o.onClick,()=>{w.current!=="mouse"&&C()}),onPointerUp:Qe(o.onPointerUp,()=>{w.current==="mouse"&&C()}),onPointerDown:Qe(o.onPointerDown,R=>{w.current=R.pointerType}),onPointerMove:Qe(o.onPointerMove,R=>{var E;w.current=R.pointerType,i?(E=c.onItemLeave)==null||E.call(c):w.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Qe(o.onPointerLeave,R=>{var E;R.currentTarget===document.activeElement&&((E=c.onItemLeave)==null||E.call(c))}),onKeyDown:Qe(o.onKeyDown,R=>{var T;((T=c.searchRef)==null?void 0:T.current)!==""&&R.key===" "||(nee.includes(R.key)&&C(),R.key===" "&&R.preventDefault())})})})})});L3.displayName=Ov;var Jh="SelectItemText",D3=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...s}=e,o=El(Jh,n),l=Rl(Jh,n),c=M3(Jh,n),d=oee(Jh,n),[f,h]=_.useState(null),g=hn(t,C=>h(C),c.onItemTextChange,C=>{var R;return(R=l.itemTextRefCallback)==null?void 0:R.call(l,C,c.value,c.disabled)}),v=f==null?void 0:f.textContent,y=_.useMemo(()=>m.jsx("option",{value:c.value,disabled:c.disabled,children:v},c.value),[c.disabled,c.value,v]),{onNativeOptionAdd:x,onNativeOptionRemove:w}=d;return Gr(()=>(x(y),()=>w(y)),[x,w,y]),m.jsxs(m.Fragment,{children:[m.jsx(Yt.span,{id:c.textId,...s,ref:g}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ps.createPortal(s.children,o.valueNode):null]})});D3.displayName=Jh;var I3="SelectItemIndicator",P3=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return M3(I3,n).isSelected?m.jsx(Yt.span,{"aria-hidden":!0,...r,ref:t}):null});P3.displayName=I3;var bw="SelectScrollUpButton",O3=_.forwardRef((e,t)=>{const n=Rl(bw,e.__scopeSelect),r=ck(bw,e.__scopeSelect),[i,s]=_.useState(!1),o=hn(t,r.onScrollButtonChange);return Gr(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;s(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?m.jsx(z3,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});O3.displayName=bw;var _w="SelectScrollDownButton",j3=_.forwardRef((e,t)=>{const n=Rl(_w,e.__scopeSelect),r=ck(_w,e.__scopeSelect),[i,s]=_.useState(!1),o=hn(t,r.onScrollButtonChange);return Gr(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;s(f)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?m.jsx(z3,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});j3.displayName=_w;var z3=_.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,s=Rl("SelectScrollButton",n),o=_.useRef(null),l=Jb(n),c=_.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return _.useEffect(()=>()=>c(),[c]),Gr(()=>{var f;const d=l().find(h=>h.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[l]),m.jsx(Yt.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Qe(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Qe(i.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Qe(i.onPointerLeave,()=>{c()})})}),vee="SelectSeparator",B3=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return m.jsx(Yt.div,{"aria-hidden":!0,...r,ref:t})});B3.displayName=vee;var yw="SelectArrow",bee=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=e0(n),s=El(yw,n),o=Rl(yw,n);return s.open&&o.position==="popper"?m.jsx($b,{...i,...r,ref:t}):null});bee.displayName=yw;var _ee="SelectBubbleInput",F3=_.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=_.useRef(null),s=hn(r,i),o=eee(t);return _.useEffect(()=>{const l=i.current;if(!l)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&f){const h=new Event("change",{bubbles:!0});f.call(l,t),l.dispatchEvent(h)}},[o,t]),m.jsx(Yt.select,{...n,style:{...L5,...n.style},ref:s,defaultValue:t})});F3.displayName=_ee;function H3(e){return e===""||e===void 0}function $3(e){const t=Bs(e),n=_.useRef(""),r=_.useRef(0),i=_.useCallback(o=>{const l=n.current+o;t(l),(function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),s=_.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function U3(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=yee(e,Math.max(s,0));i.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.textValue.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function yee(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var xee=m3,V3=v3,See=_3,wee=y3,Cee=x3,W3=S3,kee=E3,Eee=T3,G3=N3,q3=L3,Ree=D3,Tee=P3,K3=O3,Y3=j3,X3=B3;const rl=xee,Fu=Eee,oc=See,Wo=_.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(V3,{ref:r,className:ye("flex h-9 w-full items-center justify-between gap-2 rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none transition-colors","placeholder:text-muted-foreground","focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50","[&>span]:line-clamp-1",e),...n,children:[t,m.jsx(wee,{asChild:!0,children:m.jsx(Rd,{className:"h-4 w-4 shrink-0 opacity-50"})})]}));Wo.displayName=V3.displayName;const Q3=_.forwardRef(({className:e,...t},n)=>m.jsx(K3,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",e),...t,children:m.jsx(tO,{className:"h-4 w-4"})}));Q3.displayName=K3.displayName;const Z3=_.forwardRef(({className:e,...t},n)=>m.jsx(Y3,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",e),...t,children:m.jsx(Rd,{className:"h-4 w-4"})}));Z3.displayName=Y3.displayName;const Go=_.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>m.jsx(Cee,{children:m.jsxs(W3,{ref:i,className:ye("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border bg-background text-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[m.jsx(Q3,{}),m.jsx(kee,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),m.jsx(Z3,{})]})}));Go.displayName=W3.displayName;const Aee=_.forwardRef(({className:e,...t},n)=>m.jsx(G3,{ref:n,className:ye("px-2 py-1.5 text-sm font-semibold",e),...t}));Aee.displayName=G3.displayName;const Ls=_.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(q3,{ref:r,className:ye("relative flex w-full cursor-default select-none items-center rounded-md py-1.5 pl-2 pr-8 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[m.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(Tee,{children:m.jsx(ri,{className:"h-4 w-4"})})}),m.jsx(Ree,{children:t})]}));Ls.displayName=q3.displayName;const Nee=_.forwardRef(({className:e,...t},n)=>m.jsx(X3,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",e),...t}));Nee.displayName=X3.displayName;const WN="kanna:last-open-external",J3="py-2 pl-2 pr-8",Mee="rounded-md text-sm font-normal focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground",Lee="flex items-center gap-3",Dee="h-5 w-5 shrink-0";function e4({value:e,label:t,isMac:n}){return m.jsxs("span",{className:Lee,children:[m.jsx(t4,{value:e,isMac:n,className:Dee}),m.jsx("span",{children:t})]})}function Iee(e,t){return{preset:e,commandTemplate:e==="custom"&&(t==null?void 0:t.trim())||ud(e)}}function Pee(e,t){var r;if(e==="finder")return t?"Finder":"Folder";if(e==="terminal")return"Terminal";if(e==="preview")return"Preview";if(e==="default")return"Default App";const n=e.replace("editor:","");return n==="vscode"?"VS Code":((r=lk.find(i=>i.value===n))==null?void 0:r.label)??"Editor"}function t4({value:e,isMac:t,className:n}){return e==="finder"?t?m.jsx(YJ,{className:n}):m.jsx(ZJ,{className:n}):e==="terminal"?m.jsx(JJ,{className:n}):e==="preview"?m.jsx(XJ,{className:n}):e==="default"?m.jsx(QJ,{className:n}):m.jsx(p3,{preset:e.replace("editor:",""),className:n})}function Oee(e,t){if(e==="finder"||e==="terminal"||e==="preview"||e==="default")return e;if(e!=null&&e.startsWith("editor:")){const n=e.slice(7);if(n==="vscode"||lk.some(r=>r.value===n))return e}return t}function n4({editorPreset:e,isMac:t,includeFinder:n=!0,includeTerminal:r=!1,includePreview:i=!1,includeDefault:s=!1,menuKind:o="context"}){const l=[{value:"editor:cursor",label:"Cursor"},{value:"editor:xcode",label:"Xcode"},{value:"editor:windsurf",label:"Windsurf"},...e==="custom"?[{value:"editor:custom",label:"Custom"}]:[]],c=`editor:${e}`,d=[...l.filter(f=>f.value===c),...l.filter(f=>f.value!==c)];return o==="navbar"?[...d.filter(f=>f.value===c),...n?[{value:"finder",label:t?"Finder":"Folder"}]:[],...r?[{value:"terminal",label:"Terminal"}]:[],...d.filter(f=>f.value!==c)]:[...d,...i&&t?[{value:"preview",label:"Preview"}]:[],...n?[{value:"finder",label:t?"Finder":"Folder"}]:[],...r?[{value:"terminal",label:"Terminal"}]:[],...s?[{value:"default",label:"Default App"}]:[]]}function r4(e){if(e.value==="finder"){e.onOpenExternal("open_finder");return}if(e.value==="terminal"){e.onOpenExternal("open_terminal");return}if(e.value==="preview"){e.onOpenExternal("open_preview");return}if(e.value==="default"){e.onOpenExternal("open_default");return}const t=e.value.replace("editor:","");e.onOpenExternal("open_editor",Iee(t,e.editorCommandTemplate))}function jee({isMac:e,editorPreset:t,editorCommandTemplate:n,finderShortcut:r,editorShortcut:i,onOpenExternal:s}){const o=`editor:${t}`,[l,c]=_.useState(o);_.useEffect(()=>{c(Oee(window.localStorage.getItem(WN),o))},[o]);const d=_.useMemo(()=>n4({editorPreset:t,isMac:e,includeFinder:!0,includeTerminal:!0,menuKind:"navbar"}),[t,e]);function f(h){c(h),window.localStorage.setItem(WN,h),r4({value:h,editorCommandTemplate:n,onOpenExternal:s})}return m.jsxs("div",{className:"grid grid-cols-[1fr_auto]",children:[m.jsxs(Ev,{children:[m.jsx(Rv,{asChild:!0,children:m.jsx(qe,{variant:"ghost",size:"none",onClick:()=>f(l),title:`Open in ${Pee(l,e)}`,className:"border-0 p-1 py-[3px] pr-0 hover:!border-border/0 hover:!bg-transparent",children:m.jsx(t4,{value:l,isMac:e,className:"size-5.5"})})}),m.jsx(Mf,{side:"bottom",shortcut:l==="finder"?r:l===`editor:${t}`?i:void 0})]}),m.jsxs(rl,{value:void 0,onValueChange:h=>f(h),children:[m.jsx(Wo,{"aria-label":"Choose open destination",className:"!h-auto !py-0 !pl-0.5 !pr-1 border-0 bg-transparent hover:bg-transparent focus:ring-0 focus:ring-offset-0 [&>svg]:hidden",children:m.jsx("div",{className:"flex items-center justify-center size-5",children:m.jsx(Rd,{className:"h-4 w-4 opacity-60"})})}),m.jsx(Go,{align:"end",children:m.jsx(Fu,{children:d.map(h=>m.jsx(Ls,{value:h.value,className:J3,children:m.jsx(e4,{value:h.value,label:h.label,isMac:e})},h.value))})})]})]})}function zee({isMac:e,editorPreset:t,editorCommandTemplate:n,includeFinder:r=!0,includeTerminal:i=!1,includePreview:s=!1,includeDefault:o=!1,onOpenExternal:l}){const c=n4({editorPreset:t,isMac:e,includeFinder:r,includeTerminal:i,includePreview:s,includeDefault:o});return m.jsx(ra,{className:"rounded-lg p-1",children:c.map(d=>m.jsx(Cn,{className:`${J3} ${Mee}`,onSelect:f=>{f.preventDefault(),r4({value:d.value,editorCommandTemplate:n,onOpenExternal:l})},children:m.jsx(e4,{value:d.value,label:d.label,isMac:e})},d.value))})}function Bee(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();e.currentTarget.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:t.left+t.width/2,clientY:t.bottom,view:window}))}function Fee({showOnDesktop:e,onToggleEmbeddedTerminal:t,onExportTranscript:n,canExportTranscript:r,isExportingTranscript:i,exportTranscriptComplete:s}){return!t&&!n?null:m.jsxs(_l,{children:[m.jsx(yl,{asChild:!0,children:m.jsx(qe,{variant:"ghost",size:"none",onClick:Bee,title:"More actions",className:ye("border border-border/0 hover:!border-border/0 px-1.5 h-9 hover:!bg-transparent",e?"flex":"flex md:hidden"),children:m.jsx(Eb,{strokeWidth:2,className:"h-4.5"})})}),m.jsxs(ra,{children:[t?m.jsxs(Cn,{onSelect:o=>{o.preventDefault(),t()},children:[m.jsx(Ab,{strokeWidth:2,className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Toggle Terminal"})]}):null,n?m.jsxs(Cn,{disabled:!r||i,onSelect:o=>{o.preventDefault(),!(!r||i)&&n()},children:[i?m.jsx(dn,{className:"h-3.5 w-3.5 animate-spin"}):s?m.jsx(ri,{className:"h-3.5 w-3.5 text-emerald-400"}):m.jsx(dC,{strokeWidth:2,className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Share Chat"})]}):null]})]})}function Hee({sidebarCollapsed:e,onOpenSidebar:t,onExpandSidebar:n,onNewChat:r,localPath:i,embeddedTerminalVisible:s=!1,onToggleEmbeddedTerminal:o,rightPanel:l="hidden",onToggleGitPanel:c,onToggleBrowserPanel:d,onOpenExternal:f,onExportTranscript:h,canExportTranscript:g=!1,isExportingTranscript:v=!1,exportTranscriptComplete:y=!1,editorPreset:x="cursor",editorCommandTemplate:w,platform:C="darwin",finderShortcut:R,editorShortcut:E,terminalShortcut:T,rightSidebarShortcut:A,branchName:N,hasGitRepo:D=!0,gitStatus:L="unknown",isTranscriptViewportNarrow:G=!0}){const z=D?L==="unknown"?null:N??"Detached HEAD":"Setup Git",$=C==="darwin",H=l!=="hidden",O=l==="browser"?d:l==="git"?c:void 0,F=l==="hidden"||l==="git",U=l==="hidden"||l==="browser";return m.jsx(SC,{className:ye("absolute top-0 left-0 right-0 z-10 md:pt-[9px] lg:pb-[9px] pl-1 pr-2 border-border/0 flex items-center justify-center",G?"bg-background border-b border-border":"bg-transparent"),children:m.jsxs("div",{className:"relative flex items-center gap-2 w-full",children:[m.jsxs("div",{className:`h-[30px] flex items-center gap-0 flex-shrink-0 border border-border/0 rounded-[9px] ${e?"px-1.5 border-border":""} px-[2px] backdrop-blur-lg`,children:[m.jsx(qe,{variant:"ghost",size:"icon",className:"md:hidden !h-[auto] hover:!border-border/0 hover:!bg-transparent",onClick:t,children:m.jsx(lC,{className:"size-4"})}),e&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"hidden md:flex items-center justify-center w-[36px] h-[36px]",children:m.jsx(Ku,{className:"h-4 w-4 sm:h-5 sm:w-5 text-logo ml-1 hidden md:block"})}),m.jsx(qe,{variant:"ghost",size:"icon",className:"hidden md:flex hover:!border-border/0 hover:!bg-transparent",onClick:n,title:"Expand sidebar",children:m.jsx(HS,{className:"size-4"})})]}),m.jsx(qe,{variant:"ghost",size:"icon",className:"hover:!border-border/0 hover:!bg-transparent",onClick:r,title:"Compose",children:m.jsx(uC,{className:"size-4"})})]}),m.jsx("div",{className:"flex-1 min-w-0"}),i&&(f||o||c||d||h)?m.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[f?m.jsx("div",{className:"hidden md:block border border-border/70 rounded-[9px] backdrop-blur-lg",children:m.jsx(jee,{isMac:$,editorPreset:x,editorCommandTemplate:w,finderShortcut:R,editorShortcut:E,onOpenExternal:f})}):null,o||c||d||h?m.jsxs("div",{className:"flex items-center rounded-[9px] h-[30px] backdrop-blur-lg",children:[m.jsx(Fee,{showOnDesktop:H,onToggleEmbeddedTerminal:o,onExportTranscript:h,canExportTranscript:g,isExportingTranscript:v,exportTranscriptComplete:y}),o?m.jsxs(Ev,{children:[m.jsx(Rv,{asChild:!0,children:m.jsx(qe,{variant:"ghost",size:"none",onClick:o,className:ye(H?"hidden":"hidden md:flex","border border-border/0 hover:!border-border/0 px-1.5 h-9 hover:!bg-transparent",s&&"text-foreground"),children:m.jsx(Ab,{strokeWidth:2,className:"h-4"})})}),m.jsx(Mf,{side:"bottom",shortcut:T})]}):null,h?m.jsx(qe,{variant:"ghost",size:"none",onClick:h,disabled:!g||v,title:"Share chat","aria-label":"Share chat",className:ye(H?"hidden":"hidden md:flex","border border-border/0 hover:!border-border/0 px-1.5 h-9 hover:!bg-transparent disabled:opacity-50"),children:v?m.jsx(dn,{className:"h-4 animate-spin"}):y?m.jsx(ri,{className:"h-4 text-emerald-400"}):m.jsx(dC,{strokeWidth:2,className:"h-4"})}):null,d&&F?m.jsx(qe,{variant:"ghost",size:"none",onClick:d,title:"Browser","aria-label":"Browser",className:ye("border border-border/0 hover:!border-border/0 px-1.5 h-9 hover:!bg-transparent"),children:m.jsx(aC,{strokeWidth:2.25,className:"h-4"})}):null,c&&U?m.jsxs(Ev,{children:[m.jsx(Rv,{asChild:!0,children:m.jsxs(qe,{variant:"ghost",size:"none",onClick:c,className:ye("border flex flex-row items-center gap-1.5 h-9 border-border/0 hover:!border-border/0 hover:!bg-transparent",H?"w-[38px] justify-center px-0":"pl-1.5 pr-2"),children:[m.jsx(lc,{strokeWidth:2.25,className:"h-4"}),z&&!H?m.jsx("div",{className:"font-[13px] max-w-[140px] truncate hidden md:block",children:z}):null]})}),m.jsx(Mf,{side:"bottom",shortcut:A})]}):null,H&&O?m.jsx(qe,{variant:"ghost",size:"none",onClick:O,title:"Collapse sidebar","aria-label":"Collapse sidebar",className:"border border-border/0 hover:!border-border/0 px-1.5 h-9 hover:!bg-transparent text-foreground",children:m.jsx(uV,{strokeWidth:2.25,className:"h-4"})}):null]}):null]}):null]})})}let jv=null,jh=null;const zv=new Map,ux=new Map;function $ee(e){return e.filter(t=>t.status>=200&&t.status<400)}function dx(){return jv}function Uee(e,t){return jh||(jh=e.command({type:"browser.listLocalHttpServers",projectId:t}).then(n=>{const r=$ee(n);return jv=r,r}).finally(()=>{jh=null}),jh)}function Vee(e){const t=(jv??[]).filter(n=>n.port!==e);return jv=t,t}function GN(e){return zv.get(e)}function Wee(e,t){const n=ux.get(t);if(n)return n;const r=e.command({type:"project.readQuickActions",projectId:t}).then(i=>(zv.set(t,i),i)).finally(()=>{ux.delete(t)});return ux.set(t,r),r}function Gee(e,t,n){return zv.set(t,n),e.command({type:"project.writeQuickActions",projectId:t,quickActions:n}).then(r=>(zv.set(t,r),r))}function qee(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var s;const o=c=>c===null?null:JSON.parse(c,void 0),l=(s=n.getItem(i))!=null?s:null;return l instanceof Promise?l.then(o):o(l)},setItem:(i,s)=>n.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>n.removeItem(i)}}const xw=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return xw(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return xw(r)(n)}}}},Kee=(e,t)=>(n,r,i)=>{let s={storage:qee(()=>window.localStorage),partialize:w=>w,version:0,merge:(w,C)=>({...C,...w}),...t},o=!1,l=0;const c=new Set,d=new Set;let f=s.storage;if(!f)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...w)},r,i);const h=()=>{const w=s.partialize({...r()});return f.setItem(s.name,{state:w,version:s.version})},g=i.setState;i.setState=(w,C)=>(g(w,C),h());const v=e((...w)=>(n(...w),h()),r,i);i.getInitialState=()=>v;let y;const x=()=>{var w,C;if(!f)return;const R=++l;o=!1,c.forEach(T=>{var A;return T((A=r())!=null?A:v)});const E=((C=s.onRehydrateStorage)==null?void 0:C.call(s,(w=r())!=null?w:v))||void 0;return xw(f.getItem.bind(f))(s.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==s.version){if(s.migrate){const A=s.migrate(T.state,T.version);return A instanceof Promise?A.then(N=>[!0,N]):[!0,A]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var A;if(R!==l)return;const[N,D]=T;if(y=s.merge(D,(A=r())!=null?A:v),n(y,!0),N)return h()}).then(()=>{R===l&&(E==null||E(y,void 0),y=r(),o=!0,d.forEach(T=>T(y)))}).catch(T=>{R===l&&(E==null||E(void 0,T))})};return i.persist={setOptions:w=>{s={...s,...w},w.storage&&(f=w.storage)},clearStorage:()=>{f==null||f.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>x(),hasHydrated:()=>o,onHydrate:w=>(c.add(w),()=>{c.delete(w)}),onFinishHydration:w=>(d.add(w),()=>{d.delete(w)})},s.skipHydration||x(),y||v},t0=Kee,dd=420,Bv=370;function Yee(e){return Number.isFinite(e)?Math.max(Bv,e):dd}function Xee(){return{rightPanel:"hidden"}}function zh(){return{viewMode:"history",collapsedPaths:{},summary:"",description:""}}function Qee(){return{address:"",history:[],historyIndex:-1,zoom:1}}function Sw(e){const t=e.trim();return t?/^[a-z][a-z\d+.-]*:\/\//i.test(t)?t:`http://${t}`:""}function i4(e){return Number.isFinite(e)?Math.min(2,Math.max(.5,Math.round(e*10)/10)):1}function hx(e,t){return e[t]??Xee()}function tg(e,t){return e[t]??Qee()}function Zee(e){if(!e||typeof e!="object")return{size:dd,projects:{},projectUi:{},projectBrowser:{}};const t=e,n=Object.fromEntries(Object.entries(t.projects??{}).map(([i,s])=>[i,{rightPanel:s.rightPanel??(s.isVisible?"git":"hidden")}])),r=Object.fromEntries(Object.entries(t.projectBrowser??{}).map(([i,s])=>{const o=Sw(s.address??""),l=(s.history??[]).map(Sw).filter(Boolean),c=Math.min(l.length-1,Math.max(-1,s.historyIndex??l.length-1));return[i,{address:o,history:l,historyIndex:c,zoom:i4(s.zoom??1)}]}));return{size:dd,projects:n,projectUi:t.projectUi??{},projectBrowser:r}}const br=kl()(t0(e=>({size:dd,projects:{},projectUi:{},projectBrowser:{},togglePanel:(t,n)=>e(r=>({projects:{...r.projects,[t]:{...hx(r.projects,t),rightPanel:hx(r.projects,t).rightPanel===n?"hidden":n}}})),hidePanel:t=>e(n=>({projects:{...n.projects,[t]:{...hx(n.projects,t),rightPanel:"hidden"}}})),setSize:t=>e({size:Yee(t)}),navigateBrowser:(t,n)=>e(r=>{const i=tg(r.projectBrowser,t),s=Sw(n);if(!s)return{projectBrowser:{...r.projectBrowser,[t]:{...i,address:""}}};if(i.address===s)return r;const o=i.history.slice(0,i.historyIndex+1),l=o[o.length-1]===s?o:[...o,s];return{projectBrowser:{...r.projectBrowser,[t]:{...i,address:s,history:l,historyIndex:l.length-1}}}}),goBrowserBack:t=>e(n=>{const r=tg(n.projectBrowser,t),i=Math.max(0,r.historyIndex-1);return i===r.historyIndex||!r.history[i]?n:{projectBrowser:{...n.projectBrowser,[t]:{...r,address:r.history[i],historyIndex:i}}}}),goBrowserForward:t=>e(n=>{const r=tg(n.projectBrowser,t),i=Math.min(r.history.length-1,r.historyIndex+1);return i===r.historyIndex||!r.history[i]?n:{projectBrowser:{...n.projectBrowser,[t]:{...r,address:r.history[i],historyIndex:i}}}}),setBrowserZoom:(t,n)=>e(r=>{const i=tg(r.projectBrowser,t),s=i4(n);return i.zoom===s?r:{projectBrowser:{...r.projectBrowser,[t]:{...i,zoom:s}}}}),reconcileCollapsedPaths:(t,n)=>e(r=>{const i=r.projectUi[t]??zh(),s=Object.fromEntries(n.map(o=>[o,i.collapsedPaths[o]??!0]));return Object.keys(i.collapsedPaths).length===Object.keys(s).length&&Object.entries(s).every(([o,l])=>i.collapsedPaths[o]===l)?r:{projectUi:{...r.projectUi,[t]:{...i,collapsedPaths:s}}}}),toggleCollapsedPath:(t,n)=>e(r=>{const i=r.projectUi[t]??zh();return{projectUi:{...r.projectUi,[t]:{...i,collapsedPaths:{...i.collapsedPaths,[n]:!(i.collapsedPaths[n]??!0)}}}}}),setViewMode:(t,n)=>e(r=>{const i=r.projectUi[t]??zh();return i.viewMode===n?r:{projectUi:{...r.projectUi,[t]:{...i,viewMode:n}}}}),setCommitDraft:(t,n)=>e(r=>{const i=r.projectUi[t]??zh();return i.summary===n.summary&&i.description===n.description?r:{projectUi:{...r.projectUi,[t]:{...i,summary:n.summary,description:n.description}}}}),clearCommitDraft:t=>e(n=>{const r=n.projectUi[t]??zh();return!r.summary&&!r.description?n:{projectUi:{...n.projectUi,[t]:{...r,summary:"",description:""}}}}),clearProject:t=>e(n=>{const{[t]:r,...i}=n.projects,{[t]:s,...o}=n.projectUi,{[t]:l,...c}=n.projectBrowser;return{projects:i,projectUi:o,projectBrowser:c}})}),{name:"right-sidebar-layouts",version:7,migrate:Zee})),Jee={rightPanel:"hidden"};function ete(e){const t=e.match(/^\/(?:Users|home)\/[^/]+(?=\/|$)/),n=t==null?void 0:t[0];return n&&e===n?"~":n&&e.startsWith(`${n}/`)?`~/${e.slice(n.length+1)}`:e}function tte(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget.getBoundingClientRect();e.currentTarget.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:t.left+t.width/2,clientY:t.bottom,view:window}))}function ng({label:e,disabled:t,onClick:n,children:r}){return m.jsx(qe,{type:"button",variant:"ghost",size:"none",title:e,"aria-label":e,disabled:t,onClick:n,className:"h-8 w-8 shrink-0 border-border/0 text-muted-foreground hover:!border-border/0 hover:!bg-transparent hover:text-foreground disabled:opacity-40",children:r})}function nte({projectId:e,socket:t,onRunQuickAction:n}){const r=br(le=>le.projectBrowser[e]),i=br(le=>le.navigateBrowser),s=br(le=>le.setBrowserZoom),o=_.useRef(null),l=(r==null?void 0:r.address)??"",c=(r==null?void 0:r.zoom)??1,[d,f]=_.useState(l),[h,g]=_.useState(0),[v,y]=_.useState(()=>dx()??[]),[x,w]=_.useState(!1),[C,R]=_.useState(null),[E,T]=_.useState(()=>GN(e)??[]),[A,N]=_.useState(null),[D,L]=_.useState(""),[G,z]=_.useState(!1),[$,H]=_.useState(!1),[O,F]=_.useState(!1),U=_.useRef([]),j=v.filter(le=>le.sameProject),W=v.filter(le=>!le.sameProject),B=j.length===0,I=O||B?v:j,V=_.useCallback((le={})=>{const te=dx()!==null;le.silent||w(!0),R(null),Uee(t,e).then(y).catch(Ce=>R(Ce instanceof Error?Ce.message:String(Ce))).finally(()=>{(!le.silent||!te)&&w(!1)})},[e,t]),X=_.useCallback(le=>{y(Vee(le.port)),t.command({type:"browser.killLocalHttpServer",port:le.port}).then(()=>V({silent:!0})).catch(te=>R(te instanceof Error?te.message:String(te)))},[V,t]),P=_.useCallback(le=>{T(le),N(null),Gee(t,e,le).then(T).catch(te=>N(te instanceof Error?te.message:String(te)))},[e,t]),ie=_.useCallback(le=>{var Ce,Fe;le.preventDefault();const te=D.trim();te&&(P([...E,{id:((Fe=(Ce=globalThis.crypto)==null?void 0:Ce.randomUUID)==null?void 0:Fe.call(Ce))??`quick-action-${Date.now()}`,label:te,command:te}]),L(""),z(!1))},[D,E,P]),re=_.useCallback(le=>{P(E.filter(te=>te.id!==le))},[E,P]),se=_.useCallback(le=>{le.currentTarget.contains(le.relatedTarget)||z(!1)},[]),oe=_.useCallback(le=>{n(le),U.current.forEach(te=>window.clearTimeout(te)),U.current=[1e3,2e3].map(te=>window.setTimeout(()=>{V({silent:!0})},te))},[n,V]);_.useEffect(()=>{f(l)},[l]),_.useEffect(()=>{if(l)return;const le=dx();y(le||[]),V({silent:!!le})},[l,V]),_.useEffect(()=>{const le=GN(e);T(le||[]),N(null),Wee(t,e).then(T).catch(te=>N(te instanceof Error?te.message:String(te)))},[e,t]),_.useEffect(()=>{if(l)return;const le=window.setInterval(()=>{document.visibilityState==="visible"&&V({silent:!0})},7e3);return()=>window.clearInterval(le)},[l,V]),_.useEffect(()=>()=>{U.current.forEach(le=>window.clearTimeout(le)),U.current=[]},[]);const fe=m.jsxs("div",{className:"space-y-1.5",children:[m.jsxs("div",{className:"flex items-center gap-2 pl-1 text-sm font-medium mb-3",children:[m.jsx(aW,{className:"h-4 w-4 text-muted-foreground"}),m.jsx("span",{children:"Quick Actions"}),m.jsx(qe,{type:"button",variant:"ghost",size:"none","aria-label":"Add quick action",title:"Add quick action",onClick:()=>z(le=>!le),className:"ml-auto h-6 w-6 border-border/0 text-muted-foreground hover:!border-border/0 hover:!bg-transparent hover:text-foreground",children:m.jsx(od,{className:"h-4 w-4"})})]}),G?m.jsxs("form",{onSubmit:ie,onBlur:se,className:"relative flex h-[42px] min-w-0 items-center rounded-xl border border-border/70 px-3",children:[m.jsx(Or,{value:D,onChange:le=>L(le.target.value),placeholder:"bun run dev",className:"h-auto min-w-0 flex-1 border-0 bg-transparent p-0 pr-10 text-sm font-medium shadow-none outline-none focus-visible:ring-0 focus-visible:ring-offset-0",autoFocus:!0}),m.jsx(qe,{type:"submit",variant:"ghost",size:"none",disabled:!D.trim(),className:"absolute right-1.5 top-1/2 h-6 -translate-y-1/2 rounded-md px-2 text-xs text-muted-foreground hover:!bg-muted/40 hover:text-foreground",children:m.jsx(nO,{className:"h-3.5 w-3.5"})})]}):null,A?m.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:A}):null,E.length===0?m.jsx("div",{className:"rounded-md border border-dashed border-border/70 px-3 py-3 text-xs text-muted-foreground",children:"No quick actions."}):E.map(le=>m.jsxs(_l,{children:[m.jsx(yl,{asChild:!0,children:m.jsxs("div",{role:"button",tabIndex:0,onClick:()=>oe(le.command),onKeyDown:te=>{te.key!=="Enter"&&te.key!==" "||(te.preventDefault(),oe(le.command))},className:"flex min-w-0 cursor-pointer items-center gap-2 rounded-xl border border-border/70 px-3 pr-[10px] py-2 outline-none hover:bg-muted/40 focus-visible:outline-none active:outline-none",title:le.command,children:[m.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-sm font-medium text-foreground",children:le.label}),m.jsx(qe,{type:"button",variant:"ghost",size:"none","aria-label":"Run quick action",title:"Run quick action",onClick:te=>{te.stopPropagation(),oe(le.command)},className:"h-6 w-6 shrink-0 border-border/0 text-muted-foreground hover:!border-border/0 hover:!bg-transparent hover:text-foreground",children:m.jsx(_V,{className:"h-3.5 w-3.5"})})]})}),m.jsx(ra,{children:m.jsxs(Cn,{onSelect:te=>{te.preventDefault(),re(le.id)},className:"text-destructive focus:text-destructive",children:[m.jsx(Rf,{className:"h-3.5 w-3.5"}),m.jsx("span",{children:"Delete"})]})})]},le.id))]});function de(le){le.preventDefault(),i(e,d)}function ve(){if(!l){V();return}g(le=>le+1)}return m.jsx("div",{className:"h-full min-h-0 border-l border-border bg-background md:min-w-[370px]",children:m.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[m.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-2 py-2",children:[m.jsx(ng,{label:"Home",onClick:()=>i(e,""),children:m.jsx(BU,{className:"h-4 w-4"})}),m.jsx(ng,{label:"Refresh",onClick:ve,children:m.jsx(dO,{className:"h-4 w-4"})}),m.jsxs("form",{onSubmit:de,className:"group relative min-w-0 flex-1",children:[m.jsx(Or,{value:d,onChange:le=>f(le.target.value),placeholder:"Enter a URL",className:"h-7 rounded-[9px] px-[28px] text-xs text-muted-foreground focus:text-foreground hover:text-foreground text-center border-border/0 bg-background hover:bg-card focus:bg-card hover:border-border/50 focus:border-border/50 transition-all"}),l?m.jsx(qe,{type:"button",variant:"ghost",size:"none",title:"Open external","aria-label":"Open external",onClick:()=>window.open(l,"_blank","noopener,noreferrer"),className:"absolute right-1 top-1/2 h-6 w-6 -translate-y-1/2 border-border/0 text-muted-foreground opacity-0 hover:!border-border/0 hover:!bg-transparent hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100",children:m.jsx(op,{className:"h-3.5 w-3.5"})}):null]}),m.jsxs(uo,{open:$,children:[m.jsx(ho,{asChild:!0,children:m.jsxs("div",{className:"flex shrink-0 items-center gap-0",onMouseEnter:()=>H(!0),onMouseLeave:()=>H(!1),onFocus:()=>H(!0),onBlur:le=>{le.currentTarget.contains(le.relatedTarget)||H(!1)},children:[m.jsx(ng,{label:"Zoom out",onClick:()=>s(e,c-.1),children:m.jsx(uO,{className:"h-4 w-4"})}),m.jsx(ng,{label:"Zoom in",onClick:()=>s(e,c+.1),children:m.jsx(od,{className:"h-4 w-4"})})]})}),m.jsxs(Ps,{side:"bottom",children:[Math.round(c*100),"%"]})]})]}),m.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:l?m.jsx("div",{className:"h-full w-full overflow-auto bg-muted/20",children:m.jsx("iframe",{ref:o,src:l,title:"Browser panel",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-same-origin allow-scripts",className:"h-full w-full origin-top-left border-0 bg-background",style:{width:`${100/c}%`,height:`${100/c}%`,transform:`scale(${c})`}},`${l}-${h}`)}):m.jsx("div",{className:"h-full overflow-y-auto p-3 ",children:m.jsxs("div",{className:"h-full mx-auto max-w-[450px] flex flex-col",style:{justifyContent:"start"},children:[m.jsxs("div",{className:"pl-1 mb-3 flex items-center gap-2 text-sm font-medium",children:[m.jsx(aC,{className:"h-4 w-4 text-muted-foreground"}),m.jsx("span",{children:"Local Servers"})]}),m.jsxs("div",{className:"space-y-4",children:[C?m.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:C}):x?m.jsx("div",{className:"space-y-1.5 animate-pulse",children:[0,1,2].map(le=>m.jsxs("div",{className:"flex w-full min-w-0 flex-col rounded-md border border-border/70 px-3 py-2",children:[m.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[m.jsx("div",{className:le===1?"h-4 w-36 rounded bg-muted":"h-4 w-28 rounded bg-muted"}),m.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-muted"}),m.jsx("div",{className:"ml-auto h-6 w-6 rounded bg-muted"})]}),m.jsxs("div",{className:"mt-1.5 flex w-full min-w-0 items-center gap-3",children:[m.jsx("div",{className:le===2?"h-3 w-32 rounded bg-muted":"h-3 w-40 rounded bg-muted"}),m.jsx("div",{className:"ml-auto h-3 w-[42%] rounded bg-muted"})]})]},le))}):v.length===0?m.jsx("div",{className:"flex h-40 items-center justify-center px-6 text-center text-sm text-muted-foreground",children:"No local HTTP servers found."}):m.jsxs("div",{className:"space-y-1.5",children:[I.map(le=>m.jsxs(_l,{children:[m.jsx(yl,{asChild:!0,children:m.jsxs("div",{role:"button",tabIndex:0,onClick:()=>i(e,le.address),onKeyDown:te=>{te.key!=="Enter"&&te.key!==" "||(te.preventDefault(),i(e,le.address))},className:"flex w-full min-w-0 cursor-pointer flex-col rounded-xl border border-border/70 px-3 py-1.5 pb-2.5 text-left outline-none hover:border-border hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[m.jsxs("span",{className:"flex w-full min-w-0 items-center gap-2",children:[m.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[m.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-foreground",children:le.title}),le.sameProject?m.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-400"}):null]}),m.jsx(qe,{type:"button",variant:"ghost",size:"none","aria-label":"Server actions",title:"Server actions",onClick:tte,className:"!h-auto !w-auto shrink-0 border-border/0 text-muted-foreground hover:!border-border/0 hover:!bg-transparent hover:text-foreground",children:m.jsx(Eb,{className:"w-4"})})]}),m.jsxs("span",{className:"flex w-full min-w-0 items-center gap-3",children:[m.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:le.address}),le.ownerPath?m.jsx("span",{className:"max-w-[45%] shrink-0 truncate text-right text-[11px] text-muted-foreground/70",children:ete(le.ownerPath)}):null]})]})}),m.jsxs(ra,{children:[m.jsxs(Cn,{onSelect:te=>{te.preventDefault(),window.open(le.address,"_blank","noopener,noreferrer")},children:[m.jsx(HV,{className:"h-3.5 w-3.5"}),m.jsx("span",{children:"Open in New Tab"})]}),m.jsxs(Cn,{onSelect:te=>{te.preventDefault(),X(le)},className:"text-destructive focus:text-destructive",children:[m.jsx(Rf,{className:"h-3.5 w-3.5"}),m.jsx("span",{children:"Kill Process"})]})]})]},le.address)),W.length>0&&!B?m.jsx(qe,{type:"button",variant:"ghost",size:"none",onClick:()=>F(le=>!le),className:"h-8 w-fit rounded-md px-2 text-xs text-muted-foreground hover:!bg-muted/40",children:O?"Hide other projects":`Other projects (${W.length})`}):null]}),fe,m.jsx("div",{className:"h-3"})]})]})})})]})})}const rte=_.memo(nte),ite={position:"absolute",top:0,bottom:0,textAlign:"center"},ste={display:"contents"};function qN(){return null}const Fv="diffs-container",ote=/(?=^From [a-f0-9]+ .+$)/m,Yg=/(?=^diff --git)/gm,KN=/(?=^---\s+\S)/gm,ate=/(?=^@@ )/gm,lte=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,fx=new RegExp("(?<=\\n)"),cte=/^(---|\+\+\+)\s+([^\t\r\n]+)/,ute=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,dte=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,hte=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,uk="header-prefix",dk="header-metadata",hk="header-custom",so={dark:"pierre-dark",light:"pierre-light"},s4="data-theme-css",o4="data-unsafe-css",Ju=1,fte={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},pte=Object.freeze({fromStart:0,fromEnd:0}),YN={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},mte={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function jf(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function gte(e,t){return typeof window>"u"&&t!=null?m.jsxs(m.Fragment,{children:[m.jsx("template",{shadowrootmode:"open",dangerouslySetInnerHTML:{__html:t}}),e]}):m.jsx(m.Fragment,{children:e})}const vte=_.createContext(void 0);function bte(){return _.useContext(vte)}const gc=new Map,px=new Map,ww=new Map,Cw=new Set;function XN(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let r;if(typeof n=="string"){if(r=gc.get(n),r==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else r=n,n=n.name,gc.has(n)||gc.set(n,r);Cw.has(n)||(Cw.add(n),t.loadThemeSync(r))}}const _te="modulepreload",yte=function(e){return"/"+e},QN={},Y=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(d){return Promise.all(d.map(f=>Promise.resolve(f).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(n.map(d=>{if(d=yte(d),d in QN)return;QN[d]=!0;const f=d.endsWith(".css"),h=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const g=document.createElement("link");if(g.rel=f?"stylesheet":_te,f||(g.as="script"),g.crossOrigin="",g.href=d,c&&g.setAttribute("nonce",c),document.head.appendChild(g),f)return new Promise((v,y)=>{g.addEventListener("load",v),g.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},zf=new Map,mx=new Map,xte=new Map,kw=new Set;function ZN(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(kw.has(n.name))continue;let r=zf.get(n.name);r==null&&(r=n,zf.set(n.name,r)),kw.add(r.name),t.loadLanguageSync(r.data)}}function a4(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}let nr=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function Ste(e){return fk(e)}function fk(e){return Array.isArray(e)?wte(e):e instanceof RegExp?e:typeof e=="object"?Cte(e):e}function wte(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=fk(e[n]);return t}function Cte(e){let t={};for(let n in e)t[n]=fk(e[n]);return t}function l4(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function c4(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?c4(e.substring(0,e.length-1)):e.substr(~t+1)}var gx=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,rg=class{static hasCaptures(e){return e===null?!1:(gx.lastIndex=0,gx.test(e))}static replaceCaptures(e,t,n){return e.replace(gx,(r,i,s,o)=>{let l=n[parseInt(i||s,10)];if(l){let c=t.substring(l.start,l.end);for(;c[0]===".";)c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function u4(e,t){return e<t?-1:e>t?1:0}function d4(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let i=0;i<n;i++){let s=u4(e[i],t[i]);if(s!==0)return s}return 0}return n-r}function JN(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function h4(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var f4=class{constructor(e){ee(this,"cache",new Map);this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},Hv=class{constructor(e,t,n){ee(this,"_cachedMatchRoot",new f4(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Rte(e),t)}static createFromParsedTheme(e,t){return Ate(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(i=>kte(e.parent,i.parentScopes));return r?new p4(r.fontStyle,r.foreground,r.background):null}},vx=class Xg{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Xg(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Xg(n,t[r]);return n}push(t){return new Xg(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function kte(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Ete(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Ete(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var p4=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Rte(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let i=0,s=t.length;i<s;i++){let o=t[i];if(!o.settings)continue;let l;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),l=h.split(",")}else Array.isArray(o.scope)?l=o.scope:l=[""];let c=-1;if(typeof o.settings.fontStyle=="string"){c=0;let h=o.settings.fontStyle.split(" ");for(let g=0,v=h.length;g<v;g++)switch(h[g]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let d=null;typeof o.settings.foreground=="string"&&JN(o.settings.foreground)&&(d=o.settings.foreground);let f=null;typeof o.settings.background=="string"&&JN(o.settings.background)&&(f=o.settings.background);for(let h=0,g=l.length;h<g;h++){let y=l[h].trim().split(" "),x=y[y.length-1],w=null;y.length>1&&(w=y.slice(0,y.length-1),w.reverse()),n[r++]=new Tte(x,w,i,c,d,f)}}return n}var Tte=class{constructor(e,t,n,r,i,s){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=s}},Vr=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(Vr||{});function Ate(e,t){e.sort((c,d)=>{let f=u4(c.scope,d.scope);return f!==0||(f=d4(c.parentScopes,d.parentScopes),f!==0)?f:c.index-d.index});let n=0,r="#000000",i="#ffffff";for(;e.length>=1&&e[0].scope==="";){let c=e.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(i=c.background)}let s=new Nte(t),o=new p4(n,s.getId(r),s.getId(i)),l=new Lte(new Ew(0,null,-1,0,0),[]);for(let c=0,d=e.length;c<d;c++){let f=e[c];l.insert(0,f.scope,f.parentScopes,f.fontStyle,s.getId(f.foreground),s.getId(f.background))}return new Hv(s,o,l)}var Nte=class{constructor(e){ee(this,"_isFrozen");ee(this,"_lastColorId");ee(this,"_id2color");ee(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Mte=Object.freeze([]),Ew=class m4{constructor(t,n,r,i,s){ee(this,"scopeDepth");ee(this,"parentScopes");ee(this,"fontStyle");ee(this,"foreground");ee(this,"background");this.scopeDepth=t,this.parentScopes=n||Mte,this.fontStyle=r,this.foreground=i,this.background=s}clone(){return new m4(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,i=t.length;r<i;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,i){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),i!==0&&(this.background=i)}},Lte=class Rw{constructor(t,n=[],r={}){ee(this,"_rulesWithParentScopes");this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,i=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[i]===">"&&i++,!(r>=t.parentScopes.length||i>=n.parentScopes.length);){const s=n.parentScopes[i].length-t.parentScopes[r].length;if(s!==0)return s;r++,i++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),i,s;if(r===-1?(i=t,s=""):(i=t.substring(0,r),s=t.substring(r+1)),this._children.hasOwnProperty(i))return this._children[i].match(s)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Rw._cmpBySpecificity),n}insert(t,n,r,i,s,o){if(n===""){this._doInsertHere(t,r,i,s,o);return}let l=n.indexOf("."),c,d;l===-1?(c=n,d=""):(c=n.substring(0,l),d=n.substring(l+1));let f;this._children.hasOwnProperty(c)?f=this._children[c]:(f=new Rw(this._mainRule.clone(),Ew.cloneArr(this._rulesWithParentScopes)),this._children[c]=f),f.insert(t+1,d,r,i,s,o)}_doInsertHere(t,n,r,i,s){if(n===null){this._mainRule.acceptOverwrite(t,r,i,s);return}for(let o=0,l=this._rulesWithParentScopes.length;o<l;o++){let c=this._rulesWithParentScopes[o];if(d4(c.parentScopes,n)===0){c.acceptOverwrite(t,r,i,s);return}}r===-1&&(r=this._mainRule.fontStyle),i===0&&(i=this._mainRule.foreground),s===0&&(s=this._mainRule.background),this._rulesWithParentScopes.push(new Ew(t,n,r,i,s))}},hd=class as{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=as.getLanguageId(t),r=as.getTokenType(t),i=as.getFontStyle(t),s=as.getForeground(t),o=as.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:s,background:o})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,i,s,o,l){let c=as.getLanguageId(t),d=as.getTokenType(t),f=as.containsBalancedBrackets(t)?1:0,h=as.getFontStyle(t),g=as.getForeground(t),v=as.getBackground(t);return n!==0&&(c=n),r!==8&&(d=r),i!==null&&(f=i?1:0),s!==-1&&(h=s),o!==0&&(g=o),l!==0&&(v=l),(c<<0|d<<8|f<<10|h<<11|g<<15|v<<24)>>>0}};function $v(e,t){const n=[],r=Dte(e);let i=r.next();for(;i!==null;){let c=0;if(i.length===2&&i.charAt(1)===":"){switch(i.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let d=o();if(n.push({matcher:d,priority:c}),i!==",")break;i=r.next()}return n;function s(){if(i==="-"){i=r.next();const c=s();return d=>!!c&&!c(d)}if(i==="("){i=r.next();const c=l();return i===")"&&(i=r.next()),c}if(eM(i)){const c=[];do c.push(i),i=r.next();while(eM(i));return d=>t(c,d)}return null}function o(){const c=[];let d=s();for(;d;)c.push(d),d=s();return f=>c.every(h=>h(f))}function l(){const c=[];let d=o();for(;d&&(c.push(d),i==="|"||i===",");){do i=r.next();while(i==="|"||i===",");d=o()}return f=>c.some(h=>h(f))}}function eM(e){return!!e&&!!e.match(/[\w\.:]+/)}function Dte(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function g4(e){typeof e.dispose=="function"&&e.dispose()}var Bf=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Ite=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Pte=class{constructor(){ee(this,"_references",[]);ee(this,"_seenReferenceKeys",new Set);ee(this,"visitedRule",new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Ote=class{constructor(e,t){ee(this,"seenFullScopeRequests",new Set);ee(this,"seenPartialScopeRequests",new Set);ee(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Bf(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new Pte;for(const n of e)jte(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Bf){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function jte(e,t,n,r){const i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const s=n.lookup(t);e instanceof Bf?Qg({baseGrammar:s,selfGrammar:i},r):Tw(e.ruleName,{baseGrammar:s,selfGrammar:i,repository:i.repository},r);const o=n.injections(e.scopeName);if(o)for(const l of o)r.add(new Bf(l))}function Tw(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];Uv([r],t,n)}}function Qg(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Uv(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Uv(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Uv(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const i=r.repository?l4({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Uv(r.patterns,{...t,repository:i},n);const s=r.include;if(!s)continue;const o=v4(s);switch(o.kind){case 0:Qg({...t,selfGrammar:t.baseGrammar},n);break;case 1:Qg(t,n);break;case 2:Tw(o.ruleName,{...t,repository:i},n);break;case 3:case 4:const l=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(l){const c={baseGrammar:t.baseGrammar,selfGrammar:l,repository:i};o.kind===4?Tw(o.ruleName,c,n):Qg(c,n)}else o.kind===4?n.add(new Ite(o.scopeName,o.ruleName)):n.add(new Bf(o.scopeName));break}}}var zte=class{constructor(){ee(this,"kind",0)}},Bte=class{constructor(){ee(this,"kind",1)}},Fte=class{constructor(e){ee(this,"kind",2);this.ruleName=e}},Hte=class{constructor(e){ee(this,"kind",3);this.scopeName=e}},$te=class{constructor(e,t){ee(this,"kind",4);this.scopeName=e,this.ruleName=t}};function v4(e){if(e==="$base")return new zte;if(e==="$self")return new Bte;const t=e.indexOf("#");if(t===-1)return new Hte(e);if(t===0)return new Fte(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new $te(n,r)}}var Ute=/\\(\d+)/,tM=/\\(\d+)/g,Vte=-1,b4=-2;var bp=class{constructor(e,t,n,r){ee(this,"$location");ee(this,"id");ee(this,"_nameIsCapturing");ee(this,"_name");ee(this,"_contentNameIsCapturing");ee(this,"_contentName");this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=rg.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=rg.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${c4(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:rg.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:rg.replaceCaptures(this._contentName,e,t)}},Wte=class extends bp{constructor(t,n,r,i,s){super(t,n,r,i);ee(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,n){throw new Error("Not supported!")}compile(t,n){throw new Error("Not supported!")}compileAG(t,n,r,i){throw new Error("Not supported!")}},Gte=class extends bp{constructor(t,n,r,i,s){super(t,n,r,null);ee(this,"_match");ee(this,"captures");ee(this,"_cachedCompiledPatterns");this._match=new Ff(i,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t).compileAG(t,r,i)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Hf,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},nM=class extends bp{constructor(t,n,r,i,s){super(t,n,r,i);ee(this,"hasMissingPatterns");ee(this,"patterns");ee(this,"_cachedCompiledPatterns");this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,n){for(const r of this.patterns)t.getRule(r).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t).compileAG(t,r,i)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Hf,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Aw=class extends bp{constructor(t,n,r,i,s,o,l,c,d,f){super(t,n,r,i);ee(this,"_begin");ee(this,"beginCaptures");ee(this,"_end");ee(this,"endHasBackReferences");ee(this,"endCaptures");ee(this,"applyEndPatternLast");ee(this,"hasMissingPatterns");ee(this,"patterns");ee(this,"_cachedCompiledPatterns");this._begin=new Ff(s,this.id),this.beginCaptures=o,this._end=new Ff(l||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,this.applyEndPatternLast=d||!1,this.patterns=f.patterns,this.hasMissingPatterns=f.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t,n).compileAG(t,r,i)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Hf;for(const r of this.patterns)t.getRule(r).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},Vv=class extends bp{constructor(t,n,r,i,s,o,l,c,d){super(t,n,r,i);ee(this,"_begin");ee(this,"beginCaptures");ee(this,"whileCaptures");ee(this,"_while");ee(this,"whileHasBackReferences");ee(this,"hasMissingPatterns");ee(this,"patterns");ee(this,"_cachedCompiledPatterns");ee(this,"_cachedCompiledWhilePatterns");this._begin=new Ff(s,this.id),this.beginCaptures=o,this.whileCaptures=c,this._while=new Ff(l,b4),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t).compileAG(t,r,i)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Hf;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,r,i){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,r,i)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Hf,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||"￿"),this._cachedCompiledWhilePatterns}},_4=class Hr{static createCaptureRule(t,n,r,i,s){return t.registerRule(o=>new Wte(n,o,r,i,s))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new Gte(t.$vscodeTextmateLocation,t.id,t.name,t.match,Hr._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=l4({},r,t.repository));let s=t.patterns;return typeof s>"u"&&t.include&&(s=[{include:t.include}]),new nM(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Hr._compilePatterns(s,n,r))}return t.while?new Vv(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Hr._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,Hr._compileCaptures(t.whileCaptures||t.captures,n,r),Hr._compilePatterns(t.patterns,n,r)):new Aw(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Hr._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,Hr._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,Hr._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let s=0;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const l=parseInt(o,10);l>s&&(s=l)}for(let o=0;o<=s;o++)i[o]=null;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const l=parseInt(o,10);let c=0;t[o].patterns&&(c=Hr.getCompiledRuleId(t[o],n,r)),i[l]=Hr.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,c)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let s=0,o=t.length;s<o;s++){const l=t[s];let c=-1;if(l.include){const d=v4(l.include);switch(d.kind){case 0:case 1:c=Hr.getCompiledRuleId(r[l.include],n,r);break;case 2:let f=r[d.ruleName];f&&(c=Hr.getCompiledRuleId(f,n,r));break;case 3:case 4:const h=d.scopeName,g=d.kind===4?d.ruleName:null,v=n.getExternalGrammar(h,r);if(v)if(g){let y=v.repository[g];y&&(c=Hr.getCompiledRuleId(y,n,v.repository))}else c=Hr.getCompiledRuleId(v.repository.$self,n,v.repository);break}}else c=Hr.getCompiledRuleId(l,n,r);if(c!==-1){const d=n.getRule(c);let f=!1;if((d instanceof nM||d instanceof Aw||d instanceof Vv)&&d.hasMissingPatterns&&d.patterns.length===0&&(f=!0),f)continue;i.push(c)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},Ff=class y4{constructor(t,n){ee(this,"source");ee(this,"ruleId");ee(this,"hasAnchor");ee(this,"hasBackReferences");ee(this,"_anchorCache");if(t&&typeof t=="string"){const r=t.length;let i=0,s=[],o=!1;for(let l=0;l<r;l++)if(t.charAt(l)==="\\"&&l+1<r){const d=t.charAt(l+1);d==="z"?(s.push(t.substring(i,l)),s.push("$(?!\\n)(?<!\\n)"),i=l+2):(d==="A"||d==="G")&&(o=!0),l++}this.hasAnchor=o,i===0?this.source=t:(s.push(t.substring(i,r)),this.source=s.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=Ute.test(this.source):this.hasBackReferences=!1}clone(){return new y4(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(i=>t.substring(i.start,i.end));return tM.lastIndex=0,this.source.replace(tM,(i,s)=>h4(r[parseInt(s,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],i=[],s,o,l,c;for(s=0,o=this.source.length;s<o;s++)l=this.source.charAt(s),t[s]=l,n[s]=l,r[s]=l,i[s]=l,l==="\\"&&s+1<o&&(c=this.source.charAt(s+1),c==="A"?(t[s+1]="￿",n[s+1]="￿",r[s+1]="A",i[s+1]="A"):c==="G"?(t[s+1]="￿",n[s+1]="G",r[s+1]="￿",i[s+1]="G"):(t[s+1]=c,n[s+1]=c,r[s+1]=c,i[s+1]=c),s++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:i.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Hf=class{constructor(){ee(this,"_items");ee(this,"_hasAnchors");ee(this,"_cached");ee(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new rM(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(i=>i.resolveAnchors(t,n));return new rM(e,r,this._items.map(i=>i.ruleId))}},rM=class{constructor(e,t,n){ee(this,"scanner");this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
665
665
  `)}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},bx=class{constructor(e,t){this.languageId=e,this.tokenType=t}},qo,qte=(qo=class{constructor(t,n){ee(this,"_defaultAttributes");ee(this,"_embeddedLanguagesMatcher");ee(this,"_getBasicScopeAttributes",new f4(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new bx(n,r)}));this._defaultAttributes=new bx(t,8),this._embeddedLanguagesMatcher=new Kte(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?qo._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(qo.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},ee(qo,"_NULL_SCOPE_METADATA",new bx(0,0)),ee(qo,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),qo),Kte=class{constructor(e){ee(this,"values");ee(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>h4(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},iM=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function x4(e,t,n,r,i,s,o,l){const c=t.content.length;let d=!1,f=-1;if(o){const v=Yte(e,t,n,r,i,s);i=v.stack,r=v.linePos,n=v.isFirstLine,f=v.anchorPosition}const h=Date.now();for(;!d;){if(l!==0&&Date.now()-h>l)return new iM(i,!0);g()}return new iM(i,!1);function g(){const v=Xte(e,t,n,r,i,f);if(!v){s.produce(i,c),d=!0;return}const y=v.captureIndices,x=v.matchedRuleId,w=y&&y.length>0?y[0].end>r:!1;if(x===Vte){const C=i.getRule(e);s.produce(i,y[0].start),i=i.withContentNameScopesList(i.nameScopesList),ef(e,t,n,i,s,C.endCaptures,y),s.produce(i,y[0].end);const R=i;if(i=i.parent,f=R.getAnchorPos(),!w&&R.getEnterPos()===r){i=R,s.produce(i,c),d=!0;return}}else{const C=e.getRule(x);s.produce(i,y[0].start);const R=i,E=C.getName(t.content,y),T=i.contentNameScopesList.pushAttributed(E,e);if(i=i.push(x,r,f,y[0].end===c,null,T,T),C instanceof Aw){const A=C;ef(e,t,n,i,s,A.beginCaptures,y),s.produce(i,y[0].end),f=y[0].end;const N=A.getContentName(t.content,y),D=T.pushAttributed(N,e);if(i=i.withContentNameScopesList(D),A.endHasBackReferences&&(i=i.withEndRule(A.getEndWithResolvedBackReferences(t.content,y))),!w&&R.hasSameRuleAs(i)){i=i.pop(),s.produce(i,c),d=!0;return}}else if(C instanceof Vv){const A=C;ef(e,t,n,i,s,A.beginCaptures,y),s.produce(i,y[0].end),f=y[0].end;const N=A.getContentName(t.content,y),D=T.pushAttributed(N,e);if(i=i.withContentNameScopesList(D),A.whileHasBackReferences&&(i=i.withEndRule(A.getWhileWithResolvedBackReferences(t.content,y))),!w&&R.hasSameRuleAs(i)){i=i.pop(),s.produce(i,c),d=!0;return}}else if(ef(e,t,n,i,s,C.captures,y),s.produce(i,y[0].end),i=i.pop(),!w){i=i.safePop(),s.produce(i,c),d=!0;return}}y[0].end>r&&(r=y[0].end,n=!1)}}function Yte(e,t,n,r,i,s){let o=i.beginRuleCapturedEOL?0:-1;const l=[];for(let c=i;c;c=c.pop()){const d=c.getRule(e);d instanceof Vv&&l.push({rule:d,stack:c})}for(let c=l.pop();c;c=l.pop()){const{ruleScanner:d,findOptions:f}=Jte(c.rule,e,c.stack.endRule,n,r===o),h=d.findNextMatchSync(t,r,f);if(h){if(h.ruleId!==b4){i=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(s.produce(c.stack,h.captureIndices[0].start),ef(e,t,n,c.stack,s,c.rule.whileCaptures,h.captureIndices),s.produce(c.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>r&&(r=h.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Xte(e,t,n,r,i,s){const o=Qte(e,t,n,r,i,s),l=e.getInjections();if(l.length===0)return o;const c=Zte(l,e,t,n,r,i,s);if(!c)return o;if(!o)return c;const d=o.captureIndices[0].start,f=c.captureIndices[0].start;return f<d||c.priorityMatch&&f===d?c:o}function Qte(e,t,n,r,i,s){const o=i.getRule(e),{ruleScanner:l,findOptions:c}=S4(o,e,i.endRule,n,r===s),d=l.findNextMatchSync(t,r,c);return d?{captureIndices:d.captureIndices,matchedRuleId:d.ruleId}:null}function Zte(e,t,n,r,i,s,o){let l=Number.MAX_VALUE,c=null,d,f=0;const h=s.contentNameScopesList.getScopeNames();for(let g=0,v=e.length;g<v;g++){const y=e[g];if(!y.matcher(h))continue;const x=t.getRule(y.ruleId),{ruleScanner:w,findOptions:C}=S4(x,t,null,r,i===o),R=w.findNextMatchSync(n,i,C);if(!R)continue;const E=R.captureIndices[0].start;if(!(E>=l)&&(l=E,c=R.captureIndices,d=R.ruleId,f=y.priority,l===i))break}return c?{priorityMatch:f===-1,captureIndices:c,matchedRuleId:d}:null}function S4(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Jte(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function ef(e,t,n,r,i,s,o){if(s.length===0)return;const l=t.content,c=Math.min(s.length,o.length),d=[],f=o[0].end;for(let h=0;h<c;h++){const g=s[h];if(g===null)continue;const v=o[h];if(v.length===0)continue;if(v.start>f)break;for(;d.length>0&&d[d.length-1].endPos<=v.start;)i.produceFromScopes(d[d.length-1].scopes,d[d.length-1].endPos),d.pop();if(d.length>0?i.produceFromScopes(d[d.length-1].scopes,v.start):i.produce(r,v.start),g.retokenizeCapturedWithRuleId){const x=g.getName(l,o),w=r.contentNameScopesList.pushAttributed(x,e),C=g.getContentName(l,o),R=w.pushAttributed(C,e),E=r.push(g.retokenizeCapturedWithRuleId,v.start,-1,!1,null,w,R),T=e.createOnigString(l.substring(0,v.end));x4(e,T,n&&v.start===0,v.start,E,i,!1,0),g4(T);continue}const y=g.getName(l,o);if(y!==null){const w=(d.length>0?d[d.length-1].scopes:r.contentNameScopesList).pushAttributed(y,e);d.push(new ene(w,v.end))}}for(;d.length>0;)i.produceFromScopes(d[d.length-1].scopes,d[d.length-1].endPos),d.pop()}var ene=class{constructor(e,t){ee(this,"scopes");ee(this,"endPos");this.scopes=e,this.endPos=t}};function tne(e,t,n,r,i,s,o,l){return new rne(e,t,n,r,i,s,o,l)}function sM(e,t,n,r,i){const s=$v(t,Wv),o=_4.getCompiledRuleId(n,r,i.repository);for(const l of s)e.push({debugSelector:t,matcher:l.matcher,ruleId:o,grammar:i,priority:l.priority})}function Wv(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let i=n;i<t.length;i++)if(nne(t[i],r))return n=i+1,!0;return!1})}function nne(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var rne=class{constructor(e,t,n,r,i,s,o,l){ee(this,"_rootId");ee(this,"_lastRuleId");ee(this,"_ruleId2desc");ee(this,"_includedGrammars");ee(this,"_grammarRepository");ee(this,"_grammar");ee(this,"_injections");ee(this,"_basicScopeAttributesProvider");ee(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=s,this._onigLib=l,this._basicScopeAttributesProvider=new qte(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=oM(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(const c of Object.keys(i)){const d=$v(c,Wv);for(const f of d)this._tokenTypeMatchers.push({matcher:f.matcher,type:i[c]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:i=>i===this._rootScopeName?this._grammar:this.getExternalGrammar(i),injections:i=>this._grammarRepository.injections(i)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){const i=r.injections;if(i)for(let o in i)sM(t,o,i[o],this,r);const s=this._grammarRepository.injections(n);s&&s.forEach(o=>{const l=this.getExternalGrammar(o);if(l){const c=l.injectionSelector;c&&sM(t,c,l,this,l)}})}return t.sort((i,s)=>i.priority-s.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=oM(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=_4.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Nw.NULL){i=!0;const d=this._basicScopeAttributesProvider.getDefaultAttributes(),f=this.themeProvider.getDefaults(),h=hd.set(0,d.languageId,d.tokenType,null,f.fontStyle,f.foregroundId,f.backgroundId),g=this.getRule(this._rootId).getName(null,null);let v;g?v=vf.createRootAndLookUpScopeName(g,h,this):v=vf.createRoot("unknown",h),t=new Nw(null,this._rootId,-1,-1,!1,null,v,v)}else i=!1,t.reset();e=e+`
666
666
  `;const s=this.createOnigString(e),o=s.content.length,l=new sne(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=x4(this,s,i,0,t,l,!0,r);return g4(s),{lineLength:o,lineTokens:l,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function oM(e,t){return e=Ste(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var vf=class Qs{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,i=(t==null?void 0:t.scopePath)??null;for(const s of n)i=vx.push(i,s.scopeNames),r=new Qs(r,i,s.encodedTokenAttributes);return r}static createRoot(t,n){return new Qs(null,new vx(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const i=r.getMetadataForScope(t),s=new vx(null,t),o=r.themeProvider.themeMatch(s),l=Qs.mergeAttributes(n,i,o);return new Qs(null,s,l)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Qs.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let i=-1,s=0,o=0;return r!==null&&(i=r.fontStyle,s=r.foregroundId,o=r.backgroundId),hd.set(t,n.languageId,n.tokenType,null,i,s,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return Qs._pushAttributed(this,t,n);const r=t.split(/ /g);let i=this;for(const s of r)i=Qs._pushAttributed(i,s,n);return i}static _pushAttributed(t,n,r){const i=r.getMetadataForScope(n),s=t.scopePath.push(n),o=r.themeProvider.themeMatch(s),l=Qs.mergeAttributes(t.tokenAttributes,i,o);return new Qs(t,s,l)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var i;const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(((i=r.parent)==null?void 0:i.scopePath)??null)}),r=r.parent;return r===t?n.reverse():void 0}},hs,Nw=(hs=class{constructor(t,n,r,i,s,o,l,c){ee(this,"_stackElementBrand");ee(this,"_enterPos");ee(this,"_anchorPos");ee(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=s,this.endRule=o,this.nameScopesList=l,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=i}equals(t){return t===null?!1:hs._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?vf.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){hs._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,s,o,l){return new hs(this,t,n,r,i,s,o,l)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){var r,i;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(r=this.nameScopesList)==null?void 0:r.toString()}, ${(i=this.contentNameScopesList)==null?void 0:i.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new hs(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var t,n,r;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((t=this.parent)==null?void 0:t.nameScopesList)??null))??[],contentNameScopesList:((r=this.contentNameScopesList)==null?void 0:r.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,n){const r=vf.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new hs(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,vf.fromExtension(r,n.contentNameScopesList))}},ee(hs,"NULL",new hs(null,0,0,0,!1,null,null,null)),hs),ine=class{constructor(e,t){ee(this,"balancedBracketScopes");ee(this,"unbalancedBracketScopes");ee(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):$v(n,Wv).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>$v(n,Wv).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},sne=class{constructor(e,t,n,r){ee(this,"_emitBinaryTokens");ee(this,"_lineText");ee(this,"_tokens");ee(this,"_binaryTokens");ee(this,"_lastTokenEndIndex");ee(this,"_tokenTypeOverrides");this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var r;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let i=(e==null?void 0:e.tokenAttributes)??0,s=!1;if((r=this.balancedBracketSelectors)!=null&&r.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=(e==null?void 0:e.getScopeNames())??[];for(const l of this._tokenTypeOverrides)l.matcher(o)&&(i=hd.set(i,0,l.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(o))}if(s&&(i=hd.set(i,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===i){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(i),this._lastTokenEndIndex=t;return}const n=(e==null?void 0:e.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,i=this._binaryTokens.length;r<i;r++)n[r]=this._binaryTokens[r];return n}},one=class{constructor(e,t){ee(this,"_grammars",new Map);ee(this,"_rawGrammars",new Map);ee(this,"_injectionGrammars",new Map);ee(this,"_theme");this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let s=this._rawGrammars.get(e);if(!s)return null;this._grammars.set(e,tne(e,s,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},ane=class{constructor(t){ee(this,"_options");ee(this,"_syncRegistry");ee(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new one(Hv.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(Hv.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,r){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(t,n,r){return this._loadGrammar(t,n,r.embeddedLanguages,r.tokenTypes,new ine(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,i,s){const o=new Ote(this._syncRegistry,t);for(;o.Q.length>0;)o.Q.map(l=>this._loadSingleGrammar(l.scopeName)),o.processQueue();return this._grammarForScopeName(t,n,r,i,s)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,i=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,i)}_grammarForScopeName(t,n=0,r=null,i=null,s=null){return this._syncRegistry.grammarForScopeName(t,n,r,i,s)}},Mw=Nw.NULL;const lne=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class _p{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}_p.prototype.normal={};_p.prototype.property={};_p.prototype.space=void 0;function w4(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new _p(n,r,t)}function Lw(e){return e.toLowerCase()}class xi{constructor(t,n){this.attribute=n,this.property=t}}xi.prototype.attribute="";xi.prototype.booleanish=!1;xi.prototype.boolean=!1;xi.prototype.commaOrSpaceSeparated=!1;xi.prototype.commaSeparated=!1;xi.prototype.defined=!1;xi.prototype.mustUseProperty=!1;xi.prototype.number=!1;xi.prototype.overloadedBoolean=!1;xi.prototype.property="";xi.prototype.spaceSeparated=!1;xi.prototype.space=void 0;let cne=0;const jt=Oc(),er=Oc(),Dw=Oc(),Pe=Oc(),Tn=Oc(),ed=Oc(),zi=Oc();function Oc(){return 2**++cne}const Iw=Object.freeze(Object.defineProperty({__proto__:null,boolean:jt,booleanish:er,commaOrSpaceSeparated:zi,commaSeparated:ed,number:Pe,overloadedBoolean:Dw,spaceSeparated:Tn},Symbol.toStringTag,{value:"Module"})),_x=Object.keys(Iw);class pk extends xi{constructor(t,n,r,i){let s=-1;if(super(t,n),aM(this,"space",i),typeof r=="number")for(;++s<_x.length;){const o=_x[s];aM(this,_x[s],(r&Iw[o])===Iw[o])}}}pk.prototype.defined=!0;function aM(e,t,n){n&&(e[t]=n)}function zd(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new pk(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Lw(r)]=r,n[Lw(s.attribute)]=r}return new _p(t,n,e.space)}const C4=zd({properties:{ariaActiveDescendant:null,ariaAtomic:er,ariaAutoComplete:null,ariaBusy:er,ariaChecked:er,ariaColCount:Pe,ariaColIndex:Pe,ariaColSpan:Pe,ariaControls:Tn,ariaCurrent:null,ariaDescribedBy:Tn,ariaDetails:null,ariaDisabled:er,ariaDropEffect:Tn,ariaErrorMessage:null,ariaExpanded:er,ariaFlowTo:Tn,ariaGrabbed:er,ariaHasPopup:null,ariaHidden:er,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Tn,ariaLevel:Pe,ariaLive:null,ariaModal:er,ariaMultiLine:er,ariaMultiSelectable:er,ariaOrientation:null,ariaOwns:Tn,ariaPlaceholder:null,ariaPosInSet:Pe,ariaPressed:er,ariaReadOnly:er,ariaRelevant:null,ariaRequired:er,ariaRoleDescription:Tn,ariaRowCount:Pe,ariaRowIndex:Pe,ariaRowSpan:Pe,ariaSelected:er,ariaSetSize:Pe,ariaSort:null,ariaValueMax:Pe,ariaValueMin:Pe,ariaValueNow:Pe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function k4(e,t){return t in e?e[t]:t}function E4(e,t){return k4(e,t.toLowerCase())}const une=zd({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ed,acceptCharset:Tn,accessKey:Tn,action:null,allow:null,allowFullScreen:jt,allowPaymentRequest:jt,allowUserMedia:jt,alt:null,as:null,async:jt,autoCapitalize:null,autoComplete:Tn,autoFocus:jt,autoPlay:jt,blocking:Tn,capture:null,charSet:null,checked:jt,cite:null,className:Tn,cols:Pe,colSpan:null,content:null,contentEditable:er,controls:jt,controlsList:Tn,coords:Pe|ed,crossOrigin:null,data:null,dateTime:null,decoding:null,default:jt,defer:jt,dir:null,dirName:null,disabled:jt,download:Dw,draggable:er,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:jt,formTarget:null,headers:Tn,height:Pe,hidden:Dw,high:Pe,href:null,hrefLang:null,htmlFor:Tn,httpEquiv:Tn,id:null,imageSizes:null,imageSrcSet:null,inert:jt,inputMode:null,integrity:null,is:null,isMap:jt,itemId:null,itemProp:Tn,itemRef:Tn,itemScope:jt,itemType:Tn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:jt,low:Pe,manifest:null,max:null,maxLength:Pe,media:null,method:null,min:null,minLength:Pe,multiple:jt,muted:jt,name:null,nonce:null,noModule:jt,noValidate:jt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:jt,optimum:Pe,pattern:null,ping:Tn,placeholder:null,playsInline:jt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:jt,referrerPolicy:null,rel:Tn,required:jt,reversed:jt,rows:Pe,rowSpan:Pe,sandbox:Tn,scope:null,scoped:jt,seamless:jt,selected:jt,shadowRootClonable:jt,shadowRootDelegatesFocus:jt,shadowRootMode:null,shape:null,size:Pe,sizes:null,slot:null,span:Pe,spellCheck:er,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Pe,step:null,style:null,tabIndex:Pe,target:null,title:null,translate:null,type:null,typeMustMatch:jt,useMap:null,value:er,width:Pe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Tn,axis:null,background:null,bgColor:null,border:Pe,borderColor:null,bottomMargin:Pe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:jt,declare:jt,event:null,face:null,frame:null,frameBorder:null,hSpace:Pe,leftMargin:Pe,link:null,longDesc:null,lowSrc:null,marginHeight:Pe,marginWidth:Pe,noResize:jt,noHref:jt,noShade:jt,noWrap:jt,object:null,profile:null,prompt:null,rev:null,rightMargin:Pe,rules:null,scheme:null,scrolling:er,standby:null,summary:null,text:null,topMargin:Pe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Pe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:jt,disableRemotePlayback:jt,prefix:null,property:null,results:Pe,security:null,unselectable:null},space:"html",transform:E4}),dne=zd({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:zi,accentHeight:Pe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Pe,amplitude:Pe,arabicForm:null,ascent:Pe,attributeName:null,attributeType:null,azimuth:Pe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Pe,by:null,calcMode:null,capHeight:Pe,className:Tn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Pe,diffuseConstant:Pe,direction:null,display:null,dur:null,divisor:Pe,dominantBaseline:null,download:jt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Pe,enableBackground:null,end:null,event:null,exponent:Pe,externalResourcesRequired:null,fill:null,fillOpacity:Pe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ed,g2:ed,glyphName:ed,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Pe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Pe,horizOriginX:Pe,horizOriginY:Pe,id:null,ideographic:Pe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Pe,k:Pe,k1:Pe,k2:Pe,k3:Pe,k4:Pe,kernelMatrix:zi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Pe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Pe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Pe,overlineThickness:Pe,paintOrder:null,panose1:null,path:null,pathLength:Pe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Tn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Pe,pointsAtY:Pe,pointsAtZ:Pe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:zi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:zi,rev:zi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:zi,requiredFeatures:zi,requiredFonts:zi,requiredFormats:zi,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Pe,specularExponent:Pe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Pe,strikethroughThickness:Pe,string:null,stroke:null,strokeDashArray:zi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Pe,strokeOpacity:Pe,strokeWidth:null,style:null,surfaceScale:Pe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:zi,tabIndex:Pe,tableValues:null,target:null,targetX:Pe,targetY:Pe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:zi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Pe,underlineThickness:Pe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Pe,values:null,vAlphabetic:Pe,vMathematical:Pe,vectorEffect:null,vHanging:Pe,vIdeographic:Pe,version:null,vertAdvY:Pe,vertOriginX:Pe,vertOriginY:Pe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Pe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:k4}),R4=zd({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),T4=zd({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:E4}),A4=zd({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),hne={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},fne=/[A-Z]/g,lM=/-[a-z]/g,pne=/^data[-\w.:]+$/i;function N4(e,t){const n=Lw(t);let r=t,i=xi;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&pne.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(lM,gne);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!lM.test(s)){let o=s.replace(fne,mne);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=pk}return new i(r,t)}function mne(e){return"-"+e.toLowerCase()}function gne(e){return e.charAt(1).toUpperCase()}const M4=w4([C4,une,R4,T4,A4],"html"),yp=w4([C4,dne,R4,T4,A4],"svg"),cM={}.hasOwnProperty;function vne(e,t){const n=t||{};function r(i,...s){let o=r.invalid;const l=r.handlers;if(i&&cM.call(i,e)){const c=String(i[e]);o=cM.call(l,c)?l[c]:r.unknown}if(o)return o.call(this,i,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const bne=/["&'<>`]/g,_ne=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,yne=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,xne=/[|\\{}()[\]^$+*?.]/g,uM=new WeakMap;function Sne(e,t){if(e=e.replace(t.subset?wne(t.subset):bne,r),t.subset||t.escapeOnly)return e;return e.replace(_ne,n).replace(yne,r);function n(i,s,o){return t.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),t)}function r(i,s,o){return t.format(i.charCodeAt(0),o.charCodeAt(s+1),t)}}function wne(e){let t=uM.get(e);return t||(t=Cne(e),uM.set(e,t)),t}function Cne(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(xne,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const kne=/[\dA-Fa-f]/;function Ene(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!kne.test(String.fromCharCode(t))?r:r+";"}const Rne=/\d/;function Tne(e,t,n){const r="&#"+String(e);return n&&t&&!Rne.test(String.fromCharCode(t))?r:r+";"}const Ane=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],yx={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},Nne=["cent","copy","divide","gt","lt","not","para","times"],L4={}.hasOwnProperty,Pw={};let ig;for(ig in yx)L4.call(yx,ig)&&(Pw[yx[ig]]=ig);const Mne=/[^\dA-Za-z]/;function Lne(e,t,n,r){const i=String.fromCharCode(e);if(L4.call(Pw,i)){const s=Pw[i],o="&"+s;return n&&Ane.includes(s)&&!Nne.includes(s)&&(!r||t&&t!==61&&Mne.test(String.fromCharCode(t)))?o:o+";"}return""}function Dne(e,t,n){let r=Ene(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Lne(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){const s=Tne(e,t,n.omitOptionalSemicolons);s.length<r.length&&(r=s)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function td(e,t){return Sne(e,Object.assign({format:Dne},t))}const Ine=/^>|^->|<!--|-->|--!>|<!-$/g,Pne=[">"],One=["<",">"];function jne(e,t,n,r){return r.settings.bogusComments?"<?"+td(e.value,Object.assign({},r.settings.characterReferences,{subset:Pne}))+">":"<!--"+e.value.replace(Ine,i)+"-->";function i(s){return td(s,Object.assign({},r.settings.characterReferences,{subset:One}))}}function zne(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function Gv(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function D4(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function I4(e){return e.join(" ").trim()}const Bne=/[ \t\n\f\r]/g;function n0(e){return typeof e=="object"?e.type==="text"?dM(e.value):!1:dM(e)}function dM(e){return e.replace(Bne,"")===""}const pr=O4(1),P4=O4(-1),Fne=[];function O4(e){return t;function t(n,r,i){const s=n?n.children:Fne;let o=(r||0)+e,l=s[o];if(!i)for(;l&&n0(l);)o+=e,l=s[o];return l}}const Hne={}.hasOwnProperty;function j4(e){return t;function t(n,r,i){return Hne.call(e,n.tagName)&&e[n.tagName](n,r,i)}}const mk=j4({body:Une,caption:xx,colgroup:xx,dd:qne,dt:Gne,head:xx,html:$ne,li:Wne,optgroup:Kne,option:Yne,p:Vne,rp:hM,rt:hM,tbody:Qne,td:fM,tfoot:Zne,th:fM,thead:Xne,tr:Jne});function xx(e,t,n){const r=pr(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&n0(r.value.charAt(0)))}function $ne(e,t,n){const r=pr(n,t);return!r||r.type!=="comment"}function Une(e,t,n){const r=pr(n,t);return!r||r.type!=="comment"}function Vne(e,t,n){const r=pr(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Wne(e,t,n){const r=pr(n,t);return!r||r.type==="element"&&r.tagName==="li"}function Gne(e,t,n){const r=pr(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function qne(e,t,n){const r=pr(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function hM(e,t,n){const r=pr(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Kne(e,t,n){const r=pr(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function Yne(e,t,n){const r=pr(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Xne(e,t,n){const r=pr(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Qne(e,t,n){const r=pr(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Zne(e,t,n){return!pr(n,t)}function Jne(e,t,n){const r=pr(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function fM(e,t,n){const r=pr(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const ere=j4({body:rre,colgroup:ire,head:nre,html:tre,tbody:sre});function tre(e){const t=pr(e,-1);return!t||t.type!=="comment"}function nre(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function rre(e){const t=pr(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&n0(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function ire(e,t,n){const r=P4(n,t),i=pr(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&mk(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function sre(e,t,n){const r=P4(n,t),i=pr(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&mk(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const sg={name:[[`
667
667
  \f\r &/=>`.split(""),`