@gram-ai/elements 1.13.3 → 1.13.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/elements.cjs CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  Utilities:
12
12
  ${n.map(o=>`- ${o.language}: ${o.prompt}`).join(`
13
- `)}`}const Gl=({children:t,config:n})=>{const[o,i]=N.useState(n.model?.defaultModel??a.MODELS[0]),[e,r]=N.useState(n.modal?.defaultExpanded??!1),[s,l]=N.useState(n.modal?.defaultOpen),m=Vl({transport:new qt({api:n.chatEndpoint??Wl,prepareSendMessagesRequest:({id:c,messages:d})=>({body:{messages:d,system:Jl(n.systemPrompt,n.plugins??w.recommended),id:c,config:{mcp:n.mcp,environment:n.environment,projectSlug:n.projectSlug,model:o}}})})});return u.jsx(k.AssistantRuntimeProvider,{runtime:m,children:u.jsx(w.ElementsContext.Provider,{value:{config:n,setModel:i,model:o,isExpanded:e,setIsExpanded:r,isOpen:s??!1,setIsOpen:l,plugins:n.plugins??[]},children:t})})};const ql=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Kl=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,o,i)=>i?i.toUpperCase():o.toLowerCase()),er=t=>{const n=Kl(t);return n.charAt(0).toUpperCase()+n.slice(1)},Jr=(...t)=>t.filter((n,o,i)=>!!n&&n.trim()!==""&&i.indexOf(n)===o).join(" ").trim(),Hl=t=>{for(const n in t)if(n.startsWith("aria-")||n==="role"||n==="title")return!0};var Xl={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Yl=N.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:o=2,absoluteStrokeWidth:i,className:e="",children:r,iconNode:s,...l},m)=>N.createElement("svg",{ref:m,...Xl,width:n,height:n,stroke:t,strokeWidth:i?Number(o)*24/Number(n):o,className:Jr("lucide",e),...!r&&!Hl(l)&&{"aria-hidden":"true"},...l},[...s.map(([c,d])=>N.createElement(c,d)),...Array.isArray(r)?r:[r]]));const R=(t,n)=>{const o=N.forwardRef(({className:i,...e},r)=>N.createElement(Yl,{ref:r,iconNode:n,className:Jr(`lucide-${ql(er(t))}`,`lucide-${t}`,i),...e}));return o.displayName=er(t),o};const Ql=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ec=R("arrow-down",Ql);const tc=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],nc=R("arrow-up",tc);const rc=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],ic=R("brain",rc);const oc=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],qe=R("check",oc);const ac=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],rn=R("chevron-down",ac);const sc=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],lc=R("chevron-left",sc);const cc=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],uc=R("chevron-right",cc);const dc=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Gr=R("chevron-up",dc);const mc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],fc=R("circle-alert",mc);const gc=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],qr=R("copy",gc);const pc=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],vc=R("file-text",pc);const hc=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Kr=R("loader-circle",hc);const yc=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],bc=R("maximize",yc);const $c=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],xc=R("message-circle",$c);const _c=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],wc=R("minimize",_c);const Sc=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Ic=R("panel-right-close",Sc);const jc=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],kc=R("panel-right-open",jc);const Nc=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Ec=R("pencil",Nc);const Oc=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Cc=R("plus",Oc);const Pc=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Tc=R("refresh-cw",Pc);const Dc=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Rc=R("settings-2",Dc);const Ac=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Uc=R("square",Ac);const zc=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],on=R("x",zc);function tr(t,n){if(typeof t=="function")return t(n);t!=null&&(t.current=n)}function an(...t){return n=>{let o=!1;const i=t.map(e=>{const r=tr(e,n);return!o&&typeof r=="function"&&(o=!0),r});if(o)return()=>{for(let e=0;e<i.length;e++){const r=i[e];typeof r=="function"?r():tr(t[e],null)}}}}function G(...t){return g.useCallback(an(...t),t)}var Mc=Symbol.for("react.lazy"),mt=g[" use ".trim().toString()];function Lc(t){return typeof t=="object"&&t!==null&&"then"in t}function Hr(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===Mc&&"_payload"in t&&Lc(t._payload)}function Xr(t){const n=Fc(t),o=g.forwardRef((i,e)=>{let{children:r,...s}=i;Hr(r)&&typeof mt=="function"&&(r=mt(r._payload));const l=g.Children.toArray(r),m=l.find(Bc);if(m){const c=m.props.children,d=l.map(f=>f===m?g.Children.count(c)>1?g.Children.only(null):g.isValidElement(c)?c.props.children:null:f);return u.jsx(n,{...s,ref:e,children:g.isValidElement(c)?g.cloneElement(c,void 0,d):null})}return u.jsx(n,{...s,ref:e,children:r})});return o.displayName=`${t}.Slot`,o}var Zc=Xr("Slot");function Fc(t){const n=g.forwardRef((o,i)=>{let{children:e,...r}=o;if(Hr(e)&&typeof mt=="function"&&(e=mt(e._payload)),g.isValidElement(e)){const s=Gc(e),l=Jc(r,e.props);return e.type!==g.Fragment&&(l.ref=i?an(i,s):s),g.cloneElement(e,l)}return g.Children.count(e)>1?g.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var Yr=Symbol("radix.slottable");function Vc(t){const n=({children:o})=>u.jsx(u.Fragment,{children:o});return n.displayName=`${t}.Slottable`,n.__radixId=Yr,n}var Wc=Vc("Slottable");function Bc(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Yr}function Jc(t,n){const o={...n};for(const i in n){const e=t[i],r=n[i];/^on[A-Z]/.test(i)?e&&r?o[i]=(...l)=>{const m=r(...l);return e(...l),m}:e&&(o[i]=e):i==="style"?o[i]={...e,...r}:i==="className"&&(o[i]=[e,r].filter(Boolean).join(" "))}return{...t,...o}}function Gc(t){let n=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=n&&"isReactWarning"in n&&n.isReactWarning;return o?t.ref:(n=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=n&&"isReactWarning"in n&&n.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}const nr=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,rr=w.clsx,qc=(t,n)=>o=>{var i;if(n?.variants==null)return rr(t,o?.class,o?.className);const{variants:e,defaultVariants:r}=n,s=Object.keys(e).map(c=>{const d=o?.[c],f=r?.[c];if(d===null)return null;const y=nr(d)||nr(f);return e[c][y]}),l=o&&Object.entries(o).reduce((c,d)=>{let[f,y]=d;return y===void 0||(c[f]=y),c},{}),m=n==null||(i=n.compoundVariants)===null||i===void 0?void 0:i.reduce((c,d)=>{let{class:f,className:y,...p}=d;return Object.entries(p).every(h=>{let[v,$]=h;return Array.isArray($)?$.includes({...r,...l}[v]):{...r,...l}[v]===$})?[...c,f,y]:c},[]);return rr(t,s,m,o?.class,o?.className)},Kc=qc("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}}),ue=g.forwardRef(({className:t,variant:n,size:o,asChild:i=!1,...e},r)=>{const s=i?Zc:"button";return u.jsx(s,{"data-slot":"button",className:w.cn(Kc({variant:n,size:o,className:t})),ref:r,...e})});ue.displayName="Button";function M(t,n,{checkForDefaultPrevented:o=!0}={}){return function(e){if(t?.(e),o===!1||!e.defaultPrevented)return n?.(e)}}function Hc(t,n){const o=g.createContext(n),i=r=>{const{children:s,...l}=r,m=g.useMemo(()=>l,Object.values(l));return u.jsx(o.Provider,{value:m,children:s})};i.displayName=t+"Provider";function e(r){const s=g.useContext(o);if(s)return s;if(n!==void 0)return n;throw new Error(`\`${r}\` must be used within \`${t}\``)}return[i,e]}function Ke(t,n=[]){let o=[];function i(r,s){const l=g.createContext(s),m=o.length;o=[...o,s];const c=f=>{const{scope:y,children:p,...h}=f,v=y?.[t]?.[m]||l,$=g.useMemo(()=>h,Object.values(h));return u.jsx(v.Provider,{value:$,children:p})};c.displayName=r+"Provider";function d(f,y){const p=y?.[t]?.[m]||l,h=g.useContext(p);if(h)return h;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${r}\``)}return[c,d]}const e=()=>{const r=o.map(s=>g.createContext(s));return function(l){const m=l?.[t]||r;return g.useMemo(()=>({[`__scope${t}`]:{...l,[t]:m}}),[l,m])}};return e.scopeName=t,[i,Xc(e,...n)]}function Xc(...t){const n=t[0];if(t.length===1)return n;const o=()=>{const i=t.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(r){const s=i.reduce((l,{useScope:m,scopeName:c})=>{const f=m(r)[`__scope${c}`];return{...l,...f}},{});return g.useMemo(()=>({[`__scope${n.scopeName}`]:s}),[s])}};return o.scopeName=n.scopeName,o}function sn(t){const n=Yc(t),o=g.forwardRef((i,e)=>{const{children:r,...s}=i,l=g.Children.toArray(r),m=l.find(eu);if(m){const c=m.props.children,d=l.map(f=>f===m?g.Children.count(c)>1?g.Children.only(null):g.isValidElement(c)?c.props.children:null:f);return u.jsx(n,{...s,ref:e,children:g.isValidElement(c)?g.cloneElement(c,void 0,d):null})}return u.jsx(n,{...s,ref:e,children:r})});return o.displayName=`${t}.Slot`,o}function Yc(t){const n=g.forwardRef((o,i)=>{const{children:e,...r}=o;if(g.isValidElement(e)){const s=nu(e),l=tu(r,e.props);return e.type!==g.Fragment&&(l.ref=i?an(i,s):s),g.cloneElement(e,l)}return g.Children.count(e)>1?g.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var Qr=Symbol("radix.slottable");function Qc(t){const n=({children:o})=>u.jsx(u.Fragment,{children:o});return n.displayName=`${t}.Slottable`,n.__radixId=Qr,n}function eu(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Qr}function tu(t,n){const o={...n};for(const i in n){const e=t[i],r=n[i];/^on[A-Z]/.test(i)?e&&r?o[i]=(...l)=>{const m=r(...l);return e(...l),m}:e&&(o[i]=e):i==="style"?o[i]={...e,...r}:i==="className"&&(o[i]=[e,r].filter(Boolean).join(" "))}return{...t,...o}}function nu(t){let n=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=n&&"isReactWarning"in n&&n.isReactWarning;return o?t.ref:(n=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=n&&"isReactWarning"in n&&n.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}var ru=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=ru.reduce((t,n)=>{const o=sn(`Primitive.${n}`),i=g.forwardRef((e,r)=>{const{asChild:s,...l}=e,m=s?o:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...l,ref:r})});return i.displayName=`Primitive.${n}`,{...t,[n]:i}},{});function iu(t,n){t&&Or.flushSync(()=>t.dispatchEvent(n))}function xe(t){const n=g.useRef(t);return g.useEffect(()=>{n.current=t}),g.useMemo(()=>(...o)=>n.current?.(...o),[])}function ou(t,n=globalThis?.document){const o=xe(t);g.useEffect(()=>{const i=e=>{e.key==="Escape"&&o(e)};return n.addEventListener("keydown",i,{capture:!0}),()=>n.removeEventListener("keydown",i,{capture:!0})},[o,n])}var au="DismissableLayer",Kt="dismissableLayer.update",su="dismissableLayer.pointerDownOutside",lu="dismissableLayer.focusOutside",ir,ei=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),yt=g.forwardRef((t,n)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:i,onPointerDownOutside:e,onFocusOutside:r,onInteractOutside:s,onDismiss:l,...m}=t,c=g.useContext(ei),[d,f]=g.useState(null),y=d?.ownerDocument??globalThis?.document,[,p]=g.useState({}),h=G(n,S=>f(S)),v=Array.from(c.layers),[$]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),x=v.indexOf($),_=d?v.indexOf(d):-1,I=c.layersWithOutsidePointerEventsDisabled.size>0,b=_>=x,j=du(S=>{const O=S.target,P=[...c.branches].some(T=>T.contains(O));!b||P||(e?.(S),s?.(S),S.defaultPrevented||l?.())},y),E=mu(S=>{const O=S.target;[...c.branches].some(T=>T.contains(O))||(r?.(S),s?.(S),S.defaultPrevented||l?.())},y);return ou(S=>{_===c.layers.size-1&&(i?.(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},y),g.useEffect(()=>{if(d)return o&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(ir=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),or(),()=>{o&&c.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=ir)}},[d,y,o,c]),g.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),or())},[d,c]),g.useEffect(()=>{const S=()=>p({});return document.addEventListener(Kt,S),()=>document.removeEventListener(Kt,S)},[]),u.jsx(V.div,{...m,ref:h,style:{pointerEvents:I?b?"auto":"none":void 0,...t.style},onFocusCapture:M(t.onFocusCapture,E.onFocusCapture),onBlurCapture:M(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:M(t.onPointerDownCapture,j.onPointerDownCapture)})});yt.displayName=au;var cu="DismissableLayerBranch",uu=g.forwardRef((t,n)=>{const o=g.useContext(ei),i=g.useRef(null),e=G(n,i);return g.useEffect(()=>{const r=i.current;if(r)return o.branches.add(r),()=>{o.branches.delete(r)}},[o.branches]),u.jsx(V.div,{...t,ref:e})});uu.displayName=cu;function du(t,n=globalThis?.document){const o=xe(t),i=g.useRef(!1),e=g.useRef(()=>{});return g.useEffect(()=>{const r=l=>{if(l.target&&!i.current){let m=function(){ti(su,o,c,{discrete:!0})};const c={originalEvent:l};l.pointerType==="touch"?(n.removeEventListener("click",e.current),e.current=m,n.addEventListener("click",e.current,{once:!0})):m()}else n.removeEventListener("click",e.current);i.current=!1},s=window.setTimeout(()=>{n.addEventListener("pointerdown",r)},0);return()=>{window.clearTimeout(s),n.removeEventListener("pointerdown",r),n.removeEventListener("click",e.current)}},[n,o]),{onPointerDownCapture:()=>i.current=!0}}function mu(t,n=globalThis?.document){const o=xe(t),i=g.useRef(!1);return g.useEffect(()=>{const e=r=>{r.target&&!i.current&&ti(lu,o,{originalEvent:r},{discrete:!1})};return n.addEventListener("focusin",e),()=>n.removeEventListener("focusin",e)},[n,o]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function or(){const t=new CustomEvent(Kt);document.dispatchEvent(t)}function ti(t,n,o,{discrete:i}){const e=o.originalEvent.target,r=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:o});n&&e.addEventListener(t,n,{once:!0}),i?iu(e,r):e.dispatchEvent(r)}var Y=globalThis?.document?g.useLayoutEffect:()=>{},fu=g[" useId ".trim().toString()]||(()=>{}),gu=0;function Ee(t){const[n,o]=g.useState(fu());return Y(()=>{o(i=>i??String(gu++))},[t]),n?`radix-${n}`:""}const pu=["top","right","bottom","left"],ye=Math.min,K=Math.max,ft=Math.round,tt=Math.floor,le=t=>({x:t,y:t}),vu={left:"right",right:"left",bottom:"top",top:"bottom"},hu={start:"end",end:"start"};function Ht(t,n,o){return K(t,ye(n,o))}function fe(t,n){return typeof t=="function"?t(n):t}function ge(t){return t.split("-")[0]}function Re(t){return t.split("-")[1]}function ln(t){return t==="x"?"y":"x"}function cn(t){return t==="y"?"height":"width"}const yu=new Set(["top","bottom"]);function se(t){return yu.has(ge(t))?"y":"x"}function un(t){return ln(se(t))}function bu(t,n,o){o===void 0&&(o=!1);const i=Re(t),e=un(t),r=cn(e);let s=e==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return n.reference[r]>n.floating[r]&&(s=gt(s)),[s,gt(s)]}function $u(t){const n=gt(t);return[Xt(t),n,Xt(n)]}function Xt(t){return t.replace(/start|end/g,n=>hu[n])}const ar=["left","right"],sr=["right","left"],xu=["top","bottom"],_u=["bottom","top"];function wu(t,n,o){switch(t){case"top":case"bottom":return o?n?sr:ar:n?ar:sr;case"left":case"right":return n?xu:_u;default:return[]}}function Su(t,n,o,i){const e=Re(t);let r=wu(ge(t),o==="start",i);return e&&(r=r.map(s=>s+"-"+e),n&&(r=r.concat(r.map(Xt)))),r}function gt(t){return t.replace(/left|right|bottom|top/g,n=>vu[n])}function Iu(t){return{top:0,right:0,bottom:0,left:0,...t}}function ni(t){return typeof t!="number"?Iu(t):{top:t,right:t,bottom:t,left:t}}function pt(t){const{x:n,y:o,width:i,height:e}=t;return{width:i,height:e,top:o,left:n,right:n+i,bottom:o+e,x:n,y:o}}function lr(t,n,o){let{reference:i,floating:e}=t;const r=se(n),s=un(n),l=cn(s),m=ge(n),c=r==="y",d=i.x+i.width/2-e.width/2,f=i.y+i.height/2-e.height/2,y=i[l]/2-e[l]/2;let p;switch(m){case"top":p={x:d,y:i.y-e.height};break;case"bottom":p={x:d,y:i.y+i.height};break;case"right":p={x:i.x+i.width,y:f};break;case"left":p={x:i.x-e.width,y:f};break;default:p={x:i.x,y:i.y}}switch(Re(n)){case"start":p[s]-=y*(o&&c?-1:1);break;case"end":p[s]+=y*(o&&c?-1:1);break}return p}const ju=async(t,n,o)=>{const{placement:i="bottom",strategy:e="absolute",middleware:r=[],platform:s}=o,l=r.filter(Boolean),m=await(s.isRTL==null?void 0:s.isRTL(n));let c=await s.getElementRects({reference:t,floating:n,strategy:e}),{x:d,y:f}=lr(c,i,m),y=i,p={},h=0;for(let v=0;v<l.length;v++){const{name:$,fn:x}=l[v],{x:_,y:I,data:b,reset:j}=await x({x:d,y:f,initialPlacement:i,placement:y,strategy:e,middlewareData:p,rects:c,platform:s,elements:{reference:t,floating:n}});d=_??d,f=I??f,p={...p,[$]:{...p[$],...b}},j&&h<=50&&(h++,typeof j=="object"&&(j.placement&&(y=j.placement),j.rects&&(c=j.rects===!0?await s.getElementRects({reference:t,floating:n,strategy:e}):j.rects),{x:d,y:f}=lr(c,y,m)),v=-1)}return{x:d,y:f,placement:y,strategy:e,middlewareData:p}};async function Be(t,n){var o;n===void 0&&(n={});const{x:i,y:e,platform:r,rects:s,elements:l,strategy:m}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:y=!1,padding:p=0}=fe(n,t),h=ni(p),$=l[y?f==="floating"?"reference":"floating":f],x=pt(await r.getClippingRect({element:(o=await(r.isElement==null?void 0:r.isElement($)))==null||o?$:$.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(l.floating)),boundary:c,rootBoundary:d,strategy:m})),_=f==="floating"?{x:i,y:e,width:s.floating.width,height:s.floating.height}:s.reference,I=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l.floating)),b=await(r.isElement==null?void 0:r.isElement(I))?await(r.getScale==null?void 0:r.getScale(I))||{x:1,y:1}:{x:1,y:1},j=pt(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:_,offsetParent:I,strategy:m}):_);return{top:(x.top-j.top+h.top)/b.y,bottom:(j.bottom-x.bottom+h.bottom)/b.y,left:(x.left-j.left+h.left)/b.x,right:(j.right-x.right+h.right)/b.x}}const ku=t=>({name:"arrow",options:t,async fn(n){const{x:o,y:i,placement:e,rects:r,platform:s,elements:l,middlewareData:m}=n,{element:c,padding:d=0}=fe(t,n)||{};if(c==null)return{};const f=ni(d),y={x:o,y:i},p=un(e),h=cn(p),v=await s.getDimensions(c),$=p==="y",x=$?"top":"left",_=$?"bottom":"right",I=$?"clientHeight":"clientWidth",b=r.reference[h]+r.reference[p]-y[p]-r.floating[h],j=y[p]-r.reference[p],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let S=E?E[I]:0;(!S||!await(s.isElement==null?void 0:s.isElement(E)))&&(S=l.floating[I]||r.floating[h]);const O=b/2-j/2,P=S/2-v[h]/2-1,T=ye(f[x],P),z=ye(f[_],P),W=T,L=S-v[h]-z,A=S/2-v[h]/2+O,q=Ht(W,A,L),Z=!m.arrow&&Re(e)!=null&&A!==q&&r.reference[h]/2-(A<W?T:z)-v[h]/2<0,F=Z?A<W?A-W:A-L:0;return{[p]:y[p]+F,data:{[p]:q,centerOffset:A-q-F,...Z&&{alignmentOffset:F}},reset:Z}}}),Nu=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(n){var o,i;const{placement:e,middlewareData:r,rects:s,initialPlacement:l,platform:m,elements:c}=n,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:y,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:v=!0,...$}=fe(t,n);if((o=r.arrow)!=null&&o.alignmentOffset)return{};const x=ge(e),_=se(l),I=ge(l)===l,b=await(m.isRTL==null?void 0:m.isRTL(c.floating)),j=y||(I||!v?[gt(l)]:$u(l)),E=h!=="none";!y&&E&&j.push(...Su(l,v,h,b));const S=[l,...j],O=await Be(n,$),P=[];let T=((i=r.flip)==null?void 0:i.overflows)||[];if(d&&P.push(O[x]),f){const A=bu(e,s,b);P.push(O[A[0]],O[A[1]])}if(T=[...T,{placement:e,overflows:P}],!P.every(A=>A<=0)){var z,W;const A=(((z=r.flip)==null?void 0:z.index)||0)+1,q=S[A];if(q&&(!(f==="alignment"?_!==se(q):!1)||T.every(C=>se(C.placement)===_?C.overflows[0]>0:!0)))return{data:{index:A,overflows:T},reset:{placement:q}};let Z=(W=T.filter(F=>F.overflows[0]<=0).sort((F,C)=>F.overflows[1]-C.overflows[1])[0])==null?void 0:W.placement;if(!Z)switch(p){case"bestFit":{var L;const F=(L=T.filter(C=>{if(E){const B=se(C.placement);return B===_||B==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(B=>B>0).reduce((B,re)=>B+re,0)]).sort((C,B)=>C[1]-B[1])[0])==null?void 0:L[0];F&&(Z=F);break}case"initialPlacement":Z=l;break}if(e!==Z)return{reset:{placement:Z}}}return{}}}};function cr(t,n){return{top:t.top-n.height,right:t.right-n.width,bottom:t.bottom-n.height,left:t.left-n.width}}function ur(t){return pu.some(n=>t[n]>=0)}const Eu=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(n){const{rects:o}=n,{strategy:i="referenceHidden",...e}=fe(t,n);switch(i){case"referenceHidden":{const r=await Be(n,{...e,elementContext:"reference"}),s=cr(r,o.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:ur(s)}}}case"escaped":{const r=await Be(n,{...e,altBoundary:!0}),s=cr(r,o.floating);return{data:{escapedOffsets:s,escaped:ur(s)}}}default:return{}}}}},ri=new Set(["left","top"]);async function Ou(t,n){const{placement:o,platform:i,elements:e}=t,r=await(i.isRTL==null?void 0:i.isRTL(e.floating)),s=ge(o),l=Re(o),m=se(o)==="y",c=ri.has(s)?-1:1,d=r&&m?-1:1,f=fe(n,t);let{mainAxis:y,crossAxis:p,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof h=="number"&&(p=l==="end"?h*-1:h),m?{x:p*d,y:y*c}:{x:y*c,y:p*d}}const Cu=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(n){var o,i;const{x:e,y:r,placement:s,middlewareData:l}=n,m=await Ou(n,t);return s===((o=l.offset)==null?void 0:o.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:e+m.x,y:r+m.y,data:{...m,placement:s}}}}},Pu=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(n){const{x:o,y:i,placement:e}=n,{mainAxis:r=!0,crossAxis:s=!1,limiter:l={fn:$=>{let{x,y:_}=$;return{x,y:_}}},...m}=fe(t,n),c={x:o,y:i},d=await Be(n,m),f=se(ge(e)),y=ln(f);let p=c[y],h=c[f];if(r){const $=y==="y"?"top":"left",x=y==="y"?"bottom":"right",_=p+d[$],I=p-d[x];p=Ht(_,p,I)}if(s){const $=f==="y"?"top":"left",x=f==="y"?"bottom":"right",_=h+d[$],I=h-d[x];h=Ht(_,h,I)}const v=l.fn({...n,[y]:p,[f]:h});return{...v,data:{x:v.x-o,y:v.y-i,enabled:{[y]:r,[f]:s}}}}}},Tu=function(t){return t===void 0&&(t={}),{options:t,fn(n){const{x:o,y:i,placement:e,rects:r,middlewareData:s}=n,{offset:l=0,mainAxis:m=!0,crossAxis:c=!0}=fe(t,n),d={x:o,y:i},f=se(e),y=ln(f);let p=d[y],h=d[f];const v=fe(l,n),$=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(m){const I=y==="y"?"height":"width",b=r.reference[y]-r.floating[I]+$.mainAxis,j=r.reference[y]+r.reference[I]-$.mainAxis;p<b?p=b:p>j&&(p=j)}if(c){var x,_;const I=y==="y"?"width":"height",b=ri.has(ge(e)),j=r.reference[f]-r.floating[I]+(b&&((x=s.offset)==null?void 0:x[f])||0)+(b?0:$.crossAxis),E=r.reference[f]+r.reference[I]+(b?0:((_=s.offset)==null?void 0:_[f])||0)-(b?$.crossAxis:0);h<j?h=j:h>E&&(h=E)}return{[y]:p,[f]:h}}}},Du=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(n){var o,i;const{placement:e,rects:r,platform:s,elements:l}=n,{apply:m=()=>{},...c}=fe(t,n),d=await Be(n,c),f=ge(e),y=Re(e),p=se(e)==="y",{width:h,height:v}=r.floating;let $,x;f==="top"||f==="bottom"?($=f,x=y===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(x=f,$=y==="end"?"top":"bottom");const _=v-d.top-d.bottom,I=h-d.left-d.right,b=ye(v-d[$],_),j=ye(h-d[x],I),E=!n.middlewareData.shift;let S=b,O=j;if((o=n.middlewareData.shift)!=null&&o.enabled.x&&(O=I),(i=n.middlewareData.shift)!=null&&i.enabled.y&&(S=_),E&&!y){const T=K(d.left,0),z=K(d.right,0),W=K(d.top,0),L=K(d.bottom,0);p?O=h-2*(T!==0||z!==0?T+z:K(d.left,d.right)):S=v-2*(W!==0||L!==0?W+L:K(d.top,d.bottom))}await m({...n,availableWidth:O,availableHeight:S});const P=await s.getDimensions(l.floating);return h!==P.width||v!==P.height?{reset:{rects:!0}}:{}}}};function bt(){return typeof window<"u"}function Ae(t){return ii(t)?(t.nodeName||"").toLowerCase():"#document"}function H(t){var n;return(t==null||(n=t.ownerDocument)==null?void 0:n.defaultView)||window}function me(t){var n;return(n=(ii(t)?t.ownerDocument:t.document)||window.document)==null?void 0:n.documentElement}function ii(t){return bt()?t instanceof Node||t instanceof H(t).Node:!1}function ee(t){return bt()?t instanceof Element||t instanceof H(t).Element:!1}function de(t){return bt()?t instanceof HTMLElement||t instanceof H(t).HTMLElement:!1}function dr(t){return!bt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof H(t).ShadowRoot}const Ru=new Set(["inline","contents"]);function He(t){const{overflow:n,overflowX:o,overflowY:i,display:e}=te(t);return/auto|scroll|overlay|hidden|clip/.test(n+i+o)&&!Ru.has(e)}const Au=new Set(["table","td","th"]);function Uu(t){return Au.has(Ae(t))}const zu=[":popover-open",":modal"];function $t(t){return zu.some(n=>{try{return t.matches(n)}catch{return!1}})}const Mu=["transform","translate","scale","rotate","perspective"],Lu=["transform","translate","scale","rotate","perspective","filter"],Zu=["paint","layout","strict","content"];function dn(t){const n=mn(),o=ee(t)?te(t):t;return Mu.some(i=>o[i]?o[i]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!n&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!n&&(o.filter?o.filter!=="none":!1)||Lu.some(i=>(o.willChange||"").includes(i))||Zu.some(i=>(o.contain||"").includes(i))}function Fu(t){let n=be(t);for(;de(n)&&!Pe(n);){if(dn(n))return n;if($t(n))return null;n=be(n)}return null}function mn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Vu=new Set(["html","body","#document"]);function Pe(t){return Vu.has(Ae(t))}function te(t){return H(t).getComputedStyle(t)}function xt(t){return ee(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function be(t){if(Ae(t)==="html")return t;const n=t.assignedSlot||t.parentNode||dr(t)&&t.host||me(t);return dr(n)?n.host:n}function oi(t){const n=be(t);return Pe(n)?t.ownerDocument?t.ownerDocument.body:t.body:de(n)&&He(n)?n:oi(n)}function Je(t,n,o){var i;n===void 0&&(n=[]),o===void 0&&(o=!0);const e=oi(t),r=e===((i=t.ownerDocument)==null?void 0:i.body),s=H(e);if(r){const l=Yt(s);return n.concat(s,s.visualViewport||[],He(e)?e:[],l&&o?Je(l):[])}return n.concat(e,Je(e,[],o))}function Yt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ai(t){const n=te(t);let o=parseFloat(n.width)||0,i=parseFloat(n.height)||0;const e=de(t),r=e?t.offsetWidth:o,s=e?t.offsetHeight:i,l=ft(o)!==r||ft(i)!==s;return l&&(o=r,i=s),{width:o,height:i,$:l}}function fn(t){return ee(t)?t:t.contextElement}function Oe(t){const n=fn(t);if(!de(n))return le(1);const o=n.getBoundingClientRect(),{width:i,height:e,$:r}=ai(n);let s=(r?ft(o.width):o.width)/i,l=(r?ft(o.height):o.height)/e;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const Wu=le(0);function si(t){const n=H(t);return!mn()||!n.visualViewport?Wu:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function Bu(t,n,o){return n===void 0&&(n=!1),!o||n&&o!==H(t)?!1:n}function _e(t,n,o,i){n===void 0&&(n=!1),o===void 0&&(o=!1);const e=t.getBoundingClientRect(),r=fn(t);let s=le(1);n&&(i?ee(i)&&(s=Oe(i)):s=Oe(t));const l=Bu(r,o,i)?si(r):le(0);let m=(e.left+l.x)/s.x,c=(e.top+l.y)/s.y,d=e.width/s.x,f=e.height/s.y;if(r){const y=H(r),p=i&&ee(i)?H(i):i;let h=y,v=Yt(h);for(;v&&i&&p!==h;){const $=Oe(v),x=v.getBoundingClientRect(),_=te(v),I=x.left+(v.clientLeft+parseFloat(_.paddingLeft))*$.x,b=x.top+(v.clientTop+parseFloat(_.paddingTop))*$.y;m*=$.x,c*=$.y,d*=$.x,f*=$.y,m+=I,c+=b,h=H(v),v=Yt(h)}}return pt({width:d,height:f,x:m,y:c})}function _t(t,n){const o=xt(t).scrollLeft;return n?n.left+o:_e(me(t)).left+o}function li(t,n){const o=t.getBoundingClientRect(),i=o.left+n.scrollLeft-_t(t,o),e=o.top+n.scrollTop;return{x:i,y:e}}function Ju(t){let{elements:n,rect:o,offsetParent:i,strategy:e}=t;const r=e==="fixed",s=me(i),l=n?$t(n.floating):!1;if(i===s||l&&r)return o;let m={scrollLeft:0,scrollTop:0},c=le(1);const d=le(0),f=de(i);if((f||!f&&!r)&&((Ae(i)!=="body"||He(s))&&(m=xt(i)),de(i))){const p=_e(i);c=Oe(i),d.x=p.x+i.clientLeft,d.y=p.y+i.clientTop}const y=s&&!f&&!r?li(s,m):le(0);return{width:o.width*c.x,height:o.height*c.y,x:o.x*c.x-m.scrollLeft*c.x+d.x+y.x,y:o.y*c.y-m.scrollTop*c.y+d.y+y.y}}function Gu(t){return Array.from(t.getClientRects())}function qu(t){const n=me(t),o=xt(t),i=t.ownerDocument.body,e=K(n.scrollWidth,n.clientWidth,i.scrollWidth,i.clientWidth),r=K(n.scrollHeight,n.clientHeight,i.scrollHeight,i.clientHeight);let s=-o.scrollLeft+_t(t);const l=-o.scrollTop;return te(i).direction==="rtl"&&(s+=K(n.clientWidth,i.clientWidth)-e),{width:e,height:r,x:s,y:l}}const mr=25;function Ku(t,n){const o=H(t),i=me(t),e=o.visualViewport;let r=i.clientWidth,s=i.clientHeight,l=0,m=0;if(e){r=e.width,s=e.height;const d=mn();(!d||d&&n==="fixed")&&(l=e.offsetLeft,m=e.offsetTop)}const c=_t(i);if(c<=0){const d=i.ownerDocument,f=d.body,y=getComputedStyle(f),p=d.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,h=Math.abs(i.clientWidth-f.clientWidth-p);h<=mr&&(r-=h)}else c<=mr&&(r+=c);return{width:r,height:s,x:l,y:m}}const Hu=new Set(["absolute","fixed"]);function Xu(t,n){const o=_e(t,!0,n==="fixed"),i=o.top+t.clientTop,e=o.left+t.clientLeft,r=de(t)?Oe(t):le(1),s=t.clientWidth*r.x,l=t.clientHeight*r.y,m=e*r.x,c=i*r.y;return{width:s,height:l,x:m,y:c}}function fr(t,n,o){let i;if(n==="viewport")i=Ku(t,o);else if(n==="document")i=qu(me(t));else if(ee(n))i=Xu(n,o);else{const e=si(t);i={x:n.x-e.x,y:n.y-e.y,width:n.width,height:n.height}}return pt(i)}function ci(t,n){const o=be(t);return o===n||!ee(o)||Pe(o)?!1:te(o).position==="fixed"||ci(o,n)}function Yu(t,n){const o=n.get(t);if(o)return o;let i=Je(t,[],!1).filter(l=>ee(l)&&Ae(l)!=="body"),e=null;const r=te(t).position==="fixed";let s=r?be(t):t;for(;ee(s)&&!Pe(s);){const l=te(s),m=dn(s);!m&&l.position==="fixed"&&(e=null),(r?!m&&!e:!m&&l.position==="static"&&!!e&&Hu.has(e.position)||He(s)&&!m&&ci(t,s))?i=i.filter(d=>d!==s):e=l,s=be(s)}return n.set(t,i),i}function Qu(t){let{element:n,boundary:o,rootBoundary:i,strategy:e}=t;const s=[...o==="clippingAncestors"?$t(n)?[]:Yu(n,this._c):[].concat(o),i],l=s[0],m=s.reduce((c,d)=>{const f=fr(n,d,e);return c.top=K(f.top,c.top),c.right=ye(f.right,c.right),c.bottom=ye(f.bottom,c.bottom),c.left=K(f.left,c.left),c},fr(n,l,e));return{width:m.right-m.left,height:m.bottom-m.top,x:m.left,y:m.top}}function ed(t){const{width:n,height:o}=ai(t);return{width:n,height:o}}function td(t,n,o){const i=de(n),e=me(n),r=o==="fixed",s=_e(t,!0,r,n);let l={scrollLeft:0,scrollTop:0};const m=le(0);function c(){m.x=_t(e)}if(i||!i&&!r)if((Ae(n)!=="body"||He(e))&&(l=xt(n)),i){const p=_e(n,!0,r,n);m.x=p.x+n.clientLeft,m.y=p.y+n.clientTop}else e&&c();r&&!i&&e&&c();const d=e&&!i&&!r?li(e,l):le(0),f=s.left+l.scrollLeft-m.x-d.x,y=s.top+l.scrollTop-m.y-d.y;return{x:f,y,width:s.width,height:s.height}}function At(t){return te(t).position==="static"}function gr(t,n){if(!de(t)||te(t).position==="fixed")return null;if(n)return n(t);let o=t.offsetParent;return me(t)===o&&(o=o.ownerDocument.body),o}function ui(t,n){const o=H(t);if($t(t))return o;if(!de(t)){let e=be(t);for(;e&&!Pe(e);){if(ee(e)&&!At(e))return e;e=be(e)}return o}let i=gr(t,n);for(;i&&Uu(i)&&At(i);)i=gr(i,n);return i&&Pe(i)&&At(i)&&!dn(i)?o:i||Fu(t)||o}const nd=async function(t){const n=this.getOffsetParent||ui,o=this.getDimensions,i=await o(t.floating);return{reference:td(t.reference,await n(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function rd(t){return te(t).direction==="rtl"}const id={convertOffsetParentRelativeRectToViewportRelativeRect:Ju,getDocumentElement:me,getClippingRect:Qu,getOffsetParent:ui,getElementRects:nd,getClientRects:Gu,getDimensions:ed,getScale:Oe,isElement:ee,isRTL:rd};function di(t,n){return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}function od(t,n){let o=null,i;const e=me(t);function r(){var l;clearTimeout(i),(l=o)==null||l.disconnect(),o=null}function s(l,m){l===void 0&&(l=!1),m===void 0&&(m=1),r();const c=t.getBoundingClientRect(),{left:d,top:f,width:y,height:p}=c;if(l||n(),!y||!p)return;const h=tt(f),v=tt(e.clientWidth-(d+y)),$=tt(e.clientHeight-(f+p)),x=tt(d),I={rootMargin:-h+"px "+-v+"px "+-$+"px "+-x+"px",threshold:K(0,ye(1,m))||1};let b=!0;function j(E){const S=E[0].intersectionRatio;if(S!==m){if(!b)return s();S?s(!1,S):i=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!di(c,t.getBoundingClientRect())&&s(),b=!1}try{o=new IntersectionObserver(j,{...I,root:e.ownerDocument})}catch{o=new IntersectionObserver(j,I)}o.observe(t)}return s(!0),r}function ad(t,n,o,i){i===void 0&&(i={});const{ancestorScroll:e=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:m=!1}=i,c=fn(t),d=e||r?[...c?Je(c):[],...Je(n)]:[];d.forEach(x=>{e&&x.addEventListener("scroll",o,{passive:!0}),r&&x.addEventListener("resize",o)});const f=c&&l?od(c,o):null;let y=-1,p=null;s&&(p=new ResizeObserver(x=>{let[_]=x;_&&_.target===c&&p&&(p.unobserve(n),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var I;(I=p)==null||I.observe(n)})),o()}),c&&!m&&p.observe(c),p.observe(n));let h,v=m?_e(t):null;m&&$();function $(){const x=_e(t);v&&!di(v,x)&&o(),v=x,h=requestAnimationFrame($)}return o(),()=>{var x;d.forEach(_=>{e&&_.removeEventListener("scroll",o),r&&_.removeEventListener("resize",o)}),f?.(),(x=p)==null||x.disconnect(),p=null,m&&cancelAnimationFrame(h)}}const sd=Cu,ld=Pu,cd=Nu,ud=Du,dd=Eu,pr=ku,md=Tu,fd=(t,n,o)=>{const i=new Map,e={platform:id,...o},r={...e.platform,_c:i};return ju(t,n,{...e,platform:r})};var gd=typeof document<"u",pd=function(){},ct=gd?N.useLayoutEffect:pd;function vt(t,n){if(t===n)return!0;if(typeof t!=typeof n)return!1;if(typeof t=="function"&&t.toString()===n.toString())return!0;let o,i,e;if(t&&n&&typeof t=="object"){if(Array.isArray(t)){if(o=t.length,o!==n.length)return!1;for(i=o;i--!==0;)if(!vt(t[i],n[i]))return!1;return!0}if(e=Object.keys(t),o=e.length,o!==Object.keys(n).length)return!1;for(i=o;i--!==0;)if(!{}.hasOwnProperty.call(n,e[i]))return!1;for(i=o;i--!==0;){const r=e[i];if(!(r==="_owner"&&t.$$typeof)&&!vt(t[r],n[r]))return!1}return!0}return t!==t&&n!==n}function mi(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function vr(t,n){const o=mi(t);return Math.round(n*o)/o}function Ut(t){const n=g.useRef(t);return ct(()=>{n.current=t}),n}function vd(t){t===void 0&&(t={});const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:e,elements:{reference:r,floating:s}={},transform:l=!0,whileElementsMounted:m,open:c}=t,[d,f]=g.useState({x:0,y:0,strategy:o,placement:n,middlewareData:{},isPositioned:!1}),[y,p]=g.useState(i);vt(y,i)||p(i);const[h,v]=g.useState(null),[$,x]=g.useState(null),_=g.useCallback(C=>{C!==E.current&&(E.current=C,v(C))},[]),I=g.useCallback(C=>{C!==S.current&&(S.current=C,x(C))},[]),b=r||h,j=s||$,E=g.useRef(null),S=g.useRef(null),O=g.useRef(d),P=m!=null,T=Ut(m),z=Ut(e),W=Ut(c),L=g.useCallback(()=>{if(!E.current||!S.current)return;const C={placement:n,strategy:o,middleware:y};z.current&&(C.platform=z.current),fd(E.current,S.current,C).then(B=>{const re={...B,isPositioned:W.current!==!1};A.current&&!vt(O.current,re)&&(O.current=re,Or.flushSync(()=>{f(re)}))})},[y,n,o,z,W]);ct(()=>{c===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,f(C=>({...C,isPositioned:!1})))},[c]);const A=g.useRef(!1);ct(()=>(A.current=!0,()=>{A.current=!1}),[]),ct(()=>{if(b&&(E.current=b),j&&(S.current=j),b&&j){if(T.current)return T.current(b,j,L);L()}},[b,j,L,T,P]);const q=g.useMemo(()=>({reference:E,floating:S,setReference:_,setFloating:I}),[_,I]),Z=g.useMemo(()=>({reference:b,floating:j}),[b,j]),F=g.useMemo(()=>{const C={position:o,left:0,top:0};if(!Z.floating)return C;const B=vr(Z.floating,d.x),re=vr(Z.floating,d.y);return l?{...C,transform:"translate("+B+"px, "+re+"px)",...mi(Z.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:B,top:re}},[o,l,Z.floating,d.x,d.y]);return g.useMemo(()=>({...d,update:L,refs:q,elements:Z,floatingStyles:F}),[d,L,q,Z,F])}const hd=t=>{function n(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:t,fn(o){const{element:i,padding:e}=typeof t=="function"?t(o):t;return i&&n(i)?i.current!=null?pr({element:i.current,padding:e}).fn(o):{}:i?pr({element:i,padding:e}).fn(o):{}}}},yd=(t,n)=>({...sd(t),options:[t,n]}),bd=(t,n)=>({...ld(t),options:[t,n]}),$d=(t,n)=>({...md(t),options:[t,n]}),xd=(t,n)=>({...cd(t),options:[t,n]}),_d=(t,n)=>({...ud(t),options:[t,n]}),wd=(t,n)=>({...dd(t),options:[t,n]}),Sd=(t,n)=>({...hd(t),options:[t,n]});var Id="Arrow",fi=g.forwardRef((t,n)=>{const{children:o,width:i=10,height:e=5,...r}=t;return u.jsx(V.svg,{...r,ref:n,width:i,height:e,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?o:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});fi.displayName=Id;var jd=fi;function kd(t){const[n,o]=g.useState(void 0);return Y(()=>{if(t){o({width:t.offsetWidth,height:t.offsetHeight});const i=new ResizeObserver(e=>{if(!Array.isArray(e)||!e.length)return;const r=e[0];let s,l;if("borderBoxSize"in r){const m=r.borderBoxSize,c=Array.isArray(m)?m[0]:m;s=c.inlineSize,l=c.blockSize}else s=t.offsetWidth,l=t.offsetHeight;o({width:s,height:l})});return i.observe(t,{box:"border-box"}),()=>i.unobserve(t)}else o(void 0)},[t]),n}var gn="Popper",[gi,wt]=Ke(gn),[Nd,pi]=gi(gn),vi=t=>{const{__scopePopper:n,children:o}=t,[i,e]=g.useState(null);return u.jsx(Nd,{scope:n,anchor:i,onAnchorChange:e,children:o})};vi.displayName=gn;var hi="PopperAnchor",yi=g.forwardRef((t,n)=>{const{__scopePopper:o,virtualRef:i,...e}=t,r=pi(hi,o),s=g.useRef(null),l=G(n,s),m=g.useRef(null);return g.useEffect(()=>{const c=m.current;m.current=i?.current||s.current,c!==m.current&&r.onAnchorChange(m.current)}),i?null:u.jsx(V.div,{...e,ref:l})});yi.displayName=hi;var pn="PopperContent",[Ed,Od]=gi(pn),bi=g.forwardRef((t,n)=>{const{__scopePopper:o,side:i="bottom",sideOffset:e=0,align:r="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:m=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:y=!1,updatePositionStrategy:p="optimized",onPlaced:h,...v}=t,$=pi(pn,o),[x,_]=g.useState(null),I=G(n,Ue=>_(Ue)),[b,j]=g.useState(null),E=kd(b),S=E?.width??0,O=E?.height??0,P=i+(r!=="center"?"-"+r:""),T=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},z=Array.isArray(c)?c:[c],W=z.length>0,L={padding:T,boundary:z.filter(Pd),altBoundary:W},{refs:A,floatingStyles:q,placement:Z,isPositioned:F,middlewareData:C}=vd({strategy:"fixed",placement:P,whileElementsMounted:(...Ue)=>ad(...Ue,{animationFrame:p==="always"}),elements:{reference:$.anchor},middleware:[yd({mainAxis:e+O,alignmentAxis:s}),m&&bd({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?$d():void 0,...L}),m&&xd({...L}),_d({...L,apply:({elements:Ue,rects:An,availableWidth:Jo,availableHeight:Go})=>{const{width:qo,height:Ko}=An.reference,Qe=Ue.floating.style;Qe.setProperty("--radix-popper-available-width",`${Jo}px`),Qe.setProperty("--radix-popper-available-height",`${Go}px`),Qe.setProperty("--radix-popper-anchor-width",`${qo}px`),Qe.setProperty("--radix-popper-anchor-height",`${Ko}px`)}}),b&&Sd({element:b,padding:l}),Td({arrowWidth:S,arrowHeight:O}),y&&wd({strategy:"referenceHidden",...L})]}),[B,re]=_i(Z),Rn=xe(h);Y(()=>{F&&Rn?.()},[F,Rn]);const Zo=C.arrow?.x,Fo=C.arrow?.y,Vo=C.arrow?.centerOffset!==0,[Wo,Bo]=g.useState();return Y(()=>{x&&Bo(window.getComputedStyle(x).zIndex)},[x]),u.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:F?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Wo,"--radix-popper-transform-origin":[C.transformOrigin?.x,C.transformOrigin?.y].join(" "),...C.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:u.jsx(Ed,{scope:o,placedSide:B,onArrowChange:j,arrowX:Zo,arrowY:Fo,shouldHideArrow:Vo,children:u.jsx(V.div,{"data-side":B,"data-align":re,...v,ref:I,style:{...v.style,animation:F?void 0:"none"}})})})});bi.displayName=pn;var $i="PopperArrow",Cd={top:"bottom",right:"left",bottom:"top",left:"right"},xi=g.forwardRef(function(n,o){const{__scopePopper:i,...e}=n,r=Od($i,i),s=Cd[r.placedSide];return u.jsx("span",{ref:r.onArrowChange,style:{position:"absolute",left:r.arrowX,top:r.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[r.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[r.placedSide],visibility:r.shouldHideArrow?"hidden":void 0},children:u.jsx(jd,{...e,ref:o,style:{...e.style,display:"block"}})})});xi.displayName=$i;function Pd(t){return t!==null}var Td=t=>({name:"transformOrigin",options:t,fn(n){const{placement:o,rects:i,middlewareData:e}=n,s=e.arrow?.centerOffset!==0,l=s?0:t.arrowWidth,m=s?0:t.arrowHeight,[c,d]=_i(o),f={start:"0%",center:"50%",end:"100%"}[d],y=(e.arrow?.x??0)+l/2,p=(e.arrow?.y??0)+m/2;let h="",v="";return c==="bottom"?(h=s?f:`${y}px`,v=`${-m}px`):c==="top"?(h=s?f:`${y}px`,v=`${i.floating.height+m}px`):c==="right"?(h=`${-m}px`,v=s?f:`${p}px`):c==="left"&&(h=`${i.floating.width+m}px`,v=s?f:`${p}px`),{data:{x:h,y:v}}}});function _i(t){const[n,o="center"]=t.split("-");return[n,o]}var wi=vi,vn=yi,Si=bi,Ii=xi,Dd="Portal",St=g.forwardRef((t,n)=>{const{container:o,...i}=t,[e,r]=g.useState(!1);Y(()=>r(!0),[]);const s=o||e&&globalThis?.document?.body;return s?Er.createPortal(u.jsx(V.div,{...i,ref:n}),s):null});St.displayName=Dd;function Rd(t,n){return g.useReducer((o,i)=>n[o][i]??o,t)}var pe=t=>{const{present:n,children:o}=t,i=Ad(n),e=typeof o=="function"?o({present:i.isPresent}):g.Children.only(o),r=G(i.ref,Ud(e));return typeof o=="function"||i.isPresent?g.cloneElement(e,{ref:r}):null};pe.displayName="Presence";function Ad(t){const[n,o]=g.useState(),i=g.useRef(null),e=g.useRef(t),r=g.useRef("none"),s=t?"mounted":"unmounted",[l,m]=Rd(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const c=nt(i.current);r.current=l==="mounted"?c:"none"},[l]),Y(()=>{const c=i.current,d=e.current;if(d!==t){const y=r.current,p=nt(c);t?m("MOUNT"):p==="none"||c?.display==="none"?m("UNMOUNT"):m(d&&y!==p?"ANIMATION_OUT":"UNMOUNT"),e.current=t}},[t,m]),Y(()=>{if(n){let c;const d=n.ownerDocument.defaultView??window,f=p=>{const v=nt(i.current).includes(CSS.escape(p.animationName));if(p.target===n&&v&&(m("ANIMATION_END"),!e.current)){const $=n.style.animationFillMode;n.style.animationFillMode="forwards",c=d.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=$)})}},y=p=>{p.target===n&&(r.current=nt(i.current))};return n.addEventListener("animationstart",y),n.addEventListener("animationcancel",f),n.addEventListener("animationend",f),()=>{d.clearTimeout(c),n.removeEventListener("animationstart",y),n.removeEventListener("animationcancel",f),n.removeEventListener("animationend",f)}}else m("ANIMATION_END")},[n,m]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:g.useCallback(c=>{i.current=c?getComputedStyle(c):null,o(c)},[])}}function nt(t){return t?.animationName||"none"}function Ud(t){let n=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=n&&"isReactWarning"in n&&n.isReactWarning;return o?t.ref:(n=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=n&&"isReactWarning"in n&&n.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}var zd=g[" useInsertionEffect ".trim().toString()]||Y;function It({prop:t,defaultProp:n,onChange:o=()=>{},caller:i}){const[e,r,s]=Md({defaultProp:n,onChange:o}),l=t!==void 0,m=l?t:e;{const d=g.useRef(t!==void 0);g.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${i} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,i])}const c=g.useCallback(d=>{if(l){const f=Ld(d)?d(t):d;f!==t&&s.current?.(f)}else r(d)},[l,t,r,s]);return[m,c]}function Md({defaultProp:t,onChange:n}){const[o,i]=g.useState(t),e=g.useRef(o),r=g.useRef(n);return zd(()=>{r.current=n},[n]),g.useEffect(()=>{e.current!==o&&(r.current?.(o),e.current=o)},[o,e]),[o,i,r]}function Ld(t){return typeof t=="function"}var Zd=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"}),Fd="VisuallyHidden",ji=g.forwardRef((t,n)=>u.jsx(V.span,{...t,ref:n,style:{...Zd,...t.style}}));ji.displayName=Fd;var Vd=ji,[jt]=Ke("Tooltip",[wt]),kt=wt(),ki="TooltipProvider",Wd=700,Qt="tooltip.open",[Bd,hn]=jt(ki),Ni=t=>{const{__scopeTooltip:n,delayDuration:o=Wd,skipDelayDuration:i=300,disableHoverableContent:e=!1,children:r}=t,s=g.useRef(!0),l=g.useRef(!1),m=g.useRef(0);return g.useEffect(()=>{const c=m.current;return()=>window.clearTimeout(c)},[]),u.jsx(Bd,{scope:n,isOpenDelayedRef:s,delayDuration:o,onOpen:g.useCallback(()=>{window.clearTimeout(m.current),s.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>s.current=!0,i)},[i]),isPointerInTransitRef:l,onPointerInTransitChange:g.useCallback(c=>{l.current=c},[]),disableHoverableContent:e,children:r})};Ni.displayName=ki;var Ge="Tooltip",[Jd,Xe]=jt(Ge),Ei=t=>{const{__scopeTooltip:n,children:o,open:i,defaultOpen:e,onOpenChange:r,disableHoverableContent:s,delayDuration:l}=t,m=hn(Ge,t.__scopeTooltip),c=kt(n),[d,f]=g.useState(null),y=Ee(),p=g.useRef(0),h=s??m.disableHoverableContent,v=l??m.delayDuration,$=g.useRef(!1),[x,_]=It({prop:i,defaultProp:e??!1,onChange:S=>{S?(m.onOpen(),document.dispatchEvent(new CustomEvent(Qt))):m.onClose(),r?.(S)},caller:Ge}),I=g.useMemo(()=>x?$.current?"delayed-open":"instant-open":"closed",[x]),b=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,$.current=!1,_(!0)},[_]),j=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),E=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{$.current=!0,_(!0),p.current=0},v)},[v,_]);return g.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),u.jsx(wi,{...c,children:u.jsx(Jd,{scope:n,contentId:y,open:x,stateAttribute:I,trigger:d,onTriggerChange:f,onTriggerEnter:g.useCallback(()=>{m.isOpenDelayedRef.current?E():b()},[m.isOpenDelayedRef,E,b]),onTriggerLeave:g.useCallback(()=>{h?j():(window.clearTimeout(p.current),p.current=0)},[j,h]),onOpen:b,onClose:j,disableHoverableContent:h,children:o})})};Ei.displayName=Ge;var en="TooltipTrigger",Oi=g.forwardRef((t,n)=>{const{__scopeTooltip:o,...i}=t,e=Xe(en,o),r=hn(en,o),s=kt(o),l=g.useRef(null),m=G(n,l,e.onTriggerChange),c=g.useRef(!1),d=g.useRef(!1),f=g.useCallback(()=>c.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),u.jsx(vn,{asChild:!0,...s,children:u.jsx(V.button,{"aria-describedby":e.open?e.contentId:void 0,"data-state":e.stateAttribute,...i,ref:m,onPointerMove:M(t.onPointerMove,y=>{y.pointerType!=="touch"&&!d.current&&!r.isPointerInTransitRef.current&&(e.onTriggerEnter(),d.current=!0)}),onPointerLeave:M(t.onPointerLeave,()=>{e.onTriggerLeave(),d.current=!1}),onPointerDown:M(t.onPointerDown,()=>{e.open&&e.onClose(),c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:M(t.onFocus,()=>{c.current||e.onOpen()}),onBlur:M(t.onBlur,e.onClose),onClick:M(t.onClick,e.onClose)})})});Oi.displayName=en;var yn="TooltipPortal",[Gd,qd]=jt(yn,{forceMount:void 0}),Ci=t=>{const{__scopeTooltip:n,forceMount:o,children:i,container:e}=t,r=Xe(yn,n);return u.jsx(Gd,{scope:n,forceMount:o,children:u.jsx(pe,{present:o||r.open,children:u.jsx(St,{asChild:!0,container:e,children:i})})})};Ci.displayName=yn;var Te="TooltipContent",Pi=g.forwardRef((t,n)=>{const o=qd(Te,t.__scopeTooltip),{forceMount:i=o.forceMount,side:e="top",...r}=t,s=Xe(Te,t.__scopeTooltip);return u.jsx(pe,{present:i||s.open,children:s.disableHoverableContent?u.jsx(Ti,{side:e,...r,ref:n}):u.jsx(Kd,{side:e,...r,ref:n})})}),Kd=g.forwardRef((t,n)=>{const o=Xe(Te,t.__scopeTooltip),i=hn(Te,t.__scopeTooltip),e=g.useRef(null),r=G(n,e),[s,l]=g.useState(null),{trigger:m,onClose:c}=o,d=e.current,{onPointerInTransitChange:f}=i,y=g.useCallback(()=>{l(null),f(!1)},[f]),p=g.useCallback((h,v)=>{const $=h.currentTarget,x={x:h.clientX,y:h.clientY},_=Qd(x,$.getBoundingClientRect()),I=em(x,_),b=tm(v.getBoundingClientRect()),j=rm([...I,...b]);l(j),f(!0)},[f]);return g.useEffect(()=>()=>y(),[y]),g.useEffect(()=>{if(m&&d){const h=$=>p($,d),v=$=>p($,m);return m.addEventListener("pointerleave",h),d.addEventListener("pointerleave",v),()=>{m.removeEventListener("pointerleave",h),d.removeEventListener("pointerleave",v)}}},[m,d,p,y]),g.useEffect(()=>{if(s){const h=v=>{const $=v.target,x={x:v.clientX,y:v.clientY},_=m?.contains($)||d?.contains($),I=!nm(x,s);_?y():I&&(y(),c())};return document.addEventListener("pointermove",h),()=>document.removeEventListener("pointermove",h)}},[m,d,s,c,y]),u.jsx(Ti,{...t,ref:r})}),[Hd,Xd]=jt(Ge,{isInside:!1}),Yd=Qc("TooltipContent"),Ti=g.forwardRef((t,n)=>{const{__scopeTooltip:o,children:i,"aria-label":e,onEscapeKeyDown:r,onPointerDownOutside:s,...l}=t,m=Xe(Te,o),c=kt(o),{onClose:d}=m;return g.useEffect(()=>(document.addEventListener(Qt,d),()=>document.removeEventListener(Qt,d)),[d]),g.useEffect(()=>{if(m.trigger){const f=y=>{y.target?.contains(m.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[m.trigger,d]),u.jsx(yt,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:u.jsxs(Si,{"data-state":m.stateAttribute,...c,...l,ref:n,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:[u.jsx(Yd,{children:i}),u.jsx(Hd,{scope:o,isInside:!0,children:u.jsx(Vd,{id:m.contentId,role:"tooltip",children:e||i})})]})})});Pi.displayName=Te;var Di="TooltipArrow",Ri=g.forwardRef((t,n)=>{const{__scopeTooltip:o,...i}=t,e=kt(o);return Xd(Di,o).isInside?null:u.jsx(Ii,{...e,...i,ref:n})});Ri.displayName=Di;function Qd(t,n){const o=Math.abs(n.top-t.y),i=Math.abs(n.bottom-t.y),e=Math.abs(n.right-t.x),r=Math.abs(n.left-t.x);switch(Math.min(o,i,e,r)){case r:return"left";case e:return"right";case o:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function em(t,n,o=5){const i=[];switch(n){case"top":i.push({x:t.x-o,y:t.y+o},{x:t.x+o,y:t.y+o});break;case"bottom":i.push({x:t.x-o,y:t.y-o},{x:t.x+o,y:t.y-o});break;case"left":i.push({x:t.x+o,y:t.y-o},{x:t.x+o,y:t.y+o});break;case"right":i.push({x:t.x-o,y:t.y-o},{x:t.x-o,y:t.y+o});break}return i}function tm(t){const{top:n,right:o,bottom:i,left:e}=t;return[{x:e,y:n},{x:o,y:n},{x:o,y:i},{x:e,y:i}]}function nm(t,n){const{x:o,y:i}=t;let e=!1;for(let r=0,s=n.length-1;r<n.length;s=r++){const l=n[r],m=n[s],c=l.x,d=l.y,f=m.x,y=m.y;d>i!=y>i&&o<(f-c)*(i-d)/(y-d)+c&&(e=!e)}return e}function rm(t){const n=t.slice();return n.sort((o,i)=>o.x<i.x?-1:o.x>i.x?1:o.y<i.y?-1:o.y>i.y?1:0),im(n)}function im(t){if(t.length<=1)return t.slice();const n=[];for(let i=0;i<t.length;i++){const e=t[i];for(;n.length>=2;){const r=n[n.length-1],s=n[n.length-2];if((r.x-s.x)*(e.y-s.y)>=(r.y-s.y)*(e.x-s.x))n.pop();else break}n.push(e)}n.pop();const o=[];for(let i=t.length-1;i>=0;i--){const e=t[i];for(;o.length>=2;){const r=o[o.length-1],s=o[o.length-2];if((r.x-s.x)*(e.y-s.y)>=(r.y-s.y)*(e.x-s.x))o.pop();else break}o.push(e)}return o.pop(),n.length===1&&o.length===1&&n[0].x===o[0].x&&n[0].y===o[0].y?n:n.concat(o)}var om=Ni,am=Ei,sm=Oi,lm=Ci,cm=Pi,um=Ri;function Ai({delayDuration:t=0,...n}){return u.jsx(om,{"data-slot":"tooltip-provider",delayDuration:t,...n})}function bn({...t}){return u.jsx(Ai,{children:u.jsx(am,{"data-slot":"tooltip",...t})})}function $n({...t}){return u.jsx(sm,{"data-slot":"tooltip-trigger",...t})}function xn({className:t,sideOffset:n=0,children:o,...i}){return u.jsx(lm,{children:u.jsxs(cm,{"data-slot":"tooltip-content",sideOffset:n,className:w.cn("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...i,children:[o,u.jsx(um,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px]"})]})})}const Q=N.forwardRef(({children:t,tooltip:n,side:o="bottom",align:i="center",className:e,...r},s)=>u.jsxs(bn,{children:[u.jsx($n,{asChild:!0,children:u.jsxs(ue,{variant:"ghost",size:"icon",...r,className:w.cn("aui-button-icon size-6 p-1",e),ref:s,children:[u.jsx(Wc,{children:t}),u.jsx("span",{className:"aui-sr-only sr-only",children:n})]})}),u.jsx(xn,{side:o,align:i,children:n})]}));Q.displayName="TooltipIconButton";function dm(t){return N.useMemo(()=>t.reduce((n,o)=>(n?.[o.language]&&!o.overrideExisting||(n={...n,[o.language]:{CodeHeader:o.Header??(()=>null),SyntaxHighlighter:o.Component??void 0}}),n),{}),[t])}const mm=()=>{const{plugins:t}=w.useElements(),n=dm(t);return u.jsx(Bt.MarkdownTextPrimitive,{remarkPlugins:[Xo],className:"aui-md",components:pm,componentsByLanguage:n})},Ui=N.memo(mm),fm=({language:t,code:n})=>{const i=k.useAssistantState(({message:l})=>l).status?.type==="complete",{isCopied:e,copyToClipboard:r}=gm(),s=()=>{!n||e||r(n)};return i?u.jsxs("div",{className:"aui-code-header-root bg-muted-foreground/15 text-foreground dark:bg-muted-foreground/20 mt-4 flex items-center justify-between gap-4 rounded-t-lg px-4 py-2 text-sm font-semibold",children:[u.jsx("span",{className:"aui-code-header-language lowercase [&>span]:text-xs",children:t}),u.jsxs(Q,{tooltip:"Copy",onClick:s,children:[!e&&u.jsx(qr,{}),e&&u.jsx(qe,{})]})]}):null},gm=({copiedDuration:t=3e3}={})=>{const[n,o]=N.useState(!1);return{isCopied:n,copyToClipboard:e=>{e&&navigator.clipboard.writeText(e).then(()=>{o(!0),setTimeout(()=>o(!1),t)})}}},pm=Bt.unstable_memoizeMarkdownComponents({h1:({className:t,...n})=>u.jsx("h1",{className:w.cn("aui-md-h1 mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0",t),...n}),h2:({className:t,...n})=>u.jsx("h2",{className:w.cn("aui-md-h2 mt-8 mb-4 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0",t),...n}),h3:({className:t,...n})=>u.jsx("h3",{className:w.cn("aui-md-h3 mt-6 mb-4 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0",t),...n}),h4:({className:t,...n})=>u.jsx("h4",{className:w.cn("aui-md-h4 mt-6 mb-4 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0",t),...n}),h5:({className:t,...n})=>u.jsx("h5",{className:w.cn("aui-md-h5 my-4 text-lg font-semibold first:mt-0 last:mb-0",t),...n}),h6:({className:t,...n})=>u.jsx("h6",{className:w.cn("aui-md-h6 my-4 font-semibold first:mt-0 last:mb-0",t),...n}),p:({className:t,...n})=>u.jsx("p",{className:w.cn("aui-md-p mt-5 mb-5 leading-7 first:mt-0 last:mb-0",t),...n}),a:({className:t,...n})=>u.jsx("a",{className:w.cn("aui-md-a text-primary font-medium underline underline-offset-4",t),...n}),blockquote:({className:t,...n})=>u.jsx("blockquote",{className:w.cn("aui-md-blockquote border-l-2 pl-6 italic",t),...n}),ul:({className:t,...n})=>u.jsx("ul",{className:w.cn("aui-md-ul my-5 ml-6 list-disc [&>li]:mt-2",t),...n}),ol:({className:t,...n})=>u.jsx("ol",{className:w.cn("aui-md-ol my-5 ml-6 list-decimal [&>li]:mt-2",t),...n}),hr:({className:t,...n})=>u.jsx("hr",{className:w.cn("aui-md-hr my-5 border-b",t),...n}),table:({className:t,...n})=>u.jsx("table",{className:w.cn("aui-md-table my-5 w-full border-separate border-spacing-0 overflow-y-auto",t),...n}),th:({className:t,...n})=>u.jsx("th",{className:w.cn("aui-md-th bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [[align=center]]:text-center [[align=right]]:text-right",t),...n}),td:({className:t,...n})=>u.jsx("td",{className:w.cn("aui-md-td border-b border-l px-4 py-2 text-left last:border-r [[align=center]]:text-center [[align=right]]:text-right",t),...n}),tr:({className:t,...n})=>u.jsx("tr",{className:w.cn("aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",t),...n}),sup:({className:t,...n})=>u.jsx("sup",{className:w.cn("aui-md-sup [&>a]:text-xs [&>a]:no-underline",t),...n}),pre:({className:t,...n})=>u.jsx("pre",{className:w.cn("aui-md-pre text-foreground bg-muted overflow-x-auto rounded-t-none! rounded-b-lg border border-t-0 p-4",t),...n}),code:function({className:n,...o}){const i=Bt.useIsMarkdownCodeBlock();return u.jsx("code",{className:w.cn(!i&&"aui-md-inline-code bg-muted rounded border font-semibold",n),...o})},CodeHeader:fm}),vm=a.union([a.object({type:a.literal("text"),text:a.string()}),a.object({type:a.literal("image"),data:a.string()})]),hm=a.object({content:a.array(vm)}).or(a._undefined$1()),ce=[.23,1,.32,1];function zi(t){return t.replace(/[-_]/g," ").split(/(?=[A-Z])/).join(" ").split(/\s+/).map(n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()).join(" ")}const ym=({toolName:t,status:n,result:o})=>{const e=k.useAssistantState(({message:f})=>f).parts.filter(f=>f.type==="tool-call"),r=e.findIndex(f=>f.toolName===t),s=N.useMemo(()=>n.type==="complete"?u.jsx(qe,{className:"size-4 text-emerald-500"}):n.type==="incomplete"?u.jsx(fc,{className:"size-4 text-rose-500"}):u.jsx(Kr,{className:"size-4 animate-spin text-blue-700"}),[n]),l=w.useDensity(),[m,c]=N.useState(!1),d=f=>{f.stopPropagation(),c(!m)};return u.jsx(J.LazyMotion,{features:J.domAnimation,children:u.jsxs("div",{className:w.cn("aui-tool-fallback-root flex w-full flex-col",r!==-1&&"border-b",r===e.length-1&&"border-b-0"),children:[u.jsxs("button",{className:w.cn("aui-tool-fallback-header flex h-full w-full cursor-pointer items-center",l("py-xs"),l("px-md"),l("gap-md")),onClick:d,children:[u.jsx("div",{children:s}),u.jsx("div",{className:"select-none",children:zi(t)}),u.jsx("div",{className:"ml-auto",children:u.jsx(ue,{variant:"ghost",size:"icon",className:"cursor-pointer hover:bg-transparent",onClick:d,children:m?u.jsx(Gr,{className:"size-4"}):u.jsx(rn,{className:"size-4"})})})]}),u.jsx(J.AnimatePresence,{children:m&&u.jsx(J.m.div,{initial:{height:0,opacity:0,y:-10},animate:{height:"auto",opacity:1,y:0},exit:{height:0,opacity:0,y:-10},transition:{duration:.3,ease:ce},style:{overflow:"hidden"},className:"bg-muted flex",children:bm(o)})})]})})};function bm(t){return hm.parse(t)?.content?.map(o=>{switch(o.type){case"text":return u.jsx("pre",{className:"aui-tool-fallback-result-content bg-accent max-h-[300px] overflow-y-auto p-4 font-mono whitespace-pre-wrap",children:o.text});case"image":{const i=`data:image/png;base64,${o.data}`;return u.jsx("img",{src:i,className:"max-h-[300px] max-w-full object-contain"})}default:return u.jsx("pre",{className:"aui-tool-fallback-result-content whitespace-pre-wrap",children:JSON.stringify(o,null,2)})}})}var Nt="Collapsible",[$m]=Ke(Nt),[xm,_n]=$m(Nt),Mi=g.forwardRef((t,n)=>{const{__scopeCollapsible:o,open:i,defaultOpen:e,disabled:r,onOpenChange:s,...l}=t,[m,c]=It({prop:i,defaultProp:e??!1,onChange:s,caller:Nt});return u.jsx(xm,{scope:o,disabled:r,contentId:Ee(),open:m,onOpenToggle:g.useCallback(()=>c(d=>!d),[c]),children:u.jsx(V.div,{"data-state":Sn(m),"data-disabled":r?"":void 0,...l,ref:n})})});Mi.displayName=Nt;var Li="CollapsibleTrigger",Zi=g.forwardRef((t,n)=>{const{__scopeCollapsible:o,...i}=t,e=_n(Li,o);return u.jsx(V.button,{type:"button","aria-controls":e.contentId,"aria-expanded":e.open||!1,"data-state":Sn(e.open),"data-disabled":e.disabled?"":void 0,disabled:e.disabled,...i,ref:n,onClick:M(t.onClick,e.onOpenToggle)})});Zi.displayName=Li;var wn="CollapsibleContent",Fi=g.forwardRef((t,n)=>{const{forceMount:o,...i}=t,e=_n(wn,t.__scopeCollapsible);return u.jsx(pe,{present:o||e.open,children:({present:r})=>u.jsx(_m,{...i,ref:n,present:r})})});Fi.displayName=wn;var _m=g.forwardRef((t,n)=>{const{__scopeCollapsible:o,present:i,children:e,...r}=t,s=_n(wn,o),[l,m]=g.useState(i),c=g.useRef(null),d=G(n,c),f=g.useRef(0),y=f.current,p=g.useRef(0),h=p.current,v=s.open||l,$=g.useRef(v),x=g.useRef(void 0);return g.useEffect(()=>{const _=requestAnimationFrame(()=>$.current=!1);return()=>cancelAnimationFrame(_)},[]),Y(()=>{const _=c.current;if(_){x.current=x.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const I=_.getBoundingClientRect();f.current=I.height,p.current=I.width,$.current||(_.style.transitionDuration=x.current.transitionDuration,_.style.animationName=x.current.animationName),m(i)}},[s.open,i]),u.jsx(V.div,{"data-state":Sn(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...r,ref:d,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...t.style},children:v&&e})});function Sn(t){return t?"open":"closed"}var wm=Mi;function Sm({...t}){return u.jsx(wm,{"data-slot":"collapsible",...t})}function Im({...t}){return u.jsx(Zi,{"data-slot":"collapsible-trigger",...t})}function jm({...t}){return u.jsx(Fi,{"data-slot":"collapsible-content",...t})}const hr=200,Vi=({className:t,children:n})=>{const o=N.useRef(null),[i,e]=N.useState(!1),r=k.useScrollLock(o,hr),s=N.useCallback(l=>{l||r(),e(l)},[r]);return u.jsx(Sm,{ref:o,open:i,onOpenChange:s,className:w.cn("aui-reasoning-root mb-4 w-full",t),style:{"--animation-duration":`${hr}ms`},children:n})};Vi.displayName="ReasoningRoot";const km=({className:t})=>u.jsx("div",{className:w.cn("aui-reasoning-fade pointer-events-none absolute inset-x-0 bottom-0 z-10 h-16","bg-[linear-gradient(to_top,var(--color-background),transparent)]","fade-in-0 animate-in","group-data-[state=open]/collapsible-content:animate-out","group-data-[state=open]/collapsible-content:fade-out-0","group-data-[state=open]/collapsible-content:delay-[calc(var(--animation-duration)*0.75)]","group-data-[state=open]/collapsible-content:fill-mode-forwards","duration-(--animation-duration)","group-data-[state=open]/collapsible-content:duration-(--animation-duration)",t)}),Nm=({active:t,className:n})=>u.jsxs(Im,{className:w.cn("aui-reasoning-trigger group/trigger text-muted-foreground hover:text-foreground -mb-2 flex max-w-[75%] items-center gap-2 py-2 text-sm transition-colors",n,t&&"shimmer"),children:[u.jsx(ic,{className:"aui-reasoning-trigger-icon size-4 shrink-0"}),u.jsxs("span",{className:"aui-reasoning-trigger-label-wrapper relative inline-block leading-none",children:[u.jsx("span",{children:"Reasoning"}),t?u.jsx("span",{"aria-hidden":!0,className:"aui-reasoning-trigger-shimmer shimmer pointer-events-none absolute inset-0 motion-reduce:animate-none",children:"Reasoning"}):null]}),u.jsx(rn,{className:w.cn("aui-reasoning-trigger-chevron mt-0.5 size-4 shrink-0","transition-transform duration-(--animation-duration) ease-out","group-data-[state=closed]/trigger:-rotate-90","group-data-[state=open]/trigger:rotate-0")})]}),Wi=({className:t,children:n,"aria-busy":o})=>u.jsxs(jm,{className:w.cn("aui-reasoning-content text-muted-foreground relative overflow-hidden text-sm outline-none","group/collapsible-content ease-out","data-[state=closed]:animate-collapsible-up","data-[state=open]:animate-collapsible-down","data-[state=closed]:fill-mode-forwards","data-[state=closed]:pointer-events-none","data-[state=open]:duration-(--animation-duration)","data-[state=closed]:duration-(--animation-duration)",t),"aria-busy":o,children:[n,u.jsx(km,{})]});Wi.displayName="ReasoningContent";const Bi=({className:t,children:n})=>u.jsx("div",{className:w.cn("aui-reasoning-text relative z-0 space-y-4 pt-4 pl-6 leading-relaxed","transform-gpu transition-[transform,opacity]","group-data-[state=open]/collapsible-content:animate-in","group-data-[state=closed]/collapsible-content:animate-out","group-data-[state=open]/collapsible-content:fade-in-0","group-data-[state=closed]/collapsible-content:fade-out-0","group-data-[state=open]/collapsible-content:slide-in-from-top-4","group-data-[state=closed]/collapsible-content:slide-out-to-top-4","group-data-[state=open]/collapsible-content:duration-(--animation-duration)","group-data-[state=closed]/collapsible-content:duration-(--animation-duration)","[&_p]:-mb-2",t),children:n});Bi.displayName="ReasoningText";const Em=()=>u.jsx(Ui,{}),Om=({children:t,startIndex:n,endIndex:o})=>{const i=k.useAssistantState(({message:e})=>{if(e.status?.type!=="running")return!1;const r=e.parts.length-1;return r<0||e.parts[r]?.type!=="reasoning"?!1:r>=n&&r<=o});return u.jsxs(Vi,{children:[u.jsx(Nm,{active:i}),u.jsx(Wi,{"aria-busy":i,children:u.jsx(Bi,{children:t})})]})},Ji=N.memo(Em);Ji.displayName="Reasoning";const Gi=N.memo(Om);Gi.displayName="ReasoningGroup";var zt="focusScope.autoFocusOnMount",Mt="focusScope.autoFocusOnUnmount",yr={bubbles:!1,cancelable:!0},Cm="FocusScope",In=g.forwardRef((t,n)=>{const{loop:o=!1,trapped:i=!1,onMountAutoFocus:e,onUnmountAutoFocus:r,...s}=t,[l,m]=g.useState(null),c=xe(e),d=xe(r),f=g.useRef(null),y=G(n,v=>m(v)),p=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(i){let v=function(I){if(p.paused||!l)return;const b=I.target;l.contains(b)?f.current=b:he(f.current,{select:!0})},$=function(I){if(p.paused||!l)return;const b=I.relatedTarget;b!==null&&(l.contains(b)||he(f.current,{select:!0}))},x=function(I){if(document.activeElement===document.body)for(const j of I)j.removedNodes.length>0&&he(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",$);const _=new MutationObserver(x);return l&&_.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",$),_.disconnect()}}},[i,l,p.paused]),g.useEffect(()=>{if(l){$r.add(p);const v=document.activeElement;if(!l.contains(v)){const x=new CustomEvent(zt,yr);l.addEventListener(zt,c),l.dispatchEvent(x),x.defaultPrevented||(Pm(Um(qi(l)),{select:!0}),document.activeElement===v&&he(l))}return()=>{l.removeEventListener(zt,c),setTimeout(()=>{const x=new CustomEvent(Mt,yr);l.addEventListener(Mt,d),l.dispatchEvent(x),x.defaultPrevented||he(v??document.body,{select:!0}),l.removeEventListener(Mt,d),$r.remove(p)},0)}}},[l,c,d,p]);const h=g.useCallback(v=>{if(!o&&!i||p.paused)return;const $=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if($&&x){const _=v.currentTarget,[I,b]=Tm(_);I&&b?!v.shiftKey&&x===b?(v.preventDefault(),o&&he(I,{select:!0})):v.shiftKey&&x===I&&(v.preventDefault(),o&&he(b,{select:!0})):x===_&&v.preventDefault()}},[o,i,p.paused]);return u.jsx(V.div,{tabIndex:-1,...s,ref:y,onKeyDown:h})});In.displayName=Cm;function Pm(t,{select:n=!1}={}){const o=document.activeElement;for(const i of t)if(he(i,{select:n}),document.activeElement!==o)return}function Tm(t){const n=qi(t),o=br(n,t),i=br(n.reverse(),t);return[o,i]}function qi(t){const n=[],o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const e=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||e?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;o.nextNode();)n.push(o.currentNode);return n}function br(t,n){for(const o of t)if(!Dm(o,{upTo:n}))return o}function Dm(t,{upTo:n}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(n!==void 0&&t===n)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Rm(t){return t instanceof HTMLInputElement&&"select"in t}function he(t,{select:n=!1}={}){if(t&&t.focus){const o=document.activeElement;t.focus({preventScroll:!0}),t!==o&&Rm(t)&&n&&t.select()}}var $r=Am();function Am(){let t=[];return{add(n){const o=t[0];n!==o&&o?.pause(),t=xr(t,n),t.unshift(n)},remove(n){t=xr(t,n),t[0]?.resume()}}}function xr(t,n){const o=[...t],i=o.indexOf(n);return i!==-1&&o.splice(i,1),o}function Um(t){return t.filter(n=>n.tagName!=="A")}var Lt=0;function Ki(){g.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??_r()),document.body.insertAdjacentElement("beforeend",t[1]??_r()),Lt++,()=>{Lt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),Lt--}},[])}function _r(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var ae=function(){return ae=Object.assign||function(n){for(var o,i=1,e=arguments.length;i<e;i++){o=arguments[i];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])}return n},ae.apply(this,arguments)};function Hi(t,n){var o={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&n.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var e=0,i=Object.getOwnPropertySymbols(t);e<i.length;e++)n.indexOf(i[e])<0&&Object.prototype.propertyIsEnumerable.call(t,i[e])&&(o[i[e]]=t[i[e]]);return o}function zm(t,n,o){if(o||arguments.length===2)for(var i=0,e=n.length,r;i<e;i++)(r||!(i in n))&&(r||(r=Array.prototype.slice.call(n,0,i)),r[i]=n[i]);return t.concat(r||Array.prototype.slice.call(n))}var ut="right-scroll-bar-position",dt="width-before-scroll-bar",Mm="with-scroll-bars-hidden",Lm="--removed-body-scroll-bar-size";function Zt(t,n){return typeof t=="function"?t(n):t&&(t.current=n),t}function Zm(t,n){var o=N.useState(function(){return{value:t,callback:n,facade:{get current(){return o.value},set current(i){var e=o.value;e!==i&&(o.value=i,o.callback(i,e))}}}})[0];return o.callback=n,o.facade}var Fm=typeof window<"u"?g.useLayoutEffect:g.useEffect,wr=new WeakMap;function Vm(t,n){var o=Zm(null,function(i){return t.forEach(function(e){return Zt(e,i)})});return Fm(function(){var i=wr.get(o);if(i){var e=new Set(i),r=new Set(t),s=o.current;e.forEach(function(l){r.has(l)||Zt(l,null)}),r.forEach(function(l){e.has(l)||Zt(l,s)})}wr.set(o,t)},[t]),o}function Wm(t){return t}function Bm(t,n){n===void 0&&(n=Wm);var o=[],i=!1,e={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return o.length?o[o.length-1]:t},useMedium:function(r){var s=n(r,i);return o.push(s),function(){o=o.filter(function(l){return l!==s})}},assignSyncMedium:function(r){for(i=!0;o.length;){var s=o;o=[],s.forEach(r)}o={push:function(l){return r(l)},filter:function(){return o}}},assignMedium:function(r){i=!0;var s=[];if(o.length){var l=o;o=[],l.forEach(r),s=o}var m=function(){var d=s;s=[],d.forEach(r)},c=function(){return Promise.resolve().then(m)};c(),o={push:function(d){s.push(d),c()},filter:function(d){return s=s.filter(d),o}}}};return e}function Jm(t){t===void 0&&(t={});var n=Bm(null);return n.options=ae({async:!0,ssr:!1},t),n}var Xi=function(t){var n=t.sideCar,o=Hi(t,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=n.read();if(!i)throw new Error("Sidecar medium not found");return g.createElement(i,ae({},o))};Xi.isSideCarExport=!0;function Gm(t,n){return t.useMedium(n),Xi}var Yi=Jm(),Ft=function(){},Et=g.forwardRef(function(t,n){var o=g.useRef(null),i=g.useState({onScrollCapture:Ft,onWheelCapture:Ft,onTouchMoveCapture:Ft}),e=i[0],r=i[1],s=t.forwardProps,l=t.children,m=t.className,c=t.removeScrollBar,d=t.enabled,f=t.shards,y=t.sideCar,p=t.noRelative,h=t.noIsolation,v=t.inert,$=t.allowPinchZoom,x=t.as,_=x===void 0?"div":x,I=t.gapMode,b=Hi(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=y,E=Vm([o,n]),S=ae(ae({},b),e);return g.createElement(g.Fragment,null,d&&g.createElement(j,{sideCar:Yi,removeScrollBar:c,shards:f,noRelative:p,noIsolation:h,inert:v,setCallbacks:r,allowPinchZoom:!!$,lockRef:o,gapMode:I}),s?g.cloneElement(g.Children.only(l),ae(ae({},S),{ref:E})):g.createElement(_,ae({},S,{className:m,ref:E}),l))});Et.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Et.classNames={fullWidth:dt,zeroRight:ut};var qm=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Km(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var n=qm();return n&&t.setAttribute("nonce",n),t}function Hm(t,n){t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n))}function Xm(t){var n=document.head||document.getElementsByTagName("head")[0];n.appendChild(t)}var Ym=function(){var t=0,n=null;return{add:function(o){t==0&&(n=Km())&&(Hm(n,o),Xm(n)),t++},remove:function(){t--,!t&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},Qm=function(){var t=Ym();return function(n,o){g.useEffect(function(){return t.add(n),function(){t.remove()}},[n&&o])}},Qi=function(){var t=Qm(),n=function(o){var i=o.styles,e=o.dynamic;return t(i,e),null};return n},ef={left:0,top:0,right:0,gap:0},Vt=function(t){return parseInt(t||"",10)||0},tf=function(t){var n=window.getComputedStyle(document.body),o=n[t==="padding"?"paddingLeft":"marginLeft"],i=n[t==="padding"?"paddingTop":"marginTop"],e=n[t==="padding"?"paddingRight":"marginRight"];return[Vt(o),Vt(i),Vt(e)]},nf=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return ef;var n=tf(t),o=document.documentElement.clientWidth,i=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,i-o+n[2]-n[0])}},rf=Qi(),Ce="data-scroll-locked",of=function(t,n,o,i){var e=t.left,r=t.top,s=t.right,l=t.gap;return o===void 0&&(o="margin"),`
13
+ `)}`}const Gl=({children:t,config:n})=>{const[o,i]=N.useState(n.model?.defaultModel??a.MODELS[0]),[e,r]=N.useState(n.modal?.defaultExpanded??!1),[s,l]=N.useState(n.modal?.defaultOpen),m=Vl({transport:new qt({api:n.chatEndpoint??Wl,prepareSendMessagesRequest:({id:c,messages:d})=>({body:{messages:d,system:Jl(n.systemPrompt,n.plugins??w.recommended),id:c,config:{mcp:n.mcp,environment:n.environment,projectSlug:n.projectSlug,model:o}}})})});return u.jsx(k.AssistantRuntimeProvider,{runtime:m,children:u.jsx(w.ElementsContext.Provider,{value:{config:n,setModel:i,model:o,isExpanded:e,setIsExpanded:r,isOpen:s??!1,setIsOpen:l,plugins:n.plugins??[]},children:t})})};const ql=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Kl=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,o,i)=>i?i.toUpperCase():o.toLowerCase()),er=t=>{const n=Kl(t);return n.charAt(0).toUpperCase()+n.slice(1)},Jr=(...t)=>t.filter((n,o,i)=>!!n&&n.trim()!==""&&i.indexOf(n)===o).join(" ").trim(),Hl=t=>{for(const n in t)if(n.startsWith("aria-")||n==="role"||n==="title")return!0};var Xl={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Yl=N.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:o=2,absoluteStrokeWidth:i,className:e="",children:r,iconNode:s,...l},m)=>N.createElement("svg",{ref:m,...Xl,width:n,height:n,stroke:t,strokeWidth:i?Number(o)*24/Number(n):o,className:Jr("lucide",e),...!r&&!Hl(l)&&{"aria-hidden":"true"},...l},[...s.map(([c,d])=>N.createElement(c,d)),...Array.isArray(r)?r:[r]]));const R=(t,n)=>{const o=N.forwardRef(({className:i,...e},r)=>N.createElement(Yl,{ref:r,iconNode:n,className:Jr(`lucide-${ql(er(t))}`,`lucide-${t}`,i),...e}));return o.displayName=er(t),o};const Ql=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ec=R("arrow-down",Ql);const tc=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],nc=R("arrow-up",tc);const rc=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],ic=R("brain",rc);const oc=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],qe=R("check",oc);const ac=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],rn=R("chevron-down",ac);const sc=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],lc=R("chevron-left",sc);const cc=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],uc=R("chevron-right",cc);const dc=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Gr=R("chevron-up",dc);const mc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],fc=R("circle-alert",mc);const gc=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],qr=R("copy",gc);const pc=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],vc=R("file-text",pc);const hc=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Kr=R("loader-circle",hc);const yc=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],bc=R("maximize",yc);const $c=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],xc=R("message-circle",$c);const _c=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],wc=R("minimize",_c);const Sc=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Ic=R("panel-right-close",Sc);const jc=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],kc=R("panel-right-open",jc);const Nc=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Ec=R("pencil",Nc);const Oc=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Cc=R("plus",Oc);const Pc=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Tc=R("refresh-cw",Pc);const Dc=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Rc=R("settings-2",Dc);const Ac=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Uc=R("square",Ac);const zc=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],on=R("x",zc);function tr(t,n){if(typeof t=="function")return t(n);t!=null&&(t.current=n)}function an(...t){return n=>{let o=!1;const i=t.map(e=>{const r=tr(e,n);return!o&&typeof r=="function"&&(o=!0),r});if(o)return()=>{for(let e=0;e<i.length;e++){const r=i[e];typeof r=="function"?r():tr(t[e],null)}}}}function G(...t){return g.useCallback(an(...t),t)}var Mc=Symbol.for("react.lazy"),mt=g[" use ".trim().toString()];function Lc(t){return typeof t=="object"&&t!==null&&"then"in t}function Hr(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===Mc&&"_payload"in t&&Lc(t._payload)}function Xr(t){const n=Fc(t),o=g.forwardRef((i,e)=>{let{children:r,...s}=i;Hr(r)&&typeof mt=="function"&&(r=mt(r._payload));const l=g.Children.toArray(r),m=l.find(Bc);if(m){const c=m.props.children,d=l.map(f=>f===m?g.Children.count(c)>1?g.Children.only(null):g.isValidElement(c)?c.props.children:null:f);return u.jsx(n,{...s,ref:e,children:g.isValidElement(c)?g.cloneElement(c,void 0,d):null})}return u.jsx(n,{...s,ref:e,children:r})});return o.displayName=`${t}.Slot`,o}var Zc=Xr("Slot");function Fc(t){const n=g.forwardRef((o,i)=>{let{children:e,...r}=o;if(Hr(e)&&typeof mt=="function"&&(e=mt(e._payload)),g.isValidElement(e)){const s=Gc(e),l=Jc(r,e.props);return e.type!==g.Fragment&&(l.ref=i?an(i,s):s),g.cloneElement(e,l)}return g.Children.count(e)>1?g.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var Yr=Symbol("radix.slottable");function Vc(t){const n=({children:o})=>u.jsx(u.Fragment,{children:o});return n.displayName=`${t}.Slottable`,n.__radixId=Yr,n}var Wc=Vc("Slottable");function Bc(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Yr}function Jc(t,n){const o={...n};for(const i in n){const e=t[i],r=n[i];/^on[A-Z]/.test(i)?e&&r?o[i]=(...l)=>{const m=r(...l);return e(...l),m}:e&&(o[i]=e):i==="style"?o[i]={...e,...r}:i==="className"&&(o[i]=[e,r].filter(Boolean).join(" "))}return{...t,...o}}function Gc(t){let n=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=n&&"isReactWarning"in n&&n.isReactWarning;return o?t.ref:(n=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=n&&"isReactWarning"in n&&n.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}const nr=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,rr=w.clsx,qc=(t,n)=>o=>{var i;if(n?.variants==null)return rr(t,o?.class,o?.className);const{variants:e,defaultVariants:r}=n,s=Object.keys(e).map(c=>{const d=o?.[c],f=r?.[c];if(d===null)return null;const y=nr(d)||nr(f);return e[c][y]}),l=o&&Object.entries(o).reduce((c,d)=>{let[f,y]=d;return y===void 0||(c[f]=y),c},{}),m=n==null||(i=n.compoundVariants)===null||i===void 0?void 0:i.reduce((c,d)=>{let{class:f,className:y,...p}=d;return Object.entries(p).every(h=>{let[v,$]=h;return Array.isArray($)?$.includes({...r,...l}[v]):{...r,...l}[v]===$})?[...c,f,y]:c},[]);return rr(t,s,m,o?.class,o?.className)},Kc=qc("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}}),ue=g.forwardRef(({className:t,variant:n,size:o,asChild:i=!1,...e},r)=>{const s=i?Zc:"button";return u.jsx(s,{"data-slot":"button",className:w.cn(Kc({variant:n,size:o,className:t})),ref:r,...e})});ue.displayName="Button";function M(t,n,{checkForDefaultPrevented:o=!0}={}){return function(e){if(t?.(e),o===!1||!e.defaultPrevented)return n?.(e)}}function Hc(t,n){const o=g.createContext(n),i=r=>{const{children:s,...l}=r,m=g.useMemo(()=>l,Object.values(l));return u.jsx(o.Provider,{value:m,children:s})};i.displayName=t+"Provider";function e(r){const s=g.useContext(o);if(s)return s;if(n!==void 0)return n;throw new Error(`\`${r}\` must be used within \`${t}\``)}return[i,e]}function Ke(t,n=[]){let o=[];function i(r,s){const l=g.createContext(s),m=o.length;o=[...o,s];const c=f=>{const{scope:y,children:p,...h}=f,v=y?.[t]?.[m]||l,$=g.useMemo(()=>h,Object.values(h));return u.jsx(v.Provider,{value:$,children:p})};c.displayName=r+"Provider";function d(f,y){const p=y?.[t]?.[m]||l,h=g.useContext(p);if(h)return h;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${r}\``)}return[c,d]}const e=()=>{const r=o.map(s=>g.createContext(s));return function(l){const m=l?.[t]||r;return g.useMemo(()=>({[`__scope${t}`]:{...l,[t]:m}}),[l,m])}};return e.scopeName=t,[i,Xc(e,...n)]}function Xc(...t){const n=t[0];if(t.length===1)return n;const o=()=>{const i=t.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(r){const s=i.reduce((l,{useScope:m,scopeName:c})=>{const f=m(r)[`__scope${c}`];return{...l,...f}},{});return g.useMemo(()=>({[`__scope${n.scopeName}`]:s}),[s])}};return o.scopeName=n.scopeName,o}function sn(t){const n=Yc(t),o=g.forwardRef((i,e)=>{const{children:r,...s}=i,l=g.Children.toArray(r),m=l.find(eu);if(m){const c=m.props.children,d=l.map(f=>f===m?g.Children.count(c)>1?g.Children.only(null):g.isValidElement(c)?c.props.children:null:f);return u.jsx(n,{...s,ref:e,children:g.isValidElement(c)?g.cloneElement(c,void 0,d):null})}return u.jsx(n,{...s,ref:e,children:r})});return o.displayName=`${t}.Slot`,o}function Yc(t){const n=g.forwardRef((o,i)=>{const{children:e,...r}=o;if(g.isValidElement(e)){const s=nu(e),l=tu(r,e.props);return e.type!==g.Fragment&&(l.ref=i?an(i,s):s),g.cloneElement(e,l)}return g.Children.count(e)>1?g.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var Qr=Symbol("radix.slottable");function Qc(t){const n=({children:o})=>u.jsx(u.Fragment,{children:o});return n.displayName=`${t}.Slottable`,n.__radixId=Qr,n}function eu(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Qr}function tu(t,n){const o={...n};for(const i in n){const e=t[i],r=n[i];/^on[A-Z]/.test(i)?e&&r?o[i]=(...l)=>{const m=r(...l);return e(...l),m}:e&&(o[i]=e):i==="style"?o[i]={...e,...r}:i==="className"&&(o[i]=[e,r].filter(Boolean).join(" "))}return{...t,...o}}function nu(t){let n=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=n&&"isReactWarning"in n&&n.isReactWarning;return o?t.ref:(n=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=n&&"isReactWarning"in n&&n.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}var ru=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=ru.reduce((t,n)=>{const o=sn(`Primitive.${n}`),i=g.forwardRef((e,r)=>{const{asChild:s,...l}=e,m=s?o:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...l,ref:r})});return i.displayName=`Primitive.${n}`,{...t,[n]:i}},{});function iu(t,n){t&&Or.flushSync(()=>t.dispatchEvent(n))}function xe(t){const n=g.useRef(t);return g.useEffect(()=>{n.current=t}),g.useMemo(()=>(...o)=>n.current?.(...o),[])}function ou(t,n=globalThis?.document){const o=xe(t);g.useEffect(()=>{const i=e=>{e.key==="Escape"&&o(e)};return n.addEventListener("keydown",i,{capture:!0}),()=>n.removeEventListener("keydown",i,{capture:!0})},[o,n])}var au="DismissableLayer",Kt="dismissableLayer.update",su="dismissableLayer.pointerDownOutside",lu="dismissableLayer.focusOutside",ir,ei=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),yt=g.forwardRef((t,n)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:i,onPointerDownOutside:e,onFocusOutside:r,onInteractOutside:s,onDismiss:l,...m}=t,c=g.useContext(ei),[d,f]=g.useState(null),y=d?.ownerDocument??globalThis?.document,[,p]=g.useState({}),h=G(n,S=>f(S)),v=Array.from(c.layers),[$]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),x=v.indexOf($),_=d?v.indexOf(d):-1,I=c.layersWithOutsidePointerEventsDisabled.size>0,b=_>=x,j=du(S=>{const O=S.target,P=[...c.branches].some(T=>T.contains(O));!b||P||(e?.(S),s?.(S),S.defaultPrevented||l?.())},y),E=mu(S=>{const O=S.target;[...c.branches].some(T=>T.contains(O))||(r?.(S),s?.(S),S.defaultPrevented||l?.())},y);return ou(S=>{_===c.layers.size-1&&(i?.(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},y),g.useEffect(()=>{if(d)return o&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(ir=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),or(),()=>{o&&c.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=ir)}},[d,y,o,c]),g.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),or())},[d,c]),g.useEffect(()=>{const S=()=>p({});return document.addEventListener(Kt,S),()=>document.removeEventListener(Kt,S)},[]),u.jsx(V.div,{...m,ref:h,style:{pointerEvents:I?b?"auto":"none":void 0,...t.style},onFocusCapture:M(t.onFocusCapture,E.onFocusCapture),onBlurCapture:M(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:M(t.onPointerDownCapture,j.onPointerDownCapture)})});yt.displayName=au;var cu="DismissableLayerBranch",uu=g.forwardRef((t,n)=>{const o=g.useContext(ei),i=g.useRef(null),e=G(n,i);return g.useEffect(()=>{const r=i.current;if(r)return o.branches.add(r),()=>{o.branches.delete(r)}},[o.branches]),u.jsx(V.div,{...t,ref:e})});uu.displayName=cu;function du(t,n=globalThis?.document){const o=xe(t),i=g.useRef(!1),e=g.useRef(()=>{});return g.useEffect(()=>{const r=l=>{if(l.target&&!i.current){let m=function(){ti(su,o,c,{discrete:!0})};const c={originalEvent:l};l.pointerType==="touch"?(n.removeEventListener("click",e.current),e.current=m,n.addEventListener("click",e.current,{once:!0})):m()}else n.removeEventListener("click",e.current);i.current=!1},s=window.setTimeout(()=>{n.addEventListener("pointerdown",r)},0);return()=>{window.clearTimeout(s),n.removeEventListener("pointerdown",r),n.removeEventListener("click",e.current)}},[n,o]),{onPointerDownCapture:()=>i.current=!0}}function mu(t,n=globalThis?.document){const o=xe(t),i=g.useRef(!1);return g.useEffect(()=>{const e=r=>{r.target&&!i.current&&ti(lu,o,{originalEvent:r},{discrete:!1})};return n.addEventListener("focusin",e),()=>n.removeEventListener("focusin",e)},[n,o]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function or(){const t=new CustomEvent(Kt);document.dispatchEvent(t)}function ti(t,n,o,{discrete:i}){const e=o.originalEvent.target,r=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:o});n&&e.addEventListener(t,n,{once:!0}),i?iu(e,r):e.dispatchEvent(r)}var Y=globalThis?.document?g.useLayoutEffect:()=>{},fu=g[" useId ".trim().toString()]||(()=>{}),gu=0;function Ee(t){const[n,o]=g.useState(fu());return Y(()=>{o(i=>i??String(gu++))},[t]),n?`radix-${n}`:""}const pu=["top","right","bottom","left"],ye=Math.min,K=Math.max,ft=Math.round,tt=Math.floor,le=t=>({x:t,y:t}),vu={left:"right",right:"left",bottom:"top",top:"bottom"},hu={start:"end",end:"start"};function Ht(t,n,o){return K(t,ye(n,o))}function fe(t,n){return typeof t=="function"?t(n):t}function ge(t){return t.split("-")[0]}function Re(t){return t.split("-")[1]}function ln(t){return t==="x"?"y":"x"}function cn(t){return t==="y"?"height":"width"}const yu=new Set(["top","bottom"]);function se(t){return yu.has(ge(t))?"y":"x"}function un(t){return ln(se(t))}function bu(t,n,o){o===void 0&&(o=!1);const i=Re(t),e=un(t),r=cn(e);let s=e==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return n.reference[r]>n.floating[r]&&(s=gt(s)),[s,gt(s)]}function $u(t){const n=gt(t);return[Xt(t),n,Xt(n)]}function Xt(t){return t.replace(/start|end/g,n=>hu[n])}const ar=["left","right"],sr=["right","left"],xu=["top","bottom"],_u=["bottom","top"];function wu(t,n,o){switch(t){case"top":case"bottom":return o?n?sr:ar:n?ar:sr;case"left":case"right":return n?xu:_u;default:return[]}}function Su(t,n,o,i){const e=Re(t);let r=wu(ge(t),o==="start",i);return e&&(r=r.map(s=>s+"-"+e),n&&(r=r.concat(r.map(Xt)))),r}function gt(t){return t.replace(/left|right|bottom|top/g,n=>vu[n])}function Iu(t){return{top:0,right:0,bottom:0,left:0,...t}}function ni(t){return typeof t!="number"?Iu(t):{top:t,right:t,bottom:t,left:t}}function pt(t){const{x:n,y:o,width:i,height:e}=t;return{width:i,height:e,top:o,left:n,right:n+i,bottom:o+e,x:n,y:o}}function lr(t,n,o){let{reference:i,floating:e}=t;const r=se(n),s=un(n),l=cn(s),m=ge(n),c=r==="y",d=i.x+i.width/2-e.width/2,f=i.y+i.height/2-e.height/2,y=i[l]/2-e[l]/2;let p;switch(m){case"top":p={x:d,y:i.y-e.height};break;case"bottom":p={x:d,y:i.y+i.height};break;case"right":p={x:i.x+i.width,y:f};break;case"left":p={x:i.x-e.width,y:f};break;default:p={x:i.x,y:i.y}}switch(Re(n)){case"start":p[s]-=y*(o&&c?-1:1);break;case"end":p[s]+=y*(o&&c?-1:1);break}return p}const ju=async(t,n,o)=>{const{placement:i="bottom",strategy:e="absolute",middleware:r=[],platform:s}=o,l=r.filter(Boolean),m=await(s.isRTL==null?void 0:s.isRTL(n));let c=await s.getElementRects({reference:t,floating:n,strategy:e}),{x:d,y:f}=lr(c,i,m),y=i,p={},h=0;for(let v=0;v<l.length;v++){const{name:$,fn:x}=l[v],{x:_,y:I,data:b,reset:j}=await x({x:d,y:f,initialPlacement:i,placement:y,strategy:e,middlewareData:p,rects:c,platform:s,elements:{reference:t,floating:n}});d=_??d,f=I??f,p={...p,[$]:{...p[$],...b}},j&&h<=50&&(h++,typeof j=="object"&&(j.placement&&(y=j.placement),j.rects&&(c=j.rects===!0?await s.getElementRects({reference:t,floating:n,strategy:e}):j.rects),{x:d,y:f}=lr(c,y,m)),v=-1)}return{x:d,y:f,placement:y,strategy:e,middlewareData:p}};async function Be(t,n){var o;n===void 0&&(n={});const{x:i,y:e,platform:r,rects:s,elements:l,strategy:m}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:y=!1,padding:p=0}=fe(n,t),h=ni(p),$=l[y?f==="floating"?"reference":"floating":f],x=pt(await r.getClippingRect({element:(o=await(r.isElement==null?void 0:r.isElement($)))==null||o?$:$.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(l.floating)),boundary:c,rootBoundary:d,strategy:m})),_=f==="floating"?{x:i,y:e,width:s.floating.width,height:s.floating.height}:s.reference,I=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l.floating)),b=await(r.isElement==null?void 0:r.isElement(I))?await(r.getScale==null?void 0:r.getScale(I))||{x:1,y:1}:{x:1,y:1},j=pt(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:_,offsetParent:I,strategy:m}):_);return{top:(x.top-j.top+h.top)/b.y,bottom:(j.bottom-x.bottom+h.bottom)/b.y,left:(x.left-j.left+h.left)/b.x,right:(j.right-x.right+h.right)/b.x}}const ku=t=>({name:"arrow",options:t,async fn(n){const{x:o,y:i,placement:e,rects:r,platform:s,elements:l,middlewareData:m}=n,{element:c,padding:d=0}=fe(t,n)||{};if(c==null)return{};const f=ni(d),y={x:o,y:i},p=un(e),h=cn(p),v=await s.getDimensions(c),$=p==="y",x=$?"top":"left",_=$?"bottom":"right",I=$?"clientHeight":"clientWidth",b=r.reference[h]+r.reference[p]-y[p]-r.floating[h],j=y[p]-r.reference[p],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let S=E?E[I]:0;(!S||!await(s.isElement==null?void 0:s.isElement(E)))&&(S=l.floating[I]||r.floating[h]);const O=b/2-j/2,P=S/2-v[h]/2-1,T=ye(f[x],P),z=ye(f[_],P),W=T,L=S-v[h]-z,A=S/2-v[h]/2+O,q=Ht(W,A,L),Z=!m.arrow&&Re(e)!=null&&A!==q&&r.reference[h]/2-(A<W?T:z)-v[h]/2<0,F=Z?A<W?A-W:A-L:0;return{[p]:y[p]+F,data:{[p]:q,centerOffset:A-q-F,...Z&&{alignmentOffset:F}},reset:Z}}}),Nu=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(n){var o,i;const{placement:e,middlewareData:r,rects:s,initialPlacement:l,platform:m,elements:c}=n,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:y,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:v=!0,...$}=fe(t,n);if((o=r.arrow)!=null&&o.alignmentOffset)return{};const x=ge(e),_=se(l),I=ge(l)===l,b=await(m.isRTL==null?void 0:m.isRTL(c.floating)),j=y||(I||!v?[gt(l)]:$u(l)),E=h!=="none";!y&&E&&j.push(...Su(l,v,h,b));const S=[l,...j],O=await Be(n,$),P=[];let T=((i=r.flip)==null?void 0:i.overflows)||[];if(d&&P.push(O[x]),f){const A=bu(e,s,b);P.push(O[A[0]],O[A[1]])}if(T=[...T,{placement:e,overflows:P}],!P.every(A=>A<=0)){var z,W;const A=(((z=r.flip)==null?void 0:z.index)||0)+1,q=S[A];if(q&&(!(f==="alignment"?_!==se(q):!1)||T.every(C=>se(C.placement)===_?C.overflows[0]>0:!0)))return{data:{index:A,overflows:T},reset:{placement:q}};let Z=(W=T.filter(F=>F.overflows[0]<=0).sort((F,C)=>F.overflows[1]-C.overflows[1])[0])==null?void 0:W.placement;if(!Z)switch(p){case"bestFit":{var L;const F=(L=T.filter(C=>{if(E){const B=se(C.placement);return B===_||B==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(B=>B>0).reduce((B,re)=>B+re,0)]).sort((C,B)=>C[1]-B[1])[0])==null?void 0:L[0];F&&(Z=F);break}case"initialPlacement":Z=l;break}if(e!==Z)return{reset:{placement:Z}}}return{}}}};function cr(t,n){return{top:t.top-n.height,right:t.right-n.width,bottom:t.bottom-n.height,left:t.left-n.width}}function ur(t){return pu.some(n=>t[n]>=0)}const Eu=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(n){const{rects:o}=n,{strategy:i="referenceHidden",...e}=fe(t,n);switch(i){case"referenceHidden":{const r=await Be(n,{...e,elementContext:"reference"}),s=cr(r,o.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:ur(s)}}}case"escaped":{const r=await Be(n,{...e,altBoundary:!0}),s=cr(r,o.floating);return{data:{escapedOffsets:s,escaped:ur(s)}}}default:return{}}}}},ri=new Set(["left","top"]);async function Ou(t,n){const{placement:o,platform:i,elements:e}=t,r=await(i.isRTL==null?void 0:i.isRTL(e.floating)),s=ge(o),l=Re(o),m=se(o)==="y",c=ri.has(s)?-1:1,d=r&&m?-1:1,f=fe(n,t);let{mainAxis:y,crossAxis:p,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof h=="number"&&(p=l==="end"?h*-1:h),m?{x:p*d,y:y*c}:{x:y*c,y:p*d}}const Cu=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(n){var o,i;const{x:e,y:r,placement:s,middlewareData:l}=n,m=await Ou(n,t);return s===((o=l.offset)==null?void 0:o.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:e+m.x,y:r+m.y,data:{...m,placement:s}}}}},Pu=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(n){const{x:o,y:i,placement:e}=n,{mainAxis:r=!0,crossAxis:s=!1,limiter:l={fn:$=>{let{x,y:_}=$;return{x,y:_}}},...m}=fe(t,n),c={x:o,y:i},d=await Be(n,m),f=se(ge(e)),y=ln(f);let p=c[y],h=c[f];if(r){const $=y==="y"?"top":"left",x=y==="y"?"bottom":"right",_=p+d[$],I=p-d[x];p=Ht(_,p,I)}if(s){const $=f==="y"?"top":"left",x=f==="y"?"bottom":"right",_=h+d[$],I=h-d[x];h=Ht(_,h,I)}const v=l.fn({...n,[y]:p,[f]:h});return{...v,data:{x:v.x-o,y:v.y-i,enabled:{[y]:r,[f]:s}}}}}},Tu=function(t){return t===void 0&&(t={}),{options:t,fn(n){const{x:o,y:i,placement:e,rects:r,middlewareData:s}=n,{offset:l=0,mainAxis:m=!0,crossAxis:c=!0}=fe(t,n),d={x:o,y:i},f=se(e),y=ln(f);let p=d[y],h=d[f];const v=fe(l,n),$=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(m){const I=y==="y"?"height":"width",b=r.reference[y]-r.floating[I]+$.mainAxis,j=r.reference[y]+r.reference[I]-$.mainAxis;p<b?p=b:p>j&&(p=j)}if(c){var x,_;const I=y==="y"?"width":"height",b=ri.has(ge(e)),j=r.reference[f]-r.floating[I]+(b&&((x=s.offset)==null?void 0:x[f])||0)+(b?0:$.crossAxis),E=r.reference[f]+r.reference[I]+(b?0:((_=s.offset)==null?void 0:_[f])||0)-(b?$.crossAxis:0);h<j?h=j:h>E&&(h=E)}return{[y]:p,[f]:h}}}},Du=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(n){var o,i;const{placement:e,rects:r,platform:s,elements:l}=n,{apply:m=()=>{},...c}=fe(t,n),d=await Be(n,c),f=ge(e),y=Re(e),p=se(e)==="y",{width:h,height:v}=r.floating;let $,x;f==="top"||f==="bottom"?($=f,x=y===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(x=f,$=y==="end"?"top":"bottom");const _=v-d.top-d.bottom,I=h-d.left-d.right,b=ye(v-d[$],_),j=ye(h-d[x],I),E=!n.middlewareData.shift;let S=b,O=j;if((o=n.middlewareData.shift)!=null&&o.enabled.x&&(O=I),(i=n.middlewareData.shift)!=null&&i.enabled.y&&(S=_),E&&!y){const T=K(d.left,0),z=K(d.right,0),W=K(d.top,0),L=K(d.bottom,0);p?O=h-2*(T!==0||z!==0?T+z:K(d.left,d.right)):S=v-2*(W!==0||L!==0?W+L:K(d.top,d.bottom))}await m({...n,availableWidth:O,availableHeight:S});const P=await s.getDimensions(l.floating);return h!==P.width||v!==P.height?{reset:{rects:!0}}:{}}}};function bt(){return typeof window<"u"}function Ae(t){return ii(t)?(t.nodeName||"").toLowerCase():"#document"}function H(t){var n;return(t==null||(n=t.ownerDocument)==null?void 0:n.defaultView)||window}function me(t){var n;return(n=(ii(t)?t.ownerDocument:t.document)||window.document)==null?void 0:n.documentElement}function ii(t){return bt()?t instanceof Node||t instanceof H(t).Node:!1}function ee(t){return bt()?t instanceof Element||t instanceof H(t).Element:!1}function de(t){return bt()?t instanceof HTMLElement||t instanceof H(t).HTMLElement:!1}function dr(t){return!bt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof H(t).ShadowRoot}const Ru=new Set(["inline","contents"]);function He(t){const{overflow:n,overflowX:o,overflowY:i,display:e}=te(t);return/auto|scroll|overlay|hidden|clip/.test(n+i+o)&&!Ru.has(e)}const Au=new Set(["table","td","th"]);function Uu(t){return Au.has(Ae(t))}const zu=[":popover-open",":modal"];function $t(t){return zu.some(n=>{try{return t.matches(n)}catch{return!1}})}const Mu=["transform","translate","scale","rotate","perspective"],Lu=["transform","translate","scale","rotate","perspective","filter"],Zu=["paint","layout","strict","content"];function dn(t){const n=mn(),o=ee(t)?te(t):t;return Mu.some(i=>o[i]?o[i]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!n&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!n&&(o.filter?o.filter!=="none":!1)||Lu.some(i=>(o.willChange||"").includes(i))||Zu.some(i=>(o.contain||"").includes(i))}function Fu(t){let n=be(t);for(;de(n)&&!Pe(n);){if(dn(n))return n;if($t(n))return null;n=be(n)}return null}function mn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Vu=new Set(["html","body","#document"]);function Pe(t){return Vu.has(Ae(t))}function te(t){return H(t).getComputedStyle(t)}function xt(t){return ee(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function be(t){if(Ae(t)==="html")return t;const n=t.assignedSlot||t.parentNode||dr(t)&&t.host||me(t);return dr(n)?n.host:n}function oi(t){const n=be(t);return Pe(n)?t.ownerDocument?t.ownerDocument.body:t.body:de(n)&&He(n)?n:oi(n)}function Je(t,n,o){var i;n===void 0&&(n=[]),o===void 0&&(o=!0);const e=oi(t),r=e===((i=t.ownerDocument)==null?void 0:i.body),s=H(e);if(r){const l=Yt(s);return n.concat(s,s.visualViewport||[],He(e)?e:[],l&&o?Je(l):[])}return n.concat(e,Je(e,[],o))}function Yt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ai(t){const n=te(t);let o=parseFloat(n.width)||0,i=parseFloat(n.height)||0;const e=de(t),r=e?t.offsetWidth:o,s=e?t.offsetHeight:i,l=ft(o)!==r||ft(i)!==s;return l&&(o=r,i=s),{width:o,height:i,$:l}}function fn(t){return ee(t)?t:t.contextElement}function Oe(t){const n=fn(t);if(!de(n))return le(1);const o=n.getBoundingClientRect(),{width:i,height:e,$:r}=ai(n);let s=(r?ft(o.width):o.width)/i,l=(r?ft(o.height):o.height)/e;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const Wu=le(0);function si(t){const n=H(t);return!mn()||!n.visualViewport?Wu:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function Bu(t,n,o){return n===void 0&&(n=!1),!o||n&&o!==H(t)?!1:n}function _e(t,n,o,i){n===void 0&&(n=!1),o===void 0&&(o=!1);const e=t.getBoundingClientRect(),r=fn(t);let s=le(1);n&&(i?ee(i)&&(s=Oe(i)):s=Oe(t));const l=Bu(r,o,i)?si(r):le(0);let m=(e.left+l.x)/s.x,c=(e.top+l.y)/s.y,d=e.width/s.x,f=e.height/s.y;if(r){const y=H(r),p=i&&ee(i)?H(i):i;let h=y,v=Yt(h);for(;v&&i&&p!==h;){const $=Oe(v),x=v.getBoundingClientRect(),_=te(v),I=x.left+(v.clientLeft+parseFloat(_.paddingLeft))*$.x,b=x.top+(v.clientTop+parseFloat(_.paddingTop))*$.y;m*=$.x,c*=$.y,d*=$.x,f*=$.y,m+=I,c+=b,h=H(v),v=Yt(h)}}return pt({width:d,height:f,x:m,y:c})}function _t(t,n){const o=xt(t).scrollLeft;return n?n.left+o:_e(me(t)).left+o}function li(t,n){const o=t.getBoundingClientRect(),i=o.left+n.scrollLeft-_t(t,o),e=o.top+n.scrollTop;return{x:i,y:e}}function Ju(t){let{elements:n,rect:o,offsetParent:i,strategy:e}=t;const r=e==="fixed",s=me(i),l=n?$t(n.floating):!1;if(i===s||l&&r)return o;let m={scrollLeft:0,scrollTop:0},c=le(1);const d=le(0),f=de(i);if((f||!f&&!r)&&((Ae(i)!=="body"||He(s))&&(m=xt(i)),de(i))){const p=_e(i);c=Oe(i),d.x=p.x+i.clientLeft,d.y=p.y+i.clientTop}const y=s&&!f&&!r?li(s,m):le(0);return{width:o.width*c.x,height:o.height*c.y,x:o.x*c.x-m.scrollLeft*c.x+d.x+y.x,y:o.y*c.y-m.scrollTop*c.y+d.y+y.y}}function Gu(t){return Array.from(t.getClientRects())}function qu(t){const n=me(t),o=xt(t),i=t.ownerDocument.body,e=K(n.scrollWidth,n.clientWidth,i.scrollWidth,i.clientWidth),r=K(n.scrollHeight,n.clientHeight,i.scrollHeight,i.clientHeight);let s=-o.scrollLeft+_t(t);const l=-o.scrollTop;return te(i).direction==="rtl"&&(s+=K(n.clientWidth,i.clientWidth)-e),{width:e,height:r,x:s,y:l}}const mr=25;function Ku(t,n){const o=H(t),i=me(t),e=o.visualViewport;let r=i.clientWidth,s=i.clientHeight,l=0,m=0;if(e){r=e.width,s=e.height;const d=mn();(!d||d&&n==="fixed")&&(l=e.offsetLeft,m=e.offsetTop)}const c=_t(i);if(c<=0){const d=i.ownerDocument,f=d.body,y=getComputedStyle(f),p=d.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,h=Math.abs(i.clientWidth-f.clientWidth-p);h<=mr&&(r-=h)}else c<=mr&&(r+=c);return{width:r,height:s,x:l,y:m}}const Hu=new Set(["absolute","fixed"]);function Xu(t,n){const o=_e(t,!0,n==="fixed"),i=o.top+t.clientTop,e=o.left+t.clientLeft,r=de(t)?Oe(t):le(1),s=t.clientWidth*r.x,l=t.clientHeight*r.y,m=e*r.x,c=i*r.y;return{width:s,height:l,x:m,y:c}}function fr(t,n,o){let i;if(n==="viewport")i=Ku(t,o);else if(n==="document")i=qu(me(t));else if(ee(n))i=Xu(n,o);else{const e=si(t);i={x:n.x-e.x,y:n.y-e.y,width:n.width,height:n.height}}return pt(i)}function ci(t,n){const o=be(t);return o===n||!ee(o)||Pe(o)?!1:te(o).position==="fixed"||ci(o,n)}function Yu(t,n){const o=n.get(t);if(o)return o;let i=Je(t,[],!1).filter(l=>ee(l)&&Ae(l)!=="body"),e=null;const r=te(t).position==="fixed";let s=r?be(t):t;for(;ee(s)&&!Pe(s);){const l=te(s),m=dn(s);!m&&l.position==="fixed"&&(e=null),(r?!m&&!e:!m&&l.position==="static"&&!!e&&Hu.has(e.position)||He(s)&&!m&&ci(t,s))?i=i.filter(d=>d!==s):e=l,s=be(s)}return n.set(t,i),i}function Qu(t){let{element:n,boundary:o,rootBoundary:i,strategy:e}=t;const s=[...o==="clippingAncestors"?$t(n)?[]:Yu(n,this._c):[].concat(o),i],l=s[0],m=s.reduce((c,d)=>{const f=fr(n,d,e);return c.top=K(f.top,c.top),c.right=ye(f.right,c.right),c.bottom=ye(f.bottom,c.bottom),c.left=K(f.left,c.left),c},fr(n,l,e));return{width:m.right-m.left,height:m.bottom-m.top,x:m.left,y:m.top}}function ed(t){const{width:n,height:o}=ai(t);return{width:n,height:o}}function td(t,n,o){const i=de(n),e=me(n),r=o==="fixed",s=_e(t,!0,r,n);let l={scrollLeft:0,scrollTop:0};const m=le(0);function c(){m.x=_t(e)}if(i||!i&&!r)if((Ae(n)!=="body"||He(e))&&(l=xt(n)),i){const p=_e(n,!0,r,n);m.x=p.x+n.clientLeft,m.y=p.y+n.clientTop}else e&&c();r&&!i&&e&&c();const d=e&&!i&&!r?li(e,l):le(0),f=s.left+l.scrollLeft-m.x-d.x,y=s.top+l.scrollTop-m.y-d.y;return{x:f,y,width:s.width,height:s.height}}function At(t){return te(t).position==="static"}function gr(t,n){if(!de(t)||te(t).position==="fixed")return null;if(n)return n(t);let o=t.offsetParent;return me(t)===o&&(o=o.ownerDocument.body),o}function ui(t,n){const o=H(t);if($t(t))return o;if(!de(t)){let e=be(t);for(;e&&!Pe(e);){if(ee(e)&&!At(e))return e;e=be(e)}return o}let i=gr(t,n);for(;i&&Uu(i)&&At(i);)i=gr(i,n);return i&&Pe(i)&&At(i)&&!dn(i)?o:i||Fu(t)||o}const nd=async function(t){const n=this.getOffsetParent||ui,o=this.getDimensions,i=await o(t.floating);return{reference:td(t.reference,await n(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function rd(t){return te(t).direction==="rtl"}const id={convertOffsetParentRelativeRectToViewportRelativeRect:Ju,getDocumentElement:me,getClippingRect:Qu,getOffsetParent:ui,getElementRects:nd,getClientRects:Gu,getDimensions:ed,getScale:Oe,isElement:ee,isRTL:rd};function di(t,n){return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}function od(t,n){let o=null,i;const e=me(t);function r(){var l;clearTimeout(i),(l=o)==null||l.disconnect(),o=null}function s(l,m){l===void 0&&(l=!1),m===void 0&&(m=1),r();const c=t.getBoundingClientRect(),{left:d,top:f,width:y,height:p}=c;if(l||n(),!y||!p)return;const h=tt(f),v=tt(e.clientWidth-(d+y)),$=tt(e.clientHeight-(f+p)),x=tt(d),I={rootMargin:-h+"px "+-v+"px "+-$+"px "+-x+"px",threshold:K(0,ye(1,m))||1};let b=!0;function j(E){const S=E[0].intersectionRatio;if(S!==m){if(!b)return s();S?s(!1,S):i=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!di(c,t.getBoundingClientRect())&&s(),b=!1}try{o=new IntersectionObserver(j,{...I,root:e.ownerDocument})}catch{o=new IntersectionObserver(j,I)}o.observe(t)}return s(!0),r}function ad(t,n,o,i){i===void 0&&(i={});const{ancestorScroll:e=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:m=!1}=i,c=fn(t),d=e||r?[...c?Je(c):[],...Je(n)]:[];d.forEach(x=>{e&&x.addEventListener("scroll",o,{passive:!0}),r&&x.addEventListener("resize",o)});const f=c&&l?od(c,o):null;let y=-1,p=null;s&&(p=new ResizeObserver(x=>{let[_]=x;_&&_.target===c&&p&&(p.unobserve(n),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var I;(I=p)==null||I.observe(n)})),o()}),c&&!m&&p.observe(c),p.observe(n));let h,v=m?_e(t):null;m&&$();function $(){const x=_e(t);v&&!di(v,x)&&o(),v=x,h=requestAnimationFrame($)}return o(),()=>{var x;d.forEach(_=>{e&&_.removeEventListener("scroll",o),r&&_.removeEventListener("resize",o)}),f?.(),(x=p)==null||x.disconnect(),p=null,m&&cancelAnimationFrame(h)}}const sd=Cu,ld=Pu,cd=Nu,ud=Du,dd=Eu,pr=ku,md=Tu,fd=(t,n,o)=>{const i=new Map,e={platform:id,...o},r={...e.platform,_c:i};return ju(t,n,{...e,platform:r})};var gd=typeof document<"u",pd=function(){},ct=gd?N.useLayoutEffect:pd;function vt(t,n){if(t===n)return!0;if(typeof t!=typeof n)return!1;if(typeof t=="function"&&t.toString()===n.toString())return!0;let o,i,e;if(t&&n&&typeof t=="object"){if(Array.isArray(t)){if(o=t.length,o!==n.length)return!1;for(i=o;i--!==0;)if(!vt(t[i],n[i]))return!1;return!0}if(e=Object.keys(t),o=e.length,o!==Object.keys(n).length)return!1;for(i=o;i--!==0;)if(!{}.hasOwnProperty.call(n,e[i]))return!1;for(i=o;i--!==0;){const r=e[i];if(!(r==="_owner"&&t.$$typeof)&&!vt(t[r],n[r]))return!1}return!0}return t!==t&&n!==n}function mi(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function vr(t,n){const o=mi(t);return Math.round(n*o)/o}function Ut(t){const n=g.useRef(t);return ct(()=>{n.current=t}),n}function vd(t){t===void 0&&(t={});const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:e,elements:{reference:r,floating:s}={},transform:l=!0,whileElementsMounted:m,open:c}=t,[d,f]=g.useState({x:0,y:0,strategy:o,placement:n,middlewareData:{},isPositioned:!1}),[y,p]=g.useState(i);vt(y,i)||p(i);const[h,v]=g.useState(null),[$,x]=g.useState(null),_=g.useCallback(C=>{C!==E.current&&(E.current=C,v(C))},[]),I=g.useCallback(C=>{C!==S.current&&(S.current=C,x(C))},[]),b=r||h,j=s||$,E=g.useRef(null),S=g.useRef(null),O=g.useRef(d),P=m!=null,T=Ut(m),z=Ut(e),W=Ut(c),L=g.useCallback(()=>{if(!E.current||!S.current)return;const C={placement:n,strategy:o,middleware:y};z.current&&(C.platform=z.current),fd(E.current,S.current,C).then(B=>{const re={...B,isPositioned:W.current!==!1};A.current&&!vt(O.current,re)&&(O.current=re,Or.flushSync(()=>{f(re)}))})},[y,n,o,z,W]);ct(()=>{c===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,f(C=>({...C,isPositioned:!1})))},[c]);const A=g.useRef(!1);ct(()=>(A.current=!0,()=>{A.current=!1}),[]),ct(()=>{if(b&&(E.current=b),j&&(S.current=j),b&&j){if(T.current)return T.current(b,j,L);L()}},[b,j,L,T,P]);const q=g.useMemo(()=>({reference:E,floating:S,setReference:_,setFloating:I}),[_,I]),Z=g.useMemo(()=>({reference:b,floating:j}),[b,j]),F=g.useMemo(()=>{const C={position:o,left:0,top:0};if(!Z.floating)return C;const B=vr(Z.floating,d.x),re=vr(Z.floating,d.y);return l?{...C,transform:"translate("+B+"px, "+re+"px)",...mi(Z.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:B,top:re}},[o,l,Z.floating,d.x,d.y]);return g.useMemo(()=>({...d,update:L,refs:q,elements:Z,floatingStyles:F}),[d,L,q,Z,F])}const hd=t=>{function n(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:t,fn(o){const{element:i,padding:e}=typeof t=="function"?t(o):t;return i&&n(i)?i.current!=null?pr({element:i.current,padding:e}).fn(o):{}:i?pr({element:i,padding:e}).fn(o):{}}}},yd=(t,n)=>({...sd(t),options:[t,n]}),bd=(t,n)=>({...ld(t),options:[t,n]}),$d=(t,n)=>({...md(t),options:[t,n]}),xd=(t,n)=>({...cd(t),options:[t,n]}),_d=(t,n)=>({...ud(t),options:[t,n]}),wd=(t,n)=>({...dd(t),options:[t,n]}),Sd=(t,n)=>({...hd(t),options:[t,n]});var Id="Arrow",fi=g.forwardRef((t,n)=>{const{children:o,width:i=10,height:e=5,...r}=t;return u.jsx(V.svg,{...r,ref:n,width:i,height:e,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?o:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});fi.displayName=Id;var jd=fi;function kd(t){const[n,o]=g.useState(void 0);return Y(()=>{if(t){o({width:t.offsetWidth,height:t.offsetHeight});const i=new ResizeObserver(e=>{if(!Array.isArray(e)||!e.length)return;const r=e[0];let s,l;if("borderBoxSize"in r){const m=r.borderBoxSize,c=Array.isArray(m)?m[0]:m;s=c.inlineSize,l=c.blockSize}else s=t.offsetWidth,l=t.offsetHeight;o({width:s,height:l})});return i.observe(t,{box:"border-box"}),()=>i.unobserve(t)}else o(void 0)},[t]),n}var gn="Popper",[gi,wt]=Ke(gn),[Nd,pi]=gi(gn),vi=t=>{const{__scopePopper:n,children:o}=t,[i,e]=g.useState(null);return u.jsx(Nd,{scope:n,anchor:i,onAnchorChange:e,children:o})};vi.displayName=gn;var hi="PopperAnchor",yi=g.forwardRef((t,n)=>{const{__scopePopper:o,virtualRef:i,...e}=t,r=pi(hi,o),s=g.useRef(null),l=G(n,s),m=g.useRef(null);return g.useEffect(()=>{const c=m.current;m.current=i?.current||s.current,c!==m.current&&r.onAnchorChange(m.current)}),i?null:u.jsx(V.div,{...e,ref:l})});yi.displayName=hi;var pn="PopperContent",[Ed,Od]=gi(pn),bi=g.forwardRef((t,n)=>{const{__scopePopper:o,side:i="bottom",sideOffset:e=0,align:r="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:m=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:y=!1,updatePositionStrategy:p="optimized",onPlaced:h,...v}=t,$=pi(pn,o),[x,_]=g.useState(null),I=G(n,Ue=>_(Ue)),[b,j]=g.useState(null),E=kd(b),S=E?.width??0,O=E?.height??0,P=i+(r!=="center"?"-"+r:""),T=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},z=Array.isArray(c)?c:[c],W=z.length>0,L={padding:T,boundary:z.filter(Pd),altBoundary:W},{refs:A,floatingStyles:q,placement:Z,isPositioned:F,middlewareData:C}=vd({strategy:"fixed",placement:P,whileElementsMounted:(...Ue)=>ad(...Ue,{animationFrame:p==="always"}),elements:{reference:$.anchor},middleware:[yd({mainAxis:e+O,alignmentAxis:s}),m&&bd({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?$d():void 0,...L}),m&&xd({...L}),_d({...L,apply:({elements:Ue,rects:An,availableWidth:Jo,availableHeight:Go})=>{const{width:qo,height:Ko}=An.reference,Qe=Ue.floating.style;Qe.setProperty("--radix-popper-available-width",`${Jo}px`),Qe.setProperty("--radix-popper-available-height",`${Go}px`),Qe.setProperty("--radix-popper-anchor-width",`${qo}px`),Qe.setProperty("--radix-popper-anchor-height",`${Ko}px`)}}),b&&Sd({element:b,padding:l}),Td({arrowWidth:S,arrowHeight:O}),y&&wd({strategy:"referenceHidden",...L})]}),[B,re]=_i(Z),Rn=xe(h);Y(()=>{F&&Rn?.()},[F,Rn]);const Zo=C.arrow?.x,Fo=C.arrow?.y,Vo=C.arrow?.centerOffset!==0,[Wo,Bo]=g.useState();return Y(()=>{x&&Bo(window.getComputedStyle(x).zIndex)},[x]),u.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...q,transform:F?q.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Wo,"--radix-popper-transform-origin":[C.transformOrigin?.x,C.transformOrigin?.y].join(" "),...C.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:u.jsx(Ed,{scope:o,placedSide:B,onArrowChange:j,arrowX:Zo,arrowY:Fo,shouldHideArrow:Vo,children:u.jsx(V.div,{"data-side":B,"data-align":re,...v,ref:I,style:{...v.style,animation:F?void 0:"none"}})})})});bi.displayName=pn;var $i="PopperArrow",Cd={top:"bottom",right:"left",bottom:"top",left:"right"},xi=g.forwardRef(function(n,o){const{__scopePopper:i,...e}=n,r=Od($i,i),s=Cd[r.placedSide];return u.jsx("span",{ref:r.onArrowChange,style:{position:"absolute",left:r.arrowX,top:r.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[r.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[r.placedSide],visibility:r.shouldHideArrow?"hidden":void 0},children:u.jsx(jd,{...e,ref:o,style:{...e.style,display:"block"}})})});xi.displayName=$i;function Pd(t){return t!==null}var Td=t=>({name:"transformOrigin",options:t,fn(n){const{placement:o,rects:i,middlewareData:e}=n,s=e.arrow?.centerOffset!==0,l=s?0:t.arrowWidth,m=s?0:t.arrowHeight,[c,d]=_i(o),f={start:"0%",center:"50%",end:"100%"}[d],y=(e.arrow?.x??0)+l/2,p=(e.arrow?.y??0)+m/2;let h="",v="";return c==="bottom"?(h=s?f:`${y}px`,v=`${-m}px`):c==="top"?(h=s?f:`${y}px`,v=`${i.floating.height+m}px`):c==="right"?(h=`${-m}px`,v=s?f:`${p}px`):c==="left"&&(h=`${i.floating.width+m}px`,v=s?f:`${p}px`),{data:{x:h,y:v}}}});function _i(t){const[n,o="center"]=t.split("-");return[n,o]}var wi=vi,vn=yi,Si=bi,Ii=xi,Dd="Portal",St=g.forwardRef((t,n)=>{const{container:o,...i}=t,[e,r]=g.useState(!1);Y(()=>r(!0),[]);const s=o||e&&globalThis?.document?.body;return s?Er.createPortal(u.jsx(V.div,{...i,ref:n}),s):null});St.displayName=Dd;function Rd(t,n){return g.useReducer((o,i)=>n[o][i]??o,t)}var pe=t=>{const{present:n,children:o}=t,i=Ad(n),e=typeof o=="function"?o({present:i.isPresent}):g.Children.only(o),r=G(i.ref,Ud(e));return typeof o=="function"||i.isPresent?g.cloneElement(e,{ref:r}):null};pe.displayName="Presence";function Ad(t){const[n,o]=g.useState(),i=g.useRef(null),e=g.useRef(t),r=g.useRef("none"),s=t?"mounted":"unmounted",[l,m]=Rd(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const c=nt(i.current);r.current=l==="mounted"?c:"none"},[l]),Y(()=>{const c=i.current,d=e.current;if(d!==t){const y=r.current,p=nt(c);t?m("MOUNT"):p==="none"||c?.display==="none"?m("UNMOUNT"):m(d&&y!==p?"ANIMATION_OUT":"UNMOUNT"),e.current=t}},[t,m]),Y(()=>{if(n){let c;const d=n.ownerDocument.defaultView??window,f=p=>{const v=nt(i.current).includes(CSS.escape(p.animationName));if(p.target===n&&v&&(m("ANIMATION_END"),!e.current)){const $=n.style.animationFillMode;n.style.animationFillMode="forwards",c=d.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=$)})}},y=p=>{p.target===n&&(r.current=nt(i.current))};return n.addEventListener("animationstart",y),n.addEventListener("animationcancel",f),n.addEventListener("animationend",f),()=>{d.clearTimeout(c),n.removeEventListener("animationstart",y),n.removeEventListener("animationcancel",f),n.removeEventListener("animationend",f)}}else m("ANIMATION_END")},[n,m]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:g.useCallback(c=>{i.current=c?getComputedStyle(c):null,o(c)},[])}}function nt(t){return t?.animationName||"none"}function Ud(t){let n=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=n&&"isReactWarning"in n&&n.isReactWarning;return o?t.ref:(n=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=n&&"isReactWarning"in n&&n.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}var zd=g[" useInsertionEffect ".trim().toString()]||Y;function It({prop:t,defaultProp:n,onChange:o=()=>{},caller:i}){const[e,r,s]=Md({defaultProp:n,onChange:o}),l=t!==void 0,m=l?t:e;{const d=g.useRef(t!==void 0);g.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${i} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,i])}const c=g.useCallback(d=>{if(l){const f=Ld(d)?d(t):d;f!==t&&s.current?.(f)}else r(d)},[l,t,r,s]);return[m,c]}function Md({defaultProp:t,onChange:n}){const[o,i]=g.useState(t),e=g.useRef(o),r=g.useRef(n);return zd(()=>{r.current=n},[n]),g.useEffect(()=>{e.current!==o&&(r.current?.(o),e.current=o)},[o,e]),[o,i,r]}function Ld(t){return typeof t=="function"}var Zd=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"}),Fd="VisuallyHidden",ji=g.forwardRef((t,n)=>u.jsx(V.span,{...t,ref:n,style:{...Zd,...t.style}}));ji.displayName=Fd;var Vd=ji,[jt]=Ke("Tooltip",[wt]),kt=wt(),ki="TooltipProvider",Wd=700,Qt="tooltip.open",[Bd,hn]=jt(ki),Ni=t=>{const{__scopeTooltip:n,delayDuration:o=Wd,skipDelayDuration:i=300,disableHoverableContent:e=!1,children:r}=t,s=g.useRef(!0),l=g.useRef(!1),m=g.useRef(0);return g.useEffect(()=>{const c=m.current;return()=>window.clearTimeout(c)},[]),u.jsx(Bd,{scope:n,isOpenDelayedRef:s,delayDuration:o,onOpen:g.useCallback(()=>{window.clearTimeout(m.current),s.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>s.current=!0,i)},[i]),isPointerInTransitRef:l,onPointerInTransitChange:g.useCallback(c=>{l.current=c},[]),disableHoverableContent:e,children:r})};Ni.displayName=ki;var Ge="Tooltip",[Jd,Xe]=jt(Ge),Ei=t=>{const{__scopeTooltip:n,children:o,open:i,defaultOpen:e,onOpenChange:r,disableHoverableContent:s,delayDuration:l}=t,m=hn(Ge,t.__scopeTooltip),c=kt(n),[d,f]=g.useState(null),y=Ee(),p=g.useRef(0),h=s??m.disableHoverableContent,v=l??m.delayDuration,$=g.useRef(!1),[x,_]=It({prop:i,defaultProp:e??!1,onChange:S=>{S?(m.onOpen(),document.dispatchEvent(new CustomEvent(Qt))):m.onClose(),r?.(S)},caller:Ge}),I=g.useMemo(()=>x?$.current?"delayed-open":"instant-open":"closed",[x]),b=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,$.current=!1,_(!0)},[_]),j=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),E=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{$.current=!0,_(!0),p.current=0},v)},[v,_]);return g.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),u.jsx(wi,{...c,children:u.jsx(Jd,{scope:n,contentId:y,open:x,stateAttribute:I,trigger:d,onTriggerChange:f,onTriggerEnter:g.useCallback(()=>{m.isOpenDelayedRef.current?E():b()},[m.isOpenDelayedRef,E,b]),onTriggerLeave:g.useCallback(()=>{h?j():(window.clearTimeout(p.current),p.current=0)},[j,h]),onOpen:b,onClose:j,disableHoverableContent:h,children:o})})};Ei.displayName=Ge;var en="TooltipTrigger",Oi=g.forwardRef((t,n)=>{const{__scopeTooltip:o,...i}=t,e=Xe(en,o),r=hn(en,o),s=kt(o),l=g.useRef(null),m=G(n,l,e.onTriggerChange),c=g.useRef(!1),d=g.useRef(!1),f=g.useCallback(()=>c.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),u.jsx(vn,{asChild:!0,...s,children:u.jsx(V.button,{"aria-describedby":e.open?e.contentId:void 0,"data-state":e.stateAttribute,...i,ref:m,onPointerMove:M(t.onPointerMove,y=>{y.pointerType!=="touch"&&!d.current&&!r.isPointerInTransitRef.current&&(e.onTriggerEnter(),d.current=!0)}),onPointerLeave:M(t.onPointerLeave,()=>{e.onTriggerLeave(),d.current=!1}),onPointerDown:M(t.onPointerDown,()=>{e.open&&e.onClose(),c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:M(t.onFocus,()=>{c.current||e.onOpen()}),onBlur:M(t.onBlur,e.onClose),onClick:M(t.onClick,e.onClose)})})});Oi.displayName=en;var yn="TooltipPortal",[Gd,qd]=jt(yn,{forceMount:void 0}),Ci=t=>{const{__scopeTooltip:n,forceMount:o,children:i,container:e}=t,r=Xe(yn,n);return u.jsx(Gd,{scope:n,forceMount:o,children:u.jsx(pe,{present:o||r.open,children:u.jsx(St,{asChild:!0,container:e,children:i})})})};Ci.displayName=yn;var Te="TooltipContent",Pi=g.forwardRef((t,n)=>{const o=qd(Te,t.__scopeTooltip),{forceMount:i=o.forceMount,side:e="top",...r}=t,s=Xe(Te,t.__scopeTooltip);return u.jsx(pe,{present:i||s.open,children:s.disableHoverableContent?u.jsx(Ti,{side:e,...r,ref:n}):u.jsx(Kd,{side:e,...r,ref:n})})}),Kd=g.forwardRef((t,n)=>{const o=Xe(Te,t.__scopeTooltip),i=hn(Te,t.__scopeTooltip),e=g.useRef(null),r=G(n,e),[s,l]=g.useState(null),{trigger:m,onClose:c}=o,d=e.current,{onPointerInTransitChange:f}=i,y=g.useCallback(()=>{l(null),f(!1)},[f]),p=g.useCallback((h,v)=>{const $=h.currentTarget,x={x:h.clientX,y:h.clientY},_=Qd(x,$.getBoundingClientRect()),I=em(x,_),b=tm(v.getBoundingClientRect()),j=rm([...I,...b]);l(j),f(!0)},[f]);return g.useEffect(()=>()=>y(),[y]),g.useEffect(()=>{if(m&&d){const h=$=>p($,d),v=$=>p($,m);return m.addEventListener("pointerleave",h),d.addEventListener("pointerleave",v),()=>{m.removeEventListener("pointerleave",h),d.removeEventListener("pointerleave",v)}}},[m,d,p,y]),g.useEffect(()=>{if(s){const h=v=>{const $=v.target,x={x:v.clientX,y:v.clientY},_=m?.contains($)||d?.contains($),I=!nm(x,s);_?y():I&&(y(),c())};return document.addEventListener("pointermove",h),()=>document.removeEventListener("pointermove",h)}},[m,d,s,c,y]),u.jsx(Ti,{...t,ref:r})}),[Hd,Xd]=jt(Ge,{isInside:!1}),Yd=Qc("TooltipContent"),Ti=g.forwardRef((t,n)=>{const{__scopeTooltip:o,children:i,"aria-label":e,onEscapeKeyDown:r,onPointerDownOutside:s,...l}=t,m=Xe(Te,o),c=kt(o),{onClose:d}=m;return g.useEffect(()=>(document.addEventListener(Qt,d),()=>document.removeEventListener(Qt,d)),[d]),g.useEffect(()=>{if(m.trigger){const f=y=>{y.target?.contains(m.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[m.trigger,d]),u.jsx(yt,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:u.jsxs(Si,{"data-state":m.stateAttribute,...c,...l,ref:n,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:[u.jsx(Yd,{children:i}),u.jsx(Hd,{scope:o,isInside:!0,children:u.jsx(Vd,{id:m.contentId,role:"tooltip",children:e||i})})]})})});Pi.displayName=Te;var Di="TooltipArrow",Ri=g.forwardRef((t,n)=>{const{__scopeTooltip:o,...i}=t,e=kt(o);return Xd(Di,o).isInside?null:u.jsx(Ii,{...e,...i,ref:n})});Ri.displayName=Di;function Qd(t,n){const o=Math.abs(n.top-t.y),i=Math.abs(n.bottom-t.y),e=Math.abs(n.right-t.x),r=Math.abs(n.left-t.x);switch(Math.min(o,i,e,r)){case r:return"left";case e:return"right";case o:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function em(t,n,o=5){const i=[];switch(n){case"top":i.push({x:t.x-o,y:t.y+o},{x:t.x+o,y:t.y+o});break;case"bottom":i.push({x:t.x-o,y:t.y-o},{x:t.x+o,y:t.y-o});break;case"left":i.push({x:t.x+o,y:t.y-o},{x:t.x+o,y:t.y+o});break;case"right":i.push({x:t.x-o,y:t.y-o},{x:t.x-o,y:t.y+o});break}return i}function tm(t){const{top:n,right:o,bottom:i,left:e}=t;return[{x:e,y:n},{x:o,y:n},{x:o,y:i},{x:e,y:i}]}function nm(t,n){const{x:o,y:i}=t;let e=!1;for(let r=0,s=n.length-1;r<n.length;s=r++){const l=n[r],m=n[s],c=l.x,d=l.y,f=m.x,y=m.y;d>i!=y>i&&o<(f-c)*(i-d)/(y-d)+c&&(e=!e)}return e}function rm(t){const n=t.slice();return n.sort((o,i)=>o.x<i.x?-1:o.x>i.x?1:o.y<i.y?-1:o.y>i.y?1:0),im(n)}function im(t){if(t.length<=1)return t.slice();const n=[];for(let i=0;i<t.length;i++){const e=t[i];for(;n.length>=2;){const r=n[n.length-1],s=n[n.length-2];if((r.x-s.x)*(e.y-s.y)>=(r.y-s.y)*(e.x-s.x))n.pop();else break}n.push(e)}n.pop();const o=[];for(let i=t.length-1;i>=0;i--){const e=t[i];for(;o.length>=2;){const r=o[o.length-1],s=o[o.length-2];if((r.x-s.x)*(e.y-s.y)>=(r.y-s.y)*(e.x-s.x))o.pop();else break}o.push(e)}return o.pop(),n.length===1&&o.length===1&&n[0].x===o[0].x&&n[0].y===o[0].y?n:n.concat(o)}var om=Ni,am=Ei,sm=Oi,lm=Ci,cm=Pi,um=Ri;function Ai({delayDuration:t=0,...n}){return u.jsx(om,{"data-slot":"tooltip-provider",delayDuration:t,...n})}function bn({...t}){return u.jsx(Ai,{children:u.jsx(am,{"data-slot":"tooltip",...t})})}function $n({...t}){return u.jsx(sm,{"data-slot":"tooltip-trigger",...t})}function xn({className:t,sideOffset:n=0,children:o,...i}){return u.jsx(lm,{children:u.jsxs(cm,{"data-slot":"tooltip-content",sideOffset:n,className:w.cn("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...i,children:[o,u.jsx(um,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px]"})]})})}const Q=N.forwardRef(({children:t,tooltip:n,side:o="bottom",align:i="center",className:e,...r},s)=>u.jsxs(bn,{children:[u.jsx($n,{asChild:!0,children:u.jsxs(ue,{variant:"ghost",size:"icon",...r,className:w.cn("aui-button-icon size-6 p-1",e),ref:s,children:[u.jsx(Wc,{children:t}),u.jsx("span",{className:"aui-sr-only sr-only",children:n})]})}),u.jsx(xn,{side:o,align:i,children:n})]}));Q.displayName="TooltipIconButton";function dm(t){return N.useMemo(()=>t.reduce((n,o)=>(n?.[o.language]&&!o.overrideExisting||(n={...n,[o.language]:{CodeHeader:o.Header??(()=>null),SyntaxHighlighter:o.Component??void 0}}),n),{}),[t])}const mm=()=>{const{plugins:t}=w.useElements(),n=dm(t);return console.info("Using components by language",n),u.jsx(Bt.MarkdownTextPrimitive,{remarkPlugins:[Xo],className:"aui-md",components:pm,componentsByLanguage:n})},Ui=N.memo(mm),fm=({language:t,code:n})=>{const i=k.useAssistantState(({message:l})=>l).status?.type==="complete",{isCopied:e,copyToClipboard:r}=gm(),s=()=>{!n||e||r(n)};return i?u.jsxs("div",{className:"aui-code-header-root bg-muted-foreground/15 text-foreground dark:bg-muted-foreground/20 mt-4 flex items-center justify-between gap-4 rounded-t-lg px-4 py-2 text-sm font-semibold",children:[u.jsx("span",{className:"aui-code-header-language lowercase [&>span]:text-xs",children:t}),u.jsxs(Q,{tooltip:"Copy",onClick:s,children:[!e&&u.jsx(qr,{}),e&&u.jsx(qe,{})]})]}):null},gm=({copiedDuration:t=3e3}={})=>{const[n,o]=N.useState(!1);return{isCopied:n,copyToClipboard:e=>{e&&navigator.clipboard.writeText(e).then(()=>{o(!0),setTimeout(()=>o(!1),t)})}}},pm=Bt.unstable_memoizeMarkdownComponents({h1:({className:t,...n})=>u.jsx("h1",{className:w.cn("aui-md-h1 mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0",t),...n}),h2:({className:t,...n})=>u.jsx("h2",{className:w.cn("aui-md-h2 mt-8 mb-4 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0",t),...n}),h3:({className:t,...n})=>u.jsx("h3",{className:w.cn("aui-md-h3 mt-6 mb-4 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0",t),...n}),h4:({className:t,...n})=>u.jsx("h4",{className:w.cn("aui-md-h4 mt-6 mb-4 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0",t),...n}),h5:({className:t,...n})=>u.jsx("h5",{className:w.cn("aui-md-h5 my-4 text-lg font-semibold first:mt-0 last:mb-0",t),...n}),h6:({className:t,...n})=>u.jsx("h6",{className:w.cn("aui-md-h6 my-4 font-semibold first:mt-0 last:mb-0",t),...n}),p:({className:t,...n})=>u.jsx("p",{className:w.cn("aui-md-p mt-5 mb-5 leading-7 first:mt-0 last:mb-0",t),...n}),a:({className:t,...n})=>u.jsx("a",{className:w.cn("aui-md-a text-primary font-medium underline underline-offset-4",t),...n}),blockquote:({className:t,...n})=>u.jsx("blockquote",{className:w.cn("aui-md-blockquote border-l-2 pl-6 italic",t),...n}),ul:({className:t,...n})=>u.jsx("ul",{className:w.cn("aui-md-ul my-5 ml-6 list-disc [&>li]:mt-2",t),...n}),ol:({className:t,...n})=>u.jsx("ol",{className:w.cn("aui-md-ol my-5 ml-6 list-decimal [&>li]:mt-2",t),...n}),hr:({className:t,...n})=>u.jsx("hr",{className:w.cn("aui-md-hr my-5 border-b",t),...n}),table:({className:t,...n})=>u.jsx("table",{className:w.cn("aui-md-table my-5 w-full border-separate border-spacing-0 overflow-y-auto",t),...n}),th:({className:t,...n})=>u.jsx("th",{className:w.cn("aui-md-th bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [[align=center]]:text-center [[align=right]]:text-right",t),...n}),td:({className:t,...n})=>u.jsx("td",{className:w.cn("aui-md-td border-b border-l px-4 py-2 text-left last:border-r [[align=center]]:text-center [[align=right]]:text-right",t),...n}),tr:({className:t,...n})=>u.jsx("tr",{className:w.cn("aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",t),...n}),sup:({className:t,...n})=>u.jsx("sup",{className:w.cn("aui-md-sup [&>a]:text-xs [&>a]:no-underline",t),...n}),pre:({className:t,...n})=>u.jsx("pre",{className:w.cn("aui-md-pre text-foreground bg-muted overflow-x-auto rounded-t-none! rounded-b-lg border border-t-0 p-4",t),...n}),code:function({className:n,...o}){const i=Bt.useIsMarkdownCodeBlock();return u.jsx("code",{className:w.cn(!i&&"aui-md-inline-code bg-muted rounded border font-semibold",n),...o})},CodeHeader:fm}),vm=a.union([a.object({type:a.literal("text"),text:a.string()}),a.object({type:a.literal("image"),data:a.string()})]),hm=a.object({content:a.array(vm)}).or(a._undefined$1()),ce=[.23,1,.32,1];function zi(t){return t.replace(/[-_]/g," ").split(/(?=[A-Z])/).join(" ").split(/\s+/).map(n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()).join(" ")}const ym=({toolName:t,status:n,result:o})=>{const e=k.useAssistantState(({message:f})=>f).parts.filter(f=>f.type==="tool-call"),r=e.findIndex(f=>f.toolName===t),s=N.useMemo(()=>n.type==="complete"?u.jsx(qe,{className:"size-4 text-emerald-500"}):n.type==="incomplete"?u.jsx(fc,{className:"size-4 text-rose-500"}):u.jsx(Kr,{className:"size-4 animate-spin text-blue-700"}),[n]),l=w.useDensity(),[m,c]=N.useState(!1),d=f=>{f.stopPropagation(),c(!m)};return u.jsx(J.LazyMotion,{features:J.domAnimation,children:u.jsxs("div",{className:w.cn("aui-tool-fallback-root flex w-full flex-col",r!==-1&&"border-b",r===e.length-1&&"border-b-0"),children:[u.jsxs("button",{className:w.cn("aui-tool-fallback-header flex h-full w-full cursor-pointer items-center",l("py-xs"),l("px-md"),l("gap-md")),onClick:d,children:[u.jsx("div",{children:s}),u.jsx("div",{className:"select-none",children:zi(t)}),u.jsx("div",{className:"ml-auto",children:u.jsx(ue,{variant:"ghost",size:"icon",className:"cursor-pointer hover:bg-transparent",onClick:d,children:m?u.jsx(Gr,{className:"size-4"}):u.jsx(rn,{className:"size-4"})})})]}),u.jsx(J.AnimatePresence,{children:m&&u.jsx(J.m.div,{initial:{height:0,opacity:0,y:-10},animate:{height:"auto",opacity:1,y:0},exit:{height:0,opacity:0,y:-10},transition:{duration:.3,ease:ce},style:{overflow:"hidden"},className:"bg-muted flex",children:bm(o)})})]})})};function bm(t){return hm.parse(t)?.content?.map(o=>{switch(o.type){case"text":return u.jsx("pre",{className:"aui-tool-fallback-result-content bg-accent max-h-[300px] overflow-y-auto p-4 font-mono whitespace-pre-wrap",children:o.text});case"image":{const i=`data:image/png;base64,${o.data}`;return u.jsx("img",{src:i,className:"max-h-[300px] max-w-full object-contain"})}default:return u.jsx("pre",{className:"aui-tool-fallback-result-content whitespace-pre-wrap",children:JSON.stringify(o,null,2)})}})}var Nt="Collapsible",[$m]=Ke(Nt),[xm,_n]=$m(Nt),Mi=g.forwardRef((t,n)=>{const{__scopeCollapsible:o,open:i,defaultOpen:e,disabled:r,onOpenChange:s,...l}=t,[m,c]=It({prop:i,defaultProp:e??!1,onChange:s,caller:Nt});return u.jsx(xm,{scope:o,disabled:r,contentId:Ee(),open:m,onOpenToggle:g.useCallback(()=>c(d=>!d),[c]),children:u.jsx(V.div,{"data-state":Sn(m),"data-disabled":r?"":void 0,...l,ref:n})})});Mi.displayName=Nt;var Li="CollapsibleTrigger",Zi=g.forwardRef((t,n)=>{const{__scopeCollapsible:o,...i}=t,e=_n(Li,o);return u.jsx(V.button,{type:"button","aria-controls":e.contentId,"aria-expanded":e.open||!1,"data-state":Sn(e.open),"data-disabled":e.disabled?"":void 0,disabled:e.disabled,...i,ref:n,onClick:M(t.onClick,e.onOpenToggle)})});Zi.displayName=Li;var wn="CollapsibleContent",Fi=g.forwardRef((t,n)=>{const{forceMount:o,...i}=t,e=_n(wn,t.__scopeCollapsible);return u.jsx(pe,{present:o||e.open,children:({present:r})=>u.jsx(_m,{...i,ref:n,present:r})})});Fi.displayName=wn;var _m=g.forwardRef((t,n)=>{const{__scopeCollapsible:o,present:i,children:e,...r}=t,s=_n(wn,o),[l,m]=g.useState(i),c=g.useRef(null),d=G(n,c),f=g.useRef(0),y=f.current,p=g.useRef(0),h=p.current,v=s.open||l,$=g.useRef(v),x=g.useRef(void 0);return g.useEffect(()=>{const _=requestAnimationFrame(()=>$.current=!1);return()=>cancelAnimationFrame(_)},[]),Y(()=>{const _=c.current;if(_){x.current=x.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const I=_.getBoundingClientRect();f.current=I.height,p.current=I.width,$.current||(_.style.transitionDuration=x.current.transitionDuration,_.style.animationName=x.current.animationName),m(i)}},[s.open,i]),u.jsx(V.div,{"data-state":Sn(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...r,ref:d,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...t.style},children:v&&e})});function Sn(t){return t?"open":"closed"}var wm=Mi;function Sm({...t}){return u.jsx(wm,{"data-slot":"collapsible",...t})}function Im({...t}){return u.jsx(Zi,{"data-slot":"collapsible-trigger",...t})}function jm({...t}){return u.jsx(Fi,{"data-slot":"collapsible-content",...t})}const hr=200,Vi=({className:t,children:n})=>{const o=N.useRef(null),[i,e]=N.useState(!1),r=k.useScrollLock(o,hr),s=N.useCallback(l=>{l||r(),e(l)},[r]);return u.jsx(Sm,{ref:o,open:i,onOpenChange:s,className:w.cn("aui-reasoning-root mb-4 w-full",t),style:{"--animation-duration":`${hr}ms`},children:n})};Vi.displayName="ReasoningRoot";const km=({className:t})=>u.jsx("div",{className:w.cn("aui-reasoning-fade pointer-events-none absolute inset-x-0 bottom-0 z-10 h-16","bg-[linear-gradient(to_top,var(--color-background),transparent)]","fade-in-0 animate-in","group-data-[state=open]/collapsible-content:animate-out","group-data-[state=open]/collapsible-content:fade-out-0","group-data-[state=open]/collapsible-content:delay-[calc(var(--animation-duration)*0.75)]","group-data-[state=open]/collapsible-content:fill-mode-forwards","duration-(--animation-duration)","group-data-[state=open]/collapsible-content:duration-(--animation-duration)",t)}),Nm=({active:t,className:n})=>u.jsxs(Im,{className:w.cn("aui-reasoning-trigger group/trigger text-muted-foreground hover:text-foreground -mb-2 flex max-w-[75%] items-center gap-2 py-2 text-sm transition-colors",n,t&&"shimmer"),children:[u.jsx(ic,{className:"aui-reasoning-trigger-icon size-4 shrink-0"}),u.jsxs("span",{className:"aui-reasoning-trigger-label-wrapper relative inline-block leading-none",children:[u.jsx("span",{children:"Reasoning"}),t?u.jsx("span",{"aria-hidden":!0,className:"aui-reasoning-trigger-shimmer shimmer pointer-events-none absolute inset-0 motion-reduce:animate-none",children:"Reasoning"}):null]}),u.jsx(rn,{className:w.cn("aui-reasoning-trigger-chevron mt-0.5 size-4 shrink-0","transition-transform duration-(--animation-duration) ease-out","group-data-[state=closed]/trigger:-rotate-90","group-data-[state=open]/trigger:rotate-0")})]}),Wi=({className:t,children:n,"aria-busy":o})=>u.jsxs(jm,{className:w.cn("aui-reasoning-content text-muted-foreground relative overflow-hidden text-sm outline-none","group/collapsible-content ease-out","data-[state=closed]:animate-collapsible-up","data-[state=open]:animate-collapsible-down","data-[state=closed]:fill-mode-forwards","data-[state=closed]:pointer-events-none","data-[state=open]:duration-(--animation-duration)","data-[state=closed]:duration-(--animation-duration)",t),"aria-busy":o,children:[n,u.jsx(km,{})]});Wi.displayName="ReasoningContent";const Bi=({className:t,children:n})=>u.jsx("div",{className:w.cn("aui-reasoning-text relative z-0 space-y-4 pt-4 pl-6 leading-relaxed","transform-gpu transition-[transform,opacity]","group-data-[state=open]/collapsible-content:animate-in","group-data-[state=closed]/collapsible-content:animate-out","group-data-[state=open]/collapsible-content:fade-in-0","group-data-[state=closed]/collapsible-content:fade-out-0","group-data-[state=open]/collapsible-content:slide-in-from-top-4","group-data-[state=closed]/collapsible-content:slide-out-to-top-4","group-data-[state=open]/collapsible-content:duration-(--animation-duration)","group-data-[state=closed]/collapsible-content:duration-(--animation-duration)","[&_p]:-mb-2",t),children:n});Bi.displayName="ReasoningText";const Em=()=>u.jsx(Ui,{}),Om=({children:t,startIndex:n,endIndex:o})=>{const i=k.useAssistantState(({message:e})=>{if(e.status?.type!=="running")return!1;const r=e.parts.length-1;return r<0||e.parts[r]?.type!=="reasoning"?!1:r>=n&&r<=o});return u.jsxs(Vi,{children:[u.jsx(Nm,{active:i}),u.jsx(Wi,{"aria-busy":i,children:u.jsx(Bi,{children:t})})]})},Ji=N.memo(Em);Ji.displayName="Reasoning";const Gi=N.memo(Om);Gi.displayName="ReasoningGroup";var zt="focusScope.autoFocusOnMount",Mt="focusScope.autoFocusOnUnmount",yr={bubbles:!1,cancelable:!0},Cm="FocusScope",In=g.forwardRef((t,n)=>{const{loop:o=!1,trapped:i=!1,onMountAutoFocus:e,onUnmountAutoFocus:r,...s}=t,[l,m]=g.useState(null),c=xe(e),d=xe(r),f=g.useRef(null),y=G(n,v=>m(v)),p=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(i){let v=function(I){if(p.paused||!l)return;const b=I.target;l.contains(b)?f.current=b:he(f.current,{select:!0})},$=function(I){if(p.paused||!l)return;const b=I.relatedTarget;b!==null&&(l.contains(b)||he(f.current,{select:!0}))},x=function(I){if(document.activeElement===document.body)for(const j of I)j.removedNodes.length>0&&he(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",$);const _=new MutationObserver(x);return l&&_.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",$),_.disconnect()}}},[i,l,p.paused]),g.useEffect(()=>{if(l){$r.add(p);const v=document.activeElement;if(!l.contains(v)){const x=new CustomEvent(zt,yr);l.addEventListener(zt,c),l.dispatchEvent(x),x.defaultPrevented||(Pm(Um(qi(l)),{select:!0}),document.activeElement===v&&he(l))}return()=>{l.removeEventListener(zt,c),setTimeout(()=>{const x=new CustomEvent(Mt,yr);l.addEventListener(Mt,d),l.dispatchEvent(x),x.defaultPrevented||he(v??document.body,{select:!0}),l.removeEventListener(Mt,d),$r.remove(p)},0)}}},[l,c,d,p]);const h=g.useCallback(v=>{if(!o&&!i||p.paused)return;const $=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if($&&x){const _=v.currentTarget,[I,b]=Tm(_);I&&b?!v.shiftKey&&x===b?(v.preventDefault(),o&&he(I,{select:!0})):v.shiftKey&&x===I&&(v.preventDefault(),o&&he(b,{select:!0})):x===_&&v.preventDefault()}},[o,i,p.paused]);return u.jsx(V.div,{tabIndex:-1,...s,ref:y,onKeyDown:h})});In.displayName=Cm;function Pm(t,{select:n=!1}={}){const o=document.activeElement;for(const i of t)if(he(i,{select:n}),document.activeElement!==o)return}function Tm(t){const n=qi(t),o=br(n,t),i=br(n.reverse(),t);return[o,i]}function qi(t){const n=[],o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const e=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||e?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;o.nextNode();)n.push(o.currentNode);return n}function br(t,n){for(const o of t)if(!Dm(o,{upTo:n}))return o}function Dm(t,{upTo:n}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(n!==void 0&&t===n)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Rm(t){return t instanceof HTMLInputElement&&"select"in t}function he(t,{select:n=!1}={}){if(t&&t.focus){const o=document.activeElement;t.focus({preventScroll:!0}),t!==o&&Rm(t)&&n&&t.select()}}var $r=Am();function Am(){let t=[];return{add(n){const o=t[0];n!==o&&o?.pause(),t=xr(t,n),t.unshift(n)},remove(n){t=xr(t,n),t[0]?.resume()}}}function xr(t,n){const o=[...t],i=o.indexOf(n);return i!==-1&&o.splice(i,1),o}function Um(t){return t.filter(n=>n.tagName!=="A")}var Lt=0;function Ki(){g.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??_r()),document.body.insertAdjacentElement("beforeend",t[1]??_r()),Lt++,()=>{Lt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),Lt--}},[])}function _r(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var ae=function(){return ae=Object.assign||function(n){for(var o,i=1,e=arguments.length;i<e;i++){o=arguments[i];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])}return n},ae.apply(this,arguments)};function Hi(t,n){var o={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&n.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var e=0,i=Object.getOwnPropertySymbols(t);e<i.length;e++)n.indexOf(i[e])<0&&Object.prototype.propertyIsEnumerable.call(t,i[e])&&(o[i[e]]=t[i[e]]);return o}function zm(t,n,o){if(o||arguments.length===2)for(var i=0,e=n.length,r;i<e;i++)(r||!(i in n))&&(r||(r=Array.prototype.slice.call(n,0,i)),r[i]=n[i]);return t.concat(r||Array.prototype.slice.call(n))}var ut="right-scroll-bar-position",dt="width-before-scroll-bar",Mm="with-scroll-bars-hidden",Lm="--removed-body-scroll-bar-size";function Zt(t,n){return typeof t=="function"?t(n):t&&(t.current=n),t}function Zm(t,n){var o=N.useState(function(){return{value:t,callback:n,facade:{get current(){return o.value},set current(i){var e=o.value;e!==i&&(o.value=i,o.callback(i,e))}}}})[0];return o.callback=n,o.facade}var Fm=typeof window<"u"?g.useLayoutEffect:g.useEffect,wr=new WeakMap;function Vm(t,n){var o=Zm(null,function(i){return t.forEach(function(e){return Zt(e,i)})});return Fm(function(){var i=wr.get(o);if(i){var e=new Set(i),r=new Set(t),s=o.current;e.forEach(function(l){r.has(l)||Zt(l,null)}),r.forEach(function(l){e.has(l)||Zt(l,s)})}wr.set(o,t)},[t]),o}function Wm(t){return t}function Bm(t,n){n===void 0&&(n=Wm);var o=[],i=!1,e={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return o.length?o[o.length-1]:t},useMedium:function(r){var s=n(r,i);return o.push(s),function(){o=o.filter(function(l){return l!==s})}},assignSyncMedium:function(r){for(i=!0;o.length;){var s=o;o=[],s.forEach(r)}o={push:function(l){return r(l)},filter:function(){return o}}},assignMedium:function(r){i=!0;var s=[];if(o.length){var l=o;o=[],l.forEach(r),s=o}var m=function(){var d=s;s=[],d.forEach(r)},c=function(){return Promise.resolve().then(m)};c(),o={push:function(d){s.push(d),c()},filter:function(d){return s=s.filter(d),o}}}};return e}function Jm(t){t===void 0&&(t={});var n=Bm(null);return n.options=ae({async:!0,ssr:!1},t),n}var Xi=function(t){var n=t.sideCar,o=Hi(t,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=n.read();if(!i)throw new Error("Sidecar medium not found");return g.createElement(i,ae({},o))};Xi.isSideCarExport=!0;function Gm(t,n){return t.useMedium(n),Xi}var Yi=Jm(),Ft=function(){},Et=g.forwardRef(function(t,n){var o=g.useRef(null),i=g.useState({onScrollCapture:Ft,onWheelCapture:Ft,onTouchMoveCapture:Ft}),e=i[0],r=i[1],s=t.forwardProps,l=t.children,m=t.className,c=t.removeScrollBar,d=t.enabled,f=t.shards,y=t.sideCar,p=t.noRelative,h=t.noIsolation,v=t.inert,$=t.allowPinchZoom,x=t.as,_=x===void 0?"div":x,I=t.gapMode,b=Hi(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=y,E=Vm([o,n]),S=ae(ae({},b),e);return g.createElement(g.Fragment,null,d&&g.createElement(j,{sideCar:Yi,removeScrollBar:c,shards:f,noRelative:p,noIsolation:h,inert:v,setCallbacks:r,allowPinchZoom:!!$,lockRef:o,gapMode:I}),s?g.cloneElement(g.Children.only(l),ae(ae({},S),{ref:E})):g.createElement(_,ae({},S,{className:m,ref:E}),l))});Et.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Et.classNames={fullWidth:dt,zeroRight:ut};var qm=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Km(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var n=qm();return n&&t.setAttribute("nonce",n),t}function Hm(t,n){t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n))}function Xm(t){var n=document.head||document.getElementsByTagName("head")[0];n.appendChild(t)}var Ym=function(){var t=0,n=null;return{add:function(o){t==0&&(n=Km())&&(Hm(n,o),Xm(n)),t++},remove:function(){t--,!t&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},Qm=function(){var t=Ym();return function(n,o){g.useEffect(function(){return t.add(n),function(){t.remove()}},[n&&o])}},Qi=function(){var t=Qm(),n=function(o){var i=o.styles,e=o.dynamic;return t(i,e),null};return n},ef={left:0,top:0,right:0,gap:0},Vt=function(t){return parseInt(t||"",10)||0},tf=function(t){var n=window.getComputedStyle(document.body),o=n[t==="padding"?"paddingLeft":"marginLeft"],i=n[t==="padding"?"paddingTop":"marginTop"],e=n[t==="padding"?"paddingRight":"marginRight"];return[Vt(o),Vt(i),Vt(e)]},nf=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return ef;var n=tf(t),o=document.documentElement.clientWidth,i=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,i-o+n[2]-n[0])}},rf=Qi(),Ce="data-scroll-locked",of=function(t,n,o,i){var e=t.left,r=t.top,s=t.right,l=t.gap;return o===void 0&&(o="margin"),`
14
14
  .`.concat(Mm,` {
15
15
  overflow: hidden `).concat(i,`;
16
16
  padding-right: `).concat(l,"px ").concat(i,`;
package/dist/elements.js CHANGED
@@ -10047,7 +10047,7 @@ function w_(t) {
10047
10047
  }
10048
10048
  const S_ = () => {
10049
10049
  const { plugins: t } = Y(), n = w_(t);
10050
- return /* @__PURE__ */ d(
10050
+ return console.info("Using components by language", n), /* @__PURE__ */ d(
10051
10051
  lg,
10052
10052
  {
10053
10053
  remarkPlugins: [cg],
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@gram-ai/elements",
3
3
  "description": "Gram Elements is a library of UI primitives for building chat-like experiences for MCP Servers.",
4
4
  "type": "module",
5
- "version": "1.13.3",
5
+ "version": "1.13.4",
6
6
  "main": "dist/index.js",
7
7
  "exports": {
8
8
  ".": {