PageSourceSearch

https://cloud.exducer.ai/assets/chat-D0z8SNE5.js

js exducer.ai collected 2026-10-05 14:39:10 UTC 284,853 bytes, 58 lines download raw bytes

1import{k as Ad,l as Dd,r as i,j as o,m as Rs,n as _r,o as Td,p as q,i as sn,c as Ve,f as Es,h as Id,q as Od}from"./index-BUIh04XP.js";import{Q as $d,g as Ld,a as Rn,b as cn,c as Mn,S as St,C as ta,T as _s,L as Fd,P as Bd,d as Hd,u as Wd,R as Vd,e as no,f as $a}from"./use-toast-yoZ2pEEh.js";import{c as We,u as oe,X as kr,a as Y,b as ks,d as Ps,B as le,e as Ud}from"./button-CtEs0ZcO.js";import{C as ln}from"./check-DXCa4hUg.js";import{c as fe}from"./createLucideIcon-D_qDYm43.js";import{P as Ro,T as Ms}from"./trash-2-C3oXCIzm.js";import{A as La}from"./arrow-right-Bfi5P-IJ.js";import{C as An}from"./copy-Ci1Genj2.js";import{D as mr}from"./download-dc1bB3GC.js";import{B as As}from"./money-C5aeUeci.js";import{W as zd}from"./wallet-M9od21JZ.js";import{C as Kd,L as qd,M as Gd,a as Yd}from"./message-square-6nvHmHQf.js";import{D as Xd}from"./database-DTOVHiKw.js";var Qd=class extends $d{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,r=super.createResult(e,t),{isFetching:a,isRefetching:s,isError:l,isRefetchError:c}=r,u=n.fetchMeta?.fetchMore?.direction,d=l&&u==="forward",f=a&&u==="forward",m=l&&u==="backward",h=a&&u==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Dd(t,n.data),hasPreviousPage:Ad(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:m,isFetchingPreviousPage:h,isRefetchError:c&&!d&&!m,isRefetching:s&&!f&&!h}}};function Zd(e,t){return Ld(e,Qd)}const Jd=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],ef=fe("archive-restore",Jd);const tf=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Ds=fe("archive",tf);const nf=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],rf=fe("arrow-down",nf);const of=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Eo=fe("chevron-left",of);const af=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],sf=fe("chevron-up",af);const cf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],lf=fe("circle-user",cf);const uf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],df=fe("circle",uf);const ff=[["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}],["path",{d:"M9 14 4 9l5-5",key:"102s5s"}]],mf=fe("corner-up-left",ff);const pf=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],hf=fe("credit-card",pf);const gf=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Ts=fe("ellipsis",gf);const xf=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Is=fe("file-text",xf);const vf=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],yf=fe("folder-plus",vf);const wf=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}
1]],Os=fe("folder",wf);const bf=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Sf=fe("git-branch",bf);const Nf=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],Cf=fe("keyboard",Nf);const jf=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],Fa=fe("message-square-plus",jf);const Rf=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],$s=fe("panel-left-close",Rf);const Ef=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Ls=fe("panel-left",Ef);const _f=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Fs=fe("panel-right",_f);const kf=[["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"}]],pr=fe("pencil",kf);const Pf=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]],Mf=fe("pin-off",Pf);const Af=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],Bs=fe("pin",Af);const Df=[["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"}]],Tf=fe("refresh-cw",Df);const If=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],_o=fe("search",If);const Of=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],$f=fe("send",Of);const Lf=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Ff=fe("server",Lf);const Bf=[["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"}]],Hf=fe("settings-2",Bf);const Wf=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Vf=fe("settings",Wf);const Uf=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]],zf=fe("store",Uf);const Kf=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Ba=fe("timer",Kf);const qf=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}
vendor: 9,486 bytes, line 1
1],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Gf=fe("wifi-off",qf);function G(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e?.(a),n===!1||!a.defaultPrevented)return t?.(a)}}function Yf(e,t){const n=i.createContext(t),r=s=>{const{children:l,...c}=s,u=i.useMemo(()=>c,Object.values(c));return o.jsx(n.Provider,{value:u,children:l})};r.displayName=e+"Provider";function a(s){const l=i.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,a]}function Ke(e,t=[]){let n=[];function r(s,l){const c=i.createContext(l),u=n.length;n=[...n,l];const d=m=>{const{scope:h,children:g,...x}=m,p=h?.[e]?.[u]||c,y=i.useMemo(()=>x,Object.values(x));return o.jsx(p.Provider,{value:y,children:g})};d.displayName=s+"Provider";function f(m,h){const g=h?.[e]?.[u]||c,x=i.useContext(g);if(x)return x;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[d,f]}const a=()=>{const s=n.map(l=>i.createContext(l));return function(c){const u=c?.[e]||s;return i.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return a.scopeName=e,[r,Xf(a,...t)]}function Xf(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(s){const l=r.reduce((c,{useScope:u,scopeName:d})=>{const m=u(s)[`__scope${d}`];return{...c,...m}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var Pe=globalThis?.document?i.useLayoutEffect:()=>{},Qf=Rs[" useId ".trim().toString()]||(()=>{}),Zf=0;function Re(e){const[t,n]=i.useState(Qf());return Pe(()=>{n(r=>r??String(Zf++))},[e]),e||(t?`radix-${t}`:"")}var Jf=Rs[" useInsertionEffect ".trim().toString()]||Pe;function lt({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,s,l]=em({defaultProp:t,onChange:n}),c=e!==void 0,u=c?e:a;{const f=i.useRef(e!==void 0);i.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"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.`),f.current=c},[c,r])}const d=i.useCallback(f=>{if(c){const m=tm(f)?f(e):f;m!==e&&l.current?.(m)}else s(f)},[c,e,s,l]);return[u,d]}function em({defaultProp:e,onChange:t}){const[n,r]=i.useState(e),a=i.useRef(n),s=i.useRef(t);return Jf(()=>{s.current=t},[t]),i.useEffect(()=>{a.current!==n&&(s.current?.(n),a.current=n)},[n,a]),[n,r,s]}function tm(e){return typeof e=="function"}function nm(e){const t=rm(e),n=i.forwardRef((r,a)=>{const{children:s,...l}=r,c=i.Children.toArray(s),u=c.find(am);if(u){const d=u.props.children,f=c.map(m=>m===u?i.Children.count(d)>1?i.Children.only(null):i.isValidElement(d)?d.props.children:null:m);return o.jsx(t,{...l,ref:a,children:i.isValidElement(d)?i.cloneElement(d,void 0,f):null})}return o.jsx(t,{...l,ref:a,children:s})});return n.displayName=`${e}.Slot`,n}function rm(e){const t=i.forwardRef((n,r)=>{const{children:a,...s}=n;if(i.isValidElement(a)){const l=im(a),c=sm(s,a.props);return a.type!==i.Fragment&&(c.ref=r?We(r,l):l),i.cloneElement(a,c)}return i.Children.count(a)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var om=Symbol("radix.slottable");function am(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===om}function sm(e,t){const n={...t};for(const r in t){const a=e[r],s=t[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...c)=>{const u=s(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...s}:r==="className"&&(n[r]=[a,s].filter(Boolean).join(" "))}return{...e,...n}}function im(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var cm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Z=cm.reduce((e,t)=>{const n=nm(`Primitive.${t}`),r=i.forwardRef((a,s)=>{const{asChild:l,...c}=a,u=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(u,{...c,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Hs(e,t){e&&_r.flushSync(()=>e.dispatchEvent(t))}function Xe(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>t.current?.(...n),[])}function lm(e,t=globalThis?.document){const n=Xe(e);i.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var um="DismissableLayer",ko="dismissableLayer.update",dm="dismissableLayer.pointerDownOutside",fm="dismissableLayer.focusOutside",Ha,Ws=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Dn=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(Ws),[f,m]=i.useState(null),h=f?.ownerDocument??globalThis?.document,[,g]=i.useState({}),x=oe(t,C=>m(C)),p=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),v=p.indexOf(y),b=f?p.indexOf(f):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,S=b>=v,j=hm(C=>{const _=C.target,M=[...d.branches].some(O=>O.contains(_));!S||M||(a?.(C),l?.(C),C.defaultPrevented||c?.())},h),k=gm(C=>{const _=C.target;[...d.branches].some(O=>O.contains(_))||(s?.(C),l?.(C),C.defaultPrevented||c?.())},h);return lm(C=>{b===d.layers.size-1&&(r?.(C),!C.defaultPrevented&&c&&(C.preventDefault(),c()))},h),i.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Ha=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Wa(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Ha)}},[f,h,n,d]),i.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Wa())},[f,d]),i.useEffect(()=>{const C=()=>g({});return document.addEventListener(ko,C),()=>document.removeEventListener(ko,C)},[]),o.jsx(Z.div,{...u,ref:x,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:G(e.onFocusCapture,k.onFocusCapture),onBlurCapture:G(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:G(e.onPointerDownCapture,j.onPointerDownCapture)})});Dn.displayName=um;var mm="DismissableLayerBranch",pm=i.forwardRef((e,t)=>{const n=i.useContext(Ws),r=i.useRef(null),a=oe(t,r);return i.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),o.jsx(Z.div,{...e,ref:a})});pm.displayName=mm;function hm(e,t=globalThis?.document){const n=Xe(e),r=i.useRef(!1),a=i.useRef(()=>{});return i.useEffect(()=>{const s=c=>{if(c.target&&!r.current){let u=function(){Vs(dm,n,d,{discrete:!0})};const d={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=u,t.addEventListener("click",a.current,{once:!0})):u()}else t.removeEventListener("click",a.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",s),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function gm(e,t=globalThis?.document){const n=Xe(e),r=i.useRef(!1);return i.useEffect(()=>{const a=s=>{s.target&&!r.current&&Vs(fm,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Wa(){const e=new CustomEvent(ko);document.dispatchEvent(e)}function Vs(e,t,n,{discrete:r}){const a=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Hs(a,s):a.dispatchEvent(s)}var ro="focusScope.autoFocusOnMount",oo="focusScope.autoFocusOnUnmount",Va={bubbles:!1,cancelable:!0},xm="FocusScope",Tn=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...l}=e,[c,u]=i.useState(null),d=Xe(a),f=Xe(s),m=i.useRef(null),h=oe(t,p=>u(p)),g=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(r){let p=function(w){if(g.paused||!c)return;const S=w.target;c.contains(S)?m.current=S:bt(m.current,{select:!0})},y=function(w){if(g.paused||!c)return;const S=w.relatedTarget;S!==null&&(c.contains(S)||bt(m.current,{select:!0}))},v=function(w){if(document.activeElement===document.body)for(const j of w)j.removedNodes.length>0&&bt(c)};document.addEventListener("focusin",p),document.addEventListener("focusout",y);const b=new MutationObserver(v);return c&&b.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",y),b.disconnect()}}},[r,c,g.paused]),i.useEffect(()=>{if(c){za.add(g);const p=document.activeElement;if(!c.contains(p)){const v=new CustomEvent(ro,Va);c.addEventListener(ro,d),c.dispatchEvent(v),v.defaultPrevented||(vm(Nm(Us(c)),{select:!0}),document.activeElement===p&&bt(c))}return()=>{c.removeEventListener(ro,d),setTimeout(()=>{const v=new CustomEvent(oo,Va);
vendor: 4,526 bytes, line 1
1c.addEventListener(oo,f),c.dispatchEvent(v),v.defaultPrevented||bt(p??document.body,{select:!0}),c.removeEventListener(oo,f),za.remove(g)},0)}}},[c,d,f,g]);const x=i.useCallback(p=>{if(!n&&!r||g.paused)return;const y=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,v=document.activeElement;if(y&&v){const b=p.currentTarget,[w,S]=ym(b);w&&S?!p.shiftKey&&v===S?(p.preventDefault(),n&&bt(w,{select:!0})):p.shiftKey&&v===w&&(p.preventDefault(),n&&bt(S,{select:!0})):v===b&&p.preventDefault()}},[n,r,g.paused]);return o.jsx(Z.div,{tabIndex:-1,...l,ref:h,onKeyDown:x})});Tn.displayName=xm;function vm(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(bt(r,{select:t}),document.activeElement!==n)return}function ym(e){const t=Us(e),n=Ua(t,e),r=Ua(t.reverse(),e);return[n,r]}function Us(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ua(e,t){for(const n of e)if(!wm(n,{upTo:t}))return n}function wm(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function bm(e){return e instanceof HTMLInputElement&&"select"in e}function bt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&bm(e)&&t&&e.select()}}var za=Sm();function Sm(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ka(e,t),e.unshift(t)},remove(t){e=Ka(e,t),e[0]?.resume()}}}function Ka(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Nm(e){return e.filter(t=>t.tagName!=="A")}var Cm="Portal",In=i.forwardRef((e,t)=>{const{container:n,...r}=e,[a,s]=i.useState(!1);Pe(()=>s(!0),[]);const l=n||a&&globalThis?.document?.body;return l?Td.createPortal(o.jsx(Z.div,{...r,ref:t}),l):null});In.displayName=Cm;function jm(e,t){return i.useReducer((n,r)=>t[n][r]??n,e)}var Je=e=>{const{present:t,children:n}=e,r=Rm(t),a=typeof n=="function"?n({present:r.isPresent}):i.Children.only(n),s=oe(r.ref,Em(a));return typeof n=="function"||r.isPresent?i.cloneElement(a,{ref:s}):null};Je.displayName="Presence";function Rm(e){const[t,n]=i.useState(),r=i.useRef(null),a=i.useRef(e),s=i.useRef("none"),l=e?"mounted":"unmounted",[c,u]=jm(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const d=Zn(r.current);s.current=c==="mounted"?d:"none"},[c]),Pe(()=>{const d=r.current,f=a.current;if(f!==e){const h=s.current,g=Zn(d);e?u("MOUNT"):g==="none"||d?.display==="none"?u("UNMOUNT"):u(f&&h!==g?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,u]),Pe(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,m=g=>{const p=Zn(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&p&&(u("ANIMATION_END"),!a.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},h=g=>{g.target===t&&(s.current=Zn(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function Zn(e){return e?.animationName||"none"}function Em(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ao=0;function Pr(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??qa()),document.body.insertAdjacentElement("beforeend",e[1]??qa()),ao++,()=>{ao===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ao--}},[])}function qa(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.
vendor: 5,651 bytes, lines 1-16
1style.position="fixed",e.style.pointerEvents="none",e}var st=function(){return st=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},st.apply(this,arguments)};function zs(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function _m(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,s;r<a;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var ur="right-scroll-bar-position",dr="width-before-scroll-bar",km="with-scroll-bars-hidden",Pm="--removed-body-scroll-bar-size";function so(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Mm(e,t){var n=i.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var Am=typeof window<"u"?i.useLayoutEffect:i.useEffect,Ga=new WeakMap;function Dm(e,t){var n=Mm(null,function(r){return e.forEach(function(a){return so(a,r)})});return Am(function(){var r=Ga.get(n);if(r){var a=new Set(r),s=new Set(e),l=n.current;a.forEach(function(c){s.has(c)||so(c,null)}),s.forEach(function(c){a.has(c)||so(c,l)})}Ga.set(n,e)},[e]),n}function Tm(e){return e}function Im(e,t){t===void 0&&(t=Tm);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var l=t(s,r);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(s){for(r=!0;n.length;){var l=n;n=[],l.forEach(s)}n={push:function(c){return s(c)},filter:function(){return n}}},assignMedium:function(s){r=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(s),l=n}var u=function(){var f=l;l=[],f.forEach(s)},d=function(){return Promise.resolve().then(u)};d(),n={push:function(f){l.push(f),d()},filter:function(f){return l=l.filter(f),n}}}};return a}function Om(e){e===void 0&&(e={});var t=Im(null);return t.options=st({async:!0,ssr:!1},e),t}var Ks=function(e){var t=e.sideCar,n=zs(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return i.createElement(r,st({},n))};Ks.isSideCarExport=!0;function $m(e,t){return e.useMedium(t),Ks}var qs=Om(),io=function(){},Mr=i.forwardRef(function(e,t){var n=i.useRef(null),r=i.useState({onScrollCapture:io,onWheelCapture:io,onTouchMoveCapture:io}),a=r[0],s=r[1],l=e.forwardProps,c=e.children,u=e.className,d=e.removeScrollBar,f=e.enabled,m=e.shards,h=e.sideCar,g=e.noRelative,x=e.noIsolation,p=e.inert,y=e.allowPinchZoom,v=e.as,b=v===void 0?"div":v,w=e.gapMode,S=zs(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=h,k=Dm([n,t]),C=st(st({},S),a);return i.createElement(i.Fragment,null,f&&i.createElement(j,{sideCar:qs,removeScrollBar:d,shards:m,noRelative:g,noIsolation:x,inert:p,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:w}),l?i.cloneElement(i.Children.only(c),st(st({},C),{ref:k})):i.createElement(b,st({},C,{className:u,ref:k}),c))});Mr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Mr.classNames={fullWidth:dr,zeroRight:ur};var Lm=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Fm(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Lm();return t&&e.setAttribute("nonce",t),e}function Bm(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Hm(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Wm=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Fm())&&(Bm(t,n),Hm(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Vm=function(){var e=Wm();return function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Gs=function(){var e=Vm(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},Um={left:0,top:0,right:0,gap:0},co=function(e){return parseInt(e||"",10)||0},zm=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[co(n),co(r),co(a)]},Km=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Um;var t=zm(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},qm=Gs(),en="data-scroll-locked",Gm=function(e,t,n,r){var a=e.left,s=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
2  .`.concat(km,` {
3   overflow: hidden `).concat(r,`;
4   padding-right: `).concat(c,"px ").concat(r,`;
5  }
6  body[`).concat(en,`] {
7    overflow: hidden `).concat(r,`;
8    overscroll-behavior: contain;
9    `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
10    padding-left: `.concat(a,`px;
11    padding-top: `).concat(s,`px;
12    padding-right: `).concat(l,`px;
13    margin-left:0;
14    margin-top:0;
15    margin-right: `).concat(c,"px ").concat(r,`;
16    `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";
16")].filter(Boolean).join(""),`
17  }
18  
19  .`).concat(ur,` {
20    right: `).concat(c,"px ").concat(r,`;
21  }
22  
23  .`).concat(dr,` {
24    margin-right: `).concat(c,"px ").concat(r,`;
25  }
26  
27  .`).concat(ur," .").concat(ur,` {
28    right: 0 `).concat(r,`;
29  }
30  
31  .`).concat(dr," .").concat(dr,` {
32    margin-right: 0 `).concat(r,`;
33  }
34  
35  body[`).concat(en,`] {
36    `).concat(Pm,": ").concat(c,`px;
37  }
38`)},Ya=function(){var e=parseInt(document.body.getAttribute(en)||"0",10);return isFinite(e)?e:0},Ym=function(){i.useEffect(function(){return document.body.setAttribute(en,(Ya()+1).toString()),function(){var e=Ya()-1;e<=0?document.body.removeAttribute(en):document.body.setAttribute(en,e.toString())}},[])},Xm=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;Ym();var s=i.useMemo(function(){return Km(a)},[a]);return i.createElement(qm,{styles:Gm(s,!t,a,n?"":"!important")})},Po=!1;if(typeof window<"u")try{var Jn=Object.defineProperty({},"passive",{get:function(){return Po=!0,!0}});window.addEventListener("test",Jn,Jn),window.removeEventListener("test",Jn,Jn)}catch{Po=!1}
vendor: 5,177 bytes, lines 38-41
38var Gt=Po?{passive:!1}:!1,Qm=function(e){return e.tagName==="TEXTAREA"},Ys=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Qm(e)&&n[t]==="visible")},Zm=function(e){return Ys(e,"overflowY")},Jm=function(e){return Ys(e,"overflowX")},Xa=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=Xs(e,r);if(a){var s=Qs(e,r),l=s[1],c=s[2];if(l>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ep=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},tp=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Xs=function(e,t){return e==="v"?Zm(t):Jm(t)},Qs=function(e,t){return e==="v"?ep(t):tp(t)},np=function(e,t){return e==="h"&&t==="rtl"?-1:1},rp=function(e,t,n,r,a){var s=np(e,window.getComputedStyle(t).direction),l=s*r,c=n.target,u=t.contains(c),d=!1,f=l>0,m=0,h=0;do{if(!c)break;var g=Qs(e,c),x=g[0],p=g[1],y=g[2],v=p-y-s*x;(x||v)&&Xs(e,c)&&(m+=v,h+=x);var b=c.parentNode;c=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(f&&Math.abs(m)<1||!f&&Math.abs(h)<1)&&(d=!0),d},er=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Qa=function(e){return[e.deltaX,e.deltaY]},Za=function(e){return e&&"current"in e?e.current:e},op=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ap=function(e){return`
39  .block-interactivity-`.concat(e,` {pointer-events: none;}
40  .allow-interactivity-`).concat(e,` {pointer-events: all;}
41`)},sp=0,Yt=[];function ip(e){var t=i.useRef([]),n=i.useRef([0,0]),r=i.useRef(),a=i.useState(sp++)[0],s=i.useState(Gs)[0],l=i.useRef(e);i.useEffect(function(){l.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var p=_m([e.lockRef.current],(e.shards||[]).map(Za),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var c=i.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!l.current.allowPinchZoom;var v=er(p),b=n.current,w="deltaX"in p?p.deltaX:b[0]-v[0],S="deltaY"in p?p.deltaY:b[1]-v[1],j,k=p.target,C=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in p&&C==="h"&&k.type==="range")return!1;var _=window.getSelection(),M=_&&_.anchorNode,O=M?M===k||M.contains(k):!1;if(O)return!1;var L=Xa(C,k);if(!L)return!0;if(L?j=C:(j=C==="v"?"h":"v",L=Xa(C,k)),!L)return!1;if(!r.current&&"changedTouches"in p&&(w||S)&&(r.current=j),!j)return!0;var D=r.current||j;return rp(D,y,p,D==="h"?w:S)},[]),u=i.useCallback(function(p){var y=p;if(!(!Yt.length||Yt[Yt.length-1]!==s)){var v="deltaY"in y?Qa(y):er(y),b=t.current.filter(function(j){return j.name===y.type&&(j.target===y.target||y.target===j.shadowParent)&&op(j.delta,v)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var w=(l.current.shards||[]).map(Za).filter(Boolean).filter(function(j){return j.contains(y.target)}),S=w.length>0?c(y,w[0]):!l.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),d=i.useCallback(function(p,y,v,b){var w={name:p,delta:y,target:v,should:b,shadowParent:cp(v)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),f=i.useCallback(function(p){n.current=er(p),r.current=void 0},[]),m=i.useCallback(function(p){d(p.type,Qa(p),p.target,c(p,e.lockRef.current))},[]),h=i.useCallback(function(p){d(p.type,er(p),p.target,c(p,e.lockRef.current))},[]);i.useEffect(function(){return Yt.push(s),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:h}),document.addEventListener("wheel",u,Gt),document.addEventListener("touchmove",u,Gt),document.addEventListener("touchstart",f,Gt),function(){Yt=Yt.filter(function(p){return p!==s}),document.removeEventListener("wheel",u,Gt),document.removeEventListener("touchmove",u,Gt),document.removeEventListener("touchstart",f,Gt)}},[]);var g=e.removeScrollBar,x=e.inert;return i.createElement(i.Fragment,null,x?i.createElement(s,{styles:ap(a)}):null,g?i.createElement(Xm,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function cp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const lp=$m(qs,ip);var On=i.forwardRef(function(e,t){return i.createElement(Mr,st({},e,{ref:t,sideCar:lp}))});On.classNames=Mr.classNames;var up=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Xt=new WeakMap,tr=new WeakMap,nr={},lo=0,Zs=function(e){return e&&(e.host||Zs(e.parentNode))},dp=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Zs(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},fp=function(e,t,n,r){var a=dp(t,Array.isArray(e)?e:[e]);nr[n]||(nr[n]=new WeakMap);
vendor: 8,540 bytes, lines 41-45
41var s=nr[n],l=[],c=new Set,u=new Set(a),d=function(m){!m||c.has(m)||(c.add(m),d(m.parentNode))};a.forEach(d);var f=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(h){if(c.has(h))f(h);else try{var g=h.getAttribute(r),x=g!==null&&g!=="false",p=(Xt.get(h)||0)+1,y=(s.get(h)||0)+1;Xt.set(h,p),s.set(h,y),l.push(h),p===1&&x&&tr.set(h,!0),y===1&&h.setAttribute(n,"true"),x||h.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",h,v)}})};return f(t),c.clear(),lo++,function(){l.forEach(function(m){var h=Xt.get(m)-1,g=s.get(m)-1;Xt.set(m,h),s.set(m,g),h||(tr.has(m)||m.removeAttribute(r),tr.delete(m)),g||m.removeAttribute(n)}),lo--,lo||(Xt=new WeakMap,Xt=new WeakMap,tr=new WeakMap,nr={})}},Ar=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=up(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),fp(r,a,n,"aria-hidden")):function(){return null}};function mp(e){const t=pp(e),n=i.forwardRef((r,a)=>{const{children:s,...l}=r,c=i.Children.toArray(s),u=c.find(gp);if(u){const d=u.props.children,f=c.map(m=>m===u?i.Children.count(d)>1?i.Children.only(null):i.isValidElement(d)?d.props.children:null:m);return o.jsx(t,{...l,ref:a,children:i.isValidElement(d)?i.cloneElement(d,void 0,f):null})}return o.jsx(t,{...l,ref:a,children:s})});return n.displayName=`${e}.Slot`,n}function pp(e){const t=i.forwardRef((n,r)=>{const{children:a,...s}=n;if(i.isValidElement(a)){const l=vp(a),c=xp(s,a.props);return a.type!==i.Fragment&&(c.ref=r?We(r,l):l),i.cloneElement(a,c)}return i.Children.count(a)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hp=Symbol("radix.slottable");function gp(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hp}function xp(e,t){const n={...t};for(const r in t){const a=e[r],s=t[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...c)=>{const u=s(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...s}:r==="className"&&(n[r]=[a,s].filter(Boolean).join(" "))}return{...e,...n}}function vp(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Dr="Dialog",[Js,ei]=Ke(Dr),[yp,et]=Js(Dr),ti=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:s,modal:l=!0}=e,c=i.useRef(null),u=i.useRef(null),[d,f]=lt({prop:r,defaultProp:a??!1,onChange:s,caller:Dr});return o.jsx(yp,{scope:t,triggerRef:c,contentRef:u,contentId:Re(),titleId:Re(),descriptionId:Re(),open:d,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(m=>!m),[f]),modal:l,children:n})};ti.displayName=Dr;var ni="DialogTrigger",ri=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=et(ni,n),s=oe(t,a.triggerRef);return o.jsx(Z.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":oa(a.open),...r,ref:s,onClick:G(e.onClick,a.onOpenToggle)})});ri.displayName=ni;var na="DialogPortal",[wp,oi]=Js(na,{forceMount:void 0}),ai=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,s=et(na,t);return o.jsx(wp,{scope:t,forceMount:n,children:i.Children.map(r,l=>o.jsx(Je,{present:n||s.open,children:o.jsx(In,{asChild:!0,container:a,children:l})}))})};ai.displayName=na;var hr="DialogOverlay",si=i.forwardRef((e,t)=>{const n=oi(hr,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,s=et(hr,e.__scopeDialog);return s.modal?o.jsx(Je,{present:r||s.open,children:o.jsx(Sp,{...a,ref:t})}):null});si.displayName=hr;var bp=mp("DialogOverlay.RemoveScroll"),Sp=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=et(hr,n);return o.jsx(On,{as:bp,allowPinchZoom:!0,shards:[a.contentRef],children:o.jsx(Z.div,{"data-state":oa(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),It="DialogContent",ii=i.forwardRef((e,t)=>{const n=oi(It,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,s=et(It,e.__scopeDialog);return o.jsx(Je,{present:r||s.open,children:s.modal?o.jsx(Np,{...a,ref:t}):o.jsx(Cp,{...a,ref:t})})});ii.displayName=It;var Np=i.forwardRef((e,t)=>{const n=et(It,e.__scopeDialog),r=i.useRef(null),a=oe(t,n.contentRef,r);return i.useEffect(()=>{const s=r.current;if(s)return Ar(s)},[]),o.jsx(ci,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:G(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:G(e.onPointerDownOutside,s=>{const l=s.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&s.preventDefault()}),onFocusOutside:G(e.onFocusOutside,s=>s.preventDefault())})}),Cp=i.forwardRef((e,t)=>{const n=et(It,e.__scopeDialog),r=i.useRef(!1),a=i.useRef(!1);return o.jsx(ci,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=s.target;n.triggerRef.current?.contains(l)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),ci=i.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:s,...l}=e,c=et(It,n),u=i.useRef(null),d=oe(t,u);return Pr(),o.jsxs(o.Fragment,{children:[o.jsx(Tn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:s,children:o.jsx(Dn,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":oa(c.open),...l,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(Rp,{titleId:c.titleId}),o.jsx(_p,{contentRef:u,descriptionId:c.descriptionId})]})]})}),ra="DialogTitle",li=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=et(ra,n);return o.jsx(Z.h2,{id:a.titleId,...r,ref:t})});li.displayName=ra;var ui="DialogDescription",di=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=et(ui,n);return o.jsx(Z.p,{id:a.descriptionId,...r,ref:t})});di.displayName=ui;var fi="DialogClose",mi=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=et(fi,n);return o.jsx(Z.button,{type:"button",...r,ref:t,onClick:G(e.onClick,()=>a.onOpenChange(!1))})});mi.displayName=fi;function oa(e){return e?"open":"closed"}var pi="DialogTitleWarning",[jp,hi]=Yf(pi,{contentName:It,titleName:ra,docsSlug:"dialog"}),Rp=({titleId:e})=>{const t=hi(pi),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
42
43If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
44
45For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Ep="DialogDescriptionWarning",_p=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${hi(Ep).contentName}}.`;return i.useEffect(()=>{const a=e.current?.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},$n=ti,kp=ri,Ln=ai,Bt=si,Ht=ii,un=li,dn=di,Tr=mi;const Pp=$n,Mp=Ln,gi=i.forwardRef(({className:e,...t},n)=>o.jsx(Bt,{className:Y("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));gi.displayName=Bt.displayName;const Ap=ks("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),xi=i.forwardRef(({side:e="right",className:t,children:n,...r},a)=>o.jsxs(Mp,{children:[o.jsx(gi,{}),o.jsxs(Ht,{ref:a,className:Y(Ap({side:e}),t),...r,children:[o.jsxs(Tr,{className:"absolute right-4 top-4 roun
45ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[o.jsx(kr,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]}),n]})]}));xi.displayName=Ht.displayName;const Dp=i.forwardRef(({className:e,...t},n)=>o.jsx(un,{ref:n,className:Y("text-lg font-semibold text-foreground",e),...t}));Dp.displayName=un.displayName;const Tp=i.forwardRef(({className:e,...t},n)=>o.jsx(dn,{ref:n,className:Y("text-sm text-muted-foreground",e),...t}));Tp.displayName=dn.displayName;function Ip(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const vi=q.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),Fn=()=>{const e=q.useContext(vi);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};Ip(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
46[data-state=closed]
47){opacity:0}
47[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function Op(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function $p(){return aa(/^Mac/)}function Lp(){return aa(/^iPhone/)}function Ja(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Fp(){return aa(/^iPad/)||$p()&&navigator.maxTouchPoints>1}function yi(){return Lp()||Fp()}function aa(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const Bp=24,Hp=typeof window<"u"?i.useLayoutEffect:i.useEffect;function es(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const uo=typeof document<"u"&&window.visualViewport;function ts(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function wi(e){for(ts(e)&&(e=e.parentElement);e&&!ts(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Wp=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let rr=0,fo;function Vp(e={}){let{isDisabled:t}=e;Hp(()=>{if(!t)return rr++,rr===1&&yi()&&(fo=Up()),()=>{rr--,rr===0&&fo?.()}},[t])}function Up(){let e,t=0,n=m=>{e=wi(m.target),!(e===document.documentElement&&e===document.body)&&(t=m.changedTouches[0].pageY)},r=m=>{if(!e||e===document.documentElement||e===document.body){m.preventDefault();return}let h=m.changedTouches[0].pageY,g=e.scrollTop,x=e.scrollHeight-e.clientHeight;x!==0&&((g<=0&&h>t||g>=x&&h<t)&&m.preventDefault(),t=h)},a=m=>{let h=m.target;Mo(h)&&h!==document.activeElement&&(m.preventDefault(),h.style.transform="translateY(-2000px)",h.focus(),requestAnimationFrame(()=>{h.style.transform=""}))},s=m=>{let h=m.target;Mo(h)&&(h.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{h.style.transform="",uo&&(uo.height<window.innerHeight?requestAnimationFrame(()=>{ns(h)}):uo.addEventListener("resize",()=>ns(h),{once:!0}))}))},l=()=>{window.scrollTo(0,0)},c=window.pageXOffset,u=window.pageYOffset,d=es(zp(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let f=es(vn(document,"touchstart",n,{passive:!1,capture:!0}),vn(document,"touchmove",r,{passive:!1,capture:!0}),vn(document,"touchend",a,{passive:!1,capture:!0}),vn(document,"focus",s,!0),vn(window,"scroll",l));return()=>{d(),f(),window.scrollTo(c,u)}}function zp(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function vn(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function ns(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=wi(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,a=e.getBoundingClientRect().top,s=e.getBoundingClientRect().bottom;const l=n.getBoundingClientRect().bottom+Bp;s>l&&(n.scrollTop+=a-r)}e=n.parentElement}}function Mo(e){return e instanceof HTMLInputElement&&!Wp.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function Kp(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function qp(...e){return t=>e.forEach(n=>Kp(n,t))}function bi(...e){return i.useCallback(qp(...e),e)}const Si=new WeakMap;function je(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([a,s])=>{if(a.startsWith("--")){e.style.setProperty(a,s);return}r[a]=e.style[a],e.style[a]=s}),!n&&Si.set(e,r)}function Gp(e,t){if(!e||!(e instanceof HTMLElement))return;let n=Si.get(e);n&&(e.style[t]=n[t])}const Ne=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function or(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let a=r.match(/^matrix3d\((.+)\)$/);return a?parseFloat(a[1].split(", ")[Ne(t)?13:12]):(a=r.match(/^matrix\((.+)\)$/),a?parseFloat(a[1].split(", ")[Ne(t)?5:4]):null)}function Yp(e){return 8*(Math.log(e+1)-2)}function mo(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function Xp(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const ye={DURATION:.5,EASE:[.32,.72,0,1]},Ni=.4,Qp=.25,Zp=100,Ci=8,At=16,Ao=26,po="vaul-dragging";function ji(e){const t=q.useRef(e);return q.useEffect(()=>{t.current=e}),q.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function Jp({defaultProp:e,onChange:t}){const n=q.useState(e),[r]=n,a=q.useRef(r),s=ji(t);return q.useEffect(()=>{a.current!==r&&(s(r),a.current=r)},[r,a,s]),n}function Ri({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,a]=Jp({defaultProp:t,onChange:n}),s=e!==void 0,l=s?e:r,c=ji(n),u=q.useCallback(d=>
47{if(s){const m=typeof d=="function"?d(e):d;m!==e&&c(m)}else a(d)},[s,e,a,c]);return[l,u]}function eh({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:a,fadeFromIndex:s,onSnapPointChange:l,direction:c="bottom",container:u,snapToSequentialPoint:d}){const[f,m]=Ri({prop:e,defaultProp:n?.[0],onChange:t}),[h,g]=q.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);q.useEffect(()=>{function C(){g({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const x=q.useMemo(()=>f===n?.[n.length-1]||null,[n,f]),p=q.useMemo(()=>{var C;return(C=n?.findIndex(_=>_===f))!=null?C:null},[n,f]),y=n&&n.length>0&&(s||s===0)&&!Number.isNaN(s)&&n[s]===f||!n,v=q.useMemo(()=>{const C=u?{width:u.getBoundingClientRect().width,height:u.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var _;return(_=n?.map(M=>{const O=typeof M=="string";let L=0;if(O&&(L=parseInt(M,10)),Ne(c)){const E=O?L:h?M*C.height:0;return h?c==="bottom"?C.height-E:-C.height+E:E}const D=O?L:h?M*C.width:0;return h?c==="right"?C.width-D:-C.width+D:D}))!=null?_:[]},[n,h,u]),b=q.useMemo(()=>p!==null?v?.[p]:null,[v,p]),w=q.useCallback(C=>{var _;const M=(_=v?.findIndex(O=>O===C))!=null?_:null;l(M),je(r.current,{transition:`transform ${ye.DURATION}s cubic-bezier(${ye.EASE.join(",")})`,transform:Ne(c)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`}),v&&M!==v.length-1&&s!==void 0&&M!==s&&M<s?je(a.current,{transition:`opacity ${ye.DURATION}s cubic-bezier(${ye.EASE.join(",")})`,opacity:"0"}):je(a.current,{transition:`opacity ${ye.DURATION}s cubic-bezier(${ye.EASE.join(",")})`,opacity:"1"}),m(n?.[Math.max(M,0)])},[r.current,n,v,s,a,m]);q.useEffect(()=>{if(f||e){var C;const _=(C=n?.findIndex(M=>M===e||M===f))!=null?C:-1;v&&_!==-1&&typeof v[_]=="number"&&w(v[_])}},[f,e,n,v,w]);function S({draggedDistance:C,closeDrawer:_,velocity:M,dismissible:O}){if(s===void 0)return;const L=c==="bottom"||c==="right"?(b??0)-C:(b??0)+C,D=p===s-1,E=p===0,W=C>0;if(D&&je(a.current,{transition:`opacity ${ye.DURATION}s cubic-bezier(${ye.EASE.join(",")})`}),!d&&M>2&&!W){O?_():w(v[0]);return}if(!d&&M>2&&W&&v&&n){w(v[n.length-1]);return}const P=v?.reduce((H,F)=>typeof H!="number"||typeof F!="number"?H:Math.abs(F-L)<Math.abs(H-L)?F:H),A=Ne(c)?window.innerHeight:window.innerWidth;if(M>Ni&&Math.abs(C)<A*.4){const H=W?1:-1;if(H>0&&x&&n){w(v[n.length-1]);return}if(E&&H<0&&O&&_(),p===null)return;w(v[p+H]);return}w(P)}function j({draggedDistance:C}){if(b===null)return;const _=c==="bottom"||c==="right"?b-C:b+C;(c==="bottom"||c==="right")&&_<v[v.length-1]||(c==="top"||c==="left")&&_>v[v.length-1]||je(r.current,{transform:Ne(c)?`translate3d(0, ${_}px, 0)`:`translate3d(${_}px, 0, 0)`})}function k(C,_){if(!n||typeof p!="number"||!v||s===void 0)return null;const M=p===s-1;if(p>=s&&_)return 0;if(M&&!_)return 1;if(!y&&!M)return null;const L=M?p+1:p-1,D=M?v[L]-v[L-1]:v[L+1]-v[L],E=C/Math.abs(D);return M?1-E:E}return{isLastSnapPoint:x,activeSnapPoint:f,shouldFade:y,getPercentageDragged:k,setActiveSnapPoint:m,activeSnapPointIndex:p,onRelease:S,onDrag:j,snapPointsOffset:v}}const th=()=>()=>{};function nh(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:a}=Fn(),s=q.useRef(null),l=i.useMemo(()=>document.body.style.backgroundColor,[]);function c(){return(window.innerWidth-Ao)/window.innerWidth}q.useEffect(()=>{if(t&&n){s.current&&clearTimeout(s.current);const u=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!u)return;Xp(r&&!a?mo(document.body,{background:"black"}):th,mo(u,{transformOrigin:Ne(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${ye.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ye.EASE.join(",")})`}));const d=mo(u,{borderRadius:`${Ci}px`,overflow:"hidden",...Ne(e)?{transform:`scale(${c()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${c()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}}
47);return()=>{d(),s.current=window.setTimeout(()=>{l?document.body.style.background=l:document.body.style.removeProperty("background")},ye.DURATION*1e3)}}},[t,n,l])}let yn=null;function rh({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:a,noBodyStyles:s}){const[l,c]=q.useState(()=>typeof window<"u"?window.location.href:""),u=q.useRef(0),d=q.useCallback(()=>{if(Ja()&&yn===null&&e&&!s){yn={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:m,innerHeight:h}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-u.current}px`,left:`${-m}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const g=h-window.innerHeight;g&&u.current>=h&&(document.body.style.top=`${-(u.current+g)}px`)}),300)}},[e]),f=q.useCallback(()=>{if(Ja()&&yn!==null&&!s){const m=-parseInt(document.body.style.top,10),h=-parseInt(document.body.style.left,10);Object.assign(document.body.style,yn),window.requestAnimationFrame(()=>{if(a&&l!==window.location.href){c(window.location.href);return}window.scrollTo(h,m)}),yn=null}},[l]);return q.useEffect(()=>{function m(){u.current=window.scrollY}return m(),window.addEventListener("scroll",m),()=>{window.removeEventListener("scroll",m)}},[]),q.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||f()}},[t,f]),q.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&d(),t||window.setTimeout(()=>{f()},500)):f())},[e,r,l,t,n,d,f]),{restorePositionSetting:f}}function oh({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:a,snapPoints:s,shouldScaleBackground:l=!1,setBackgroundColorOnScale:c=!0,closeThreshold:u=Qp,scrollLockTimeout:d=Zp,dismissible:f=!0,handleOnly:m=!1,fadeFromIndex:h=s&&s.length-1,activeSnapPoint:g,setActiveSnapPoint:x,fixed:p,modal:y=!0,onClose:v,nested:b,noBodyStyles:w=!1,direction:S="bottom",defaultOpen:j=!1,disablePreventScroll:k=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:_=!1,repositionInputs:M=!0,onAnimationEnd:O,container:L,autoFocus:D=!1}){var E,W;const[P=!1,A]=Ri({defaultProp:j,prop:e,onChange:ee=>{t?.(ee),!ee&&!b&&ft(),setTimeout(()=>{O?.(ee)},ye.DURATION*1e3),ee&&!y&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),ee||(document.body.style.pointerEvents="auto")}}),[H,F]=q.useState(!1),[R,X]=q.useState(!1),[ae,N]=q.useState(!1),T=q.useRef(null),U=q.useRef(null),B=q.useRef(null),K=q.useRef(null),$=q.useRef(null),Q=q.useRef(!1),re=q.useRef(null),ne=q.useRef(0),J=q.useRef(!1),ue=q.useRef(!j),xe=q.useRef(0),I=q.useRef(null),me=q.useRef(((E=I.current)==null?void 0:E.getBoundingClientRect().height)||0),ve=q.useRef(((W=I.current)==null?void 0:W.getBoundingClientRect().width)||0),Ie=q.useRef(0),Vt=q.useCallback(ee=>{s&&ee===we.length-1&&(U.current=new Date)},[]),{activeSnapPoint:Pt,activeSnapPointIndex:V,setActiveSnapPoint:te,onRelease:pe,snapPointsOffset:we,onDrag:_e,shouldFade:tt,getPercentageDragged:Ut}=eh({snapPoints:s,activeSnapPointProp:g,setActiveSnapPointProp:x,drawerRef:I,fadeFromIndex:h,overlayRef:T,onSnapPointChange:Vt,direction:S,container:L,snapToSequentialPoint:C});Vp({isDisabled:!P||R||!y||ae||!H||!M||!k});const{restorePositionSetting:ft}=rh({isOpen:P,modal:y,nested:b??!1,hasBeenOpened:H,preventScrollRestoration:_,noBodyStyles:w});function nt(){return(window.innerWidth-Ao)/window.innerWidth}function $e(ee){var de,ie;!f&&!s||I.current&&!I.current.contains(ee.target)||(me.current=((de=I.current)==null?void 0:de.getBoundingClientRect().height)||0,ve.current=((ie=I.current)==null?void 0:ie.getBoundingClientRect().width)||0,X(!0),B.current=new Date,yi()&&window.addEventListener("touchend",()=>Q.current=!1,{once:!0}),ee.target.setPointerCapture(ee.pointerId),ne.current=Ne(S)?ee.pageY:ee.pageX)}function Mt(ee,de){var ie;let se=ee;const he=(ie=window.getSelection())==null?void 0:ie.toString(),Me=I.current?or(I.current,S):null,Ee=new Date;if(se.tagName==="SELECT"||se.hasAttribute("data-vaul-no-drag")||se.closest("[data-vaul-no-drag]"))return!1;if(S==="right"||S==="left")return!0;
47if(U.current&&Ee.getTime()-U.current.getTime()<500)return!1;if(Me!==null&&(S==="bottom"?Me>0:Me<0))return!0;if(he&&he.length>0)return!1;if($.current&&Ee.getTime()-$.current.getTime()<d&&Me===0||de)return $.current=Ee,!1;for(;se;){if(se.scrollHeight>se.clientHeight){if(se.scrollTop!==0)return $.current=new Date,!1;if(se.getAttribute("role")==="dialog")return!0}se=se.parentNode}return!0}function Le(ee){if(I.current&&R){const de=S==="bottom"||S==="right"?1:-1,ie=(ne.current-(Ne(S)?ee.pageY:ee.pageX))*de,se=ie>0,he=s&&!f&&!se;if(he&&V===0)return;const Me=Math.abs(ie),Ee=document.querySelector("[data-vaul-drawer-wrapper]"),rt=S==="bottom"||S==="top"?me.current:ve.current;let Fe=Me/rt;const ot=Ut(Me,se);if(ot!==null&&(Fe=ot),he&&Fe>=1||!Q.current&&!Mt(ee.target,se))return;if(I.current.classList.add(po),Q.current=!0,je(I.current,{transition:"none"}),je(T.current,{transition:"none"}),s&&_e({draggedDistance:ie}),se&&!s){const Ue=Yp(ie),qt=Math.min(Ue*-1,0)*de;je(I.current,{transform:Ne(S)?`translate3d(0, ${qt}px, 0)`:`translate3d(${qt}px, 0, 0)`});return}const at=1-Fe;if((tt||h&&V===h-1)&&(r?.(ee,Fe),je(T.current,{opacity:`${at}`,transition:"none"},!0)),Ee&&T.current&&l){const Ue=Math.min(nt()+Fe*(1-nt()),1),qt=8-Fe*8,Qn=Math.max(0,14-Fe*14);je(Ee,{borderRadius:`${qt}px`,transform:Ne(S)?`scale(${Ue}) translate3d(0, ${Qn}px, 0)`:`scale(${Ue}) translate3d(${Qn}px, 0, 0)`,transition:"none"},!0)}if(!s){const Ue=Me*de;je(I.current,{transform:Ne(S)?`translate3d(0, ${Ue}px, 0)`:`translate3d(${Ue}px, 0, 0)`})}}}q.useEffect(()=>{window.requestAnimationFrame(()=>{ue.current=!0})},[]),q.useEffect(()=>{var ee;function de(){if(!I.current||!M)return;const ie=document.activeElement;if(Mo(ie)||J.current){var se;const he=((se=window.visualViewport)==null?void 0:se.height)||0,Me=window.innerHeight;let Ee=Me-he;const rt=I.current.getBoundingClientRect().height||0,Fe=rt>Me*.8;Ie.current||(Ie.current=rt);const ot=I.current.getBoundingClientRect().top;if(Math.abs(xe.current-Ee)>60&&(J.current=!J.current),s&&s.length>0&&we&&V){const at=we[V]||0;Ee+=at}if(xe.current=Ee,rt>he||J.current){const at=I.current.getBoundingClientRect().height;let Ue=at;at>he&&(Ue=he-(Fe?ot:Ao)),p?I.current.style.height=`${at-Math.max(Ee,0)}px`:I.current.style.height=`${Math.max(Ue,he-ot)}px`}else Op()||(I.current.style.height=`${Ie.current}px`);s&&s.length>0&&!J.current?I.current.style.bottom="0px":I.current.style.bottom=`${Math.max(Ee,0)}px`}}return(ee=window.visualViewport)==null||ee.addEventListener("resize",de),()=>{var ie;return(ie=window.visualViewport)==null?void 0:ie.removeEventListener("resize",de)}},[V,s,we]);function mt(ee){Gn(),v?.(),ee||A(!1),setTimeout(()=>{s&&te(s[0])},ye.DURATION*1e3)}function qn(){if(!I.current)return;const ee=document.querySelector("[data-vaul-drawer-wrapper]"),de=or(I.current,S);je(I.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${ye.DURATION}s cubic-bezier(${ye.EASE.join(",")})`}),je(T.current,{transition:`opacity ${ye.DURATION}s cubic-bezier(${ye.EASE.join(",")})`,opacity:"1"}),l&&de&&de>0&&P&&je(ee,{borderRadius:`${Ci}px`,overflow:"hidden",...Ne(S)?{transform:`scale(${nt()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${nt()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${ye.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ye.EASE.join(",")})`},!0)}function Gn(){!R||!I.current||(I.current.classList.remove(po),Q.current=!1,X(!1),K.current=new Date)}function Yn(ee){if(!R||!I.current)return;I.current.classList.remove(po),Q.current=!1,X(!1),K.current=new Date;const de=or(I.current,S);
47if(!ee||!Mt(ee.target,!1)||!de||Number.isNaN(de)||B.current===null)return;const ie=K.current.getTime()-B.current.getTime(),se=ne.current-(Ne(S)?ee.pageY:ee.pageX),he=Math.abs(se)/ie;if(he>.05&&(N(!0),setTimeout(()=>{N(!1)},200)),s){pe({draggedDistance:se*(S==="bottom"||S==="right"?1:-1),closeDrawer:mt,velocity:he,dismissible:f}),a?.(ee,!0);return}if(S==="bottom"||S==="right"?se>0:se<0){qn(),a?.(ee,!0);return}if(he>Ni){mt(),a?.(ee,!1);return}var Me;const Ee=Math.min((Me=I.current.getBoundingClientRect().height)!=null?Me:0,window.innerHeight);var rt;const Fe=Math.min((rt=I.current.getBoundingClientRect().width)!=null?rt:0,window.innerWidth),ot=S==="left"||S==="right";if(Math.abs(de)>=(ot?Fe:Ee)*u){mt(),a?.(ee,!1);return}a?.(ee,!0),qn()}q.useEffect(()=>(P&&(je(document.documentElement,{scrollBehavior:"auto"}),U.current=new Date),()=>{Gp(document.documentElement,"scrollBehavior")}),[P]);function zt(ee){const de=ee?(window.innerWidth-At)/window.innerWidth:1,ie=ee?-At:0;re.current&&window.clearTimeout(re.current),je(I.current,{transition:`transform ${ye.DURATION}s cubic-bezier(${ye.EASE.join(",")})`,transform:Ne(S)?`scale(${de}) translate3d(0, ${ie}px, 0)`:`scale(${de}) translate3d(${ie}px, 0, 0)`}),!ee&&I.current&&(re.current=setTimeout(()=>{const se=or(I.current,S);je(I.current,{transition:"none",transform:Ne(S)?`translate3d(0, ${se}px, 0)`:`translate3d(${se}px, 0, 0)`})},500))}function Kt(ee,de){if(de<0)return;const ie=(window.innerWidth-At)/window.innerWidth,se=ie+de*(1-ie),he=-At+de*At;je(I.current,{transform:Ne(S)?`scale(${se}) translate3d(0, ${he}px, 0)`:`scale(${se}) translate3d(${he}px, 0, 0)`,transition:"none"})}function Xn(ee,de){const ie=Ne(S)?window.innerHeight:window.innerWidth,se=de?(ie-At)/ie:1,he=de?-At:0;de&&je(I.current,{transition:`transform ${ye.DURATION}s cubic-bezier(${ye.EASE.join(",")})`,transform:Ne(S)?`scale(${se}) translate3d(0, ${he}px, 0)`:`scale(${se}) translate3d(${he}px, 0, 0)`})}return q.useEffect(()=>{y||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[y]),q.createElement($n,{defaultOpen:j,onOpenChange:ee=>{!f&&!ee||(ee?F(!0):mt(!0),A(ee))},open:P},q.createElement(vi.Provider,{value:{activeSnapPoint:Pt,snapPoints:s,setActiveSnapPoint:te,drawerRef:I,overlayRef:T,onOpenChange:t,onPress:$e,onRelease:Yn,onDrag:Le,dismissible:f,shouldAnimate:ue,handleOnly:m,isOpen:P,isDragging:R,shouldFade:tt,closeDrawer:mt,onNestedDrag:Kt,onNestedOpenChange:zt,onNestedRelease:Xn,keyboardIsOpen:J,modal:y,snapPointsOffset:we,activeSnapPointIndex:V,direction:S,shouldScaleBackground:l,setBackgroundColorOnScale:c,noBodyStyles:w,container:L,autoFocus:D}},n))}const Ei=q.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:r,onRelease:a,shouldFade:s,isOpen:l,modal:c,shouldAnimate:u}=Fn(),d=bi(t,n),f=r&&r.length>0;if(!c)return null;const m=q.useCallback(h=>a(h),[a]);return q.createElement(Bt,{onMouseUp:m,ref:d,"data-vaul-overlay":"","data-vaul-snap-points":l&&f?"true":"false","data-vaul-snap-points-overlay":l&&s?"true":"false","data-vaul-animate":u?.current?"true":"false",...e})});Ei.displayName="Drawer.Overlay";const _i=q.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},a){const{drawerRef:s,onPress:l,onRelease:c,onDrag:u,keyboardIsOpen:d,snapPointsOffset:f,activeSnapPointIndex:m,modal:h,isOpen:g,direction:x,snapPoints:p,container:y,handleOnly:v,shouldAnimate:b,autoFocus:w}=Fn(),[S,j]=q.useState(!1),k=bi(a,s),C=q.useRef(null),_=q.useRef(null),M=q.useRef(!1),O=p&&p.length>0;nh();const L=(E,W,P=0)=>{if(M.current)return!0;const A=Math.abs(E.y),H=Math.abs(E.x),F=H>A,R=["bottom","right"].includes(W)?1:-1;if(W==="left"||W==="right"){if(!(E.x*R<0)&&H>=0&&H<=P)return F}else if(!(E.y*R<0)&&A>=0&&A<=P)return!F;return M.current=!0,!0};q.useEffect(()=>{O&&window.requestAnimationFrame(()=>{j(!0)})},[]);function D(E){C.current=null,M.current=!1,c(E)}return q.createElement(Ht,{"data-vaul-drawer-direction":x,"data-vaul-drawer":"","data-vaul-delayed-snap-points":S?"true":"false","data-vaul-snap-points":g&&O?"true":"false","data-vaul-custom-container":y?"true":"false","data-vaul-animate":b?.current?"true":"false",...r,ref:k,style:f&&f.length>0?{"--snap-point-height":`${f[m??0]}px`,...t}:t,onPointerDown:E=>{v||(r.onPointerDown==null||r.onPointerDown.call(r,E),C.current={x:E.pageX,y:E.pageY},l(E))},onOpenAutoFocus:E=>{n?.(E),w||E.preventDefault()},onPointerDownOutside:E=>{if(e?.(E),!h||E.defaultPrevented){E.preventDefault();return}d.current&&(d.current=!1)},onFocusOutside:E=>{if(!h){E.preventDefault();return}},onPointerMove:E=>{if(_.current=E,v||(r.onPointerMove==null||r.onPointerMove.call(r,E),!C.current))return;const W=E.pageY-C.current.y,P=E.pageX-C.current.x,A=E.pointerType==="touch"?10:2;L({x:P,y:W},x,A)?u(E):(Math.abs(P)>A||Math.abs(W)>A)&&(C.current=null)},onPointerUp:E=>{r.onPointerUp==null||r.onPointerUp.call(r,E),C.current=null,M.current=!1,c(E)},onPointerOut:E=>{r.onPointerOut==null||r.onPointerOut.call(r,E),D(_.current)},onContextMenu:E=>{r.onContextMenu==null||r.onContextMenu.call(r,E),_.current&&D(_.current)}})});_i.displayName="Drawer.Content";const ah=250,sh=120,ih=q.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{closeDrawer:a,isDragging:s,snapPoints:l,activeSnapPoint:c,setActiveSnapPoint:u,dismissible:d,handleOnly:f,isOpen:m,onPress:h,onDrag:g}=Fn(),x=q.useRef(null),p=q.useRef(!1);function y(){if(p.current){w();return}window.setTimeout(()=>{v()},sh)}function v(){if(s||e||p.current){w();return}if(w(),!l||l.length===0){d||a();return}if(c===l[l.length-1]&&d){a();return}const j=l.findIndex(C=>C===c);if(j===-1)return;const k=l[j+1];u(k)}function b(){x.current=window.setTimeout(()=>{p.current=!0},ah)}function w(){x.current&&window.clearTimeout(x.current),p.current=!1}return q.createElement("div",{onClick:y,onPointerCancel:w,onPointerDown:S=>{f&&h(S),b()},onPointerMove:S=>{f&&g(S)},ref:r,"data-vaul-drawer-visible":m?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},q.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});ih.displayName="Drawer.Handle";function ch(e){const t=Fn(),{container:n=t.container,...r}=e;return q.createElement(Ln,{container:n,...r})}const xt={Root:oh,Content:_i,Overlay:Ei,Portal:ch,Title:un,Description:dn}
vendor: 15,115 bytes, line 47
47,ki=({shouldScaleBackground:e=!0,...t})=>o.jsx(xt.Root,{shouldScaleBackground:e,...t});ki.displayName="Drawer";const lh=xt.Portal,Pi=i.forwardRef(({className:e,...t},n)=>o.jsx(xt.Overlay,{ref:n,className:Y("fixed inset-0 z-50 bg-black/80",e),...t}));Pi.displayName=xt.Overlay.displayName;const Mi=i.forwardRef(({className:e,children:t,...n},r)=>o.jsxs(lh,{children:[o.jsx(Pi,{}),o.jsxs(xt.Content,{ref:r,className:Y("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",e),...n,children:[o.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),t]})]}));Mi.displayName="DrawerContent";const uh=i.forwardRef(({className:e,...t},n)=>o.jsx(xt.Title,{ref:n,className:Y("text-lg font-semibold leading-none tracking-tight",e),...t}));uh.displayName=xt.Title.displayName;const dh=i.forwardRef(({className:e,...t},n)=>o.jsx(xt.Description,{ref:n,className:Y("text-sm text-muted-foreground",e),...t}));dh.displayName=xt.Description.displayName;const En=i.forwardRef(({className:e,type:t,...n},r)=>o.jsx("input",{type:t,className:Y("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));En.displayName="Input";function rs(e){const t=fh(e),n=i.forwardRef((r,a)=>{const{children:s,...l}=r,c=i.Children.toArray(s),u=c.find(ph);if(u){const d=u.props.children,f=c.map(m=>m===u?i.Children.count(d)>1?i.Children.only(null):i.isValidElement(d)?d.props.children:null:m);return o.jsx(t,{...l,ref:a,children:i.isValidElement(d)?i.cloneElement(d,void 0,f):null})}return o.jsx(t,{...l,ref:a,children:s})});return n.displayName=`${e}.Slot`,n}function fh(e){const t=i.forwardRef((n,r)=>{const{children:a,...s}=n;if(i.isValidElement(a)){const l=gh(a),c=hh(s,a.props);return a.type!==i.Fragment&&(c.ref=r?We(r,l):l),i.cloneElement(a,c)}return i.Children.count(a)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var mh=Symbol("radix.slottable");function ph(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===mh}function hh(e,t){const n={...t};for(const r in t){const a=e[r],s=t[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...c)=>{const u=s(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...s}:r==="className"&&(n[r]=[a,s].filter(Boolean).join(" "))}return{...e,...n}}function gh(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Ir(e){const t=e+"CollectionProvider",[n,r]=Ke(t),[a,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=p=>{const{scope:y,children:v}=p,b=q.useRef(null),w=q.useRef(new Map).current;return o.jsx(a,{scope:y,itemMap:w,collectionRef:b,children:v})};l.displayName=t;const c=e+"CollectionSlot",u=rs(c),d=q.forwardRef((p,y)=>{const{scope:v,children:b}=p,w=s(c,v),S=oe(y,w.collectionRef);return o.jsx(u,{ref:S,children:b})});d.displayName=c;const f=e+"CollectionItemSlot",m="data-radix-collection-item",h=rs(f),g=q.forwardRef((p,y)=>{const{scope:v,children:b,...w}=p,S=q.useRef(null),j=oe(y,S),k=s(f,v);return q.useEffect(()=>(k.itemMap.set(S,{ref:S,...w}),()=>{k.itemMap.delete(S)})),o.jsx(h,{[m]:"",ref:j,children:b})});g.displayName=f;function x(p){const y=s(e+"CollectionConsumer",p);return q.useCallback(()=>{const b=y.collectionRef.current;if(!b)return[];const w=Array.from(b.querySelectorAll(`[${m}]`));return Array.from(y.itemMap.values()).sort((k,C)=>w.indexOf(k.ref.current)-w.indexOf(C.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:l,Slot:d,ItemSlot:g},x,r]}var xh=i.createContext(void 0);function Or(e){const t=i.useContext(xh);return e||t||"ltr"}const vh=["top","right","bottom","left"],Nt=Math.min,Be=Math.max,gr=Math.round,ar=Math.floor,ct=e=>({x:e,y:e}),yh={left:"right",right:"left",bottom:"top",top:"bottom"};function Do(e,t,n){return Be(e,Nt(t,n))}function ht(e,t){return typeof e=="function"?e(t):e}function gt(e){return e.split("-")[0]}function fn(e){return e.split("-")[1]}function sa(e){return e==="x"?"y":"x"}function ia(e){return e==="y"?"height":"width"}function it(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ca(e){return sa(it(e))}function wh(e,t,n){n===void 0&&(n=!1);const r=fn(e),a=ca(e),s=ia(a);let l=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(l=xr(l)),[l,xr(l)]}function bh(e){const t=xr(e);return[To(e),t,To(t)]}function To(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const os=["left","right"],as=["right","left"],Sh=["top","bottom"],Nh=["bottom","top"];function Ch(e,t,n){switch(e){case"top":case"bottom":return n?t?as:os:t?os:as;case"left":case"right":return t?Sh:Nh;default:return[]}}function jh(e,t,n,r){const a=fn(e);let s=Ch(gt(e),n==="start",r);return a&&(s=s.map(l=>l+"-"+a),t&&(s=s.concat(s.map(To)))),s}function xr(e){const t=gt(e);return yh[t]+e.slice(t.length)}function Rh(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ai(e){return typeof e!="number"?Rh(e):{top:e,right:e,bottom:e,left:e}}function vr(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function ss(e,t,n){let{reference:r,floating:a}=e;const s=it(t),l=ca(t),c=ia(l),u=gt(t),d=s==="y",f=r.x+r.width/2-a.width/2,m=r.y+r.height/2-a.height/2,h=r[c]/2-a[c]/2;let g;switch(u){case"top":g={x:f,y:r.y-a.height};break;case"bottom":g={x:f,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:m};break;case"left":g={x:r.x-a.width,y:m};break;default:g={x:r.x,y:r.y}}switch(fn(t)){case"start":g[l]-=h*(n&&d?-1:1);break;case"end":g[l]+=h*(n&&d?-1:1);break}return g}async function Eh(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:s,rects:l,elements:c,strategy:u}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:h=!1,padding:g=0}=ht(t,e),x=Ai(g),y=c[h?m==="floating"?"reference":"floating":m],v=vr(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:d,rootBoundary:f,strategy:u})),b=m==="floating"?{x:r,y:a,width:l.floating.width,height:l.floating.height}:l.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),S=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},j=vr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:w,strategy:u}):b);return{top:(v.top-j.top+x.top)/S.y,bottom:(j.bottom-v.bottom+x.bottom)/S.y,left:(v.left-j.left+x.left)/S.x,right:(j.right-v.right+x.right)/S.x}}const _h=50,kh=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:s=[],platform:l}=n,c=l.detectOverflow?l:{...l,detectOverflow:Eh},u=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:a}),{x:f,y:m}=ss(d,r,u),h=r,g=0;const x={};for(let p=0;p<s.length;p++){const y=s[p];if(!y)continue;const{name:v,fn:b}=y,{x:w,y:S,data:j,reset:k}=await b({x:f,y:m,initialPlacement:r,placement:h,strategy:a,middlewareData:x,rects:d,platform:c,elements:{reference:e,floating:t}});f=w??f,m=S??m,x[v]={...x[v],...j},k&&g<_h&&(g++,typeof k=="object"&&(k.placement&&(h=k.placement),k.rects&&(d=k.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:a}):k.rects),{x:f,y:m}=ss(d,h,u)),p=-1)}return{x:f,y:m,placement:h,strategy:a,middlewareData:x}},Ph=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:s,platform:l,elements:c,middlewareData:u}=t,{element:d,padding:f=0}=ht(e,t)||{};if(d==null)return{};const m=Ai(f),h={x:n,y:r},g=ca(a),x=ia(g),p=await l.getDimensions(d),y=g==="y",v=y?"top":"left",b=y?"bottom":"right",w=y?"clientHeight":"clientWidth",S=s.reference[x]+s.reference[g]-h[g]-s.floating[x],j=h[g]-s.reference[g],k=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d));let C=k?k[w]:0;(!C||!await(l.isElement==null?void 0:l.isElement(k)))&&(C=c.floating[w]||s.floating[x]);const _=S/2-j/2,M=C/2-p[x]/2-1,O=Nt(m[v],M),L=Nt(m[b],M),D=O,E=C-p[x]-L,W=C/2-p[x]/2+_,P=Do(D,W,E),A=!u.arrow&&fn(a)!=null&&W!==P&&s.reference[x]/2-(W<D?O:L)-p[x]/2<0,H=A?W<D?W-D:W-E:0;return{[g]:h[g]+H,data:{[g]:P,centerOffset:W-P-H,...A&&{alignmentOffset:H}},reset:A}}}),Mh=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:s,rects:l,initialPlacement:c,platform:u,elements:d}=t,{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:p=!0,...y}=ht(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=gt(a),b=it(c),w=gt(c)===c,S=await(u.isRTL==null?void 0:u.isRTL(d.floating)),j=h||(w||!p?[xr(c)]:bh(c)),k=x!=="none";!h&&k&&j.push(...jh(c,p,x,S));const C=[c,...j],_=await u.detectOverflow(t,y),M=[];let O=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&M.push(_[v]),m){const W=wh(a,l,S);M.push(_[W[0]],_[W[1]])}if(O=[...O,{placement:a,overflows:M}],!M.every(W=>W<=0)){var L,D;const W=(((L=s.flip)==null?void 0:L.index)||0)+1,P=C[W];if(P&&(!(m==="alignment"?b!==it(P):!1)||O.every(F=>it(F.placement)===b?F.overflows[0]>0:!0)))return{data:{index:W,overflows:O},reset:{placement:P}};let A=(D=O.filter(H=>H.overflows[0]<=0).sort((H,F)=>H.overflows[1]-F.overflows[1])[0])==null?void 0:D.placement;if(!A)switch(g){case"bestFit":{var E;const H=(E=O.filter(F=>{if(k){const R=it(F.placement);return R===b||R==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(R=>R>0).reduce((R,X)=>R+X,0)]).sort((F,R)=>F[1]-R[1])[0])==null?void 0:E[0];H&&(A=H);break}case"initialPlacement":A=c;break}if(a!==A)return{reset:{placement:A}}}return{}}}};function is(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function cs(e){return vh.some(t=>e[t]>=0)}const Ah=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:a="referenceHidden",...s}=ht(e,t);switch(a){case"referenceHidden":{const l=await r.detectOverflow(t,{...s,elementContext:"reference"}),c=is(l,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:cs(c)}}}case"escaped":{const l=await r.detectOverflow(t,{...s,altBoundary:!0}),c=is(l,n.floating);return{data:{escapedOffsets:c,escaped:cs(c)}}}default:return{}}}}},Di=new Set(["left","top"]);async function Dh(e,t){const{placement:n,platform:r,elements:a}=e,s=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=gt(n),c=fn(n),u=it(n)==="y",d=Di.has(l)?-1:1,f=s&&u?-1:1,m=ht(t,e);let{mainAxis:h,crossAxis:g,alignmentAxis:x}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof x=="number"&&(g=c==="end"?x*-1:x),u?{x:g*f,y:h*d}:{x:h*d,y:g*f}}const Th=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:s,placement:l,middlewareData:c}=t,u=await Dh(t,e);return l===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:a+u.x,y:s+u.y,data:{...u,placement:l}}}}},Ih=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a,platform:s}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:u={fn:v=>{let{x:b,y:w}=v;return{x:b,y:w}}},...d}=ht(e,t),f={x:n,y:r},m=await s.detectOverflow(t,d),h=it(gt(a)),g=sa(h);let x=f[g],p=f[h];if(l){const v=g==="y"?"top":"left",b=g==="y"?"bottom":"right",w=x+m[v],S=x-m[b];x=Do(w,x,S)}if(c){const v=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=p+m[v],S=p-m[b];p=Do(w,p,S)}const y=u.fn({...t,[g]:x,[h]:p});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[g]:l,[h]:c}}}}}},Oh=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:s,middlewareData:l}=t,{offset:c=0,mainAxis:u=!0,crossAxis:d=!0}=ht(e,t),f={x:n,y:r},m=it(a),h=sa(m);let g=f[h],x=f[m];const p=ht(c,t),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(u){const w=h==="y"?"height":"width",S=s.reference[h]-s.floating[w]+y.mainAxis,j=s.reference[h]+s.reference[w]-y.mainAxis;g<S?g=S:g>j&&(g=j)}if(d){var v,b;const w=h==="y"?"width":"height",S=Di.has(gt(a)),j=s.reference[m]-s.floating[w]+(S&&((v=l.offset)==null?void 0:v[m])||0)+(S?0:y.crossAxis),k=s.reference[m]+s.reference[w]+(S?0:((b=l.offset)==null?void 0:b[m])||0)-(S?y.crossAxis:0);x<j?x=j:x>k&&(x=k)}return{[h]:g,[m]:x}}}},$h=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:s,platform:l,elements:c}=t,{apply:u=()=>{},...d}=ht(e,t),f=await l.detectOverflow(t,d),m=gt(a),h=fn(a),g=it(a)==="y",{width:x,height:p}=s.floating;let y,v;m==="top"||m==="bottom"?(y=m,v=h===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(v=m,y=h==="end"?"top":"bottom");const b=p-f.top-f.bottom,w=x-f.left-f.right,S=Nt(p-f[y],b),j=Nt(x-f[v],w),k=!t.middlewareData.shift;let C=S,_=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(_=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=b),k&&!h){const O=Be(f.left,0),L=Be(f.right,0),D=Be(f.top,0),E=Be(f.bottom,0);g?_=x-2*(O!==0||L!==0?O+L:Be(f.left,f.right)):C=p-2*(D!==0||E!==0?D+E:Be(f.top,f.bottom))}await u({...t,availableWidth:_,availableHeight:C});const M=await l.getDimensions(c.floating);return x!==M.width||p!==M.height?{reset:{rects:!0}}:{}}}};function $r(){return typeof window<"u"}function mn(e){return Ti(e)?(e.nodeName||"").toLowerCase():"#document"}function He(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ut(e){var t;return(t=(Ti(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ti(e){return $r()?e instanceof Node||e instanceof He(e).Node:!1}function Qe(e){return $r()?e instanceof Element||e instanceof He(e).Element:!1}function vt(e){return $r()?e instanceof HTMLElement||e instanceof He(e).HTMLElement:!1}function ls(e){return!$r()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof He(e).ShadowRoot}function Bn(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Ze(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function Lh(e){return/^(table|td|th)$/.test(mn(e))}function Lr(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Fh=/transform|translate|scale|rotate|perspective|filter/,Bh=/paint|layout|strict|content/,Dt=e=>!!e&&e!=="none";let ho;function la(e){const t=Qe(e)?Ze(e):e;return Dt(t.transform)||Dt(t.translate)||Dt(t.scale)||Dt(t.rotate)||Dt(t.perspective)||!ua()&&(Dt(t.backdropFilter)||Dt(t.filter))||F
vendor: 6,991 bytes, line 47
47h.test(t.willChange||"")||Bh.test(t.contain||"")}function Hh(e){let t=Ct(e);for(;vt(t)&&!rn(t);){if(la(t))return t;if(Lr(t))return null;t=Ct(t)}return null}function ua(){return ho==null&&(ho=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ho}function rn(e){return/^(html|body|#document)$/.test(mn(e))}function Ze(e){return He(e).getComputedStyle(e)}function Fr(e){return Qe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ct(e){if(mn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ls(e)&&e.host||ut(e);return ls(t)?t.host:t}function Ii(e){const t=Ct(e);return rn(t)?e.ownerDocument?e.ownerDocument.body:e.body:vt(t)&&Bn(t)?t:Ii(t)}function _n(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=Ii(e),s=a===((r=e.ownerDocument)==null?void 0:r.body),l=He(a);if(s){const c=Io(l);return t.concat(l,l.visualViewport||[],Bn(a)?a:[],c&&n?_n(c):[])}else return t.concat(a,_n(a,[],n))}function Io(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Oi(e){const t=Ze(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=vt(e),s=a?e.offsetWidth:n,l=a?e.offsetHeight:r,c=gr(n)!==s||gr(r)!==l;return c&&(n=s,r=l),{width:n,height:r,$:c}}function da(e){return Qe(e)?e:e.contextElement}function tn(e){const t=da(e);if(!vt(t))return ct(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:s}=Oi(t);let l=(s?gr(n.width):n.width)/r,c=(s?gr(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const Wh=ct(0);function $i(e){const t=He(e);return!ua()||!t.visualViewport?Wh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Vh(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==He(e)?!1:t}function Ot(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),s=da(e);let l=ct(1);t&&(r?Qe(r)&&(l=tn(r)):l=tn(e));const c=Vh(s,n,r)?$i(s):ct(0);let u=(a.left+c.x)/l.x,d=(a.top+c.y)/l.y,f=a.width/l.x,m=a.height/l.y;if(s){const h=He(s),g=r&&Qe(r)?He(r):r;let x=h,p=Io(x);for(;p&&r&&g!==x;){const y=tn(p),v=p.getBoundingClientRect(),b=Ze(p),w=v.left+(p.clientLeft+parseFloat(b.paddingLeft))*y.x,S=v.top+(p.clientTop+parseFloat(b.paddingTop))*y.y;u*=y.x,d*=y.y,f*=y.x,m*=y.y,u+=w,d+=S,x=He(p),p=Io(x)}}return vr({width:f,height:m,x:u,y:d})}function Br(e,t){const n=Fr(e).scrollLeft;return t?t.left+n:Ot(ut(e)).left+n}function Li(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Br(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function Uh(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const s=a==="fixed",l=ut(r),c=t?Lr(t.floating):!1;if(r===l||c&&s)return n;let u={scrollLeft:0,scrollTop:0},d=ct(1);const f=ct(0),m=vt(r);if((m||!m&&!s)&&((mn(r)!=="body"||Bn(l))&&(u=Fr(r)),m)){const g=Ot(r);d=tn(r),f.x=g.x+r.clientLeft,f.y=g.y+r.clientTop}const h=l&&!m&&!s?Li(l,u):ct(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+f.x+h.x,y:n.y*d.y-u.scrollTop*d.y+f.y+h.y}}function zh(e){return Array.from(e.getClientRects())}function Kh(e){const t=ut(e),n=Fr(e),r=e.ownerDocument.body,a=Be(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Be(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Br(e);const c=-n.scrollTop;return Ze(r).direction==="rtl"&&(l+=Be(t.clientWidth,r.clientWidth)-a),{width:a,height:s,x:l,y:c}}const us=25;function qh(e,t){const n=He(e),r=ut(e),a=n.visualViewport;let s=r.clientWidth,l=r.clientHeight,c=0,u=0;if(a){s=a.width,l=a.height;const f=ua();(!f||f&&t==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const d=Br(r);if(d<=0){const f=r.ownerDocument,m=f.body,h=getComputedStyle(m),g=f.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,x=Math.abs(r.clientWidth-m.clientWidth-g);x<=us&&(s-=x)}else d<=us&&(s+=d);return{width:s,height:l,x:c,y:u}}function Gh(e,t){const n=Ot(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,s=vt(e)?tn(e):ct(1),l=e.clientWidth*s.x,c=e.clientHeight*s.y,u=a*s.x,d=r*s.y;return{width:l,height:c,x:u,y:d}}function ds(e,t,n){let r;if(t==="viewport")r=qh(e,n);else if(t==="document")r=Kh(ut(e));else if(Qe(t))r=Gh(t,n);else{const a=$i(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return vr(r)}function Fi(e,t){const n=Ct(e);return n===t||!Qe(n)||rn(n)?!1:Ze(n).position==="fixed"||Fi(n,t)}function Yh(e,t){const n=t.get(e);if(n)return n;let r=_n(e,[],!1).filter(c=>Qe(c)&&mn(c)!=="body"),a=null;const s=Ze(e).position==="fixed";let l=s?Ct(e):e;for(;Qe(l)&&!rn(l);){const c=Ze(l),u=la(l);!u&&c.position==="fixed"&&(a=null),(s?!u&&!a:!u&&c.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||Bn(l)&&!u&&Fi(e,l))?r=r.filter(f=>f!==l):a=c,l=Ct(l)}return t.set(e,r),r}function Xh(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?Lr(t)?[]:Yh(t,this._c):[].concat(n),r],c=ds(t,l[0],a);let u=c.top,d=c.right,f=c.bottom,m=c.left;for(let h=1;h<l.length;h++){const g=ds(t,l[h],a);u=Be(g.top,u),d=Nt(g.right,d),f=Nt(g.bottom,f),m=Be(g.left,m)}return{width:d-m,height:f-u,x:m,y:u}}function Qh(e){const{width:t,height:n}=Oi(e);return{width:t,height:n}}function Zh(e,t,n){const r=vt(t),a=ut(t),s=n==="fixed",l=Ot(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const u=ct(0);function d(){u.x=Br(a)}if(r||!r&&!s)if((mn(t)!=="body"||Bn(a))&&(c=Fr(t)),r){const g=Ot(t,!0,s,t);u.x=g.x+t.clientLeft,u.y=g.y+t.clientTop}else a&&d();s&&!r&&a&&d();const f=a&&!r&&!s?Li(a,c):ct(0),m=l.left+c.scrollLeft-u.x-f.x,h=l.top+c.scrollTop-u.y-f.y;return{x:m,y:h,width:l.width,height:l.height}}function go(e){return Ze(e).position==="static"}function fs(e,t){if(!vt(e)||Ze(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ut(e)===n&&(n=n.ownerDocument.body),n}function Bi(e,t){const n=He(e);if(Lr(e))return n;if(!vt(e)){let a=Ct(e);for(;a&&!rn(a);){if(Qe(a)&&!go(a))return a;a=Ct(a)}return n}let r=fs(e,t);for(;r&&Lh(r)&&go(r);)r=fs(r,t);return r&&rn(r)&&go(r)&&!la(r)?n:r||Hh(e)||n}const Jh=async function(e){const t=this.getOffsetParent||Bi,n=this.getDimensions,r=await n(e.floating);return{reference:Zh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function eg(e){return Ze(e).direction==="rtl"}const tg={convertOffsetParentRelativeRectToViewportRelativeRect:Uh,getDocumentElement:ut,getClippingRect:Xh,getOffsetParent:Bi,getElementRects:Jh,getClientRects:zh,getDimensions:Qh,getScale:tn,isElement:Qe,isRTL:eg};function Hi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ng(e,t){let n=null,r;const a=ut(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function l(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),s();const d=e.getBoundingClientRect(),{left:f,top:m,width:h,height:g}=d;if(c||t(),!h||!g)return;const x=ar(m),p=ar(a.clientWidth-(f+h)),y=ar(a.clientHeight-(m+g)),v=ar(f),w={rootMargin:-x+"px "+-p+"px "+-y+"px "+-v+"px",threshold:Be(0,Nt
vendor: 4,114 bytes, line 47
47(1,u))||1};let S=!0;function j(k){const C=k[0].intersectionRatio;if(C!==u){if(!S)return l();C?l(!1,C):r=setTimeout(()=>{l(!1,1e-7)},1e3)}C===1&&!Hi(d,e.getBoundingClientRect())&&l(),S=!1}try{n=new IntersectionObserver(j,{...w,root:a.ownerDocument})}catch{n=new IntersectionObserver(j,w)}n.observe(e)}return l(!0),s}function rg(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,d=da(e),f=a||s?[...d?_n(d):[],...t?_n(t):[]]:[];f.forEach(v=>{a&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const m=d&&c?ng(d,n):null;let h=-1,g=null;l&&(g=new ResizeObserver(v=>{let[b]=v;b&&b.target===d&&g&&t&&(g.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=g)==null||w.observe(t)})),n()}),d&&!u&&g.observe(d),t&&g.observe(t));let x,p=u?Ot(e):null;u&&y();function y(){const v=Ot(e);p&&!Hi(p,v)&&n(),p=v,x=requestAnimationFrame(y)}return n(),()=>{var v;f.forEach(b=>{a&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),m?.(),(v=g)==null||v.disconnect(),g=null,u&&cancelAnimationFrame(x)}}const og=Th,ag=Ih,sg=Mh,ig=$h,cg=Ah,ms=Ph,lg=Oh,ug=(e,t,n)=>{const r=new Map,a={platform:tg,...n},s={...a.platform,_c:r};return kh(e,t,{...a,platform:s})};var dg=typeof document<"u",fg=function(){},fr=dg?i.useLayoutEffect:fg;function yr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!yr(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const s=a[r];if(!(s==="_owner"&&e.$$typeof)&&!yr(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Wi(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ps(e,t){const n=Wi(e);return Math.round(t*n)/n}function xo(e){const t=i.useRef(e);return fr(()=>{t.current=e}),t}function mg(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:s,floating:l}={},transform:c=!0,whileElementsMounted:u,open:d}=e,[f,m]=i.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,g]=i.useState(r);yr(h,r)||g(r);const[x,p]=i.useState(null),[y,v]=i.useState(null),b=i.useCallback(F=>{F!==k.current&&(k.current=F,p(F))},[]),w=i.useCallback(F=>{F!==C.current&&(C.current=F,v(F))},[]),S=s||x,j=l||y,k=i.useRef(null),C=i.useRef(null),_=i.useRef(f),M=u!=null,O=xo(u),L=xo(a),D=xo(d),E=i.useCallback(()=>{if(!k.current||!C.current)return;const F={placement:t,strategy:n,middleware:h};L.current&&(F.platform=L.current),ug(k.current,C.current,F).then(R=>{const X={...R,isPositioned:D.current!==!1};W.current&&!yr(_.current,X)&&(_.current=X,_r.flushSync(()=>{m(X)}))})},[h,t,n,L,D]);fr(()=>{d===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,m(F=>({...F,isPositioned:!1})))},[d]);const W=i.useRef(!1);fr(()=>(W.current=!0,()=>{W.current=!1}),[]),fr(()=>{if(S&&(k.current=S),j&&(C.current=j),S&&j){if(O.current)return O.current(S,j,E);E()}},[S,j,E,O,M]);const P=i.useMemo(()=>({reference:k,floating:C,setReference:b,setFloating:w}),[b,w]),A=i.useMemo(()=>({reference:S,floating:j}),[S,j]),H=i.useMemo(()=>{const F={position:n,left:0,top:0};if(!A.floating)return F;const R=ps(A.floating,f.x),X=ps(A.floating,f.y);return c?{...F,transform:"translate("+R+"px, "+X+"px)",...Wi(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:R,top:X}},[n,c,A.floating,f.x,f.y]);return i.useMemo(()=>({...f,update:E,refs:P,elements:A,floatingStyles:H}),[f,E,P,A,H])}const pg=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?ms({element:r.current,padding:a}).fn(n):{}:r?ms({element:r,padding:a}).fn(n):{}}}},hg=(e,t)=>
vendor: 5,289 bytes, line 47
47{const n=og(e);return{name:n.name,fn:n.fn,options:[e,t]}},gg=(e,t)=>{const n=ag(e);return{name:n.name,fn:n.fn,options:[e,t]}},xg=(e,t)=>({fn:lg(e).fn,options:[e,t]}),vg=(e,t)=>{const n=sg(e);return{name:n.name,fn:n.fn,options:[e,t]}},yg=(e,t)=>{const n=ig(e);return{name:n.name,fn:n.fn,options:[e,t]}},wg=(e,t)=>{const n=cg(e);return{name:n.name,fn:n.fn,options:[e,t]}},bg=(e,t)=>{const n=pg(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Sg="Arrow",Vi=i.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...s}=e;return o.jsx(Z.svg,{...s,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});Vi.displayName=Sg;var Ng=Vi;function fa(e){const[t,n]=i.useState(void 0);return Pe(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const s=a[0];let l,c;if("borderBoxSize"in s){const u=s.borderBoxSize,d=Array.isArray(u)?u[0]:u;l=d.inlineSize,c=d.blockSize}else l=e.offsetWidth,c=e.offsetHeight;n({width:l,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var ma="Popper",[Ui,pn]=Ke(ma),[Cg,zi]=Ui(ma),Ki=e=>{const{__scopePopper:t,children:n}=e,[r,a]=i.useState(null);return o.jsx(Cg,{scope:t,anchor:r,onAnchorChange:a,children:n})};Ki.displayName=ma;var qi="PopperAnchor",Gi=i.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,s=zi(qi,n),l=i.useRef(null),c=oe(t,l),u=i.useRef(null);return i.useEffect(()=>{const d=u.current;u.current=r?.current||l.current,d!==u.current&&s.onAnchorChange(u.current)}),r?null:o.jsx(Z.div,{...a,ref:c})});Gi.displayName=qi;var pa="PopperContent",[jg,Rg]=Ui(pa),Yi=i.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:x,...p}=e,y=zi(pa,n),[v,b]=i.useState(null),w=oe(t,$=>b($)),[S,j]=i.useState(null),k=fa(S),C=k?.width??0,_=k?.height??0,M=r+(s!=="center"?"-"+s:""),O=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},L=Array.isArray(d)?d:[d],D=L.length>0,E={padding:O,boundary:L.filter(_g),altBoundary:D},{refs:W,floatingStyles:P,placement:A,isPositioned:H,middlewareData:F}=mg({strategy:"fixed",placement:M,whileElementsMounted:(...$)=>rg(...$,{animationFrame:g==="always"}),elements:{reference:y.anchor},middleware:[hg({mainAxis:a+_,alignmentAxis:l}),u&&gg({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?xg():void 0,...E}),u&&vg({...E}),yg({...E,apply:({elements:$,rects:Q,availableWidth:re,availableHeight:ne})=>{const{width:J,height:ue}=Q.reference,xe=$.floating.style;xe.setProperty("--radix-popper-available-width",`${re}px`),xe.setProperty("--radix-popper-available-height",`${ne}px`),xe.setProperty("--radix-popper-anchor-width",`${J}px`),xe.setProperty("--radix-popper-anchor-height",`${ue}px`)}}),S&&bg({element:S,padding:c}),kg({arrowWidth:C,arrowHeight:_}),h&&wg({strategy:"referenceHidden",...E})]}),[R,X]=Zi(A),ae=Xe(x);Pe(()=>{H&&ae?.()},[H,ae]);const N=F.arrow?.x,T=F.arrow?.y,U=F.arrow?.centerOffset!==0,[B,K]=i.useState();return Pe(()=>{v&&K(window.getComputedStyle(v).zIndex)},[v]),o.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...P,transform:H?P.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:B,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(jg,{scope:n,placedSide:R,onArrowChange:j,arrowX:N,arrowY:T,shouldHideArrow:U,children:o.jsx(Z.div,{"data-side":R,"data-align":X,...p,ref:w,style:{...p.style,animation:H?void 0:"none"}})})})});Yi.displayName=pa;var Xi="PopperArrow",Eg={top:"bottom",right:"left",bottom:"top",left:"right"},Qi=i.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,s=Rg(Xi,r),l=Eg[s.placedSide];return o.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:o.jsx(Ng,{...a,ref:n,style:{...a.style,display:"block"}})})});Qi.displayName=Xi;function _g(e){return e!==null}var kg=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:a}=t,l=a.arrow?.centerOffset!==0,c=l?0:e.arrowWidth,u=l?0:e.arrowHeight,[d,f]=Zi(n),m={start:"0%",center:"50%",end:"100%"}[f],h=(a.arrow?.x??0)+c/2,g=(a.arrow?.y??0)+u/2;let x="",p="";return d==="bottom"?(x=l?m:`${h}px`,p=`${-u}px`):d==="top"?(x=l?m:`${h}px`,p=`${r.floating.height+u}px`):d==="right"?(x=`${-u}px`,p=l?m:`${g}px`):d==="left"&&(x=`${r.floating.width+u}px`,p=l?m:`${g}px`),{data:{x,y:p}}}});function Zi(e){const[t,n="center"]=e.split("-");return[t,n]}var Hr=Ki,Wr=Gi,ha=Yi,ga=Qi,vo="rovingFocusGroup.onEntryFocus",Pg={bubbles:!1,cancelable:!0},Hn="RovingFocusGroup",[Oo,Ji,Mg]=Ir(Hn),[Ag,ec]=Ke(Hn,[Mg]),[Dg,Tg]=Ag(Hn),tc=i.forwardRef((e,t)=>
vendor: 4,221 bytes, line 47
47o.jsx(Oo.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Oo.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Ig,{...e,ref:t})})}));tc.displayName=Hn;var Ig=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...m}=e,h=i.useRef(null),g=oe(t,h),x=Or(s),[p,y]=lt({prop:l,defaultProp:c??null,onChange:u,caller:Hn}),[v,b]=i.useState(!1),w=Xe(d),S=Ji(n),j=i.useRef(!1),[k,C]=i.useState(0);return i.useEffect(()=>{const _=h.current;if(_)return _.addEventListener(vo,w),()=>_.removeEventListener(vo,w)},[w]),o.jsx(Dg,{scope:n,orientation:r,dir:x,loop:a,currentTabStopId:p,onItemFocus:i.useCallback(_=>y(_),[y]),onItemShiftTab:i.useCallback(()=>b(!0),[]),onFocusableItemAdd:i.useCallback(()=>C(_=>_+1),[]),onFocusableItemRemove:i.useCallback(()=>C(_=>_-1),[]),children:o.jsx(Z.div,{tabIndex:v||k===0?-1:0,"data-orientation":r,...m,ref:g,style:{outline:"none",...e.style},onMouseDown:G(e.onMouseDown,()=>{j.current=!0}),onFocus:G(e.onFocus,_=>{const M=!j.current;if(_.target===_.currentTarget&&M&&!v){const O=new CustomEvent(vo,Pg);if(_.currentTarget.dispatchEvent(O),!O.defaultPrevented){const L=S().filter(A=>A.focusable),D=L.find(A=>A.active),E=L.find(A=>A.id===p),P=[D,E,...L].filter(Boolean).map(A=>A.ref.current);oc(P,f)}}j.current=!1}),onBlur:G(e.onBlur,()=>b(!1))})})}),nc="RovingFocusGroupItem",rc=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:s,children:l,...c}=e,u=Re(),d=s||u,f=Tg(nc,n),m=f.currentTabStopId===d,h=Ji(n),{onFocusableItemAdd:g,onFocusableItemRemove:x,currentTabStopId:p}=f;return i.useEffect(()=>{if(r)return g(),()=>x()},[r,g,x]),o.jsx(Oo.ItemSlot,{scope:n,id:d,focusable:r,active:a,children:o.jsx(Z.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:t,onMouseDown:G(e.onMouseDown,y=>{r?f.onItemFocus(d):y.preventDefault()}),onFocus:G(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:G(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=Lg(y,f.orientation,f.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let w=h().filter(S=>S.focusable).map(S=>S.ref.current);if(v==="last")w.reverse();else if(v==="prev"||v==="next"){v==="prev"&&w.reverse();const S=w.indexOf(y.currentTarget);w=f.loop?Fg(w,S+1):w.slice(S+1)}setTimeout(()=>oc(w))}}),children:typeof l=="function"?l({isCurrentTabStop:m,hasTabStop:p!=null}):l})})});rc.displayName=nc;var Og={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $g(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Lg(e,t,n){const r=$g(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Og[r]}function oc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Fg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Bg=tc,Hg=rc;function Wg(e){const t=Vg(e),n=i.forwardRef((r,a)=>{const{children:s,...l}=r,c=i.Children.toArray(s),u=c.find(zg);if(u){const d=u.props.children,f=c.map(m=>m===u?i.Children.count(d)>1?i.Children.only(null):i.isValidElement(d)?d.props.children:null:m);return o.jsx(t,{...l,ref:a,children:i.isValidElement(d)?i.cloneElement(d,void 0,f):null})}return o.jsx(t,{...l,ref:a,children:s})});return n.displayName=`${e}.Slot`,n}function Vg(e){const t=i.forwardRef((n,r)=>{const{children:a,...s}=n;if(i.isValidElement(a)){const l=qg(a),c=Kg(s,a.props);return a.type!==i.Fragment&&(c.ref=r?We(r,l):l),i.cloneElement(a,c)}return i.Children.count(a)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ug=Symbol("radix.slottable");function zg(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ug}function Kg(e,t){const n={...t};for(const r in t){const a=e[r],s=t[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...c)=>{const u=s(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...s}
vendor: 14,400 bytes, line 47
47:r==="className"&&(n[r]=[a,s].filter(Boolean).join(" "))}return{...e,...n}}function qg(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $o=["Enter"," "],Gg=["ArrowDown","PageUp","Home"],ac=["ArrowUp","PageDown","End"],Yg=[...Gg,...ac],Xg={ltr:[...$o,"ArrowRight"],rtl:[...$o,"ArrowLeft"]},Qg={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Wn="Menu",[kn,Zg,Jg]=Ir(Wn),[Wt,sc]=Ke(Wn,[Jg,pn,ec]),Vn=pn(),ic=ec(),[cc,Rt]=Wt(Wn),[ex,Un]=Wt(Wn),lc=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:s,modal:l=!0}=e,c=Vn(t),[u,d]=i.useState(null),f=i.useRef(!1),m=Xe(s),h=Or(a);return i.useEffect(()=>{const g=()=>{f.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>f.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),o.jsx(Hr,{...c,children:o.jsx(cc,{scope:t,open:n,onOpenChange:m,content:u,onContentChange:d,children:o.jsx(ex,{scope:t,onClose:i.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:h,modal:l,children:r})})})};lc.displayName=Wn;var tx="MenuAnchor",xa=i.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=Vn(n);return o.jsx(Wr,{...a,...r,ref:t})});xa.displayName=tx;var va="MenuPortal",[nx,uc]=Wt(va,{forceMount:void 0}),dc=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,s=Rt(va,t);return o.jsx(nx,{scope:t,forceMount:n,children:o.jsx(Je,{present:n||s.open,children:o.jsx(In,{asChild:!0,container:a,children:r})})})};dc.displayName=va;var ze="MenuContent",[rx,ya]=Wt(ze),fc=i.forwardRef((e,t)=>{const n=uc(ze,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,s=Rt(ze,e.__scopeMenu),l=Un(ze,e.__scopeMenu);return o.jsx(kn.Provider,{scope:e.__scopeMenu,children:o.jsx(Je,{present:r||s.open,children:o.jsx(kn.Slot,{scope:e.__scopeMenu,children:l.modal?o.jsx(ox,{...a,ref:t}):o.jsx(ax,{...a,ref:t})})})})}),ox=i.forwardRef((e,t)=>{const n=Rt(ze,e.__scopeMenu),r=i.useRef(null),a=oe(t,r);return i.useEffect(()=>{const s=r.current;if(s)return Ar(s)},[]),o.jsx(wa,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:G(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ax=i.forwardRef((e,t)=>{const n=Rt(ze,e.__scopeMenu);return o.jsx(wa,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),sx=Wg("MenuContent.ScrollLock"),wa=i.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:h,onDismiss:g,disableOutsideScroll:x,...p}=e,y=Rt(ze,n),v=Un(ze,n),b=Vn(n),w=ic(n),S=Zg(n),[j,k]=i.useState(null),C=i.useRef(null),_=oe(t,C,y.onContentChange),M=i.useRef(0),O=i.useRef(""),L=i.useRef(0),D=i.useRef(null),E=i.useRef("right"),W=i.useRef(0),P=x?On:i.Fragment,A=x?{as:sx,allowPinchZoom:!0}:void 0,H=R=>{const X=O.current+R,ae=S().filter($=>!$.disabled),N=document.activeElement,T=ae.find($=>$.ref.current===N)?.textValue,U=ae.map($=>$.textValue),B=vx(U,X,T),K=ae.find($=>$.textValue===B)?.ref.current;(function $(Q){O.current=Q,window.clearTimeout(M.current),Q!==""&&(M.current=window.setTimeout(()=>$(""),1e3))})(X),K&&setTimeout(()=>K.focus())};i.useEffect(()=>()=>window.clearTimeout(M.current),[]),Pr();const F=i.useCallback(R=>E.current===D.current?.side&&wx(R,D.current?.area),[]);return o.jsx(rx,{scope:n,searchRef:O,onItemEnter:i.useCallback(R=>{F(R)&&R.preventDefault()},[F]),onItemLeave:i.useCallback(R=>{F(R)||(C.current?.focus(),k(null))},[F]),onTriggerLeave:i.useCallback(R=>{F(R)&&R.preventDefault()},[F]),pointerGraceTimerRef:L,onPointerGraceIntentChange:i.useCallback(R=>{D.current=R},[]),children:o.jsx(P,{...A,children:o.jsx(Tn,{asChild:!0,trapped:a,onMountAutoFocus:G(s,R=>{R.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:o.jsx(Dn,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:h,onDismiss:g,children:o.jsx(Bg,{asChild:!0,...w,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:j,onCurrentTabStopIdChange:k,onEntryFocus:G(u,R=>{v.isUsingKeyboardRef.current||R.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(ha,{role:"menu","aria-orientation":"vertical","data-state":kc(y.open),"data-radix-menu-content":"",dir:v.dir,...b,...p,ref:_,style:{outline:"none",...p.style},onKeyDown:G(p.onKeyDown,R=>{const ae=R.target.closest("[data-radix-menu-content]")===R.currentTarget,N=R.ctrlKey||R.altKey||R.metaKey,T=R.key.length===1;ae&&(R.key==="Tab"&&R.preventDefault(),!N&&T&&H(R.key));const U=C.current;if(R.target!==U||!Yg.includes(R.key))return;R.preventDefault();const K=S().filter($=>!$.disabled).map($=>$.ref.current);ac.includes(R.key)&&K.reverse(),gx(K)}),onBlur:G(e.onBlur,R=>{R.currentTarget.contains(R.target)||(window.clearTimeout(M.current),O.current="")}),onPointerMove:G(e.onPointerMove,Pn(R=>{const X=R.target,ae=W.current!==R.clientX;if(R.currentTarget.contains(X)&&ae){const N=R.clientX>W.current?"right":"left";E.current=N,W.current=R.clientX}}))})})})})})})});fc.displayName=ze;var ix="MenuGroup",ba=i.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return o.jsx(Z.div,{role:"group",...r,ref:t})});ba.displayName=ix;var cx="MenuLabel",mc=i.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return o.jsx(Z.div,{...r,ref:t})});mc.displayName=cx;var wr="MenuItem",hs="menu.itemSelect",Vr=i.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,s=i.useRef(null),l=Un(wr,e.__scopeMenu),c=ya(wr,e.__scopeMenu),u=oe(t,s),d=i.useRef(!1),f=()=>{const m=s.current;if(!n&&m){const h=new CustomEvent(hs,{bubbles:!0,cancelable:!0});m.addEventListener(hs,g=>r?.(g),{once:!0}),Hs(m,h),h.defaultPrevented?d.current=!1:l.onClose()}};return o.jsx(pc,{...a,ref:u,disabled:n,onClick:G(e.onClick,f),onPointerDown:m=>{e.onPointerDown?.(m),d.current=!0},onPointerUp:G(e.onPointerUp,m=>{d.current||m.currentTarget?.click()}),onKeyDown:G(e.onKeyDown,m=>{const h=c.searchRef.current!=="";n||h&&m.key===" "||$o.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});Vr.displayName=wr;var pc=i.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...s}=e,l=ya(wr,n),c=ic(n),u=i.useRef(null),d=oe(t,u),[f,m]=i.useState(!1),[h,g]=i.useState("");return i.useEffect(()=>{const x=u.current;x&&g((x.textContent??"").trim())},[s.children]),o.jsx(kn.ItemSlot,{scope:n,disabled:r,textValue:a??h,children:o.jsx(Hg,{asChild:!0,...c,focusable:!r,children:o.jsx(Z.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:G(e.onPointerMove,Pn(x=>{r?l.onItemLeave(x):(l.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:G(e.onPointerLeave,Pn(x=>l.onItemLeave(x))),onFocus:G(e.onFocus,()=>m(!0)),onBlur:G(e.onBlur,()=>m(!1))})})})}),lx="MenuCheckboxItem",hc=i.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return o.jsx(wc,{scope:e.__scopeMenu,checked:n,children:o.jsx(Vr,{role:"menuitemcheckbox","aria-checked":br(n)?"mixed":n,...a,ref:t,"data-state":Ca(n),onSelect:G(a.onSelect,()=>r?.(br(n)?!0:!n),{checkForDefaultPrevented:!1})})})});hc.displayName=lx;var gc="MenuRadioGroup",[ux,dx]=Wt(gc,{value:void 0,onValueChange:()=>{}}),xc=i.forwardRef((e,t)=>{const{value:n,onValueChange:r,...a}=e,s=Xe(r);return o.jsx(ux,{scope:e.__scopeMenu,value:n,onValueChange:s,children:o.jsx(ba,{...a,ref:t})})});xc.displayName=gc;var vc="MenuRadioItem",yc=i.forwardRef((e,t)=>{const{value:n,...r}=e,a=dx(vc,e.__scopeMenu),s=n===a.value;return o.jsx(wc,{scope:e.__scopeMenu,checked:s,children:o.jsx(Vr,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":Ca(s),onSelect:G(r.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});yc.displayName=vc;var Sa="MenuItemIndicator",[wc,fx]=Wt(Sa,{checked:!1}),bc=i.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,s=fx(Sa,n);return o.jsx(Je,{present:r||br(s.checked)||s.checked===!0,children:o.jsx(Z.span,{...a,ref:t,"data-state":Ca(s.checked)})})});bc.displayName=Sa;var mx="MenuSeparator",Sc=i.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return o.jsx(Z.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Sc.displayName=mx;var px="MenuArrow",Nc=i.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=Vn(n);return o.jsx(ga,{...a,...r,ref:t})});Nc.displayName=px;var Na="MenuSub",[hx,Cc]=Wt(Na),jc=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:a}=e,s=Rt(Na,t),l=Vn(t),[c,u]=i.useState(null),[d,f]=i.useState(null),m=Xe(a);return i.useEffect(()=>(s.open===!1&&m(!1),()=>m(!1)),[s.open,m]),o.jsx(Hr,{...l,children:o.jsx(cc,{scope:t,open:r,onOpenChange:m,content:d,onContentChange:f,children:o.jsx(hx,{scope:t,contentId:Re(),triggerId:Re(),trigger:c,onTriggerChange:u,children:n})})})};jc.displayName=Na;var Nn="MenuSubTrigger",Rc=i.forwardRef((e,t)=>{const n=Rt(Nn,e.__scopeMenu),r=Un(Nn,e.__scopeMenu),a=Cc(Nn,e.__scopeMenu),s=ya(Nn,e.__scopeMenu),l=i.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=s,d={__scopeMenu:e.__scopeMenu},f=i.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return i.useEffect(()=>f,[f]),i.useEffect(()=>{const m=c.current;return()=>{window.clearTimeout(m),u(null)}},[c,u]),o.jsx(xa,{asChild:!0,...d,children:o.jsx(pc,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":kc(n.open),...e,ref:We(t,a.onTriggerChange),onClick:m=>{e.onClick?.(m),!(e.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:G(e.onPointerMove,Pn(m=>{s.onItemEnter(m),!m.defaultPrevented&&!e.disabled&&!n.open&&!l.current&&(s.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:G(e.onPointerLeave,Pn(m=>{f();const h=n.content?.getBoundingClientRect();if(h){const g=n.content?.dataset.side,x=g==="right",p=x?-5:5,y=h[x?"left":"right"],v=h[x?"right":"left"];s.onPointerGraceIntentChange({area:[{x:m.clientX+p,y:m.clientY},{x:y,y:h.top},{x:v,y:h.top},{x:v,y:h.bottom},{x:y,y:h.bottom}],side:g}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(m),m.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:G(e.onKeyDown,m=>{const h=s.searchRef.current!=="";e.disabled||h&&m.key===" "||Xg[r.dir].includes(m.key)&&(n.onOpenChange(!0),n.content?.focus(),m.preventDefault())})})})});Rc.displayName=Nn;var Ec="MenuSubContent",_c=i.forwardRef((e,t)=>{const n=uc(ze,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,s=Rt(ze,e.__scopeMenu),l=Un(ze,e.__scopeMenu),c=Cc(Ec,e.__scopeMenu),u=i.useRef(null),d=oe(t,u);return o.jsx(kn.Provider,{scope:e.__scopeMenu,children:o.jsx(Je,{present:r||s.open,children:o.jsx(kn.Slot,{scope:e.__scopeMenu,children:o.jsx(wa,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:d,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{l.isUsingKeyboardRef.current&&u.current?.focus(),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:G(e.onFocusOutside,f=>{f.target!==c.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:G(e.onEscapeKeyDown,f=>{l.onClose(),f.preventDefault()}),onKeyDown:G(e.onKeyDown,f=>{const m=f.currentTarget.contains(f.target),h=Qg[l.dir].includes(f.key);m&&h&&(s.onOpenChange(!1),c.trigger?.focus(),f.preventDefault())})})})})})});_c.displayName=Ec;function kc(e){return e?"open":"closed"}function br(e){return e==="indeterminate"}function Ca(e){return br(e)?"indeterminate":e?"checked":"unchecked"}function gx(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function xx(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function vx(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let l=xx(e,Math.max(s,0));a.length===1&&(l=l.filter(d=>d!==n));const u=l.find(d=>d.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function yx(e,t){const{x:n,y:r}=e;let a=!1;for(let s=0,l=t.length-1;s<t.length;l=s++){const c=t[s],u=t[l],d=c.x,f=c.y,m=u.x,h=u.y;f>r!=h>r&&n<(m-d)*(r-f)/(h-f)+d&&(a=!a)}return a}function wx(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return yx(n,t)}function Pn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var bx=lc,Sx=xa,Nx=dc,Cx=fc,jx=ba,Rx=mc,Ex=Vr,_x=hc,kx=xc,Px=yc,Mx=bc,Ax=Sc,Dx=Nc,Tx=jc,Ix=Rc,Ox=_c,Ur="DropdownMenu",[$x]=Ke(Ur,[sc]),De=sc(),[Lx,Pc]=$x(Ur),Mc=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:s,onOpenChange:l,modal:c=!0}=e,u=De(t),d=i.useRef(null),[f,m]=lt({prop:a,defaultProp:s??!1,onChange:l,caller:Ur});return o.jsx(Lx,{scope:t,triggerId:Re(),triggerRef:d,contentId:Re(),open:f,onOpenChange:m,onOpenToggle:i.useCallback(()=>m(h=>!h),[m]),modal:c,children:o.jsx(bx,{...u,open:f,onOpenChange:m,dir:r,modal:c,children:n})})};Mc.displayName=Ur;var Ac="DropdownMenuTrigger",Dc=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=e,s=Pc(Ac,n),l=De(n);return o.jsx(Sx,{asChild:!0,...l,children:o.jsx(Z.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:We(t,s.triggerRef),onPointerDown:G(e.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:G(e.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});Dc.displayName=Ac;var Fx="DropdownMenuPortal",Tc=e=>{const{__scopeDropdownMenu:t,...n}=e,r=De(t);return o.jsx(Nx,{...r,...n})};Tc.displayName=Fx;var Ic="DropdownMenuContent",Oc=i.forwardRef((e,t)=>
47{const{__scopeDropdownMenu:n,...r}=e,a=Pc(Ic,n),s=De(n),l=i.useRef(!1);return o.jsx(Cx,{id:a.contentId,"aria-labelledby":a.triggerId,...s,...r,ref:t,onCloseAutoFocus:G(e.onCloseAutoFocus,c=>{l.current||a.triggerRef.current?.focus(),l.current=!1,c.preventDefault()}),onInteractOutside:G(e.onInteractOutside,c=>{const u=c.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,f=u.button===2||d;(!a.modal||f)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Oc.displayName=Ic;var Bx="DropdownMenuGroup",Hx=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=De(n);return o.jsx(jx,{...a,...r,ref:t})});Hx.displayName=Bx;var Wx="DropdownMenuLabel",$c=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=De(n);return o.jsx(Rx,{...a,...r,ref:t})});$c.displayName=Wx;var Vx="DropdownMenuItem",Lc=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=De(n);return o.jsx(Ex,{...a,...r,ref:t})});Lc.displayName=Vx;var Ux="DropdownMenuCheckboxItem",Fc=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=De(n);return o.jsx(_x,{...a,...r,ref:t})});Fc.displayName=Ux;var zx="DropdownMenuRadioGroup",Kx=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=De(n);return o.jsx(kx,{...a,...r,ref:t})});Kx.displayName=zx;var qx="DropdownMenuRadioItem",Bc=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=De(n);return o.jsx(Px,{...a,...r,ref:t})});Bc.displayName=qx;var Gx="DropdownMenuItemIndicator",Hc=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=De(n);return o.jsx(Mx,{...a,...r,ref:t})});Hc.displayName=Gx;var Yx="DropdownMenuSeparator",Wc=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=De(n);return o.jsx(Ax,{...a,...r,ref:t})});Wc.displayName=Yx;var Xx="DropdownMenuArrow",Qx=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=De(n);return o.jsx(Dx,{...a,...r,ref:t})});Qx.displayName=Xx;var Zx=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:a,defaultOpen:s}=e,l=De(t),[c,u]=lt({prop:r,defaultProp:s??!1,onChange:a,caller:"DropdownMenuSub"});return o.jsx(Tx,{...l,open:c,onOpenChange:u,children:n})},Jx="DropdownMenuSubTrigger",Vc=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=De(n);return o.jsx(Ix,{...a,...r,ref:t})});Vc.displayName=Jx;var ev="DropdownMenuSubContent",Uc=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=De(n);return o.jsx(Ox,{...a,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Uc.displayName=ev;var tv=Mc,nv=Dc,rv=Tc,zc=Oc,Kc=$c,qc=Lc,Gc=Fc,Yc=Bc,Xc=Hc,Qc=Wc,ov=Zx,Zc=Vc,Jc=Uc;const el=tv,tl=nv,gs=ov,Lo=i.forwardRef(({className:e,inset:t,children:n,...r},a)=>o.jsxs(Zc,{ref:a,className:Y("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[n,o.jsx(Rn,{className:"ml-auto"})]}));Lo.displayName=Zc.displayName;const Fo=i.forwardRef(({className:e,...t},n)=>o.jsx(Jc,{ref:n,className:Y("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
47de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-dropdown-menu-content-transform-origin)",e),...t}));Fo.displayName=Jc.displayName;const ja=i.forwardRef(({className:e,sideOffset:t=4,...n},r)=>o.jsx(rv,{children:o.jsx(zc,{ref:r,sideOffset:t,className:Y("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-dropdown-menu-content-transform-origin)",e),...n})}));ja.displayName=zc.displayName;const ke=i.forwardRef(({className:e,inset:t,...n},r)=>o.jsx(qc,{ref:r,className:Y("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));ke.displayName=qc.displayName;const av=i.forwardRef(({className:e,children:t,checked:n,...r},a)=>o.jsxs(Gc,{ref:a,className:Y("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(Xc,{children:o.jsx(ln,{className:"h-4 w-4"})})}),t]}));av.displayName=Gc.displayName;const sv=i.forwardRef(({className:e,children:t,...n},r)=>o.jsxs(Yc,{ref:r,className:Y("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(Xc,{children:o.jsx(df,{className:"h-2 w-2 fill-current"})})}),t]}));
vendor: 4,116 bytes, line 47
47sv.displayName=Yc.displayName;const iv=i.forwardRef(({className:e,inset:t,...n},r)=>o.jsx(Kc,{ref:r,className:Y("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));iv.displayName=Kc.displayName;const Sr=i.forwardRef(({className:e,...t},n)=>o.jsx(Qc,{ref:n,className:Y("-mx-1 my-1 h-px bg-muted",e),...t}));Sr.displayName=Qc.displayName;var zr="Collapsible",[cv]=Ke(zr),[lv,Ra]=cv(zr),nl=i.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:a,disabled:s,onOpenChange:l,...c}=e,[u,d]=lt({prop:r,defaultProp:a??!1,onChange:l,caller:zr});return o.jsx(lv,{scope:n,disabled:s,contentId:Re(),open:u,onOpenToggle:i.useCallback(()=>d(f=>!f),[d]),children:o.jsx(Z.div,{"data-state":_a(u),"data-disabled":s?"":void 0,...c,ref:t})})});nl.displayName=zr;var rl="CollapsibleTrigger",ol=i.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,a=Ra(rl,n);return o.jsx(Z.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":_a(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...r,ref:t,onClick:G(e.onClick,a.onOpenToggle)})});ol.displayName=rl;var Ea="CollapsibleContent",al=i.forwardRef((e,t)=>{const{forceMount:n,...r}=e,a=Ra(Ea,e.__scopeCollapsible);return o.jsx(Je,{present:n||a.open,children:({present:s})=>o.jsx(uv,{...r,ref:t,present:s})})});al.displayName=Ea;var uv=i.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:a,...s}=e,l=Ra(Ea,n),[c,u]=i.useState(r),d=i.useRef(null),f=oe(t,d),m=i.useRef(0),h=m.current,g=i.useRef(0),x=g.current,p=l.open||c,y=i.useRef(p),v=i.useRef(void 0);return i.useEffect(()=>{const b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),Pe(()=>{const b=d.current;if(b){v.current=v.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const w=b.getBoundingClientRect();m.current=w.height,g.current=w.width,y.current||(b.style.transitionDuration=v.current.transitionDuration,b.style.animationName=v.current.animationName),u(r)}},[l.open,r]),o.jsx(Z.div,{"data-state":_a(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!p,...s,ref:f,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:p&&a})});function _a(e){return e?"open":"closed"}var dv=nl;const fv=dv,mv=ol,pv=al;var hv=Symbol("radix.slottable");function gv(e){const t=({children:n})=>o.jsx(o.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=hv,t}var sl="AlertDialog",[xv]=Ke(sl,[ei]),yt=ei(),il=e=>{const{__scopeAlertDialog:t,...n}=e,r=yt(t);return o.jsx($n,{...r,...n,modal:!0})};il.displayName=sl;var vv="AlertDialogTrigger",yv=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=yt(n);return o.jsx(kp,{...a,...r,ref:t})});yv.displayName=vv;var wv="AlertDialogPortal",cl=e=>{const{__scopeAlertDialog:t,...n}=e,r=yt(t);return o.jsx(Ln,{...r,...n})};cl.displayName=wv;var bv="AlertDialogOverlay",ll=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=yt(n);return o.jsx(Bt,{...a,...r,ref:t})});ll.displayName=bv;var nn="AlertDialogContent",[Sv,Nv]=xv(nn),Cv=gv("AlertDialogContent"),ul=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...a}=e,s=yt(n),l=i.useRef(null),c=oe(t,l),u=i.useRef(null);return o.jsx(jp,{contentName:nn,titleName:dl,docsSlug:"alert-dialog",children:o.jsx(Sv,{scope:n,cancelRef:u,children:o.jsxs(Ht,{role:"alertdialog",...s,...a,ref:c,onOpenAutoFocus:G(a.onOpenAutoFocus,d=>{d.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[o.jsx(Cv,{children:r}),o.jsx(Rv,{contentRef:l})]})})})});ul.displayName=nn;var dl="AlertDialogTitle",fl=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=yt(n);return o.jsx(un,{...a,...r,ref:t})});fl.displayName=dl;var ml="AlertDialogDescription",pl=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=yt(n);return o.jsx(dn,{...a,...r,ref:t})});pl.displayName=ml;var jv="AlertDialogAction",hl=i.forwardRef((e,t)=>
47{const{__scopeAlertDialog:n,...r}=e,a=yt(n);return o.jsx(Tr,{...a,...r,ref:t})});hl.displayName=jv;var gl="AlertDialogCancel",xl=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=Nv(gl,n),s=yt(n),l=oe(t,a);return o.jsx(Tr,{...s,...r,ref:l})});xl.displayName=gl;var Rv=({contentRef:e})=>{const t=`\`${nn}\` requires a description for the component to be accessible for screen reader users.
48
49You can add a description to the \`${nn}\` by passing a \`${ml}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
50
51Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${nn}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
52
53For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return i.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Ev=il,_v=cl,vl=ll,yl=ul,wl=hl,bl=xl,Sl=fl,Nl=pl;const kv=Ev,Pv=_v,Cl=i.forwardRef(({className:e,...t},n)=>o.jsx(vl,{className:Y("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));Cl.displayName=vl.displayName;const jl=i.forwardRef(({className:e,...t},n)=>o.jsxs(Pv,{children:[o.jsx(Cl,{}),o.jsx(yl,{ref:n,className:Y("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));jl.displayName=yl.displayName;const Rl=({className:e,...t})=>o.jsx("div",{className:Y("flex flex-col space-y-2 text-center sm:text-left",e),...t});Rl.displayName="AlertDialogHeader";const El=({className:e,...t})=>o.jsx("div",{className:Y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});
53El.displayName="AlertDialogFooter";const _l=i.forwardRef(({className:e,...t},n)=>o.jsx(Sl,{ref:n,className:Y("text-lg font-semibold",e),...t}));_l.displayName=Sl.displayName;const kl=i.forwardRef(({className:e,...t},n)=>o.jsx(Nl,{ref:n,className:Y("text-sm text-muted-foreground",e),...t}));kl.displayName=Nl.displayName;const Pl=i.forwardRef(({className:e,...t},n)=>o.jsx(wl,{ref:n,className:Y(Ps(),e),...t}));Pl.displayName=wl.displayName;const Ml=i.forwardRef(({className:e,...t},n)=>o.jsx(bl,{ref:n,className:Y(Ps({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Ml.displayName=bl.displayName;const Al=["hour","day","week","month"];class pt extends Error{status;code;retryAfter;quota;constructor(t,n,r,a,s){super(n),this.name="MaasApiError",this.status=t,this.code=r,this.retryAfter=a,this.quota=s}}const hn="/api/v1",Dl=15,Mv=60;function Nr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Tl(e){return typeof e=="string"&&Al.includes(e)?e:null}function on(e){if(!(typeof e!="number"||!Number.isFinite(e)||e<=0))return Math.round(e)}function Av(e){if(!e)return;const t=on(Number(e));if(t!==void 0)return t;const n=Date.parse(e);if(!Number.isNaN(n))return on((n-Date.now())/1e3)}function Dv(e){if(e.code!=="quota_exceeded")return;const t=Tl(e.window);if(t)return{code:"quota_exceeded",window:t,used:typeof e.used=="number"?e.used:0,limit:typeof e.limit=="number"?e.limit:null,retry_after:on(e.retry_after)??Mv,message:typeof e.message=="string"?e.message:""}}function Tv(e){if(!Nr(e))return{message:null};const t=e.detail;if(Nr(t)){const n=Dv(t);return{message:typeof t.message=="string"?t.message:null,code:typeof t.code=="string"?t.code:typeof e.code=="string"?e.code:void 0,retryAfter:n?.retry_after??on(t.retry_after),quota:n}}return{message:typeof t=="string"?t:null,code:typeof e.code=="string"?e.code:void 0,retryAfter:on(e.retry_after)}}function Iv(e,t){const n=Av(e.headers.get("Retry-After"));if(n!==void 0)return n;if(t.retryAfter!==void 0)return t.retryAfter;if(t.code==="preempted"||e.status===503||e.status===429)return Dl}async function Kr(e){let t=null;try{t=await e.json()}catch{}const n=Tv(t);return new pt(e.status,n.message??`Request failed with status ${e.status}`,n.code,Iv(e,n),n.quota)}async function dt(e,t){const n=await fetch(`${hn}${e}`,{credentials:"include",headers:{"Content-Type":"application/json",...t?.headers},...t});if(!n.ok)throw await Kr(n);if(n.status!==204)return n.json()}async function Ov(e={}){const t=new URLSearchParams;e.q&&t.set("q",e.q),e.folderId&&t.set("folder_id",e.folderId),e.pinned!==void 0&&t.set("pinned",String(e.pinned)),e.archived!==void 0&&t.set("archived",String(e.archived)),e.limit!==void 0&&t.set("limit",String(e.limit)),e.cursor&&t.set("cursor",e.cursor);const n=t.toString();return dt(`/conversations${n?`?${n}`:""}`)}async function $v(e){return dt("/conversations",{method:"POST",body:JSON.stringify(e)})}async function Lv(e){return dt(`/conversations/${e}`)}async function Fv(e,t){return dt(`/conversations/${e}`,{method:"PATCH",body:JSON.stringify(t)})}async function Bv(e){return dt(`/conversations/${e}`,{method:"DELETE"})}async function Hv(e,t=!1){return dt(`/conversations/${e}/messages${t?"?full=true":""}`)}async function Wv(e){return dt(`/conversations/${e}/title`,{method:"POST"})}async function Vv(e,t=20){const n=new URLSearchParams({q:e,limit:String(t)});return dt(`/conversations/search?${n}`)}async function Uv(e,t="md"){const n=await fetch(`${hn}/conversations/${e}/export?fmt=${t}`,{credentials:"include"});if(!n.ok)throw await Kr(n);return n.blob()}async function zv(){return dt("/folders")}async function Kv(e){return dt("/folders",{method:"POST",body:JSON.stringify({name:e})})}async function xs(e){const{conversationId:t,content:n,parentId:r,regenerateFrom:a,signal:s,onFrame:l}=e;let c=`/conversations/${t}/messages`,u;a?(c=`/conversations/${t}/messages/${a}/regenerate`,u=JSON.stringify({})):u=JSON.stringify({content:n,parent_id:r});const d=await fetch(`${hn}${c}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:u,signal:s});if(!d.ok)throw await Kr(d);if(!d.body)throw new pt(0,"Response body is null");const f=d.body.getReader(),m=new TextDecoder;let h="",g=!1;const x=y=>{const v=y.trim();if(!v.startsWith("data:"))return!1;const b=v.slice(5).trim();if(b==="[DONE]")return g=!0,!0;let w;try{w=JSON.parse(b)}catch(S){return console.warn("maas-api: discarding malformed stream frame",b,S),!1}return w.type==="done"&&(g=!0),w.type==="error"?(g=!0,l({type:"error",code:w.code,message:w.message,retry_after:on(w.retry_after)??(w.code==="preempted"?Dl:void 0)}),!1):(l(w),!1)};let p=!1;try{for(;!p;){const{done:y,value:v}=await f.read();if(y)break;h+=m.decode(v,{stream:!0});const b=h.split(`
54`);h=b.pop()??"";for(const w of b)if(x(w)){p=!0;break}}p||(h+=m.decode(),h.trim()&&x(h))}finally{f.releaseLock()}if(!g)throw new pt(0,"stream_truncated","stream_truncated")}function qv(e){if(!Nr(e))return null;const t=Tl(e.window);if(!t)return null;const n=typeof e.used=="number"?e.used:0,r=typeof e.limit=="number"?e.limit:null;return{window:t,used:n,limit:r,remaining:typeof e.remaining=="number"?e.remaining:r===null?null:Math.max(0,r-n),exceeded:!!e.exceeded,resets_at:typeof e.resets_at=="string"?e.resets_at:null}}const yo={has_subscription:!1,plan:null,seats:0,overage_allowed:!1,period_end:null,windows:[]};async function Gv(){try{const e=await fetch(`${hn}/conversations/quota`,{credentials:"include",headers:{accept:"application/json"}});if(!e.ok)return yo;const t=await e.json();return Nr(t)?{has_subscription:!!t.has_subscription,plan:typeof t.plan=="string"?t.plan:null,seats:typeof t.seats=="number"?t.seats:0,overage_allowed:!!t.overage_allowed,peri
54od_end:typeof t.period_end=="string"?t.period_end:null,windows:Array.isArray(t.windows)?t.windows.map(qv).filter(n=>n!==null):[]}:yo}catch{return yo}}async function Yv(){const e={available:!1,backend_machine_id:null,model:null,models:[],max_model_len:null};try{const t=await fetch("/api/v1/maas/health",{credentials:"include",headers:{accept:"application/json"}});if(!t.ok)return e;const n=await t.json();return{available:!!n.available,backend_machine_id:n.backend_machine_id??null,model:n.model??null,models:Array.isArray(n.models)?n.models.filter(r=>typeof r=="string"):[],max_model_len:typeof n.max_model_len=="number"?n.max_model_len:null}}catch{return e}}const Xv=20*1024*1024,Il=["image/png","image/jpeg","image/webp","image/gif"],Ol=["application/pdf","text/plain","text/markdown","text/csv","application/json"],Qv=[...Il,...Ol].join(",");function vs(e,t){return`${hn}/conversations/${e}/attachments/${t}/content`}async function Zv(e,t,n){const r=new FormData;r.append("file",t,t.name);const a=await fetch(`${hn}/conversations/${e}/attachments`,{method:"POST",body:r,credentials:"include",signal:n});if(!a.ok)throw await Kr(a);return await a.json()}const Ce={conversations:["conversations"],conversationList:e=>["conversations","list",e],conversation:e=>["conversations","detail",e],messages:e=>["conversations","messages",e],folders:["folders"],search:e=>["search",e],quota:["maas","quota"]};function Jv(e){return Zd({queryKey:Ce.conversationList(e),queryFn:({pageParam:t})=>Ov({...e,folderId:e.folderId??void 0,cursor:t}),initialPageParam:void 0,getNextPageParam:t=>t.next_cursor||void 0})}function ey(e){return cn({queryKey:Ce.conversation(e),queryFn:()=>Lv(e),enabled:!!e})}function ty(e){return cn({queryKey:Ce.messages(e),queryFn:()=>Hv(e),enabled:!!e})}function $l(){const e=sn();return Mn({mutationFn:$v,onSuccess:t=>{e.setQueryData(Ce.conversation(t.id),t),e.invalidateQueries({queryKey:Ce.conversations})}})}function Ll(){const e=sn();return Mn({mutationFn:({id:t,...n})=>Fv(t,{...n,system_prompt:n.system_prompt??void 0,folder_id:n.folder_id??void 0}),onSuccess:t=>{e.setQueryData(Ce.conversation(t.id),t),e.invalidateQueries({queryKey:Ce.conversations})}})}function ny(){const e=sn();return Mn({mutationFn:Bv,onSuccess:(t,n)=>{e.removeQueries({queryKey:Ce.conversation(n)}),e.removeQueries({queryKey:Ce.messages(n)}),e.invalidateQueries({queryKey:Ce.conversations})}})}function ry(){return cn({queryKey:Ce.folders,queryFn:zv})}function oy(){const e=sn();return Mn({mutationFn:Kv,onSuccess:()=>{e.invalidateQueries({queryKey:Ce.folders})}})}function Fl(e){const t=ay(e,250),n=t.trim().length>=2;return cn({queryKey:Ce.search(t.trim()),queryFn:()=>Vv(t.trim()),enabled:n})}function ay(e,t){const[n,r]=i.useState(e);return i.useEffect(()=>{const a=setTimeout(()=>r(e),t);return()=>clearTimeout(a)},[e,t]),n}function sr(e,t,n){e.setQueryData(Ce.messages(t),r=>r?r.messages.some(s=>s.id===n.id)?{messages:r.messages.map(s=>s.id===n.id?n:s)}:{messages:[...r.messages,n]}:{messages:[n]})}function ys(e,t,n){e.setQueryData(Ce.messages(t),r=>!r||!r.messages.some(a=>a.id===n)?r:{messages:r.messages.filter(a=>a.id!==n)})}function sy(e){if(e instanceof pt){if(e.code)return e.code;if(e.status===402)return"insufficient_credit";if(e.status===429)return"quota_exceeded";if(e.status===503)return"preempted"}return"upstream"}function iy(){const e=sn(),[t,n]=i.useState(!1),[r,a]=i.useState(""),[s,l]=i.useState(""),[c,u]=i.useState(null),[d,f]=i.useState(null),[m,h]=i.useState(null),g=i.useRef(null),x=i.useRef(""),p=i.useRef(""),y=i.useRef(null),v=i.useRef(null),b=i.useRef(null),w=i.useCallback(()=>{y.current===null&&(y.current=requestAnimationFrame(()=>{a(x.current),l(p.current),y.current=null}))},[]),S=i.useCallback(P=>{x.current+=P,w()},[w]),j=i.useCallback(P=>{p.current+=P,w()},[w]),k=i.useCallback(()=>{y.current!==null&&(cancelAnimationFrame(y.current),y.current=null)},[]),C=i.useCallback(()=>{k(),x.current="",p.current="",b.current=null,a(""),l(""),u(null),f(null)},[k]),_=i.useCallback(()=>{C(),h(null)},[C]),M=i.useCallback(P=>{const A=v.current,H=b.current;if(!A||!H)return;const F=x.current,R=p.current;if(!F&&!R){ys(e,A,H);return}sr(e,A,{id:H,conversation_id:A,parent_id:null,role:"assistant",content:F,model:null,finish_reason:P,prompt_tokens:null,completion_tokens:null,reasoning:R||null,reasoning_tokens:null,cost_micro:null,latency_ms:null,error:null,created_at:new Date().toISOString()})},[e]),O=i.useCallback(()=>{k(),g.current?.abort(),g.current=null,n(!1)},[k]);i.useEffect(()=>()=>{y.current!==null&&cancelAnimationFrame(y.current),g.current?.abort()},[]);const L=i.useCallback(P=>{switch(P.type){case"user_message":{const A=P.message,H=A.conversation_id;v.current=H,sr(e,H,A);break}case"assistant_start":{u(P.message_id),b.current=P.message_id;const A=v.current;A&&sr(e,A,{id:P.message_id,conversation_id:A,parent_id:null,role:"assistant",content:"",model:null,finish_reason:null,prompt_tokens:null,completion_tokens:null,reasoning:null,reasoning_tokens:null,cost_micro:null,latency_ms:null,error:null,created_at:new Date().toISOString()});break}case"reasoning":{j(P.text);break}case"delta":{S(P.text);break}case"usage":{f({prompt_tokens:P.prompt_tokens,completion_tokens:P.completion_tokens,cost_micro:P.cost_micro,latency_ms:P.latency_ms});break}case"done":{const A=P.message,H=v.current;if(H){const F=b.current;
54F&&F!==A.id&&ys(e,H,F),sr(e,H,A),e.invalidateQueries({queryKey:Ce.conversations}),e.invalidateQueries({queryKey:Ce.quota})}n(!1),_();break}case"error":{M(P.code);const A="retry_after"in P&&typeof P.retry_after=="number"?P.retry_after:void 0;C(),h({code:P.code,detail:P.message,retryAfter:A}),n(!1);break}}},[S,j,C,M,e,_]),D=i.useCallback(P=>{const A=P instanceof DOMException&&P.name==="AbortError";M(A?"stopped":"error"),C(),A||h({code:sy(P),detail:P instanceof Error?P.message:String(P),retryAfter:P instanceof pt?P.retryAfter:void 0,quota:P instanceof pt?P.quota:void 0}),n(!1)},[C,M]),E=i.useCallback(async(P,A,H)=>{const F=new AbortController;g.current=F,v.current=P,_(),n(!0);try{await xs({conversationId:P,content:A,parentId:H,signal:F.signal,onFrame:L})}catch(R){D(R)}},[D,L,_]),W=i.useCallback(async(P,A)=>{const H=new AbortController;g.current=H,v.current=P,_(),n(!0);try{await xs({conversationId:P,content:"",regenerateFrom:A,signal:H.signal,onFrame:L})}catch(F){D(F)}},[D,L,_]);return{send:E,regenerate:W,stop:O,streaming:t,streamingText:r,streamingReasoning:s,streamingMessageId:c,usage:d,error:m}}function cy(){return cn({queryKey:Ce.quota,queryFn:Gv,staleTime:3e4,refetchInterval:6e4,retry:!1})}function ly(){return cn({queryKey:["maas","served-models"],queryFn:Yv,staleTime:3e4,refetchInterval:6e4,retry:!1})}function uy(e,t){return new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(new Date(e))}function dy(e,t,n){const r=new Date,a=new Date(e),s=new Date(r.getFullYear(),r.getMonth(),r.getDate()),l=new Date(s);l.setDate(l.getDate()-1);const c=new Date(s);c.setDate(c.getDate()-7);const u=new Date(s);return u.setDate(u.getDate()-30),a>=s?n("maas.sidebar.today"):a>=l?n("maas.sidebar.yesterday"):a>=c?n("maas.sidebar.previous7Days"):a>=u?n("maas.sidebar.previous30Days"):uy(e,t)}function fy(e,t,n){const r=new Map;for(const a of e){const s=dy(a.last_message_at||a.created_at,t,n),l=r.get(s)||[];l.push(a),r.set(s,l)}return Array.from(r.entries()).map(([a,s])=>({label:a,conversations:s}))}function Cr({section:e,eyebrow:t,message:n,children:r}){return o.jsxs("div",{className:"m-2 rounded-md border border-border bg-surface p-4 text-center",children:[o.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:`§ ${e} · ${t}`}),o.jsx("p",{className:"mt-1.5 text-sm text-foreground",children:n}),r]})}function Bo({section:e,message:t,onRetry:n}){const{t:r}=Ve();return o.jsx(Cr,{section:e,eyebrow:r("maas.sidebar.errorEyebrow"),message:t,children:o.jsx(le,{variant:"ghost",onClick:n,className:"mt-3 h-7 border border-border px-2.5 font-mono text-[10px] uppercase tracking-[0.14em]",children:r("maas.sidebar.retry")})})}function Ho({conversation:e,active:t,renaming:n,focusable:r,onSelect:a,onRename:s,onTogglePin:l,onMoveToFolder:c,onDuplicate:u,onExport:d,onArchive:f,onUnarchive:m,onDelete:h,folders:g,onCreateFolder:x,onOpenRename:p,onCloseRename:y}){const{t:v}=Ve(),[b,w]=i.useState(!1),[S,j]=i.useState(e.title),k=i.useRef(null),C=i.useRef(null),_=n||b,M=i.useRef(_);i.useEffect(()=>{const W=M.current;if(M.current=_,_){const P=requestAnimationFrame(()=>{k.current?.focus(),k.current?.select()});return()=>cancelAnimationFrame(P)}W&&C.current?.focus()},[_]);const O=()=>{j(e.title),w(!0),p(e.id)},L=()=>{w(!1),y()},D=()=>{const W=S.trim();W&&W!==e.title&&s(e.id,W),L()},E=()=>{j(e.title),L()};return _?o.jsx("div",{className:"px-2 py-1",children:o.jsx(En,{ref:k,value:S,onChange:W=>j(W.target.value),onBlur:D,onKeyDown:W=>{W.key==="Enter"&&D(),W.key==="Escape"&&E()},className:"h-7 text-sm"})}):o.jsxs("div",{className:Y("group relative flex items-center rounded-md transition-colors duration-150",t?"bg-[color-mix(in_oklab,var(--primary)_16%,transparent)] font-medium text-foreground":"text-muted-foreground hover:bg-secondary hover:text-foreground"),children:[o.jsx("button",{ref:C,type:"button",role:"option","aria-selected":t,"data-conversation-row":!0,"data-conversation-id":e.id,tabIndex:r?0:-1,onClick:()=>a(e.id),className:"min-w-0 flex-1 truncate ps-2 pe-8 py-1.5 text-start text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-hydro",children:o.jsx("span",{className:"truncate",children:e.title})}),o.jsxs(el,{children:[o.jsx(tl,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"icon","aria-label":v("maas.sidebar.conversationActions",{title:e.title}),className:"absolute end-1 h-6 w-6 opacity-0 transition-opacity duration-150 focus:opacity-100 group-hover:opacity-100",children:o.jsx(Ts,{className:"h-3.5 w-3.5"})})}),o.jsxs(ja,{align:"end",className:"w-48",children:[o.jsxs(ke,{onSelect:O,children:[o.jsx(pr,{className:"me-2 h-4 w-4"}),v("maas.sidebar.rename")]}),o.jsxs(ke,{onSelect:()=>l(e.id,!e.pinned),children:[e.pinned?o.jsx(Mf,{className:"me-2 h-4 w-4"}):o.jsx(Bs,{className:"me-2 h-4 w-4"}),e.pinned?v("maas.sidebar.unpin"):v("maas.sidebar.pin")]}),o.jsxs(gs,{children:[o.jsxs(Lo,{children:[o.jsx(Os,{className:"me-2 h-4 w-4"}),v("maas.sidebar.moveToFolder")]}),o.jsxs(Fo,{className:"w-48",children:[o.jsx(ke,{onSelect:()=>c(e.id,null),children:v("maas.sidebar.noFolder")}),g.map(W=>o.jsx(ke,{onSelect:()=>c(e.id,W.id),children:W.name},W.id)),o.jsx(Sr,{}),o.jsxs(ke,{onSelect:x,children:[o.jsx(yf,{className:"me-2 h-4 w-4"}),v("maas.sidebar.newFolder")]})]})]}),o.jsxs(ke,{onSelect:()=>u(e.id),children:[o.jsx(An,{className:"me-2 h-4 w-4"}),v("maas.sidebar.duplicate")]}),o.jsxs(gs,{children:[o.jsxs(Lo,{children:[o.jsx(mr,{className:"me-2 h-4 w-4"}),v("maas.sidebar.export")]}),o.jsxs(Fo,{className:"w-32",children:[o.jsx(ke,{onSelect:()=>d(e.id,"md"),children:".md"}),o.jsx(ke,{onSelect:()=>d(e.id,"json"),children:".json"})]})]}),e.archived?o.jsxs(ke,{onSelect:()=>m(e.id),children:[o.jsx(ef,{className:"me-2 h-4 w-4"}),v("maas.sidebar.unarchive")]}):o.jsxs(ke,{onSelect:()=>f(e.id),children:[o.jsx(Ds,{className:"me-2 h-4 w-4"}),v("maas.sidebar.archive")]}),o.jsx(Sr,{}),o.jsxs(ke,{onSelect:()=>h(e.id),className:"text-destructive focus:bg-destructive/10 focus:text-destructive",children:[o.jsx(Ms,{className:"me-2 h-4 w-4"}),v("maas.sidebar.delete")]})]})]})]})}function my({folder:e,conversations:t,activeId:n,renamingId:r,rovingId:a,onSelect:s,onRename:l,onTogglePin:c,onMoveToFolder:u,onDuplicate:d,onExport:f,onArchive:m,onUnarchive:h,onDelete:g,folders:x,onCreateFolder:p,onOpenRename:y,onCloseRename:v}){const{i18n:b}=Ve(),[w,S]=i.useState(!0);return o.jsxs(fv,{open:w,onOpenChange:S,children:[o.jsxs(mv,{className:"flex w-full items-center justify-between rounded-md px-2 py-1.5 text-sm transition-colors duration-150 hover:bg-secondary focus:outline-none focus-visible:ring-2 focus-visible:ring-hydro",children:[o.jsxs("span",{className:"flex items-center gap-2 truncate",children:[o.jsx(Os,{className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{className:"truncate",children:e.name})]}),o.jsx("span",{className:"font-mono text-[10px] tabular-nums text-muted-foreground",children:new Intl.NumberFormat(b.language).format(t.length)})]}),o.jsx(pv,{children:o.jsx("div",{role:"group","aria-label":e.name,className:"ms-4 space-y-0.5 border-s border-border ps-2",children:t.map(j=>o.jsx(Ho,{conversation:j,active:n===j.id,renaming:r===j.id,focusable:a===j.id,onSelect:s,onRename:l,onTogglePin:c,onMoveToFolder:u,onDuplicate:d,onExport:f,onArchive:m,onUnarchive:h,onDelete:g,folders:x,onCreateFolder:p,onOpenRename:y,onCloseRename:v},j.id))})})]})}function py({query:e,onSelect:t,onClearSearch:n}){const{t:r}=Ve(),{data:a,isPending:s,isError:l,refetch:c}=Fl(e),u=e.trim();if(u.length<2)return o.jsx(Cr,{section:"03",eyebrow:r("maas.sidebar.search"),message:r("maas.sidebar.keepTyping")});if(l)return o.jsx(Bo,{section:"03",message:r("maas.sidebar.searchError"),onRetry:()=>{c()}});if(s)return o.jsx("div",{className:"space-y-2 p-2",children:[1,2,3].map(f=>o.jsx(St,{className:"h-10 w-full"},f))});if(!a?.results.length)return o.jsx(Cr,{section:"03",eyebrow:r("maas.sidebar.search"),message:r("maas.sidebar.noResultsFor",{query:u}),children:o.jsx(le,{variant:"ghost",onClick:n,className:"mt-3 h-7 border border-border px-2.5 font-mono text-[10px] uppercase tracking-[0.14em]",children:r("maas.sidebar.clearSearch")})});const d=new Map;for(const f of a.results){const m=f.conversation_id,h=d.get(m)||[];h.push(f),d.set(m,h)}return o.jsx("div",{role:"listbox","aria-label":r("maas.sidebar.conversationList"),className:"space-y-2 p-2",children:Array.from(d.entries()).map(([f,m])=>o.jsxs("button",{type:"button",role:"option","aria-selected":!1,"data-conversation-row":!0,"data-conversation-id":f,onClick:()=>t(f),className:"w-full rounded-md px-2 py-1.5 text-start transition-colors duration-150 hover:bg-secondary focus:outline-none focus-visible:ring-2 focus-visible:ring-hydro",children:[o.jsx("div",{className:"truncate text-sm font-medium",children:m[0].title}),o.jsx("div",{className:"mt-0.5 line-clamp-2 text-xs text-muted-foreground",children:m[0].snippet.split(e).map((h,g)=>o.jsxs("span",{children:[g>0&&o.jsx("mark",{className:"rounded-[2px] bg-[color-mix(in_oklab,var(--primary)_22%,transparent)] text-foreground",children:e}),h]},g))})]},f))})}function hy({activeId:e,onSelect:t,onNew:n,collapsed:r,onToggleCollapse:a}){const{t:s,i18n:l}=Ve();Es();const[c,u]=i.useState(""),[d,f]=i.useState(null),[m,h]=i.useState(null),[g,x]=i.useState(!1),[p,y]=i.useState(""),[v,b]=i.useState(!1),[w,S]=i.useState(null),[j,k]=i.useState(null),C=i.useRef(null),{data:_,isPending:M,isError:O,refetch:L,fetchNextPage:D,hasNextPage:E,isFetchingNextPage:W}=Jv({archived:v}),{data:P,isError:A,refetch:H}=ry(),F=P||[],R=i.useMemo(()=>_?.pages.flatMap(V=>V.conversations)||[],[_]),X=i.useMemo(()=>R.filter(V=>V.pinned),[R]),ae=i.useMemo(()=>new Set(F.map(V=>V.id)),[F]),N=i.useMemo(()=>R.filter(V=>!V.pinned&&!(V.folder_id&&ae.has(V.folder_id))),[R,ae]),T=i.useMemo(()=>F.map(V=>({folder:V,conversations:R.filter(te=>te.folder_id===V.id)})).filter(V=>V.conversations.length>0),[F,R]),U=i.useMemo(()=>fy(N,l.language,s),[N,l.language,s]),B=i.useMemo(()=>{const V=te=>!!te&&R.some(pe=>pe.id===te);return V(w)?w:V(e)?e??null:X[0]?.id??N[0]?.id??null},[w,e,R,X,N]),K=Ll(),$=ny(),Q=oy(),re=$l();i.useEffect(()=>{const V=new IntersectionObserver(te=>{te[0].isIntersecting&&E&&!W&&D()},{threshold:.1});return j&&V.observe(j),()=>V.disconnect()},[j,E,W,D]);const ne=i.useCallback((V,te)=>{K.mutate({id:V,title:te}),h(null)},[K]),J=i.useCallback((V,te)=>{K.mutate({id:V,pinned:te})},[K]),ue=i.useCallback((V,te)=>{K.mutate({id:V,folder_id:te})},[K]),xe=i.useCallback(V=>{const te=R.find(pe=>pe.id===V);te&&re.mutate({title:`${te.title} (${s("maas.sidebar.copy")})`,model:te.model,system_prompt:te.system_prompt??void 0,params:te.params,folder_id:te.folder_id??void 0})},[R,s,re]),I=i.useCallback(async(V,te)=>{const pe=await Uv(V,te),we=URL.createObjectURL(pe),_e=document.createElement("a");_e.href=we,_e.download=`conversation.${te}`,_e.click(),URL.revokeObjectURL(we)},[]),me=i.useCallback(V=>{K.mutate({id:V,archived:!0})},[K]),ve=i.useCallback(V=>{K.mutate({id:V,archived:!1})},[K]),Ie=i.useCallback(V=>{$.mutate(V),f(null)},[$]),Vt=i.useCallback(V=>{Q.mutate(V),x(!1),y("")},[Q]),Pt=i.useCallback(V=>{if(V.key!=="ArrowDown"&&V.key!=="ArrowUp")return;const te=V.target;if(te&&(te.tagName==="INPUT"||te.tagName==="TEXTAREA"||te.isContentEditable))return;const pe=C.current;
54if(!pe)return;const we=Array.from(pe.querySelectorAll("[data-conversation-row]"));if(we.length===0)return;V.preventDefault();const _e=V.key==="ArrowDown"?1:-1,tt=we.findIndex(Mt=>Mt===document.activeElement),ft=((tt===-1?_e===1?-1:0:tt)+_e+we.length)%we.length,nt=we[ft];nt.focus();const $e=nt.getAttribute("data-conversation-id");$e&&S($e)},[]);return r?o.jsxs("div",{className:"flex h-full w-14 flex-col items-center gap-2 border-e border-border bg-background py-3",children:[o.jsx(le,{onClick:n,size:"icon","aria-label":s("maas.sidebar.newChat"),className:"h-9 w-9 bg-[var(--ink-900)] text-white ring-1 ring-border hover:bg-[var(--ink-950)]",children:o.jsx(Ro,{className:"h-4 w-4"})}),o.jsx(le,{variant:"ghost",size:"icon","aria-label":s("maas.sidebar.search"),className:"h-9 w-9 text-muted-foreground hover:bg-secondary hover:text-foreground",onClick:()=>{a(),setTimeout(()=>{document.querySelector("[data-sidebar-search]")?.focus()},100)},children:o.jsx(_o,{className:"h-4 w-4"})})]}):o.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col border-e border-border bg-background",children:[o.jsxs("div",{className:"flex items-center gap-2 p-3",children:[o.jsxs(le,{onClick:n,className:"min-w-0 flex-1 bg-[var(--ink-900)] text-white ring-1 ring-border hover:bg-[var(--ink-950)]",children:[o.jsx(Ro,{className:"me-2 h-4 w-4 shrink-0"}),o.jsx("span",{className:"truncate",children:s("maas.sidebar.newChat")}),o.jsx(La,{className:"ms-auto h-4 w-4 shrink-0 rtl:rotate-180","aria-hidden":!0})]}),o.jsx(le,{variant:"ghost",size:"icon",onClick:a,"aria-label":s("maas.sidebar.collapse"),className:"h-9 w-9 shrink-0 text-muted-foreground hover:bg-secondary hover:text-foreground",children:o.jsx($s,{className:"h-4 w-4"})})]}),o.jsx("div",{className:"px-3 pb-2",children:o.jsxs("div",{className:"relative",children:[o.jsx(_o,{className:"absolute start-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx(En,{"data-sidebar-search":!0,value:c,onChange:V=>u(V.target.value),placeholder:s("maas.sidebar.searchPlaceholder"),"aria-label":s("maas.sidebar.searchPlaceholder"),className:"ps-8"})]})}),o.jsx("div",{role:"group","aria-label":s("maas.sidebar.viewLabel"),className:"flex flex-wrap items-center gap-1 px-3 pb-2",children:[!1,!0].map(V=>{const te=v===V;return o.jsxs("button",{type:"button",onClick:()=>b(V),"aria-pressed":te,className:Y("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 font-mono text-[10px] uppercase tracking-[0.14em] transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-hydro",te?"border-border bg-surface text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:[o.jsx("span",{"aria-hidden":!0,className:Y("h-1.5 w-1.5 rounded-full transition-colors duration-150",te?"bg-hydro":"bg-muted-foreground/60")}),s(V?"maas.sidebar.viewArchived":"maas.sidebar.viewActive")]},String(V))})}),o.jsx("div",{ref:C,onKeyDown:Pt,className:"flex-1 overflow-y-auto px-2 pb-4",children:c?o.jsx(py,{query:c,onSelect:t,onClearSearch:()=>u("")}):O&&R.length===0?o.jsx(Bo,{section:"01",message:s("maas.sidebar.loadError"),onRetry:()=>{L()}}):M?o.jsx("div",{className:"space-y-2 p-2",children:[1,2,3,4,5].map(V=>o.jsx(St,{className:"h-8 w-full"},V))}):R.length===0&&!A?o.jsx(Cr,{section:"01",eyebrow:s("maas.sidebar.emptyEyebrow"),message:s(v?"maas.sidebar.emptyArchived":"maas.sidebar.empty"),children:!v&&o.jsxs(le,{onClick:n,className:"mt-3 bg-[var(--ink-900)] text-white ring-1 ring-border hover:bg-[var(--ink-950)]",children:[s("maas.sidebar.newChat"),o.jsx(La,{className:"ms-2 h-4 w-4 rtl:rotate-180","aria-hidden":!0})]})}):o.jsxs("div",{role:"listbox","aria-label":s("maas.sidebar.conversationList"),className:"space-y-4",children:[O&&o.jsxs("div",{className:"mx-2 mb-2 flex items-center justify-between gap-2 rounded-md border border-border px-2 py-1.5",children:[o.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:s("maas.sidebar.refreshFailed")}),o.jsx("button",{type:"button",onClick:()=>{L()},className:"font-mono text-[10px] uppercase tracking-[0.14em] text-foreground underline underline-offset-2",children:s("maas.sidebar.retry")})]}),X.length>0&&o.jsxs("div",{children:[o.jsx("div",{className:"px-2 pb-1 font-mono text-[10px] uppercase tracking-widest text-muted-foreground",children:s("maas.sidebar.pinned")}),o.jsx("div",{role:"group","aria-label":s("maas.sidebar.pinned"),className:"space-y-0.5",children:X.map(V=>o.jsx(Ho,{conversation:V,active:e===V.id,renaming:m===V.id,focusable:B===V.id,onSelect:t,onRename:ne,onTogglePin:J,onMoveToFolder:ue,onDuplicate:xe,onExport:I,onArchive:me,onUnarchive:ve,onDelete:te=>f(R.find(pe=>pe.id===te)||null),folders:F,onCreateFolder:()=>x(!0),onOpenRename:h,onCloseRename:()=>h(null)},V.id))})]}),A?o.jsx(Bo,{section:"02",message:s("maas.sidebar.foldersError"),onRetry:()=>{H()}}):T.length>0?o.jsxs("div",{children:[o.jsx("div",{className:"px-2 pb-1 font-mono text-[10px] uppercase tracking-widest text-muted-foreground",children:s("maas.sidebar.folders")}),o.jsx("div",{className:"space-y-0.5",children:T.map(({folder:V,conversations:te})=>
54o.jsx(my,{folder:V,conversations:te,activeId:e,renamingId:m,rovingId:B,onSelect:t,onRename:ne,onTogglePin:J,onMoveToFolder:ue,onDuplicate:xe,onExport:I,onArchive:me,onUnarchive:ve,onDelete:pe=>f(R.find(we=>we.id===pe)||null),folders:F,onCreateFolder:()=>x(!0),onOpenRename:h,onCloseRename:()=>h(null)},V.id))})]}):null,U.map(V=>o.jsxs("div",{children:[o.jsx("div",{className:"px-2 pb-1 font-mono text-[10px] uppercase tracking-widest text-muted-foreground",children:V.label}),o.jsx("div",{role:"group","aria-label":V.label,className:"space-y-0.5",children:V.conversations.map(te=>o.jsx(Ho,{conversation:te,active:e===te.id,renaming:m===te.id,focusable:B===te.id,onSelect:t,onRename:ne,onTogglePin:J,onMoveToFolder:ue,onDuplicate:xe,onExport:I,onArchive:me,onUnarchive:ve,onDelete:pe=>f(R.find(we=>we.id===pe)||null),folders:F,onCreateFolder:()=>x(!0),onOpenRename:h,onCloseRename:()=>h(null)},te.id))})]},V.label)),g&&o.jsx("div",{className:"px-2 py-1",children:o.jsx(En,{autoFocus:!0,value:p,onChange:V=>y(V.target.value),onBlur:()=>{p.trim()?Vt(p.trim()):x(!1)},onKeyDown:V=>{V.key==="Enter"&&p.trim()&&Vt(p.trim()),V.key==="Escape"&&x(!1)},placeholder:s("maas.sidebar.folderName"),className:"h-7 text-sm"})}),o.jsx("div",{ref:k,className:"h-1"}),W&&o.jsx("div",{className:"space-y-2 p-2",children:[1,2].map(V=>o.jsx(St,{className:"h-8 w-full"},V))})]})}),o.jsx(kv,{open:!!d,onOpenChange:V=>!V&&f(null),children:o.jsxs(jl,{children:[o.jsxs(Rl,{children:[o.jsx(_l,{children:s("maas.sidebar.deleteTitle")}),o.jsx(kl,{children:s("maas.sidebar.deleteDescription")})]}),o.jsxs(El,{children:[o.jsx(Ml,{children:s("maas.sidebar.cancel")}),o.jsx(Pl,{onClick:()=>d&&Ie(d.id),className:"bg-destructive text-white hover:bg-destructive/90",children:s("maas.sidebar.delete")})]})]})})]})}const gy=i.memo(function({language:t,code:n}){const{t:r}=Ve(),[a,s]=i.useState(!1),l=i.useCallback(()=>{navigator.clipboard.writeText(n).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})},[n]);return o.jsxs("div",{className:"my-3 overflow-hidden rounded-md border border-border bg-surface-elevated",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-1.5",children:[o.jsx("span",{className:"font-mono text-[10px] uppercase tracking-widest text-muted-foreground",children:t||r("maas.markdown.plainText")}),o.jsx("button",{onClick:l,className:"flex items-center gap-1 rounded-md px-2 py-1 font-mono text-[10px] uppercase tracking-widest text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground","aria-label":r("maas.markdown.copyCode"),children:a?o.jsxs(o.Fragment,{children:[o.jsx(ln,{className:"h-3 w-3 text-hydro"}),r("maas.markdown.copied")]}):o.jsxs(o.Fragment,{children:[o.jsx(An,{className:"h-3 w-3"}),r("maas.markdown.copy")]})})]}),o.jsx("pre",{className:"overflow-x-auto p-4",children:o.jsx("code",{className:"font-mono text-[13px] leading-relaxed",children:n})})]})});function Ye(e){const t=[];let n=e,r=0;for(;n.length>0;){const a=n.match(/^`([^`]+)`/);if(a){t.push(o.jsx("code",{className:"rounded-md bg-secondary px-1.5 py-0.5 font-mono text-[13px]",children:a[1]},r++)),n=n.slice(a[0].length);continue}const s=n.match(/^\*\*([^*]+)\*\*/);if(s){t.push(o.jsx("strong",{className:"font-semibold",children:Ye(s[1])},r++)),n=n.slice(s[0].length);continue}const l=n.match(/^\*([^*]+)\*/);if(l){t.push(o.jsx("em",{children:Ye(l[1])},r++)),n=n.slice(l[0].length);continue}const c=n.match(/^~~([^~]+)~~/);if(c){t.push(o.jsx("del",{className:"text-muted-foreground",children:Ye(c[1])},r++)),n=n.slice(c[0].length);continue}const u=n.match(/^\[([^\]]+)\]\(([^)]+)\)/);if(u){t.push(o.jsx("a",{href:u[2],target:"_blank",rel:"noopener noreferrer",className:"text-hydro underline underline-offset-2 transition-colors hover:text-foreground",children:Ye(u[1])},r++)),n=n.slice(u[0].length);continue}const d=n.search(/[`*~[]/);if(d===-1){t.push(n);break}d>0?(t.push(n.slice(0,d)),n=n.slice(d)):(t.push(n[0]),n=n.slice(1))}return t}function xy(e){if(e.length<2)return null;const t=e[0],r=e[1].split("|").map(c=>c.trim()).filter(c=>c.length>0);if(r.length===0)return null;const a=r.map(c=>{const u=c.trim();return u.startsWith(":")&&u.endsWith(":")?"center":u.endsWith(":")?"right":u.startsWith(":")?"left":null}),s=t.split("|").map(c=>c.trim()).filter(c=>c.length>0).map((c,u)=>({content:c,align:a[u]||null}));if(s.length===0)return null;const l=[];for(let c=2;c<e.length;c++){const u=e[c].trim();if(!u||!u.includes("|"))break;const d=u.split("|").map(f=>f.trim()).filter(f=>f.length>0).map((f,m)=>({content:f,align:a[m]||null}));d.length>0&&l.push({cells:d})}return{headers:s,rows:l}}function vy(e){const t=n=>n==="center"?"text-center":n==="right"?"text-end":"text-start";return o.jsx("div",{className:"my-3 overflow-x-auto",children:o.jsxs("table",{className:"w-full border-collapse text-sm",children:[o.jsx("thead",{children:o.jsx("tr",{className:"border-b border-border",children:e.headers.map((n,r)=>o.jsx("th",{className:`px-3 py-2 font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground ${t(n.align)}`,children:Ye(n.content)},r))})}),o.jsx("tbody",{children:e.rows.map((n,r)=>o.jsx("tr",{className:"border-b border-border last:border-b-0",children:n.cells.map((a,s)=>
54o.jsx("td",{className:`px-3 py-2 text-muted-foreground ${t(a.align)}`,children:Ye(a.content)},s))},r))})]})})}function Wo(e){const t=e.split(`
55`),n=[];let r=0,a=!1,s="",l=[],c=[],u=[],d=[];const f=()=>{d.length>0&&(n.push(o.jsx("blockquote",{className:"my-3 border-s border-border ps-4 text-muted-foreground",children:Wo(d.join(`
56`))},r++)),d=[])},m=()=>{if(c.length>0){const x=xy(c);x?n.push(o.jsx("div",{children:vy(x)},r++)):c.forEach(p=>{n.push(o.jsx("p",{className:"my-2",children:Ye(p)},r++))}),c=[]}},h=()=>{for(;u.length>0;){const x=u.pop();n.push(x.type==="ul"?o.jsx("ul",{className:"my-2 list-disc ps-6",children:x.items},r++):o.jsx("ol",{className:"my-2 list-decimal ps-6",children:x.items},r++))}},g=()=>{a&&(n.push(o.jsx(gy,{language:s,code:l.join(`
57`)},r++)),a=!1,s="",l=[])};for(let x=0;x<t.length;x++){const p=t[x],y=p.match(/^```(\w*)/);if(y){a?g():(f(),m(),h(),a=!0,s=y[1]||"");continue}if(a){l.push(p);continue}if(p.trim().startsWith("|")&&p.trim().endsWith("|")){f(),h(),c.push(p);continue}c.length>0&&m();const v=p.match(/^>\s?(.*)/);if(v){h(),d.push(v[1]);continue}f();const b=p.match(/^(#{1,4})\s+(.*)/);if(b){h();const j=Math.min(b[1].length,4),k=Ye(b[2]),C=`h${j+1}`,_={1:{classes:"my-4 font-display text-2xl font-semibold",tracking:"-0.022em"},2:{classes:"my-3 font-display text-xl font-semibold",tracking:"-0.02em"},3:{classes:"my-3 font-display text-lg font-medium",tracking:"-0.016em"},4:{classes:"my-2 font-display text-base font-medium",tracking:"-0.01em"}}[j];n.push(o.jsx(C,{className:_.classes,style:{letterSpacing:_.tracking},children:k},r++));continue}if(/^\s*([-*_])\s*\1\s*\1\s*$/.test(p)){h(),n.push(o.jsx("hr",{className:"my-4 border-border"},r++));continue}const w=p.match(/^\s*[-*+]\s+(.*)/);if(w){f(),m(),(u.length===0||u[u.length-1].type!=="ul")&&(h(),u.push({type:"ul",items:[]})),u[u.length-1].items.push(o.jsx("li",{children:Ye(w[1])},r++));continue}const S=p.match(/^\s*\d+\.\s+(.*)/);if(S){f(),m(),(u.length===0||u[u.length-1].type!=="ol")&&(h(),u.push({type:"ol",items:[]})),u[u.length-1].items.push(o.jsx("li",{children:Ye(S[1])},r++));continue}h(),p.trim()!==""&&n.push(o.jsx("p",{className:"my-2",children:Ye(p)},r++))}return g(),f(),m(),h(),n}function yy(e){let t=0,n=!1,r=0;for(;;){const a=e.indexOf(`
58`,r),s=a===-1?e.length:a;if(e.startsWith("```",r))n=!n;else if(!n){let l=!0;for(let c=r;c<s;c++){const u=e[c];if(u!==" "&&u!=="	"&&u!=="\r"){l=!1;break}}l&&a!==-1&&(t=a+1)}if(a===-1)break;r=a+1}return t}const Vo=i.memo(function({text:t}){const n=yy(t),r=t.slice(0,n),a=t.slice(n),s=i.useRef({text:"",nodes:[]}),l=i.useMemo(()=>{const u=s.current;if(u.text===r)return u.nodes;const d=u.text.length>0&&r.startsWith(u.text),f=d?r.slice(u.text.length):r,m=o.jsx(q.Fragment,{children:Wo(f)},`chunk-${r.length}`),h=d?[...u.nodes,m]:[m];return s.current={text:r,nodes:h},h},[r]),c=i.useMemo(()=>Wo(a),[a]);return o.jsxs("div",{className:"text-sm leading-relaxed",children:[l,o.jsx(q.Fragment,{children:c},"trailing")]})}),Bl="[&>*>*:last-child]:after:ms-1 [&>*>*:last-child]:after:inline-block [&>*>*:last-child]:after:h-[1em] [&>*>*:last-child]:after:w-[0.45em] [&>*>*:last-child]:after:translate-y-[0.12em] [&>*>*:last-child]:after:bg-hydro [&>*>*:last-child]:after:align-text-bottom [&>*>*:last-child]:after:content-[''] motion-safe:[&>*>*:last-child]:after:animate-pulse",Hl="bg-surface-elevated",wy="opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto focus-within:opacity-100 focus-within:pointer-events-auto motion-safe:transition-opacity motion-safe:duration-150",wn="h-7 w-7 rounded-md text-muted-foreground hover:bg-transparent hover:text-foreground motion-safe:transition-colors motion-safe:duration-150",jr="font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",Uo="[&>div]:leading-[1.75]",wo="w-full max-w-md rounded-lg "+Hl+" p-6",by=[{key:"maas.chat.suggestion1",tag:"maas.chat.suggestionTag1"},{key:"maas.chat.suggestion2",tag:"maas.chat.suggestionTag2"},{key:"maas.chat.suggestion3",tag:"maas.chat.suggestionTag3"},{key:"maas.chat.suggestion4",tag:"maas.chat.suggestionTag4"}];function Sy(e,t){if(e==null)return null;const n=e/1e6;return new Intl.NumberFormat(t,{style:"currency",currency:As,minimumFractionDigits:4,maximumFractionDigits:4}).format(n)}function ws(e,t){return e==null?null:new Intl.NumberFormat(t).format(e)}function Ny(e,t){if(e==null)return null;try{return new Intl.NumberFormat(t,{style:"unit",unit:"millisecond",unitDisplay:"short",maximumFractionDigits:0}).format(e)}catch{return new Intl.NumberFormat(t).format(e)}}function Cy(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function jy(){return o.jsxs("span",{className:"inline-flex items-baseline gap-[3px]",children:[o.jsx("span",{className:"text-foreground",style:{fontFamily:"var(--font-brand)",fontWeight:600,fontSize:20,letterSpacing:"-0.01em",lineHeight:1},children:"ExducerAI"}
58),o.jsx("span",{"aria-hidden":!0,className:"inline-block rounded-full",style:{width:5,height:5,background:"#C8372D"}})]})}function Wl({text:e,tokens:t,live:n=!1,answerStarted:r=!1}){const{t:a,i18n:s}=Ve(),l=i.useId(),c=i.useRef(null),u=i.useRef(!1),d=n&&!r,[f,m]=i.useState(d);i.useEffect(()=>{u.current||m(d)},[d]),i.useEffect(()=>{if(!d||!f)return;const p=c.current;p&&(p.scrollTop=p.scrollHeight)},[e,d,f]);const h=i.useMemo(()=>new Intl.NumberFormat(s.language),[s.language]),g=d?a("maas.chat.thinking"):typeof t=="number"?a("maas.chat.reasoningWithTokens",{tokens:h.format(t),unit:a("maas.chat.tokens",{count:t})}):a("maas.chat.reasoning"),x=f?ta:s.dir()==="rtl"?Eo:Rn;return o.jsxs("div",{className:"min-w-0",children:[o.jsxs("button",{type:"button","aria-expanded":f,"aria-controls":l,onClick:()=>{u.current=!0,m(p=>!p)},className:`flex max-w-full items-center gap-1.5 rounded-md text-start hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring motion-safe:transition-colors motion-safe:duration-150 ${jr}`,children:[o.jsx(x,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),o.jsx("span",{className:"min-w-0",children:g}),d&&o.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 shrink-0 rounded-full bg-hydro motion-safe:animate-pulse"})]}),o.jsx("div",{ref:c,id:l,hidden:!f,"aria-live":"off",className:`mt-2 min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere] border-s border-border ps-4 text-xs leading-relaxed text-muted-foreground ${d?"max-h-48 overflow-y-auto":""}`,children:e})]})}function Ry({message:e,isStreaming:t,streamingText:n,streamingReasoning:r,onRegenerate:a,onEditBranch:s,onSelectSibling:l,onBranchFrom:c,onDeleteMessage:u}){const{t:d,i18n:f}=Ve(),[m,h]=i.useState(!1),g=e.role==="user",x=e.attachments??[],p=e.role==="assistant",y=i.useCallback(async()=>{try{await navigator.clipboard.writeText(e.content),h(!0),setTimeout(()=>h(!1),2e3)}catch{}},[e.content]),v=i.useMemo(()=>new Intl.NumberFormat(f.language),[f.language]),b=Sy(e.cost_micro,f.language),w=ws(e.prompt_tokens,f.language),S=ws(e.completion_tokens,f.language),j=Ny(e.latency_ms,f.language),k=e.sibling_count??0,C=e.sibling_index??0,_=k>1&&C>=1,M=f.dir()==="rtl",O=M?Rn:Eo,L=M?Eo:Rn,E=(t?r:void 0)||e.reasoning||"",W=p&&E.trim().length>0;return o.jsxs("div",{className:"group flex min-w-0 flex-col gap-2",children:[W&&o.jsx(Wl,{text:E,tokens:e.reasoning_tokens,live:!!t,answerStarted:!!(t&&n)}),o.jsx("div",{role:"article","aria-label":d(g?"maas.chat.youSaid":"maas.chat.assistantSaid"),className:`min-w-0 break-words [overflow-wrap:anywhere] text-foreground ${g?`max-w-[75%] self-end rounded-lg ${Hl} px-4 py-3`:"w-full max-w-full"}`,children:g?o.jsxs("div",{className:"flex flex-col gap-2",children:[x.length>0&&o.jsx("ul",{className:"flex flex-wrap justify-end gap-2",children:x.map(P=>P.kind==="image"?o.jsx("li",{children:o.jsx("a",{href:vs(e.conversation_id,P.id),target:"_blank",rel:"noreferrer",className:"block rounded-lg focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:o.jsx("img",{src:vs(e.conversation_id,P.id),alt:P.filename,loading:"lazy",className:"max-h-48 max-w-full rounded-lg border border-border object-contain"})})},P.id):o.jsxs("li",{className:"flex items-center gap-2 rounded-lg border border-border px-3 py-2",children:[o.jsx(Is,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate text-xs",children:P.filename})]},P.id))}),e.content&&o.jsx("div",{className:"whitespace-pre-wrap text-sm leading-relaxed",children:e.content})]}):o.jsx("div",{className:"text-sm leading-relaxed",children:t&&n?o.jsx("div",{className:`${Bl} ${Uo}`,children:o.jsx(Vo,{text:n})}):o.jsx("div",{className:Uo,children:o.jsx(Vo,{text:e.content})})})}),o.jsxs("div",{className:`flex min-h-7 flex-wrap items-center gap-x-4 gap-y-2 tabular-nums ${jr} ${g?"justify-end":"justify-start"}`,children:[p&&!t&&o.jsxs(o.Fragment,{children:[e.model&&o.jsxs("span",{children:[o.jsxs("span",{className:"sr-only",children:[d("maas.chat.modelLabel"),": "]}),e.model]}),w&&S&&o.jsxs("span",{children:[o.jsxs("span",{className:"sr-only",children:[d("maas.chat.tokensLabel"),": "]}),d("maas.chat.tokenUsage",{prompt:w,completion:S,unit:d("maas.chat.tokens",{count:e.completion_tokens??0})})]}),j&&o.jsxs("span",{children:[o.jsxs("span",{className:"sr-only",children:[d("maas.chat.latencyLabel"),": "]}),j]}),b&&o.jsxs("span",{children:[o.jsxs("span",{className:"sr-only",children:[d("maas.chat.costLabel"),": "]}),b]})]}),_&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:()=>l?.(e.id,C-1),disabled:!l||C<=1,"aria-label":d("maas.chat.previousSibling"),className:"rounded-md p-0.5 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-40 motion-safe:transition-colors motion-safe:duration-150",children:o.jsx(O,{className:"h-3 w-3","aria-hidden":!0})}),o.jsxs("span",{children:[o.jsx("span",{className:"sr-only",children:d("maas.chat.siblingOf",{index:v.format(C),count:v.format(k)})}
58),o.jsx("span",{"aria-hidden":!0,children:d("maas.chat.siblingPosition",{index:v.format(C),count:v.format(k)})})]}),o.jsx("button",{type:"button",onClick:()=>l?.(e.id,C+1),disabled:!l||C>=k,"aria-label":d("maas.chat.nextSibling"),className:"rounded-md p-0.5 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-40 motion-safe:transition-colors motion-safe:duration-150",children:o.jsx(L,{className:"h-3 w-3","aria-hidden":!0})})]}),o.jsxs("div",{className:`flex items-center gap-1 ${g?"ms-auto":""} ${wy}`,children:[o.jsx(le,{variant:"ghost",size:"icon",className:wn,onClick:y,"aria-label":d("maas.chat.copy"),children:m?o.jsx(ln,{className:"h-3 w-3 text-hydro"}):o.jsx(An,{className:"h-3 w-3"})}),g&&s&&o.jsx(le,{variant:"ghost",size:"icon",className:wn,onClick:()=>s(e.id),"aria-label":d("maas.chat.editBranch"),children:o.jsx(pr,{className:"h-3 w-3"})}),p&&a&&o.jsx(le,{variant:"ghost",size:"icon",className:wn,onClick:()=>a(e.id),"aria-label":d("maas.chat.regenerate"),children:o.jsx(Tf,{className:"h-3 w-3"})}),c&&o.jsx(le,{variant:"ghost",size:"icon",className:wn,onClick:()=>c(e.id),"aria-label":d("maas.chat.branchFromHere"),children:o.jsx(Sf,{className:"h-3 w-3"})}),u&&o.jsx(le,{variant:"ghost",size:"icon",className:`${wn} hover:text-destructive`,onClick:()=>u(e.id),"aria-label":d("maas.chat.deleteMessage"),children:o.jsx(Ms,{className:"h-3 w-3"})})]})]})]})}function Ey({messages:e,streamingText:t,streamingReasoning:n,streamingMessageId:r,streaming:a,error:s,onRegenerate:l,onEditBranch:c,onRetry:u,onTopUp:d,onSuggestion:f,onSelectSibling:m,onBranchFrom:h,onDeleteMessage:g}){const{t:x,i18n:p}=Ve(),y=i.useRef(null),v=i.useRef(null),b=i.useRef(!0),[w,S]=i.useState(!0),[j,k]=i.useState(null),[C,_]=i.useState(null),M=i.useRef(!1),O=i.useRef(null),L=i.useRef(null),D=i.useMemo(()=>new Intl.NumberFormat(p.language),[p.language]),E=i.useCallback(R=>{if(v.current?.(),v.current=null,y.current=R,!R)return;const X=()=>{const{scrollTop:ae,scrollHeight:N,clientHeight:T}=R,B=N-ae-T<80;b.current=B,S(B)};R.addEventListener("scroll",X,{passive:!0}),v.current=()=>R.removeEventListener("scroll",X)},[]);i.useEffect(()=>()=>v.current?.(),[]);const W=e[0]?.conversation_id;i.useEffect(()=>{b.current=!0,S(!0);const R=y.current;R&&(R.scrollTop=R.scrollHeight)},[W]),i.useEffect(()=>{const R=y.current;!R||!b.current||(R.scrollTop=R.scrollHeight)},[e,t,n,a]),i.useEffect(()=>{a&&!M.current?(M.current=!0,_(x("maas.chat.generating"))):!a&&M.current&&(M.current=!1,_(x("maas.chat.responseComplete")))},[a,x]),i.useEffect(()=>{if(s?.code==="preempted"&&s.retryAfter){k(s.retryAfter);const R=setInterval(()=>{k(X=>X===null||X<=1?(clearInterval(R),0):X-1)},1e3);return()=>clearInterval(R)}k(null)},[s]),i.useEffect(()=>{if(!s)return;const R=L.current;R&&!R.disabled?R.focus():O.current?.focus()},[s]);const P=i.useCallback(()=>{const R=y.current;R&&(b.current=!0,S(!0),R.scrollTo({top:R.scrollHeight,behavior:Cy()?"auto":"smooth"}))},[]),A=e.length===0&&!a,H=j!==null&&j>0?Math.ceil(j/10)*10:null,F="mt-2 bg-[var(--ink-900)] text-white shadow-none hover:bg-[var(--ink-950)]";return o.jsxs("div",{className:"relative h-full",children:[o.jsx("div",{ref:E,tabIndex:0,role:"log","aria-live":"polite","aria-relevant":"additions text","aria-label":x("maas.chat.transcript"),className:"h-full overflow-y-auto overflow-x-hidden bg-surface px-4 py-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:px-6",children:o.jsxs("div",{className:"mx-auto flex min-w-0 max-w-3xl flex-col gap-8",children:[A&&o.jsxs("div",{className:"flex min-h-[60vh] w-full flex-col items-center justify-center gap-10 py-8",children:[o.jsxs("div",{className:"flex w-full max-w-2xl flex-col items-start gap-3",children:[o.jsxs("div",{className:jr,children:["§ 01 · ",x("maas.chat.heroEyebrow")]}),o.jsx(jy,{}),o.jsx("h2",{className:"font-display font-semibold text-foreground",style:{fontSize:"clamp(26px, 3.2vw, 40px)",letterSpacing:"-0.022em",lineHeight:1.05},children:x("maas.chat.heroTitle")}),o.jsx("p",{className:"max-w-xl text-sm leading-relaxed text-muted-foreground",children:x("maas.chat.heroSubtitle")})]}),o.jsx("div",{className:"grid w-full max-w-2xl grid-cols-1 gap-3 sm:grid-cols-2",children:by.map(({key:R,tag:X})=>o.jsxs("button",{type:"button",onClick:()=>f?.(x(R)),className:"flex flex-col gap-2 rounded-lg border border-border p-4 text-start text-sm text-muted-foreground hover:bg-surface-elevated hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring motion-safe:transition-colors motion-safe:duration-150",children:[o.jsxs("span",{className:`flex items-center gap-1.5 ${jr}
58`,children:[o.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full",style:{background:"var(--spruce-400)"}}),x(X)]}),o.jsx("span",{className:"leading-relaxed",children:x(R)})]},R))})]}),e.map(R=>o.jsx(Ry,{message:R,isStreaming:a&&R.id===r,streamingText:t,streamingReasoning:n,onRegenerate:l,onEditBranch:c,onSelectSibling:m,onBranchFrom:h,onDeleteMessage:g},R.id)),a&&!r&&o.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[(n||"").trim().length>0&&o.jsx(Wl,{text:n||"",live:!0,answerStarted:!!t}),o.jsx("div",{className:"flex min-w-0 justify-start",children:o.jsx("div",{role:"article","aria-label":x("maas.chat.assistantSaid"),className:"w-full min-w-0 break-words [overflow-wrap:anywhere] text-foreground",children:o.jsx("div",{className:"text-sm leading-relaxed "+Bl+" "+Uo,children:o.jsx(Vo,{text:t||""})})})})]}),s&&o.jsx("div",{ref:O,tabIndex:-1,role:"alert",className:"flex justify-center focus-visible:outline-none",children:s.code==="insufficient_credit"?o.jsx("div",{className:wo,children:o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx(zd,{className:"h-5 w-5 text-hydro"}),o.jsx("h3",{className:"font-medium text-foreground",children:x("maas.chat.outOfCredit")}),o.jsx("p",{className:"text-sm text-muted-foreground",children:x("maas.chat.outOfCreditDescription")}),o.jsxs(le,{ref:L,onClick:d,className:F,children:[x("maas.chat.topUp"),o.jsx("span",{className:"ms-2","aria-hidden":!0,children:"→"})]})]})}):s.code==="preempted"?o.jsx("div",{className:wo,children:o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx(mf,{className:"h-5 w-5 text-[var(--amber-500)]"}),o.jsx("h3",{className:"font-medium text-foreground",children:x("maas.chat.preempted")}),o.jsx("p",{className:"text-sm text-muted-foreground",children:x("maas.chat.preemptedDescription")}),j!==null&&j>0&&o.jsx("p",{"aria-hidden":!0,className:"font-mono text-sm tabular-nums text-muted-foreground",children:x("maas.chat.retryIn",{seconds:D.format(j)})}),H!==null&&o.jsx("p",{className:"sr-only",role:"status","aria-live":"polite",children:x("maas.chat.retryIn",{seconds:D.format(H)})}),o.jsxs(le,{ref:L,onClick:u,disabled:j!==null&&j>0,className:F,children:[x("maas.chat.retry"),o.jsx("span",{className:"ms-2","aria-hidden":!0,children:"→"})]})]})}):o.jsx("div",{className:wo,children:o.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[o.jsx("h3",{className:"font-medium text-foreground",children:x("maas.chat.error")}),o.jsx("p",{className:"text-sm text-muted-foreground",children:s.message||x("maas.chat.errorDescription")}),o.jsxs(le,{ref:L,onClick:u,className:F,children:[x("maas.chat.retry"),o.jsx("span",{className:"ms-2","aria-hidden":!0,children:"→"})]})]})})})]})}),o.jsx("div",{className:"sr-only",role:"status","aria-live":"polite",children:C}),!w&&o.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-4 flex justify-center",children:o.jsx("button",{type:"button",onClick:P,className:"pointer-events-auto rounded-full border border-border bg-surface px-4 py-2 text-sm text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring motion-safe:transition-colors motion-safe:duration-150",children:o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(rf,{className:"h-3 w-3","aria-hidden":!0}),x("maas.chat.jumpToLatest")]})})})]})}function Rr(e,[t,n]){return Math.min(n,Math.max(t,e))}function _y(e){const t=ky(e),n=i.forwardRef((r,a)=>{const{children:s,...l}=r,c=i.Children.toArray(s),u=c.find(My);if(u){const d=u.props.children,f=c.map(m=>m===u?i.Children.count(d)>1?i.Children.only(null):i.isValidElement(d)?d.props.children:null:m);return o.jsx(t,{...l,ref:a,children:i.isValidElement(d)?i.cloneElement(d,void 0,f):null})}return o.jsx(t,{...l,ref:a,children:s})});return n.displayName=`${e}.Slot`,n}function ky(e){const t=i.forwardRef((n,r)=>{const{children:a,...s}=n;if(i.isValidElement(a)){const l=Dy(a),c=Ay(s,a.props);return a.type!==i.Fragment&&(c.ref=r?We(r,l):l),i.cloneElement(a,c)}return i.Children.count(a)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Py=Symbol("radix.slottable");function My(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Py}function Ay(e,t){const n={...t};for(const r in t){const a=e[r],s=t[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...c)=>{const u=s(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...s}
vendor: 4,131 bytes, line 58
58:r==="className"&&(n[r]=[a,s].filter(Boolean).join(" "))}return{...e,...n}}function Dy(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ka(e){const t=i.useRef({value:e,previous:e});return i.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Vl=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ty="VisuallyHidden",Iy=i.forwardRef((e,t)=>o.jsx(Z.span,{...e,ref:t,style:{...Vl,...e.style}}));Iy.displayName=Ty;var Oy=[" ","Enter","ArrowUp","ArrowDown"],$y=[" ","Enter"],$t="Select",[qr,Gr,Ly]=Ir($t),[gn]=Ke($t,[Ly,pn]),Yr=pn(),[Fy,Et]=gn($t),[By,Hy]=gn($t),Ul=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:s,value:l,defaultValue:c,onValueChange:u,dir:d,name:f,autoComplete:m,disabled:h,required:g,form:x}=e,p=Yr(t),[y,v]=i.useState(null),[b,w]=i.useState(null),[S,j]=i.useState(!1),k=Or(d),[C,_]=lt({prop:r,defaultProp:a??!1,onChange:s,caller:$t}),[M,O]=lt({prop:l,defaultProp:c,onChange:u,caller:$t}),L=i.useRef(null),D=y?x||!!y.closest("form"):!0,[E,W]=i.useState(new Set),P=Array.from(E).map(A=>A.props.value).join(";");return o.jsx(Hr,{...p,children:o.jsxs(Fy,{required:g,scope:t,trigger:y,onTriggerChange:v,valueNode:b,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:j,contentId:Re(),value:M,onValueChange:O,open:C,onOpenChange:_,dir:k,triggerPointerDownPosRef:L,disabled:h,children:[o.jsx(qr.Provider,{scope:t,children:o.jsx(By,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback(A=>{W(H=>new Set(H).add(A))},[]),onNativeOptionRemove:i.useCallback(A=>{W(H=>{const F=new Set(H);return F.delete(A),F})},[]),children:n})}),D?o.jsxs(pu,{"aria-hidden":!0,required:g,tabIndex:-1,name:f,autoComplete:m,value:M,onChange:A=>O(A.target.value),disabled:h,form:x,children:[M===void 0?o.jsx("option",{value:""}):null,Array.from(E)]},P):null]})})};Ul.displayName=$t;var zl="SelectTrigger",Kl=i.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...a}=e,s=Yr(n),l=Et(zl,n),c=l.disabled||r,u=oe(t,l.onTriggerChange),d=Gr(n),f=i.useRef("touch"),[m,h,g]=gu(p=>{const y=d().filter(w=>!w.disabled),v=y.find(w=>w.value===l.value),b=xu(y,p,v);b!==void 0&&l.onValueChange(b.value)}),x=p=>{c||(l.onOpenChange(!0),g()),p&&(l.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return o.jsx(Wr,{asChild:!0,...s,children:o.jsx(Z.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":hu(l.value)?"":void 0,...a,ref:u,onClick:G(a.onClick,p=>{p.currentTarget.focus(),f.current!=="mouse"&&x(p)}),onPointerDown:G(a.onPointerDown,p=>{f.current=p.pointerType;const y=p.target;y.hasPointerCapture(p.pointerId)&&y.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(x(p),p.preventDefault())}),onKeyDown:G(a.onKeyDown,p=>{const y=m.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&h(p.key),!(y&&p.key===" ")&&Oy.includes(p.key)&&(x(),p.preventDefault())})})})});Kl.displayName=zl;var ql="SelectValue",Gl=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:s,placeholder:l="",...c}=e,u=Et(ql,n),{onValueNodeHasChildrenChange:d}=u,f=s!==void 0,m=oe(t,u.onValueNodeChange);return Pe(()=>{d(f)},[d,f]),o.jsx(Z.span,{...c,ref:m,style:{pointerEvents:"none"},children:hu(u.value)?o.jsx(o.Fragment,{children:l}):s})});Gl.displayName=ql;var Wy="SelectIcon",Yl=i.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return o.jsx(Z.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})});Yl.displayName=Wy;var Vy="SelectPortal",Xl=e=>o.jsx(In,{asChild:!0,...e});Xl.displayName=Vy;var Lt="SelectContent",Ql=i.forwardRef((e,t)=>
vendor: 12,702 bytes, line 58
58{const n=Et(Lt,e.__scopeSelect),[r,a]=i.useState();if(Pe(()=>{a(new DocumentFragment)},[]),!n.open){const s=r;return s?_r.createPortal(o.jsx(Zl,{scope:e.__scopeSelect,children:o.jsx(qr.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),s):null}return o.jsx(Jl,{...e,ref:t})});Ql.displayName=Lt;var Ge=10,[Zl,_t]=gn(Lt),Uy="SelectContentImpl",zy=_y("SelectContent.RemoveScroll"),Jl=i.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:l,side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:m,collisionBoundary:h,collisionPadding:g,sticky:x,hideWhenDetached:p,avoidCollisions:y,...v}=e,b=Et(Lt,n),[w,S]=i.useState(null),[j,k]=i.useState(null),C=oe(t,$=>S($)),[_,M]=i.useState(null),[O,L]=i.useState(null),D=Gr(n),[E,W]=i.useState(!1),P=i.useRef(!1);i.useEffect(()=>{if(w)return Ar(w)},[w]),Pr();const A=i.useCallback($=>{const[Q,...re]=D().map(ue=>ue.ref.current),[ne]=re.slice(-1),J=document.activeElement;for(const ue of $)if(ue===J||(ue?.scrollIntoView({block:"nearest"}),ue===Q&&j&&(j.scrollTop=0),ue===ne&&j&&(j.scrollTop=j.scrollHeight),ue?.focus(),document.activeElement!==J))return},[D,j]),H=i.useCallback(()=>A([_,w]),[A,_,w]);i.useEffect(()=>{E&&H()},[E,H]);const{onOpenChange:F,triggerPointerDownPosRef:R}=b;i.useEffect(()=>{if(w){let $={x:0,y:0};const Q=ne=>{$={x:Math.abs(Math.round(ne.pageX)-(R.current?.x??0)),y:Math.abs(Math.round(ne.pageY)-(R.current?.y??0))}},re=ne=>{$.x<=10&&$.y<=10?ne.preventDefault():w.contains(ne.target)||F(!1),document.removeEventListener("pointermove",Q),R.current=null};return R.current!==null&&(document.addEventListener("pointermove",Q),document.addEventListener("pointerup",re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Q),document.removeEventListener("pointerup",re,{capture:!0})}}},[w,F,R]),i.useEffect(()=>{const $=()=>F(!1);return window.addEventListener("blur",$),window.addEventListener("resize",$),()=>{window.removeEventListener("blur",$),window.removeEventListener("resize",$)}},[F]);const[X,ae]=gu($=>{const Q=D().filter(J=>!J.disabled),re=Q.find(J=>J.ref.current===document.activeElement),ne=xu(Q,$,re);ne&&setTimeout(()=>ne.ref.current.focus())}),N=i.useCallback(($,Q,re)=>{const ne=!P.current&&!re;(b.value!==void 0&&b.value===Q||ne)&&(M($),ne&&(P.current=!0))},[b.value]),T=i.useCallback(()=>w?.focus(),[w]),U=i.useCallback(($,Q,re)=>{const ne=!P.current&&!re;(b.value!==void 0&&b.value===Q||ne)&&L($)},[b.value]),B=r==="popper"?zo:eu,K=B===zo?{side:c,sideOffset:u,align:d,alignOffset:f,arrowPadding:m,collisionBoundary:h,collisionPadding:g,sticky:x,hideWhenDetached:p,avoidCollisions:y}:{};return o.jsx(Zl,{scope:n,content:w,viewport:j,onViewportChange:k,itemRefCallback:N,selectedItem:_,onItemLeave:T,itemTextRefCallback:U,focusSelectedItem:H,selectedItemText:O,position:r,isPositioned:E,searchRef:X,children:o.jsx(On,{as:zy,allowPinchZoom:!0,children:o.jsx(Tn,{asChild:!0,trapped:b.open,onMountAutoFocus:$=>{$.preventDefault()},onUnmountAutoFocus:G(a,$=>{b.trigger?.focus({preventScroll:!0}),$.preventDefault()}),children:o.jsx(Dn,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:$=>$.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:o.jsx(B,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:$=>$.preventDefault(),...v,...K,onPlaced:()=>W(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:G(v.onKeyDown,$=>{const Q=$.ctrlKey||$.altKey||$.metaKey;if($.key==="Tab"&&$.preventDefault(),!Q&&$.key.length===1&&ae($.key),["ArrowUp","ArrowDown","Home","End"].includes($.key)){let ne=D().filter(J=>!J.disabled).map(J=>J.ref.current);if(["ArrowUp","End"].includes($.key)&&(ne=ne.slice().reverse()),["ArrowUp","ArrowDown"].includes($.key)){const J=$.target,ue=ne.indexOf(J);ne=ne.slice(ue+1)}setTimeout(()=>A(ne)),$.preventDefault()}})})})})})})});Jl.displayName=Uy;var Ky="SelectItemAlignedPosition",eu=i.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...a}=e,s=Et(Lt,n),l=_t(Lt,n),[c,u]=i.useState(null),[d,f]=i.useState(null),m=oe(t,C=>f(C)),h=Gr(n),g=i.useRef(!1),x=i.useRef(!0),{viewport:p,selectedItem:y,selectedItemText:v,focusSelectedItem:b}=l,w=i.useCallback(()=>{if(s.trigger&&s.valueNode&&c&&d&&p&&y&&v){const C=s.trigger.getBoundingClientRect(),_=d.getBoundingClientRect(),M=s.valueNode.getBoundingClientRect(),O=v.getBoundingClientRect();if(s.dir!=="rtl"){const J=O.left-_.left,ue=M.left-J,xe=C.left-ue,I=C.width+xe,me=Math.max(I,_.width),ve=window.innerWidth-Ge,Ie=Rr(ue,[Ge,Math.max(Ge,ve-me)]);c.style.minWidth=I+"px",c.style.left=Ie+"px"}else{const J=_.right-O.right,ue=window.innerWidth-M.right-J,xe=window.innerWidth-C.right-ue,I=C.width+xe,me=Math.max(I,_.width),ve=window.innerWidth-Ge,Ie=Rr(ue,[Ge,Math.max(Ge,ve-me)]);c.style.minWidth=I+"px",c.style.right=Ie+"px"}const L=h(),D=window.innerHeight-Ge*2,E=p.scrollHeight,W=window.getComputedStyle(d),P=parseInt(W.borderTopWidth,10),A=parseInt(W.paddingTop,10),H=parseInt(W.borderBottomWidth,10),F=parseInt(W.paddingBottom,10),R=P+A+E+F+H,X=Math.min(y.offsetHeight*5,R),ae=window.getComputedStyle(p),N=parseInt(ae.paddingTop,10),T=parseInt(ae.paddingBottom,10),U=C.top+C.height/2-Ge,B=D-U,K=y.offsetHeight/2,$=y.offsetTop+K,Q=P+A+$,re=R-Q;if(Q<=U){const J=L.length>0&&y===L[L.length-1].ref.current;c.style.bottom="0px";const ue=d.clientHeight-p.offsetTop-p.offsetHeight,xe=Math.max(B,K+(J?T:0)+ue+H),I=Q+xe;c.style.height=I+"px"}else{const J=L.length>0&&y===L[0].ref.current;c.style.top="0px";const xe=Math.max(U,P+p.offsetTop+(J?N:0)+K)+re;c.style.height=xe+"px",p.scrollTop=Q-U+p.offsetTop}c.style.margin=`${Ge}px 0`,c.style.minHeight=X+"px",c.style.maxHeight=D+"px",r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,s.trigger,s.valueNode,c,d,p,y,v,s.dir,r]);Pe(()=>w(),[w]);const[S,j]=i.useState();Pe(()=>{d&&j(window.getComputedStyle(d).zIndex)},[d]);const k=i.useCallback(C=>{C&&x.current===!0&&(w(),b?.(),x.current=!1)},[w,b]);return o.jsx(Gy,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:k,children:o.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:o.jsx(Z.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});eu.displayName=Ky;var qy="SelectPopperPosition",zo=i.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=Ge,...s}=e,l=Yr(n);return o.jsx(ha,{...l,...s,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});zo.displayName=qy;var[Gy,Pa]=gn(Lt,{}),Ko="SelectViewport",tu=i.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...a}=e,s=_t(Ko,n),l=Pa(Ko,n),c=oe(t,s.onViewportChange),u=i.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),o.jsx(qr.Slot,{scope:n,children:o.jsx(Z.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:G(a.onScroll,d=>{const f=d.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:h}=l;if(h?.current&&m){const g=Math.abs(u.current-f.scrollTop);if(g>0){const x=window.innerHeight-Ge*2,p=parseFloat(m.style.minHeight),y=parseFloat(m.style.height),v=Math.max(p,y);if(v<x){const b=v+g,w=Math.min(x,b),S=b-w;m.style.height=w+"px",m.style.bottom==="0px"&&(f.scrollTop=S>0?S:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});tu.displayName=Ko;var nu="SelectGroup",[Yy,Xy]=gn(nu),Qy=i.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Re();return o.jsx(Yy,{scope:n,id:a,children:o.jsx(Z.div,{role:"group","aria-labelledby":a,...r,ref:t})})});Qy.displayName=nu;var ru="SelectLabel",ou=i.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Xy(ru,n);return o.jsx(Z.div,{id:a.id,...r,ref:t})});ou.displayName=ru;var Er="SelectItem",[Zy,au]=gn(Er),su=i.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:s,...l}=e,c=Et(Er,n),u=_t(Er,n),d=c.value===r,[f,m]=i.useState(s??""),[h,g]=i.useState(!1),x=oe(t,b=>u.itemRefCallback?.(b,r,a)),p=Re(),y=i.useRef("touch"),v=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(Zy,{scope:n,value:r,disabled:a,textId:p,isSelected:d,onItemTextChange:i.useCallback(b=>{m(w=>w||(b?.textContent??"").trim())},[]),children:o.jsx(qr.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:o.jsx(Z.div,{role:"option","aria-labelledby":p,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:x,onFocus:G(l.onFocus,()=>g(!0)),onBlur:G(l.onBlur,()=>g(!1)),onClick:G(l.onClick,()=>{y.current!=="mouse"&&v()}),onPointerUp:G(l.onPointerUp,()=>{y.current==="mouse"&&v()}),onPointerDown:G(l.onPointerDown,b=>{y.current=b.pointerType}),onPointerMove:G(l.onPointerMove,b=>{y.current=b.pointerType,a?u.onItemLeave?.():y.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:G(l.onPointerLeave,b=>{b.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:G(l.onKeyDown,b=>{u.searchRef?.current!==""&&b.key===" "||($y.includes(b.key)&&v(),b.key===" "&&b.preventDefault())})})})})});su.displayName=Er;var Cn="SelectItemText",iu=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,...s}=e,l=Et(Cn,n),c=_t(Cn,n),u=au(Cn,n),d=Hy(Cn,n),[f,m]=i.useState(null),h=oe(t,v=>m(v),u.onItemTextChange,v=>c.itemTextRefCallback?.(v,u.value,u.disabled)),g=f?.textContent,x=i.useMemo(()=>o.jsx("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:p,onNativeOptionRemove:y}=d;return Pe(()=>(p(x),()=>y(x)),[p,y,x]),o.jsxs(o.Fragment,{children:[o.jsx(Z.span,{id:u.textId,...s,ref:h}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?_r.createPortal(s.children,l.valueNode):null]})});iu.displayName=Cn;var cu="SelectItemIndicator",lu=i.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return au(cu,n).isSelected?o.jsx(Z.span,{"aria-hidden":!0,...r,ref:t}):null});lu.displayName=cu;var qo="SelectScrollUpButton",uu=i.forwardRef((e,t)=>{const n=_t(qo,e.__scopeSelect),r=Pa(qo,e.__scopeSelect),[a,s]=i.useState(!1),l=oe(t,r.onScrollButtonChange);return Pe(()=>{if(n.viewport&&n.isPositioned){let c=function(){const d=u.scrollTop>0;s(d)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?o.jsx(fu,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});uu.displayName=qo;var Go="SelectScrollDownButton",du=i.forwardRef((e,t)=>{const n=_t(Go,e.__scopeSelect),r=Pa(Go,e.__scopeSelect),[a,s]=i.useState(!1),l=oe(t,r.onScrollButtonChange);return Pe(()=>{if(n.viewport&&n.isPositioned){let c=function(){const d=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)<d;s(f)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?o.jsx(fu,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});du.displayName=Go;var fu=i.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=e,s=_t("SelectScrollButton",n),l=i.useRef(null),c=Gr(n),u=i.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return i.useEffect(()=>()=>u(),[u]),Pe(()=>{c().find(f=>f.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),o.jsx(Z.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:G(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:G(a.onPointerMove,()=>{s.onItemLeave?.(),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:G(a.onPointerLeave,()=>{u()})})}),Jy="SelectSeparator",mu=i.forwardRef((e,t)=>
58{const{__scopeSelect:n,...r}=e;return o.jsx(Z.div,{"aria-hidden":!0,...r,ref:t})});mu.displayName=Jy;var Yo="SelectArrow",ew=i.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Yr(n),s=Et(Yo,n),l=_t(Yo,n);return s.open&&l.position==="popper"?o.jsx(ga,{...a,...r,ref:t}):null});ew.displayName=Yo;var tw="SelectBubbleInput",pu=i.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const a=i.useRef(null),s=oe(r,a),l=ka(t);return i.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(l!==t&&f){const m=new Event("change",{bubbles:!0});f.call(c,t),c.dispatchEvent(m)}},[l,t]),o.jsx(Z.select,{...n,style:{...Vl,...n.style},ref:s,defaultValue:t})});pu.displayName=tw;function hu(e){return e===""||e===void 0}function gu(e){const t=Xe(e),n=i.useRef(""),r=i.useRef(0),a=i.useCallback(l=>{const c=n.current+l;t(c),(function u(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[t]),s=i.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,s]}function xu(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let l=nw(e,Math.max(s,0));a.length===1&&(l=l.filter(d=>d!==n));const u=l.find(d=>d.textValue.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function nw(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var rw=Ul,vu=Kl,ow=Gl,aw=Yl,sw=Xl,yu=Ql,iw=tu,wu=ou,bu=su,cw=iu,lw=lu,Su=uu,Nu=du,Cu=mu;const uw=rw,dw=ow,ju=i.forwardRef(({className:e,children:t,...n},r)=>o.jsxs(vu,{ref:r,className:Y("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,o.jsx(aw,{asChild:!0,children:o.jsx(ta,{className:"h-4 w-4 opacity-50"})})]}));ju.displayName=vu.displayName;const Ru=i.forwardRef(({className:e,...t},n)=>o.jsx(Su,{ref:n,className:Y("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(sf,{className:"h-4 w-4"})}));Ru.displayName=Su.displayName;const Eu=i.forwardRef(({className:e,...t},n)=>o.jsx(Nu,{ref:n,className:Y("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(ta,{className:"h-4 w-4"})}));Eu.displayName=Nu.displayName;const _u=i.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>o.jsx(sw,{children:o.jsxs(yu,{ref:a,className:Y("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-select-content-transform-origin)",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[o.jsx(Ru,{}),o.jsx(iw,{className:Y("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(Eu,{})]})}));_u.displayName=yu.displayName;const fw=i.forwardRef(({className:e,...t},n)=>o.jsx(wu,{ref:n,className:Y("px-2 py-1.5 text-sm font-semibold",e),...t}));fw.displayName=wu.displayName;const ku=i.forwardRef(({className:e,children:t,...n},r)=>o.jsxs(bu,{ref:r,className:Y("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[o.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(lw,{children:o.jsx(ln,{className:"h-4 w-4"})})}),o.jsx(cw,{children:t})]}));ku.displayName=bu.displayName;const mw=i.forwardRef(({className:e,...t},n)=>o.jsx(Cu,{ref:n,className:Y("-mx-1 my-1 h-px bg-muted",e),...t}));mw.displayName=Cu.displayName;function pw(e){const t=hw(e),n=i.forwardRef((r,a)=>{const{children:s,...l}=r,c=i.Children.toArray(s),u=c.find(xw);if(u){const d=u.props.children,f=c.map(m=>m===u?i.Children.count(d)>1?i.Children.only(null):i.isValidElement(d)?d.props.children:null:m);return o.jsx(t,{...l,ref:a,children:i.isValidElement(d)?i.cloneElement(d,void 0,f):null})}return o.jsx(t,{...l,ref:a,children:s})});return n.displayName=`${e}.Slot`,n}function hw(e){const t=i.forwardRef((n,r)=>{const{children:a,...s}=n;
vendor: 4,925 bytes, line 58
58if(i.isValidElement(a)){const l=yw(a),c=vw(s,a.props);return a.type!==i.Fragment&&(c.ref=r?We(r,l):l),i.cloneElement(a,c)}return i.Children.count(a)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var gw=Symbol("radix.slottable");function xw(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===gw}function vw(e,t){const n={...t};for(const r in t){const a=e[r],s=t[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...c)=>{const u=s(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...s}:r==="className"&&(n[r]=[a,s].filter(Boolean).join(" "))}return{...e,...n}}function yw(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Xr="Popover",[Pu]=Ke(Xr,[pn]),zn=pn(),[ww,kt]=Pu(Xr),Mu=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:s,modal:l=!1}=e,c=zn(t),u=i.useRef(null),[d,f]=i.useState(!1),[m,h]=lt({prop:r,defaultProp:a??!1,onChange:s,caller:Xr});return o.jsx(Hr,{...c,children:o.jsx(ww,{scope:t,contentId:Re(),triggerRef:u,open:m,onOpenChange:h,onOpenToggle:i.useCallback(()=>h(g=>!g),[h]),hasCustomAnchor:d,onCustomAnchorAdd:i.useCallback(()=>f(!0),[]),onCustomAnchorRemove:i.useCallback(()=>f(!1),[]),modal:l,children:n})})};Mu.displayName=Xr;var Au="PopoverAnchor",bw=i.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=kt(Au,n),s=zn(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=a;return i.useEffect(()=>(l(),()=>c()),[l,c]),o.jsx(Wr,{...s,...r,ref:t})});bw.displayName=Au;var Du="PopoverTrigger",Tu=i.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=kt(Du,n),s=zn(n),l=oe(t,a.triggerRef),c=o.jsx(Z.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Fu(a.open),...r,ref:l,onClick:G(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:o.jsx(Wr,{asChild:!0,...s,children:c})});Tu.displayName=Du;var Ma="PopoverPortal",[Sw,Nw]=Pu(Ma,{forceMount:void 0}),Iu=e=>{const{__scopePopover:t,forceMount:n,children:r,container:a}=e,s=kt(Ma,t);return o.jsx(Sw,{scope:t,forceMount:n,children:o.jsx(Je,{present:n||s.open,children:o.jsx(In,{asChild:!0,container:a,children:r})})})};Iu.displayName=Ma;var an="PopoverContent",Ou=i.forwardRef((e,t)=>{const n=Nw(an,e.__scopePopover),{forceMount:r=n.forceMount,...a}=e,s=kt(an,e.__scopePopover);return o.jsx(Je,{present:r||s.open,children:s.modal?o.jsx(jw,{...a,ref:t}):o.jsx(Rw,{...a,ref:t})})});Ou.displayName=an;var Cw=pw("PopoverContent.RemoveScroll"),jw=i.forwardRef((e,t)=>{const n=kt(an,e.__scopePopover),r=i.useRef(null),a=oe(t,r),s=i.useRef(!1);return i.useEffect(()=>{const l=r.current;if(l)return Ar(l)},[]),o.jsx(On,{as:Cw,allowPinchZoom:!0,children:o.jsx($u,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:G(e.onCloseAutoFocus,l=>{l.preventDefault(),s.current||n.triggerRef.current?.focus()}),onPointerDownOutside:G(e.onPointerDownOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:G(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),Rw=i.forwardRef((e,t)=>{const n=kt(an,e.__scopePopover),r=i.useRef(!1),a=i.useRef(!1);return o.jsx($u,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=s.target;n.triggerRef.current?.contains(l)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),$u=i.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,...m}=e,h=kt(an,n),g=zn(n);return Pr(),o.jsx(Tn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:s,children:o.jsx(Dn,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>h.onOpenChange(!1),children:o.jsx(ha,{"data-state":Fu(h.open),role:"dialog",id:h.contentId,...g,...m,ref:t,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Lu="PopoverClose",Ew=i.forwardRef((e,t)=>
58{const{__scopePopover:n,...r}=e,a=kt(Lu,n);return o.jsx(Z.button,{type:"button",...r,ref:t,onClick:G(e.onClick,()=>a.onOpenChange(!1))})});Ew.displayName=Lu;var _w="PopoverArrow",kw=i.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=zn(n);return o.jsx(ga,{...a,...r,ref:t})});kw.displayName=_w;function Fu(e){return e?"open":"closed"}var Pw=Mu,Mw=Tu,Aw=Iu,Bu=Ou;const Dw=Pw,Tw=Mw,Hu=i.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>o.jsx(Aw,{children:o.jsx(Bu,{ref:a,align:t,sideOffset:n,className:Y("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-popover-content-transform-origin)",e),...r})}));Hu.displayName=Bu.displayName;var Iw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ow=Iw.reduce((e,t)=>{const n=Ud(`Primitive.${t}`),r=i.forwardRef((a,s)=>{const{asChild:l,...c}=a,u=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(u,{...c,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),$w="Label",Wu=i.forwardRef((e,t)=>o.jsx(Ow.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Wu.displayName=$w;var Vu=Wu;const Lw=ks("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Jt=i.forwardRef(({className:e,...t},n)=>o.jsx(Vu,{ref:n,className:Y(Lw(),e),...t}));Jt.displayName=Vu.displayName;var Uu=["PageUp","PageDown"],zu=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Ku={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},xn="Slider",[Xo,Fw,Bw]=Ir(xn),[qu]=Ke(xn,[Bw]),[Hw,Qr]=qu(xn),Gu=i.forwardRef((e,t)=>{const{name:n,min:r=0,max:a=100,step:s=1,orientation:l="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:d=[r],value:f,onValueChange:m=()=>{},onValueCommit:h=()=>{},inverted:g=!1,form:x,...p}=e,y=i.useRef(new Set),v=i.useRef(0),w=l==="horizontal"?Ww:Vw,[S=[],j]=lt({prop:f,defaultProp:d,onChange:L=>{[...y.current][v.current]?.focus(),m(L)}}),k=i.useRef(S);function C(L){const D=Gw(S,L);O(L,D)}function _(L){O(L,v.current)}function M(){const L=k.current[v.current];S[v.current]!==L&&h(S)}function O(L,D,{commit:E}={commit:!1}){const W=Zw(s),P=Jw(Math.round((L-r)/s)*s+r,W),A=Rr(P,[r,a]);j((H=[])=>{const F=Kw(H,A,D);if(Qw(F,u*s)){v.current=F.indexOf(A);const R=String(F)!==String(H);return R&&E&&h(F),R?F:H}else return H})}return o.jsx(Hw,{scope:e.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:v,thumbs:y.current,values:S,orientation:l,form:x,children:o.jsx(Xo.Provider,{scope:e.__scopeSlider,children:o.jsx(Xo.Slot,{scope:e.__scopeSlider,children:o.jsx(w,{"aria-disabled":c,"data-disabled":c?"":void 0,...p,ref:t,onPointerDown:G(p.onPointerDown,()=>{c||(k.current=S)}),min:r,max:a,inverted:g,onSlideStart:c?void 0:C,onSlideMove:c?void 0:_,onSlideEnd:c?void 0:M,onHomeKeyDown:()=>!c&&O(r,0,{commit:!0}),onEndKeyDown:()=>!c&&O(a,S.length-1,{commit:!0}),onStepKeyDown:({event:L,direction:D})=>{if(!c){const P=Uu.includes(L.key)||L.shiftKey&&zu.includes(L.key)?10:1,A=v.current,H=S[A],F=s*P*D;O(H+F,A,{commit:!0})}}})})})})});Gu.displayName=xn;var[Yu,Xu]=qu(xn,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Ww=i.forwardRef((e,t)=>{const{min:n,max:r,dir:a,inverted:s,onSlideStart:l,onSlideMove:c,onSlideEnd:u,onStepKeyDown:d,...f}=e,[m,h]=i.useState(null),g=oe(t,w=>h(w)),x=i.useRef(void 0),p=Or(a),y=p==="ltr",v=y&&!s||!y&&s;function b(w){const S=x.current||m.getBoundingClientRect(),j=[0,S.width],C=Aa(j,v?[n,r]:[r,n]);return x.current=S,C(w-S.left)}
58return o.jsx(Yu,{scope:e.__scopeSlider,startEdge:v?"left":"right",endEdge:v?"right":"left",direction:v?1:-1,size:"width",children:o.jsx(Qu,{dir:p,"data-orientation":"horizontal",...f,ref:g,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=b(w.clientX);l?.(S)},onSlideMove:w=>{const S=b(w.clientX);c?.(S)},onSlideEnd:()=>{x.current=void 0,u?.()},onStepKeyDown:w=>{const j=Ku[v?"from-left":"from-right"].includes(w.key);d?.({event:w,direction:j?-1:1})}})})}),Vw=i.forwardRef((e,t)=>{const{min:n,max:r,inverted:a,onSlideStart:s,onSlideMove:l,onSlideEnd:c,onStepKeyDown:u,...d}=e,f=i.useRef(null),m=oe(t,f),h=i.useRef(void 0),g=!a;function x(p){const y=h.current||f.current.getBoundingClientRect(),v=[0,y.height],w=Aa(v,g?[r,n]:[n,r]);return h.current=y,w(p-y.top)}return o.jsx(Yu,{scope:e.__scopeSlider,startEdge:g?"bottom":"top",endEdge:g?"top":"bottom",size:"height",direction:g?1:-1,children:o.jsx(Qu,{"data-orientation":"vertical",...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:p=>{const y=x(p.clientY);s?.(y)},onSlideMove:p=>{const y=x(p.clientY);l?.(y)},onSlideEnd:()=>{h.current=void 0,c?.()},onStepKeyDown:p=>{const v=Ku[g?"from-bottom":"from-top"].includes(p.key);u?.({event:p,direction:v?-1:1})}})})}),Qu=i.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:s,onHomeKeyDown:l,onEndKeyDown:c,onStepKeyDown:u,...d}=e,f=Qr(xn,n);return o.jsx(Z.span,{...d,ref:t,onKeyDown:G(e.onKeyDown,m=>{m.key==="Home"?(l(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):Uu.concat(zu).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:G(e.onPointerDown,m=>{const h=m.target;h.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(h)?h.focus():r(m)}),onPointerMove:G(e.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:G(e.onPointerUp,m=>{const h=m.target;h.hasPointerCapture(m.pointerId)&&(h.releasePointerCapture(m.pointerId),s(m))})})}),Zu="SliderTrack",Ju=i.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,a=Qr(Zu,n);return o.jsx(Z.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:t})});Ju.displayName=Zu;var Qo="SliderRange",ed=i.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,a=Qr(Qo,n),s=Xu(Qo,n),l=i.useRef(null),c=oe(t,l),u=a.values.length,d=a.values.map(h=>rd(h,a.min,a.max)),f=u>1?Math.min(...d):0,m=100-Math.max(...d);return o.jsx(Z.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...e.style,[s.startEdge]:f+"%",[s.endEdge]:m+"%"}})});ed.displayName=Qo;var Zo="SliderThumb",td=i.forwardRef((e,t)=>{const n=Fw(e.__scopeSlider),[r,a]=i.useState(null),s=oe(t,c=>a(c)),l=i.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return o.jsx(Uw,{...e,ref:s,index:l})}),Uw=i.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:a,...s}=e,l=Qr(Zo,n),c=Xu(Zo,n),[u,d]=i.useState(null),f=oe(t,b=>d(b)),m=u?l.form||!!u.closest("form"):!0,h=fa(u),g=l.values[r],x=g===void 0?0:rd(g,l.min,l.max),p=qw(r,l.values.length),y=h?.[c.size],v=y?Yw(y,x,c.direction):0;return i.useEffect(()=>{if(u)return l.thumbs.add(u),()=>{l.thumbs.delete(u)}},[u,l.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${x}% + ${v}px)`},children:[o.jsx(Xo.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(Z.span,{role:"slider","aria-label":e["aria-label"]||p,"aria-valuemin":l.min,"aria-valuenow":g,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...s,ref:f,style:g===void 0?{display:"none"}:e.style,onFocus:G(e.onFocus,()=>{l.valueIndexToChangeRef.current=r})})}),m&&o.jsx(nd,{name:a??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:g},r)]})});td.displayName=Zo;var zw="RadioBubbleInput",nd=i.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const a=i.useRef(null),s=oe(a,r),l=ka(t);return i.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(l!==t&&f){const m=new Event("input",{bubbles:!0});f.call(c,t),c.dispatchEvent(m)}},[l,t]),o.jsx(Z.input,{style:{display:"none"},...n,ref:s,defaultValue:t})});nd.displayName=zw;function Kw(e=[],t,n){const r=[...e];return r[n]=t,r.sort((a,s)=>a-s)}function rd(e,t,n){const s=100/(n-t)*(e-t);return Rr(s,[0,100])}function qw(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Gw(e,t){if(e.length===1)return 0;const n=e.map(a=>
58Math.abs(a-t)),r=Math.min(...n);return n.indexOf(r)}function Yw(e,t,n){const r=e/2,s=Aa([0,50],[0,r]);return(r-s(t)*n)*n}function Xw(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Qw(e,t){if(t>0){const n=Xw(e);return Math.min(...n)>=t}return!0}function Aa(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Zw(e){return(String(e).split(".")[1]||"").length}function Jw(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var od=Gu,eb=Ju,tb=ed,nb=td;const Tt=i.forwardRef(({className:e,...t},n)=>o.jsxs(od,{ref:n,className:Y("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(eb,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:o.jsx(tb,{className:"absolute h-full bg-primary"})}),o.jsx(nb,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));Tt.displayName=od.displayName;var Zr="Switch",[rb]=Ke(Zr),[ob,ab]=rb(Zr),ad=i.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:s,required:l,disabled:c,value:u="on",onCheckedChange:d,form:f,...m}=e,[h,g]=i.useState(null),x=oe(t,w=>g(w)),p=i.useRef(!1),y=h?f||!!h.closest("form"):!0,[v,b]=lt({prop:a,defaultProp:s??!1,onChange:d,caller:Zr});return o.jsxs(ob,{scope:n,checked:v,disabled:c,children:[o.jsx(Z.button,{type:"button",role:"switch","aria-checked":v,"aria-required":l,"data-state":ld(v),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:x,onClick:G(e.onClick,w=>{b(S=>!S),y&&(p.current=w.isPropagationStopped(),p.current||w.stopPropagation())})}),y&&o.jsx(cd,{control:h,bubbles:!p.current,name:r,value:u,checked:v,required:l,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});ad.displayName=Zr;var sd="SwitchThumb",id=i.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=ab(sd,n);return o.jsx(Z.span,{"data-state":ld(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});id.displayName=sd;var sb="SwitchBubbleInput",cd=i.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...a},s)=>{const l=i.useRef(null),c=oe(l,s),u=ka(n),d=fa(t);return i.useEffect(()=>{const f=l.current;if(!f)return;const m=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&g){const x=new Event("click",{bubbles:r});g.call(f,n),f.dispatchEvent(x)}},[u,n,r]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});cd.displayName=sb;function ld(e){return e?"checked":"unchecked"}var ud=ad,ib=id;const Da=i.forwardRef(({className:e,...t},n)=>o.jsx(ud,{className:Y("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:o.jsx(ib,{className:Y("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Da.displayName=ud.displayName;const cb=12,lb=24,bs="h-8 w-8 shrink-0 rounded-md bg-[var(--ink-900)] text-white shadow-none hover:bg-[var(--ink-950)] motion-safe:transition-colors motion-safe:duration-150 aria-disabled:cursor-not-allowed aria-disabled:opacity-40 aria-disabled:hover:bg-[var(--ink-900)]",bo="h-7 border-transparent bg-transparent text-muted-foreground shadow-none hover:bg-surface-elevated hover:text-foreground motion-safe:transition-colors motion-safe:duration-150",ub="h-14 w-14 rounded-lg border border-border object-cover";function db(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}
58function fb({value:e,onChange:t,onSubmit:n,onStop:r,streaming:a,disabled:s,disabledReason:l,model:c,onModelChange:u,models:d,params:f,onParamsChange:m,attachments:h,onAttachFiles:g,onRemoveAttachment:x,uploading:p}){const{t:y,i18n:v}=Ve(),b=i.useRef(null),w=i.useRef(-1),[S,j]=i.useState(!1),k=i.useRef(null),[C,_]=i.useState(!1),M=i.useRef(0),O=i.useId(),L=i.useId(),D=i.useId(),E=i.useId(),W=i.useId(),P=i.useMemo(()=>new Intl.NumberFormat(v.language,{minimumFractionDigits:2,maximumFractionDigits:2}),[v.language]),A=i.useMemo(()=>new Intl.NumberFormat(v.language),[v.language]),H=i.useCallback(()=>{const I=b.current;if(!I)return;const me=parseFloat(window.getComputedStyle(I).lineHeight),ve=(Number.isFinite(me)?me:lb)*cb;I.style.maxHeight=`${ve}px`,I.style.height="auto",I.style.height=`${Math.min(I.scrollHeight,ve)}px`},[]);i.useLayoutEffect(()=>{H()},[e,H]),i.useEffect(()=>{const I=b.current;if(!I||typeof ResizeObserver>"u")return;const me=new ResizeObserver(ve=>{const Ie=ve[0]?.contentRect.width??0;Math.abs(Ie-w.current)<.5||(w.current=Ie,H())});return me.observe(I),()=>me.disconnect()},[H]),i.useEffect(()=>{const I=window.matchMedia("(pointer: coarse)");j(I.matches);const me=ve=>j(ve.matches);return I.addEventListener("change",me),()=>I.removeEventListener("change",me)},[]);const F=I=>{I.key==="Enter"&&!I.shiftKey&&!S&&(I.preventDefault(),!s&&!a&&e.trim()&&n())},R=h??[],X=!!g,ae=!!e.trim()||R.length>0,N=()=>{!s&&!a&&ae&&n()},T=i.useCallback(I=>{if(!I||!g)return;const me=Array.from(I);me.length&&g(me)},[g]),U=I=>{if(!X||s)return;const me=Array.from(I.clipboardData?.files??[]);me.length&&(I.preventDefault(),g?.(me))},B=I=>{!X||s||Array.from(I.dataTransfer?.types??[]).includes("Files")&&(M.current+=1,_(!0))},K=()=>{X&&(M.current=Math.max(0,M.current-1),M.current===0&&_(!1))},$=I=>{!X||s||(I.preventDefault(),M.current=0,_(!1),T(I.dataTransfer?.files??null))},Q=Math.ceil(e.length/4),re=f.thinking??!1,ne=!!s||!ae||!!p,J=!S,ue=l??y("maas.composer.sendUnavailable"),xe=i.useMemo(()=>c&&!d.includes(c)?[c,...d]:d,[c,d]);return o.jsxs("div",{className:`rounded-xl border bg-surface p-4 focus-within:border-ring focus-within:ring-1 focus-within:ring-ring motion-safe:transition-colors motion-safe:duration-200 ${C?"border-ring ring-1 ring-ring":"border-border"}`,onDragEnter:B,onDragOver:I=>{X&&!s&&I.preventDefault()},onDragLeave:K,onDrop:$,children:[R.length>0&&o.jsx("ul",{className:"mb-3 flex flex-wrap gap-2","aria-label":y("maas.composer.attachmentsLabel"),children:R.map(I=>o.jsxs("li",{className:"group relative",children:[I.kind==="image"&&I.previewUrl?o.jsx("img",{src:I.previewUrl,alt:I.name,className:ub,draggable:!1}):o.jsxs("div",{className:"flex h-14 max-w-[200px] items-center gap-2 rounded-lg border border-border px-3",children:[o.jsx(Is,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"truncate text-xs text-foreground",children:I.name}),o.jsx("div",{className:"font-mono text-[10px] tabular-nums text-muted-foreground",children:db(I.bytes)})]})]}),o.jsx("button",{type:"button","aria-label":y("maas.composer.removeAttachment",{name:I.name}),onClick:()=>x?.(I.key),disabled:p,className:"absolute -end-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full border border-border bg-surface text-muted-foreground shadow-sm hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-40",children:o.jsx(kr,{className:"h-3 w-3"})})]},I.key))}),o.jsx(_s,{onPaste:U,ref:b,value:e,onChange:I=>t(I.target.value),onKeyDown:F,placeholder:y("maas.composer.placeholder"),"aria-label":y("maas.composer.messageLabel"),"aria-describedby":J?O:void 0,"aria-keyshortcuts":J?"Enter":void 0,disabled:s,rows:1,className:"min-h-[24px] resize-none border-0 bg-transparent p-0 text-[15px] leading-[1.7] text-foreground shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"}),J&&o.jsx("span",{id:O,className:"sr-only",children:y("maas.composer.enterHint")}),o.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[X&&o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:k,id:D,type:"file",multiple:!0,accept:Qv,className:"sr-only",onChange:I=>{T(I.target.files),I.target.value=""}}),o.jsx(le,{type:"button",variant:"ghost",size:"icon","aria-label":y("maas.composer.attach"),className:`${bo} w-7 shrink-0`,disabled:s||p,onClick:()=>k.current?.click(),children:p?o.jsx(Fd,{className:"h-3.5 w-3.5 motion-safe:animate-spin"}):o.jsx(Bd,{className:"h-3.5 w-3.5"})})]}),o.jsxs(uw,{value:c,onValueChange:u,disabled:s,children:[o.jsx(ju,{"aria-label":y("maas.composer.modelLabel"),className:`${bo} w-full min-w-0 max-w-[180px] px-2 font-mono text-[10px] uppercase tracking-[0.14em] [&>span]:truncate`,children:o.jsx(dw,{placeholder:y("maas.composer.modelLabel")})}),o.jsx(_u,{children:xe.map(I=>o.jsx(ku,{value:I,className:"font-mono text-xs",children:I},I))})]}),o.jsxs(Dw,{children:[o.jsx(Tw,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"icon","aria-label":y(re?"maas.composer.parametersThinkingOn":"maas.composer.parameters"),className:`${bo} w-7 shrink-0`,disabled:s,children:o.jsx(Hf,{className:`h-3.5 w-3.5 ${re?"text-hydro":""}`})})}),o.jsx(Hu,{className:"w-80 rounded-xl border-border bg-surface p-4",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1.5 border-b border-border pb-4",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx(Jt,{htmlFor:E,className:"cursor-pointer font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:y("maas.composer.thinking")}),o.jsx(Da,{id:E,checked:re,onCheckedChange:I=>m({...f,thinking:I}),disabled:s,"aria-describedby":W,className:"shadow-none"})]}),o.jsx("p",{id:W,className:"text-xs leading-relaxed text-muted-foreground",children:y("maas.composer.thinkingHint")})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:y("maas.composer.temperature")}),o.jsx("div",{className:"font-mono text-xs tabular-nums text-foreground",children:P.format(f.temperature??.7)})]}),o.jsx(Tt,{value:[f.temperature??.7],min:0,max:2,step:.01,onValueChange:([I])=>m({...f,temperature:I}),disabled:s})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:y("maas.composer.maxTokens")}),o.jsx("div",{className:"font-mono text-xs tabular-nums text-foreground",children:A.format(f.max_tokens??4096)})]}),o.jsx(Tt,{value:[f.max_tokens??4096],min:256,max:8192,step:256,onValueChange:([I])=>m({...f,max_tokens:I}),disabled:s})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:y("maas.composer.topP")}
58),o.jsx("div",{className:"font-mono text-xs tabular-nums text-foreground",children:P.format(f.top_p??.9)})]}),o.jsx(Tt,{value:[f.top_p??.9],min:0,max:1,step:.01,onValueChange:([I])=>m({...f,top_p:I}),disabled:s})]})]})})]})]}),o.jsxs("div",{className:"ms-auto flex shrink-0 items-center gap-3",children:[e&&o.jsxs("div",{className:"hidden font-mono text-[10px] tabular-nums text-muted-foreground sm:block",children:[A.format(Q)," ",y("maas.composer.tokens")]}),a?o.jsx(le,{size:"icon","aria-label":y("maas.composer.stop"),className:bs+" ring-1 ring-border",onClick:r,children:o.jsx(Hd,{className:"h-3 w-3 fill-current"})}):o.jsx(le,{size:"icon","aria-label":y("maas.composer.send"),"aria-disabled":ne||void 0,"aria-describedby":s?L:void 0,className:bs,onClick:N,children:o.jsx($f,{className:"h-3.5 w-3.5"})})]})]}),s&&o.jsx("p",{id:L,className:"mt-3 font-mono text-[10px] text-muted-foreground",children:ue})]})}const wt="font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",bn="border-t border-border px-6 py-5",So="space-y-2 font-mono text-[12px] tabular-nums",qe="flex items-baseline justify-between gap-4",mb={hour:"maas.inspector.planWindowHour",day:"maas.inspector.planWindowDay",week:"maas.inspector.planWindowWeek",month:"maas.inspector.planWindowMonth"},pb=700;function hb({conversation:e,messages:t,onPatch:n,open:r,onOpenChange:a}){const{t:s,i18n:l}=Ve(),[c,u]=i.useState("idle"),[d,f]=i.useState(!1),m=i.useMemo(()=>{const N=t.reduce((B,K)=>B+(K.prompt_tokens||0),0),T=t.reduce((B,K)=>B+(K.completion_tokens||0),0),U=t.reduce((B,K)=>B+(K.cost_micro||0),0);return{messageCount:t.length,promptTokens:N,completionTokens:T,costMicro:U}},[t]),h=i.useMemo(()=>t.filter(N=>N.role==="assistant"&&N.completion_tokens).map(N=>N.completion_tokens||0),[t]),g=i.useMemo(()=>{if(h.length<2)return null;const N=200,T=40,U=Math.max(...h),B=h.map((K,$)=>({x:$/(h.length-1)*N,y:U>0?T-K/U*T:T}));return{path:`M ${B.map(K=>`${K.x},${K.y}`).join(" L ")}`,last:B[B.length-1]}},[h]),x=i.useCallback((N,T)=>new Intl.NumberFormat(l.language,T===void 0?void 0:{minimumFractionDigits:T,maximumFractionDigits:T}).format(N),[l.language]),{data:p}=cy(),y=i.useMemo(()=>{const N=new Map(p?.windows.map(T=>[T.window,T])??[]);return Al.map(T=>N.get(T)).filter(T=>T!==void 0)},[p]),v=i.useCallback(N=>{const T=new Date(N);return Number.isNaN(T.getTime())?null:new Intl.DateTimeFormat(l.language,{dateStyle:"medium"}).format(T)},[l.language]),b=i.useCallback(N=>{if(!N)return null;const T=new Date(N).getTime();if(Number.isNaN(T))return null;const U=new Intl.RelativeTimeFormat(l.language,{numeric:"auto"}),B=Math.round((T-Date.now())/1e3);if(Math.abs(B)<60)return U.format(B,"second");const K=Math.round(B/60);if(Math.abs(K)<60)return U.format(K,"minute");const $=Math.round(B/3600);return Math.abs($)<24?U.format($,"hour"):U.format(Math.round(B/86400),"day")},[l.language]),w=N=>{const T=N/1e6;return new Intl.NumberFormat(l.language,{style:"currency",currency:As,minimumFractionDigits:4,maximumFractionDigits:6}).format(T)},S=async()=>{await navigator.clipboard.writeText(e.params?.attestation_hash||""),f(!0),setTimeout(()=>f(!1),2e3)},[j,k]=i.useState({});i.useEffect(()=>{k(N=>{const T={...N};let U=!1;for(const B of["temperature","max_tokens","top_p"]){const K=e.params?.[B];T[B]!==void 0&&typeof K=="number"&&K===T[B]&&(delete T[B],U=!0)}return U?T:N})},[e.params]);const C=(N,T)=>{const U=j[N];if(U!==void 0)return U;const B=e.params?.[N];return typeof B=="number"?B:T},_=C("temperature",.7),M=C("max_tokens",2048),O=C("top_p",.9),L=(N,T)=>{k(U=>({...U,[N]:T}))},D=(N,T)=>{k(U=>({...U,[N]:T})),Promise.resolve(n({params:{...e.params,temperature:_,max_tokens:M,top_p:O,[N]:T}})).catch(()=>{})},[E,W]=i.useState(e.system_prompt||""),P=i.useRef(e.system_prompt||""),A=i.useRef(null),[H,F]=i.useState(e.id);H!==e.id&&(F(e.id),W(e.system_prompt||""),P.current=e.system_prompt||"",k({}),u("idle"),A.current&&(clearTimeout(A.current),A.current=null)),i.useEffect(()=>()=>{A.current&&clearTimeout(A.current)},[]),i.useEffect(()=>{if(c!=="saved"&&c!=="error")return;const N=setTimeout(()=>u("idle"),2e3);return()=>clearTimeout(N)},[c]);const R=i.useCallback(N=>{A.current&&(clearTimeout(A.current),A.current=null),N!==P.current&&(P.current=N,u("saving"),Promise.resolve(n({system_prompt:N})).then(()=>u("saved")).catch(()=>{P.current=null,u("error")}))},[n]),X=N=>{W(N),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{A.current=null,R(N)},pb)},ae=typeof e.params?.tensor_parallel=="number"?e.params.tensor_parallel:8;return o.jsxs("div",{className:Y("flex h-full flex-col border-s border-border bg-surface",!r&&"hidden"),children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-border px-6 py-4",children:[o.jsx("div",{className:wt,children:s("maas.inspector.title")}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-6 w-6","aria-label":s("maas.inspector.close"),onClick:()=>a(!1),children:o.jsx(Rn,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 px-6 py-5",children:[o.jsxs("div",{children:[o.jsx("div",{className:wt,children:s("maas.inspector.temporaryChat")}),o.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s("maas.inspector.temporaryChatDescription")})]}),o.jsx(Da,{checked:e.temporary,onCheckedChange:N=>n({temporary:N})})]}),o.jsxs("section",{className:bn,children:[o.jsx("div",{className:wt,children:s("maas.inspector.systemPrompt")}),o.jsx(_s,{value:E,onChange:N=>X(N.target.value),onBlur:()=>R(E),placeholder:s("maas.inspector.systemPromptPlaceholder"),className:"mt-3 min-h-[100px] resize-y bg-surface-elevated"}),o.jsx("div",{role:"status","aria-live":"polite",className:Y("mt-1 min-h-[1rem] text-end text-xs",c==="error"?"text-destructive":"text-hydro"),children:c==="saved"?s("maas.inspector.saved"):c==="error"?s("maas.inspector.saveFailed"):null})]}),o.jsxs("section",{className:bn,children:[o.jsx("div",{className:wt,children:s("maas.inspector.parameters")}),o.jsxs("div",{className:"mt-3 space-y-4",children:[o.jsx("div",{className:"space-y-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Jt,{className:"text-xs text-muted-foreground",children:s("maas.inspector.model")}),o.jsx("span",{className:"font-mono text-xs tabular-nums",children:e.model})]})}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Jt,{className:"text-xs text-muted-foreground",children:s("maas.inspector.temperature")}),o.jsx("span",{className:"font-mono text-xs tabular-nums",children:x(_,2)})]}),o.jsx(Tt,{value:[_],min:0,max:2,step:.01,onValueChange:([N])=>L("temperature",N),onValueCommit:([N])=>D("temperature",N)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Jt,{className:"text-xs text-muted-foreground",children:s("maas.inspector.maxTokens")}),o.jsx("span",{className:"font-mono text-xs tabular-nums",children:x(M)})]}),o.jsx(Tt,{value:[M],min:256,max:8192,step:256,onValueChange:([N])=>L("max_tokens",N),onValueCommit:([N])=>D("max_tokens",N)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Jt,{className:"text-xs text-muted-foreground",children:s("maas.inspector.topP")}
58),o.jsx("span",{className:"font-mono text-xs tabular-nums",children:x(O,2)})]}),o.jsx(Tt,{value:[O],min:0,max:1,step:.01,onValueChange:([N])=>L("top_p",N),onValueCommit:([N])=>D("top_p",N)})]})]})]}),o.jsxs("section",{className:bn,children:[o.jsx("div",{className:wt,children:s("maas.inspector.usage")}),o.jsxs("dl",{className:Y("mt-3",So),children:[o.jsxs("div",{className:qe,children:[o.jsx("dt",{className:"text-muted-foreground",children:s("maas.inspector.messages")}),o.jsx("dd",{children:x(m.messageCount)})]}),o.jsxs("div",{className:qe,children:[o.jsx("dt",{className:"text-muted-foreground",children:s("maas.inspector.promptTokens")}),o.jsx("dd",{children:x(m.promptTokens)})]}),o.jsxs("div",{className:qe,children:[o.jsx("dt",{className:"text-muted-foreground",children:s("maas.inspector.completionTokens")}),o.jsx("dd",{children:x(m.completionTokens)})]}),o.jsxs("div",{className:Y(qe,"border-t border-border pt-2"),children:[o.jsx("dt",{className:"text-muted-foreground",children:s("maas.inspector.totalCost")}),o.jsx("dd",{children:w(m.costMicro)})]})]}),g&&o.jsxs("svg",{viewBox:"0 0 204 50",className:"mt-3 h-12 w-full",role:"img","aria-label":s("maas.inspector.completionTokensChart"),children:[o.jsx("line",{x1:"0",y1:"45",x2:"200",y2:"45",stroke:"var(--border)",strokeWidth:"1"}),o.jsx("path",{d:g.path,fill:"none",stroke:"var(--hydro)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("circle",{cx:g.last.x,cy:g.last.y,r:"2",fill:"var(--hydro)"})]})]}),p&&o.jsxs("section",{className:bn,children:[o.jsx("div",{className:wt,children:s("maas.inspector.planUsage")}),p.has_subscription?o.jsxs(o.Fragment,{children:[o.jsxs("dl",{className:Y("mt-3",So),children:[o.jsxs("div",{className:qe,children:[o.jsx("dt",{className:"text-muted-foreground",children:s("maas.inspector.planName")}),o.jsx("dd",{children:p.plan||"—"})]}),o.jsxs("div",{className:qe,children:[o.jsx("dt",{className:"text-muted-foreground",children:s("maas.inspector.planSeats")}),o.jsx("dd",{children:x(p.seats)})]}),p.period_end&&v(p.period_end)&&o.jsxs("div",{className:qe,children:[o.jsx("dt",{className:"text-muted-foreground",children:s("maas.inspector.planRenews")}),o.jsx("dd",{children:v(p.period_end)})]})]}),y.length>0&&o.jsx("div",{className:"mt-4 space-y-3",children:y.map(N=>{const T=N.exceeded&&N.window==="month"&&p.overage_allowed,U=N.exceeded&&!T,B=N.limit!==null&&N.limit>0?Math.min(100,N.used/N.limit*100):null,K=b(N.resets_at),$=[U?s("maas.inspector.planLimitReached"):null,T?s("maas.inspector.planOverage"):null,K?s("maas.inspector.planResets",{when:K}):null].filter(Q=>Q!==null);return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[o.jsx("span",{className:wt,children:s(mb[N.window])}),o.jsx("span",{dir:N.limit===null?void 0:"ltr",className:Y("font-mono text-[11px] tabular-nums",U?"text-destructive":"text-foreground"),children:N.limit===null?`${x(N.used)} · ${s("maas.inspector.planUnmetered")}`:`${x(N.used)} / ${x(N.limit)}`})]}),B!==null&&o.jsx("div",{"aria-hidden":"true",className:"mt-1.5 h-[3px] w-full overflow-hidden rounded-full bg-border",children:o.jsx("div",{className:Y("h-full rounded-full",U?"bg-destructive":"bg-hydro"),style:{width:`${B}%`}})}),$.length>0&&o.jsx("p",{className:Y("mt-1.5 font-mono text-[10px] leading-[1.5]",U?"text-destructive":T?"text-hydro":"text-muted-foreground"),children:$.join(" · ")})]},N.window)})})]}):o.jsx("p",{className:"mt-3 text-[13px] leading-relaxed text-muted-foreground",children:s("maas.inspector.planPayAsYouGo")})]}),o.jsxs("section",{className:bn,children:[o.jsx("div",{className:wt,children:s("maas.inspector.residency")}),o.jsx("p",{className:"mt-3 text-[13px] leading-relaxed text-hydro",children:s("maas.inspector.residencyStatement")}),o.jsxs("dl",{className:Y("mt-4",So),children:[o.jsxs("div",{className:qe,children:[o.jsx("dt",{className:"text-muted-foreground",children:s("maas.inspector.region")}),o.jsx("dd",{children:s("maas.inspector.regionValue")})]}),o.jsxs("div",{className:qe,children:[o.jsx("dt",{className:"text-muted-foreground",children:s("maas.inspector.upstreamHost")}),o.jsx("dd",{children:e.params?.upstream_host||"api.exducer.ai"})]}),o.jsxs("div",{className:qe,children:[o.jsx("dt",{className:"text-muted-foreground",children:s("maas.inspector.tensorParallel")}),o.jsx("dd",{children:x(ae)})]}),o.jsxs("div",{className:qe,children:[o.jsx("dt",{className:"text-muted-foreground",children:s("maas.inspector.retention")}),o.jsx("dd",{children:s("maas.inspector.retentionValue")})]}),o.jsxs("div",{className:"flex items-center justify-between gap-4 font-mono text-[12px] tabular-nums",children:[o.jsx("dt",{className:"text-muted-foreground",children:s("maas.inspector.attestation")}),o.jsxs("dd",{className:"flex items-center gap-1",children:[o.jsx("span",{children:e.params?.attestation_hash?.slice(0,12)||"—"}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-5 w-5","aria-label":s("maas.inspector.copyAttestation"),onClick:S,children:d?o.jsx(ln,{className:"h-3 w-3 text-hydro"}):o.jsx(An,{className:"h-3 w-3"})}),o.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:d?s("maas.inspector.copied"):""})]})]})]})]})]})]})}var Ss=1,gb=.9,xb=.8,vb=.17,No=.1,Co=.999,yb=.9999,wb=.99,bb=/[\\\/_+.#"@\[\(\{&]/,Sb=/[\\\/_+.#"@\[\(\{&]/g,Nb=/[\s-]/,dd=/[\s-]/g;function Jo(e,t,n,r,a,s,l){if(s===t.length)return a===e.length?Ss:wb;var c=`${a},${s}`;if(l[c]!==void 0)return l[c];for(var u=r.charAt(s),d=n.indexOf(u,a),f=0,m,h,g,x;d>=0;)m=Jo(e,t,n,r,d+1,s+1,l),m>f&&(d===a?m*=Ss:bb.test(e.charAt(d-1))?(m*=xb,g=e.slice(a,d-1).match(Sb),g&&a>0&&(m*=Math.pow(Co,g.length))):Nb.test(e.charAt(d-1))?(m*=gb,x=e.slice(a,d-1).match(dd),x&&a>0&&(m*=Math.pow(Co,x.length))):(m*=vb,a>0&&(m*=Math.pow(Co,d-a))),e.charAt(d)!==t.charAt(s)&&(m*=yb)),(m<No&&n.charAt(d-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(d-1)!==r.charAt(s))&&(h=Jo(e,t,n,r,d+1,s+2,l),h*No>m&&(m=h*No)),m>f&&(f=m),d=n.indexOf(u,d+1);return l[c]=f,f}function Ns(e){return e.toLowerCase().replace(dd," ")}function Cb(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Jo(e,t,Ns(e),Ns(t),0,0,{})}var Sn='[cmdk-group=""]',jo='[cmdk-group-items=""]',jb='[cmdk-group-heading=""]',fd='[cmdk-item=""]',Cs=`${fd}:not([aria-disabled="true"])`,ea="cmdk-item-select",Qt="data-value",Rb=(e,t,n
vendor: 10,107 bytes, line 58
58)=>Cb(e,t,n),md=i.createContext(void 0),Kn=()=>i.useContext(md),pd=i.createContext(void 0),Ta=()=>i.useContext(pd),hd=i.createContext(void 0),gd=i.forwardRef((e,t)=>{let n=Zt(()=>{var N,T;return{search:"",value:(T=(N=e.value)!=null?N:e.defaultValue)!=null?T:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Zt(()=>new Set),a=Zt(()=>new Map),s=Zt(()=>new Map),l=Zt(()=>new Set),c=xd(e),{label:u,children:d,value:f,onValueChange:m,filter:h,shouldFilter:g,loop:x,disablePointerSelection:p=!1,vimBindings:y=!0,...v}=e,b=Re(),w=Re(),S=Re(),j=i.useRef(null),k=$b();Ft(()=>{if(f!==void 0){let N=f.trim();n.current.value=N,C.emit()}},[f]),Ft(()=>{k(6,E)},[]);let C=i.useMemo(()=>({subscribe:N=>(l.current.add(N),()=>l.current.delete(N)),snapshot:()=>n.current,setState:(N,T,U)=>{var B,K,$,Q;if(!Object.is(n.current[N],T)){if(n.current[N]=T,N==="search")D(),O(),k(1,L);else if(N==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(S);re?re.focus():(B=document.getElementById(b))==null||B.focus()}if(k(7,()=>{var re;n.current.selectedItemId=(re=W())==null?void 0:re.id,C.emit()}),U||k(5,E),((K=c.current)==null?void 0:K.value)!==void 0){let re=T??"";(Q=($=c.current).onValueChange)==null||Q.call($,re);return}}C.emit()}},emit:()=>{l.current.forEach(N=>N())}}),[]),_=i.useMemo(()=>({value:(N,T,U)=>{var B;T!==((B=s.current.get(N))==null?void 0:B.value)&&(s.current.set(N,{value:T,keywords:U}),n.current.filtered.items.set(N,M(T,U)),k(2,()=>{O(),C.emit()}))},item:(N,T)=>(r.current.add(N),T&&(a.current.has(T)?a.current.get(T).add(N):a.current.set(T,new Set([N]))),k(3,()=>{D(),O(),n.current.value||L(),C.emit()}),()=>{s.current.delete(N),r.current.delete(N),n.current.filtered.items.delete(N);let U=W();k(4,()=>{D(),U?.getAttribute("id")===N&&L(),C.emit()})}),group:N=>(a.current.has(N)||a.current.set(N,new Set),()=>{s.current.delete(N),a.current.delete(N)}),filter:()=>c.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:b,inputId:S,labelId:w,listInnerRef:j}),[]);function M(N,T){var U,B;let K=(B=(U=c.current)==null?void 0:U.filter)!=null?B:Rb;return N?K(N,n.current.search,T):0}function O(){if(!n.current.search||c.current.shouldFilter===!1)return;let N=n.current.filtered.items,T=[];n.current.filtered.groups.forEach(B=>{let K=a.current.get(B),$=0;K.forEach(Q=>{let re=N.get(Q);$=Math.max(re,$)}),T.push([B,$])});let U=j.current;P().sort((B,K)=>{var $,Q;let re=B.getAttribute("id"),ne=K.getAttribute("id");return(($=N.get(ne))!=null?$:0)-((Q=N.get(re))!=null?Q:0)}).forEach(B=>{let K=B.closest(jo);K?K.appendChild(B.parentElement===K?B:B.closest(`${jo} > *`)):U.appendChild(B.parentElement===U?B:B.closest(`${jo} > *`))}),T.sort((B,K)=>K[1]-B[1]).forEach(B=>{var K;let $=(K=j.current)==null?void 0:K.querySelector(`${Sn}[${Qt}="${encodeURIComponent(B[0])}"]`);$?.parentElement.appendChild($)})}function L(){let N=P().find(U=>U.getAttribute("aria-disabled")!=="true"),T=N?.getAttribute(Qt);C.setState("value",T||void 0)}function D(){var N,T,U,B;if(!n.current.search||c.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let K=0;for(let $ of r.current){let Q=(T=(N=s.current.get($))==null?void 0:N.value)!=null?T:"",re=(B=(U=s.current.get($))==null?void 0:U.keywords)!=null?B:[],ne=M(Q,re);n.current.filtered.items.set($,ne),ne>0&&K++}for(let[$,Q]of a.current)for(let re of Q)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add($);break}n.current.filtered.count=K}function E(){var N,T,U;let B=W();B&&(((N=B.parentElement)==null?void 0:N.firstChild)===B&&((U=(T=B.closest(Sn))==null?void 0:T.querySelector(jb))==null||U.scrollIntoView({block:"nearest"})),B.scrollIntoView({block:"nearest"}))}function W(){var N;return(N=j.current)==null?void 0:N.querySelector(`${fd}[aria-selected="true"]`)}function P(){var N;return Array.from(((N=j.current)==null?void 0:N.querySelectorAll(Cs))||[])}function A(N){let T=P()[N];T&&C.setState("value",T.getAttribute(Qt))}function H(N){var T;let U=W(),B=P(),K=B.findIndex(Q=>Q===U),$=B[K+N];(T=c.current)!=null&&T.loop&&($=K+N<0?B[B.length-1]:K+N===B.length?B[0]:B[K+N]),$&&C.setState("value",$.getAttribute(Qt))}function F(N){let T=W(),U=T?.closest(Sn),B;for(;U&&!B;)U=N>0?Ib(U,Sn):Ob(U,Sn),B=U?.querySelector(Cs);B?C.setState("value",B.getAttribute(Qt)):H(N)}let R=()=>A(P().length-1),X=N=>{N.preventDefault(),N.metaKey?R():N.altKey?F(1):H(1)},ae=N=>{N.preventDefault(),N.metaKey?A(0):N.altKey?F(-1):H(-1)};return i.createElement(Z.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:N=>{var T;(T=v.onKeyDown)==null||T.call(v,N);let U=N.nativeEvent.isComposing||N.keyCode===229;if(!(N.defaultPrevented||U))switch(N.key){case"n":case"j":{y&&N.ctrlKey&&X(N);break}case"ArrowDown":{X(N);break}case"p":case"k":{y&&N.ctrlKey&&ae(N);break}case"ArrowUp":{ae(N);break}case"Home":{N.preventDefault(),A(0);break}case"End":{N.preventDefault(),R();break}case"Enter":{N.preventDefault();let B=W();if(B){let K=new Event(ea);B.dispatchEvent(K)}}}}},i.createElement("label",{"cmdk-label":"",htmlFor:_.inputId,id:_.labelId,style:Fb},u),Jr(e,N=>i.createElement(pd.Provider,{value:C},i.createElement(md.Provider,{value:_},N))))}),Eb=i.forwardRef((e,t)=>{var n,r;let a=Re(),s=i.useRef(null),l=i.useContext(hd),c=Kn(),u=xd(e),d=(r=(n=u.current)==null?void 0:n.forceMount)!=null?r:l?.forceMount;Ft(()=>{if(!d)return c.item(a,l?.id)},[d]);let f=vd(a,s,[e.value,e.children,s],e.keywords),m=Ta(),h=jt(k=>k.value&&k.value===f.current),g=jt(k=>d||c.filter()===!1?!0:k.search?k.filtered.items.get(a)>0:!0);i.useEffect(()=>{let k=s.current;if(!(!k||e.disabled))return k.addEventListener(ea,x),()=>k.removeEventListener(ea,x)},[g,e.onSelect,e.disabled]);function x(){var k,C;p(),(C=(k=u.current).onSelect)==null||C.call(k,f.current)}function p(){m.setState("value",f.current,!0)}if(!g)return null;let{disabled:y,value:v,onSelect:b,forceMount:w,keywords:S,...j}=e;return i.createElement(Z.div,{ref:We(s,t),...j,id:a,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!h,"data-disabled":!!y,"data-selected":!!h,onPointerMove:y||c.getDisablePointerSelection()?void 0:p,onClick:y?void 0:x},e.children)}),_b=i.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...s}=e,l=Re(),c=i.useRef(null),u=i.useRef(null),d=Re(),f=Kn(),m=jt(g=>a||f.filter()===!1?!0:g.search?g.filtered.groups.has(l):!0);Ft(()=>f.group(l),[]),vd(l,c,[e.value,e.heading,u]);let h=i.useMemo(()=>({id:l,forceMount:a}),[a]);return i.createElement(Z.div,{ref:We(c,t),...s,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&i.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),Jr(e,g=>i.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},i.createElement(hd.Provider,{value:h},g))))}),kb=i.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=i.useRef(null),s=jt(l=>!l.search);return!n&&!s?null:i.createElement(Z.div,{ref:We(a,t),...r,"cmdk-separator":"",role:"separator"})}),Pb=i.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,s=Ta(),l=jt(d=>d.search),c=jt(d=>d.selectedItemId),u=Kn();return i.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),i.createElement(Z.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":c,id:u.inputId,type:"text",value:a?e.value:l,onChange:d=>{a||s.setState("search",d.target.value),n?.(d.target.value)}})}),Mb=i.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...a}=e,s=i.useRef(null),l=i.useRef(null),c=jt(d=>d.selectedItemId),u=Kn();return i.useEffect(()=>{if(l.current&&s.current){let d=l.current,f=s.current,m,h=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let g=d.offsetHeight;f.style.setProperty("--cmdk-list-height",g.toFixed(1)+"px")})});return h.observe(d),()=>{cancelAnimationFrame(m),h.unobserve(d)}}},[]),i.createElement(Z.div,{ref:We(s,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:u.listId},Jr(e,d=>i.createElement("div",{ref:We(l,u.listInnerRef),"cmdk-list-sizer":""},d)))}),Ab=i.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:s,container:l,...c}=e;return i.createElement($n,{open:n,onOpenChange:r},i.createElement(Ln,{container:l},i.createElement(Bt,{"cmdk-overlay":"",className:a}),i.createElement(Ht,{"aria-label":e.label,"cmdk-dialog":"",className:s},i.createElement(gd,{ref:t,...c}))))}),Db=i.forwardRef((e,t)=>jt(n=>n.filtered.count===0)?i.createElement(Z.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Tb=i.forwardRef((e,t)=>{let{progress:n,children:r,label:a="Loading...",...s}=e;return i.createElement(Z.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Jr(e,l=>i.createElement("div",{"aria-hidden":!0},l)))}),Oe=Object.assign(gd,{List:Mb,Item:Eb,Input:Pb,Group:_b,Separator:kb,Dialog:Ab,Empty:Db,Loading:Tb});function Ib(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ob(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function xd(e){let t=i.useRef(e);return Ft(()=>{t.current=e}),t}var Ft=typeof window>"u"?i.useEffect:i.useLayoutEffect;function Zt(e){let t=i.useRef();return t.current===void 0&&(t.current=e()),t}function jt(e){let t=Ta(),n=()=>e(t.snapshot());return i.useSyncExternalStore(t.subscribe,n,n)}function vd(e,t,n,r=[]){let a=i.useRef(),s=Kn();return Ft(()=>{var l;let c=(()=>{var d;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(d=f.current.textContent)==null?void 0:d.trim():a.current}})(),u=r.map(d=>d.trim());s.value(e,c,u),(l=t.current)==null||l.setAttribute(Qt,c),a.current=c}),a}var $b=()=>{let[e,t]=i.useState(),n=Zt(()=>new Map);return Ft(()=>{n.current.forEach(r=>
58r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),t({})}};function Lb(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Jr({asChild:e,children:t},n){return e&&i.isValidElement(t)?i.cloneElement(Lb(t),{ref:t.ref},n(t.props.children)):n(t)}var Fb={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Bb=$n,Hb=Ln,yd=i.forwardRef(({className:e,...t},n)=>o.jsx(Bt,{ref:n,className:Y("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));yd.displayName=Bt.displayName;const wd=i.forwardRef(({className:e,children:t,...n},r)=>o.jsxs(Hb,{children:[o.jsx(yd,{}),o.jsxs(Ht,{ref:r,className:Y("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,o.jsxs(Tr,{className:"absolute right-4 top-4 roun
58ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(kr,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));wd.displayName=Ht.displayName;const bd=i.forwardRef(({className:e,...t},n)=>o.jsx(un,{ref:n,className:Y("text-lg font-semibold leading-none tracking-tight",e),...t}));bd.displayName=un.displayName;const Wb=i.forwardRef(({className:e,...t},n)=>o.jsx(dn,{ref:n,className:Y("text-sm text-muted-foreground",e),...t}));Wb.displayName=dn.displayName;const Sd=i.forwardRef(({className:e,...t},n)=>o.jsx(Oe,{ref:n,className:Y("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Sd.displayName=Oe.displayName;const Nd=i.forwardRef(({className:e,...t},n)=>o.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[o.jsx(_o,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),o.jsx(Oe.Input,{ref:n,className:Y("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));Nd.displayName=Oe.Input.displayName;const Cd=i.forwardRef(({className:e,...t},n)=>o.jsx(Oe.List,{ref:n,className:Y("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Cd.displayName=Oe.List.displayName;const jd=i.forwardRef((e,t)=>o.jsx(Oe.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));jd.displayName=Oe.Empty.displayName;const jn=i.forwardRef(({className:e,...t},n)=>o.jsx(Oe.Group,{ref:n,className:Y("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));jn.displayName=Oe.Group.displayName;const Vb=i.forwardRef(({className:e,...t},n)=>o.jsx(Oe.Separator,{ref:n,className:Y("-mx-1 h-px bg-border",e),...t}));Vb.displayName=Oe.Separator.displayName;const Se=i.forwardRef(({className:e,...t},n)=>o.jsx(Oe.Item,{ref:n,className:Y("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Se.displayName=Oe.Item.displayName;const Ub=e=>{if(!(e instanceof HTMLElement))return!1;const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||e.isContentEditable||e.getAttribute("role")==="textbox"},zb=e=>e instanceof HTMLElement&&e.tagName.toLowerCase()==="textarea",Kb=()=>typeof navigator>"u"?!1:navigator.platform.toLowerCase().includes("mac"),ir="[&_[cmdk-group-heading]]:font-mono [&_[cmdk-group-heading]]:text-[10px] [&_[cmdk-group-heading]]:font-normal [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:tracking-[0.14em] [&_[cmdk-group-heading]]:text-muted-foreground",cr=({children:e})=>o.jsx("span",{className:"ms-auto font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:e});function qb({open:e,onOpenChange:t,onSelectConversation:n,onNew:r,onNavigate:a,onToggleSidebar:s,onToggleInspector:l,onExport:c,onStopStreaming:u,streaming:d}){const{t:f}=Ve(),[m,h]=i.useState(""),g=m.trim(),x=g.length>=2,{data:p,isLoading:y}=Fl(m),v=p?.results?.slice(0,8)??[],b=x&&(y||p===void 0),w=M=>`${M} ${g}`;i.useEffect(()=>{e||h("")},[e]),i.useEffect(()=>{const M=O=>{const L=O.metaKey||O.ctrlKey;if(L&&!O.altKey&&(O.key==="k"||O.key==="K")){O.preventDefault(),t(!e);return}if(L&&!O.altKey&&!O.shiftKey&&(O.key==="n"||O.key==="N")){O.preventDefault(),r(),t(!1);return}if(O.key==="Escape"&&!e&&d&&u){if(Ub(O.target)&&!zb(O.target))return;O.preventDefault(),u()}};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[e,t,r,u,d]);const S=M=>{n({id:M}),t(!1)},j=M=>{a(M),t(!1)},k=()=>{r(),t(!1)},C=()=>{r({temporary:!0}),t(!1)},_=Kb()?"⌘":f("maas.palette.ctrlKey");return o.jsx(Bb,{open:e,onOpenChange:t,children:o.jsxs(wd,{className:"overflow-hidden rounded-lg border-border bg-surface p-0 shadow-none [&>button:last-child]:hidden",children:[o.jsx(bd,{className:"sr-only",children:f("maas.palette.title")}),o.jsxs(Sd,{className:"bg-transparent text-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:border-t [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:border-border [&_[cmdk-group]]:px-2 [&_[cmdk-group]]:py-2 [&_[cmdk-input-wrapper]]:border-border [&_[cmdk-input]]:h-11",children:[o.jsx(Nd,{value:m,onValueChange:h,placeholder:f("maas.palette.searchPlaceholder")}),o.jsxs(Cd,{children:[o.jsx(jd,{children:f("maas.palette.noResults")}),o.jsxs(jn,{className:ir,heading:f("maas.palette.actions"),children:[o.jsxs(Se,{onSelect:k,children:[o.jsx(F
58a,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.newChat")}),o.jsx(cr,{children:f("maas.palette.newChatShortcut",{mod:_})})]}),s&&o.jsxs(Se,{onSelect:()=>{s(),t(!1)},children:[o.jsx(Ls,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.toggleSidebar")})]}),l&&o.jsxs(Se,{onSelect:()=>{l(),t(!1)},children:[o.jsx(Fs,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.toggleInspector")})]}),o.jsxs(Se,{onSelect:C,children:[o.jsx(Ba,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.temporaryChat")})]}),c&&o.jsxs(Se,{onSelect:()=>{c(),t(!1)},children:[o.jsx(mr,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.exportCurrent")})]}),o.jsxs(Se,{onSelect:()=>j("/portal/account"),children:[o.jsx(Vf,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.settings")})]})]}),o.jsxs(jn,{className:ir,heading:f("maas.palette.navigation"),children:[o.jsxs(Se,{onSelect:()=>j("/portal"),children:[o.jsx(zf,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.marketplace")})]}),o.jsxs(Se,{onSelect:()=>j("/portal/dashboard"),children:[o.jsx(Ff,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.rentals")})]}),o.jsxs(Se,{onSelect:()=>j("/portal/billing"),children:[o.jsx(hf,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.billing")})]}),o.jsxs(Se,{onSelect:()=>j("/portal/usage"),children:[o.jsx(Kd,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.usage")})]}),o.jsxs(Se,{onSelect:()=>j("/portal/storage"),children:[o.jsx(Xd,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.storage")})]}),o.jsxs(Se,{onSelect:()=>j("/portal/support"),children:[o.jsx(qd,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.support")})]}),o.jsxs(Se,{onSelect:()=>j("/portal/account"),children:[o.jsx(lf,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.account")}
58)]})]}),x&&o.jsx(jn,{className:ir,heading:f("maas.palette.conversations"),children:b?o.jsx(Se,{value:w("conversations-loading"),disabled:!0,children:o.jsxs("div",{role:"status","aria-label":f("maas.palette.searching"),className:"flex w-full flex-col gap-1.5",children:[o.jsx(St,{className:"h-3 w-1/3"}),o.jsx(St,{className:"h-3 w-2/3"})]})}):v.length>0?v.map(M=>o.jsxs(Se,{value:w(`conversation-${M.message_id}`),onSelect:()=>S(M.conversation_id),children:[o.jsx(Gd,{className:"me-2 h-4 w-4 shrink-0 text-hydro"}),o.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[o.jsx("span",{className:"truncate",children:M.title}),o.jsx("span",{className:"line-clamp-1 text-xs text-muted-foreground",children:M.snippet})]})]},M.message_id)):o.jsx(Se,{value:w("conversations-empty"),disabled:!0,className:"text-muted-foreground",children:f("maas.palette.noConversations")})}),o.jsxs(jn,{className:ir,heading:f("maas.palette.shortcuts"),children:[o.jsxs(Se,{disabled:!0,children:[o.jsx(Cf,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.title")}),o.jsx(cr,{children:f("maas.palette.paletteShortcut",{mod:_})})]}),o.jsxs(Se,{disabled:!0,children:[o.jsx(Fa,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.palette.newChat")}),o.jsx(cr,{children:f("maas.palette.newChatShortcut",{mod:_})})]}),u&&o.jsxs(Se,{disabled:!0,children:[o.jsx(Ba,{className:"me-2 h-4 w-4"}),o.jsx("span",{children:f("maas.composer.stop")}),o.jsx(cr,{children:f("maas.palette.escapeKey")})]})]})]})]})]})})}function Gb({n:e,children:t}){return o.jsxs("div",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:["§ ",e," · ",t]})}function lr({children:e}){return o.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-border px-2.5 py-1 font-mono text-[10px] tracking-wide text-foreground",children:[o.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{background:"var(--spruce-400)"},"aria-hidden":!0}),e]})}function Yb({label:e}){return o.jsx("div",{className:"h-full overflow-hidden px-4 py-6 sm:px-6",role:"status","aria-label":e,children:o.jsx("div",{className:"mx-auto flex max-w-3xl flex-col gap-8",children:[0,1,2].map(t=>o.jsx("div",{className:t%2===0?"flex justify-end":"flex justify-start",children:o.jsxs("div",{className:t%2===0?"w-2/3 space-y-2":"w-full space-y-2",children:[o.jsx(St,{className:"h-3 w-24"}),o.jsx(St,{className:"h-3 w-full"}),o.jsx(St,{className:"h-3 w-5/6"})]})},t))})})}function js(e,t,n=10){try{const r=localStorage.getItem(e);if(!r)return t;const a=Number.parseFloat(r);return Number.isFinite(a)&&a>=n&&a<=100?a:t}catch{return t}}function l0(){const{t:e,i18n:t}=Ve(),n=Es(),r=Id({from:"/portal/chat"}),{toast:a}=Wd(),s=sn(),[l,c]=i.useState(()=>{try{return localStorage.getItem("chat.sidebarOpen")!=="false"}catch{return!0}}),[u,d]=i.useState(()=>{try{return localStorage.getItem("chat.inspectorOpen")==="true"}catch{return!1}}),[f,m]=i.useState(()=>js("chat.sidebarSize",22,15)),[h,g]=i.useState(()=>js("chat.inspectorSize",26,20)),[x,p]=i.useState(!1),[y,v]=i.useState(!1),[b,w]=i.useState(!1),[S,j]=i.useState(""),[k,C]=i.useState(!1),[_,M]=i.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(max-width: 1023px)").matches),[O,L]=i.useState(()=>typeof navigator>"u"?!0:navigator.onLine),D=r.c,{data:E,isError:W}=ey(D??""),[P,A]=i.useState(""),[H,F]=i.useState([]),[R,X]=i.useState(!1),ae=i.useRef(new Set),N=i.useRef(0),{data:T}=ly(),[U,B]=i.useState("");i.useEffect(()=>{!U&&T?.model&&B(T.model)},[U,T?.model]);const[K,$]=i.useState({temperature:.7,max_tokens:4096,top_p:.95,thinking:!1});i.useEffect(()=>{const z=E?.params;z&&$(ce=>({...ce,...z}))},[E?.id]);const{data:Q,isLoading:re}=ty(D??""),ne=$l(),J=Ll(),ue=i.useCallback(z=>{$(z),D&&J.mutate({id:D,params:z})},[D,J]),{send:xe,regenerate:I,stop:me,streaming:ve,streamingText:Ie,streamingReasoning:Vt,streamingMessageId:Pt,error:V}=iy(),[te,pe]=i.useState(null),[we,_e]=i.useState(!1),tt=i.useRef(null),[Ut,ft]=i.useState(null),nt=i.useRef(new Set),$e=i.useMemo(()=>Q?.messages??[],[Q]),Mt=i.useMemo(()=>$e.some(z=>z.role==="assistant"&&!z.error),[$e]);i.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const z=window.matchMedia("(max-width: 1023px)"),ce=be=>M(be.matches);return M(z.matches),z.addEventListener("change",ce),()=>z.removeEventListener("change",ce)},[]),i.useEffect(()=>{const z=()=>L(!0),ce=()=>L(!1);return L(navigator.onLine),window.addEventListener("online",z),window.addEventListener("offline",ce),()=>{window.removeEventListener("online",z),window.removeEventListener("offline",ce)}},[]),i.useEffect(()=>{try{localStorage.setItem("chat.sidebarOpen",String(l))}catch{}},[l]),i.useEffect(()=>{try{localStorage.setItem("chat.inspectorOpen",String(u))}catch{}},[u]),i.useEffect(()=>{try{Number.isFinite(f)&&localStorage.setItem("chat.sidebarSize",String(f))}catch{}},[f]),i.useEffect(()=>{try{Number.isFinite(h)&&localStorage.setItem("chat.inspectorSize",String(h))}catch{}},[h]),i.useEffect(()=>{E&&j(E.title)},[E?.id,E?.title]),i.useEffect(()=>{V&&_e(!1)},[V]),i.useEffect(()=>{pe(null),_e(!1),ft(null),w(!1),tt.current=null},[D]);const Le=we?null:te??V??null,mt=i.useMemo(()=>Le?!O&&Le.code!=="insufficient_credit"?{code:"offline",message:e("maas.chat.offlineError")}:Le.code==="insufficient_credit"?{...Le,message:e("maas.chat.insufficientCredit")}:Le.code==="preempted"?{...Le,message:e("maas.chat.preempted")}:Le.code==="create_failed"?Le:{code:Le.code||"upstream",message:e("maas.chat.upstreamError"),retryAfter:Le.retryAfter}:null,[Le,O,e]),qn=i.useCallback(()=>{pe(null),_e(!0)},[]),{mutate:Gn}=Mn({mutationFn:z=>Wv(z),onSuccess:(z,ce)=>{s.invalidateQueries({queryKey:Ce.conversation(ce)}),s.invalidateQueries({queryKey:Ce.conversations})}});i.useEffect(()=>{ve||!D||!E||E.title_generated||!Mt||nt.current.has(D)||(nt.current.add(D),Gn(D))},[ve,D,E,E?.title_generated,Mt,Gn]);const Yn=i.useCallback(z=>{n({to:"/portal/chat",search:{c:z}}),p(!1)},[n]),zt=i.useCallback(async()=>{pe(null),_e(!1);try{const z=await ne.mutateAsync({model:U||T?.model||"",params:K});n({to:"/portal/chat",search:{c:z.id}}),p(!1)}catch(z){pe({code:"create_failed",message:z instanceof pt&&z.code==="insufficient_credit"?e("maas.chat.insufficientCredit"):e("maas.chat.errorCreate")})}},[ne,n,e]),Kt=i.useCallback(z=>{z&&(URL.revokeObjectURL(z),ae.current.delete(z))},[]),Xn=i.useCallback(()=>{F(z=>(z.forEach(ce=>Kt(ce.previewUrl)),[]))},[Kt]);i.useEffect(()=>{const z=ae.current;return()=>{z.forEach(ce=>URL.revokeObjectURL(ce)),z.clear()}},[]);const ee=i.useCallback(z=>{const ce=[];let be=null;for(const ge of z){const Ae=Il.includes(ge.type),Te=Ol.includes(ge.type);if(!Ae&&!Te){be=e("maas.chat.attachUnsupported",{name:ge.name});continue}if(ge.size>Xv){be=e("maas.chat.attachTooLarge",{name:ge.name});continue}const to=Ae?URL.createObjectURL(ge):void 0;to&&ae.current.add(to),N.current+=1,ce.push({key:`st_${N.current}`,name:ge.name,kind:Ae?"image":"document",bytes:ge.size,previewUrl:to,file:ge})}ce.length&&F(ge=>[...ge,...ce]),be&&a({title:be,variant:"destructive"})},[e,a]),de=i.useCallback(z=>{F(ce=>{const be=ce.find(ge=>ge.key===z);
58return Kt(be?.previewUrl),ce.filter(ge=>ge.key!==z)})},[Kt]),ie=i.useCallback(async(z,ce)=>{const be=z.trim(),ge=H;if(!be&&ge.length===0)return;pe(null),_e(!1),tt.current={kind:"send",content:be,parentId:ce};let Ae=D;if(!Ae)try{const Te=await ne.mutateAsync({model:U||T?.model||"",params:K});Ae=Te.id,n({to:"/portal/chat",search:{c:Te.id},replace:!0})}catch(Te){pe({code:"create_failed",message:Te instanceof pt&&Te.code==="insufficient_credit"?e("maas.chat.insufficientCredit"):e("maas.chat.errorCreate")});return}if(ge.length){X(!0);try{for(const Te of ge)await Zv(Ae,Te.file)}catch(Te){pe({code:"attach_failed",message:Te instanceof pt&&Te.message?Te.message:e("maas.chat.attachFailed")});return}finally{X(!1)}Xn()}await xe(Ae,be,ce)},[D,Xn,ne,U,K,n,xe,T,H,e]),se=i.useCallback(()=>{me()},[me]),he=i.useCallback(async z=>{D&&(pe(null),_e(!1),tt.current={kind:"regenerate",messageId:z},await I(D,z))},[D,I]),Me=i.useCallback((z,ce)=>{const be=$e.find(Te=>Te.id===z),ge=be?.parent_id??void 0,Ae=typeof ce=="string"?ce.trim():"";if(Ae&&Ae!==be?.content){ft(null),ie(Ae,ge);return}ft({messageId:z,parentId:ge}),A(be?.content??"")},[$e,ie]),Ee=i.useCallback(async()=>{if(!D||!S.trim()){w(!1);return}try{await J.mutateAsync({id:D,title:S.trim()}),w(!1)}catch{a({title:e("maas.chat.error"),description:e("maas.chat.errorRename"),variant:"destructive"})}},[D,S,J,a,e]),rt=i.useCallback(async()=>{if(D)try{await J.mutateAsync({id:D,archived:!0}),n({to:"/portal/chat",search:{}})}catch{a({title:e("maas.chat.error"),description:e("maas.chat.errorArchive"),variant:"destructive"})}},[D,J,n,a,e]),Fe=i.useCallback(async()=>{if(!(!D||!E))try{await J.mutateAsync({id:D,pinned:!E.pinned})}catch{a({title:e("maas.chat.error"),description:e("maas.chat.errorPin"),variant:"destructive"})}},[D,E,J,a,e]),ot=i.useCallback(async z=>{if(D)try{const ce=await fetch(`/api/v1/conversations/${D}/export?fmt=${z}`,{credentials:"include"});if(!ce.ok)throw new Error;const be=await ce.blob(),ge=URL.createObjectURL(be),Ae=document.createElement("a");Ae.href=ge,Ae.download=`conversation.${z}`,Ae.click(),URL.revokeObjectURL(ge)}catch{a({title:e("maas.chat.error"),description:e("maas.chat.errorExport"),variant:"destructive"})}},[D,a,e]),at=i.useCallback(async()=>{if(D)try{await navigator.clipboard.writeText(`${window.location.origin}/portal/chat?c=${D}`),a({title:e("maas.chat.linkCopied")})}catch{a({title:e("maas.chat.error"),description:e("maas.chat.errorCopy"),variant:"destructive"})}},[D,a,e]),Ue=i.useCallback(()=>{const z=tt.current;pe(null),_e(!1),z&&(z.kind==="regenerate"?he(z.messageId):ie(z.content,z.parentId))},[he,ie]),qt=i.useCallback(z=>{A(z),(te||V)&&(pe(null),_e(!0))},[te,V]),Qn=i.useCallback(()=>{const z=P.trim();if(!z&&H.length===0)return;A("");const ce=Ut;ft(null),ie(z,ce?.parentId)},[P,Ut,ie,H.length]),eo=o.jsx(hy,{activeId:D,onSelect:Yn,onNew:zt,collapsed:!l&&!_,onToggleCollapse:()=>{_?p(!1):c(z=>!z)}}),Ia=(z,ce)=>E?o.jsx(hb,{conversation:E,messages:$e,onPatch:be=>{D&&J.mutate({id:D,...be})},open:z,onOpenChange:ce}):null,Rd=()=>{E&&(j(E.title),w(!0))},Ed=o.jsxs("div",{className:"shrink-0 bg-surface px-4 py-5 sm:px-6",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[_?o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0","aria-label":e("maas.chat.openSidebar"),onClick:()=>p(!0),children:o.jsx(Yd,{className:"h-4 w-4"})}):o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0","aria-label":e("maas.chat.toggleSidebar"),"aria-expanded":l,onClick:()=>c(z=>!z),children:l?o.jsx($s,{className:"h-4 w-4"}):o.jsx(Ls,{className:"h-4 w-4"})}),o.jsx("div",{className:"min-w-0 flex-1",children:o.jsx(Gb,{n:"02",children:e(E?"maas.chat.sectionConversation":"maas.sidebar.newChat")})}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":e("maas.sidebar.newChat"),onClick:zt,children:o.jsx(Ro,{className:"h-4 w-4"})}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":e("maas.chat.toggleInspector"),"aria-expanded":_?y:u,disabled:!E,onClick:()=>{_?v(!0):d(!u)},children:o.jsx(Fs,{className:"h-4 w-4"})}),E&&o.jsxs(el,{children:[o.jsx(tl,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":e("maas.chat.conversationMenu"),children:o.jsx(Ts,{className:"h-4 w-4"})})}),o.jsxs(ja,{align:"end",className:"w-48",children:[o.jsxs(ke,{onClick:Fe,children:[o.jsx(Bs,{className:"me-2 h-4 w-4"}),E.pinned?e("maas.chat.unpin"):e("maas.chat.pin")]}),o.jsxs(ke,{onClick:()=>
58ot("md"),children:[o.jsx(mr,{className:"me-2 h-4 w-4"}),e("maas.chat.exportMd")]}),o.jsxs(ke,{onClick:()=>ot("json"),children:[o.jsx(mr,{className:"me-2 h-4 w-4"}),e("maas.chat.exportJson")]}),o.jsxs(ke,{onClick:at,children:[o.jsx(An,{className:"me-2 h-4 w-4"}),e("maas.chat.copyLink")]}),o.jsx(Sr,{}),o.jsxs(ke,{onClick:rt,className:"text-destructive focus:text-destructive",children:[o.jsx(Ds,{className:"me-2 h-4 w-4"}),e("maas.chat.archive")]})]})]})]})]}),E&&(b?o.jsxs("div",{className:"mt-3 flex min-w-0 items-center gap-1",children:[o.jsx("div",{className:"min-w-0 flex-1",children:o.jsx(En,{value:S,"aria-label":e("maas.chat.conversationTitle"),onChange:z=>j(z.target.value),onKeyDown:z=>{z.key==="Enter"&&Ee(),z.key==="Escape"&&w(!1)},className:"h-8 w-full min-w-0 max-w-64 font-medium",autoFocus:!0})}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0","aria-label":e("maas.chat.saveTitle"),onClick:Ee,children:o.jsx(ln,{className:"h-3.5 w-3.5"})}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0","aria-label":e("maas.chat.cancelRename"),onClick:()=>w(!1),children:o.jsx(kr,{className:"h-3.5 w-3.5"})})]}):o.jsxs("button",{className:"group mt-3 flex w-full min-w-0 items-center gap-2 text-start",onClick:Rd,children:[o.jsx("h1",{className:"min-w-0 truncate font-display",style:{fontSize:"clamp(22px, 2.4vw, 32px)",lineHeight:1.06,letterSpacing:"-0.022em",margin:0},children:E.title}),o.jsx(pr,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100 motion-safe:transition-opacity motion-safe:duration-150","aria-hidden":!0})]})),E&&o.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[o.jsx(lr,{children:E.model}),o.jsx(lr,{children:e("maas.chat.pillResidency")}),o.jsx(lr,{children:e("maas.chat.pillNoRetention")}),E.temporary&&o.jsx(lr,{children:e("maas.chat.temporary")})]})]}),_d=Pt&&$e.some(z=>z.id===Pt)?Pt:void 0,kd=!!D&&W&&!ve,Pd=!!D&&re&&!ve&&$e.length===0,Oa=o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col bg-surface",children:[Ed,o.jsx("div",{className:"min-h-0 flex-1",children:kd?o.jsx("div",{className:"flex h-full items-center justify-center px-4 sm:px-6",children:o.jsxs("div",{className:"w-full max-w-md text-center",children:[o.jsx("h3",{className:"font-medium text-foreground",children:e("maas.chat.notFound")}),o.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:e("maas.chat.notFoundDescription")}),o.jsxs(le,{className:"mt-6 bg-[var(--ink-900)] text-white hover:bg-[var(--ink-950)]",onClick:zt,children:[e("maas.chat.startNewChat"),o.jsx("span",{className:"ms-2","aria-hidden":!0,children:"→"})]})]})}):Pd?o.jsx(Yb,{label:e("maas.chat.loadingThread")}):o.jsx(Ey,{messages:$e,streaming:ve,streamingText:Ie,streamingReasoning:Vt,streamingMessageId:_d,error:mt,onRetry:Ue,onRegenerate:he,onEditBranch:Me,onTopUp:()=>n({to:"/portal/billing"}),onSuggestion:z=>A(z)})}),o.jsx("div",{className:"shrink-0 bg-surface px-4 pb-5 sm:px-6",children:o.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[!O&&o.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-lg border border-border px-3 py-2",children:[o.jsx(Gf,{className:"h-3.5 w-3.5 shrink-0 text-[var(--amber-500)]","aria-hidden":!0}),o.jsx("span",{className:"min-w-0 font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:e("maas.chat.offline")})]}),O&&mt&&o.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-lg border border-border px-3 py-2",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:mt.message}),o.jsx(le,{variant:"ghost",size:"sm",className:"h-7 shrink-0 font-mono text-[10px] uppercase tracking-[0.14em]",onClick:qn,children:e("maas.chat.dismiss")})]}),Ut&&o.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-lg border border-border px-3 py-2",children:[o.jsx(pr,{className:"h-3.5 w-3.5 shrink-0 text-hydro","aria-hidden":!0}),o.jsx("span",{className:"min-w-0 flex-1 font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:e("maas.chat.editingBranch")}),o.jsx(le,{variant:"ghost",size:"sm",className:"h-7 shrink-0 font-mono text-[10px] uppercase tracking-[0.14em]",onClick:()=>{ft(null),A("")},children:e("maas.chat.cancelEdit")})]}),o.jsx(fb,{value:P,onChange:qt,onSubmit:Qn,onStop:se,streaming:ve,disabled:!O,disabledReason:O?void 0:e("maas.chat.offline"),model:U,onModelChange:B,models:T?.models?.length?T.models:[],params:K,onParamsChange:ue,attachments:H,onAttachFiles:ee,onRemoveAttachment:de,uploading:R})]})})]}),Md=Od.includes(t.language)?"right":"left";return o.jsxs("div",{className:"flex h-full min-h-0 flex-1 flex-col",children:[o.jsx("div",{className:"flex min-h-0 flex-1",children:_?o.jsxs(o.Fragment,{children:[o.jsx(Pp,{open:x,onOpenChange:p,children:o.jsx(xi,{side:Md,className:"w-[320px] bg-background p-0 [&>button]:hidden",children:eo})}),Oa,o.jsx(ki,{open:y,onOpenChange:v,children:o.jsx(Mi,{className:"h-[70vh] bg-background",children:o.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:Ia(y,v)})})})]}):o.jsxs(o.Fragment,{children:[!l&&o.jsx("div",{className:"flex min-h-0 shrink-0",children:eo}),o.jsxs(Vd,{orientation:"horizontal",className:"min-h-0 flex-1",children:[l&&o.jsxs(o.Fragment,{children:[o.jsx(no,{id:"sidebar",defaultSize:`${f}%`,minSize:"15%",maxSize:"40%",onResize:z=>m(z.asPercentage),children:o.jsx("div",{className:"flex h-full min-h-0",children:eo})}),o.jsx($a,{})]}),o.jsx(no,{id:"thread",minSize:"30%",children:o.jsx("div",{className:"flex h-full min-h-0 flex-col",children:Oa})}),u&&o.jsxs(o.Fragment,{children:[o.jsx($a,{}),o.jsx(no,{id:"inspector",defaultSize:`${h}%`,minSize:"20%",maxSize:"40%",onResize:z=>g(z.asPercentage),children:o.jsx("div",{className:"flex h-full min-h-0",children:Ia(u,d)})})]})]})]})}),o.jsx(qb,{open:k,onOpenChange:C,onSelectConversation:z=>Yn(z.id),onNew:zt,onNavigate:z=>n({to:z})})]})}export{l0 as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.