vpschatbotwidget 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist-lib/types/chatbot/api/chatbot-api.d.ts +2 -0
- package/dist-lib/types/chatbot/api/chatbot-types.d.ts +9 -2
- package/dist-lib/types/chatbot/config/roles.d.ts +92 -0
- package/dist-lib/types/chatbot/core/ChatProvider.d.ts +4 -2
- package/dist-lib/types/chatbot/embedded/EmbeddedChatbot.d.ts +3 -2
- package/dist-lib/types/chatbot/index.d.ts +2 -1
- package/dist-lib/types/chatbot/widget/ChatbotWidget.d.ts +3 -2
- package/dist-lib/vps-chatbot.cjs +45 -45
- package/dist-lib/vps-chatbot.js +3962 -3857
- package/package.json +1 -1
- package/src/chatbot/api/chatbot-api.ts +9 -1
- package/src/chatbot/api/chatbot-types.ts +10 -2
- package/src/chatbot/chatbot.test.tsx +52 -0
- package/src/chatbot/config/roles.ts +99 -0
- package/src/chatbot/core/ChatHeader.tsx +5 -2
- package/src/chatbot/core/ChatMessage.tsx +3 -1
- package/src/chatbot/core/ChatProvider.tsx +42 -10
- package/src/chatbot/embedded/EmbeddedChatbot.tsx +24 -3
- package/src/chatbot/embedded/EmbeddedChatbotTrigger.tsx +2 -2
- package/src/chatbot/index.ts +2 -0
- package/src/chatbot/widget/ChatbotWidget.tsx +6 -2
- package/src/index.css +17 -2
package/dist-lib/vps-chatbot.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var zc=Object.create;var
|
|
2
|
-
`);if(!
|
|
1
|
+
"use strict";var zc=Object.create;var sr=Object.defineProperty;var Gc=Object.getOwnPropertyDescriptor;var Kc=Object.getOwnPropertyNames;var Yc=Object.getPrototypeOf,Xc=Object.prototype.hasOwnProperty;var Qc=(e,t,n)=>t in e?sr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Jc=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Kc(t))!Xc.call(e,o)&&o!==n&&sr(e,o,{get:()=>t[o],enumerable:!(r=Gc(t,o))||r.enumerable});return e};var Zc=(e,t,n)=>(n=e!=null?zc(Yc(e)):{},Jc(t||!e||!e.__esModule?sr(n,"default",{value:e,enumerable:!0}):n,e));var ce=(e,t,n)=>Qc(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),O=require("react"),ea=require("react-dom");var ir=typeof document<"u"?document.currentScript:null;function zs(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const y=zs(O),ht=zs(ea),ta={};function wt(e){if(e!=null&&e.trim()!=="")return e.trim().replace(/\/+$/,"");const t=(typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:ir&&ir.tagName.toUpperCase()==="SCRIPT"&&ir.src||new URL("vps-chatbot.cjs",document.baseURI).href}<"u"&&ta,"");return String(t).trim().replace(/\/+$/,"")}function Tn(e,t){const n=wt(e);if(!n)return t;if(n.endsWith("/api")&&t.startsWith("/api/"))return`${n}${t.slice(4)}`;if(n.endsWith("/api")&&t==="/health"){const o=n.slice(0,-4);return o?`${o}/health`:"/health"}const r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`}function zo(e){return e&&typeof e=="object"&&"data"in e&&e.success!==!1?e.data:e}function Go(e,t,n){var s,i,c;const r=e,o=(s=r==null?void 0:r.error)==null?void 0:s.message;return o&&!na(o)?{code:(i=r==null?void 0:r.error)==null?void 0:i.code,message:o,requestId:(c=r==null?void 0:r.error)==null?void 0:c.request_id}:n>=500?{message:"I couldn't process that request right now."}:n===0?{message:"Something went wrong while connecting. Please try again."}:{message:t}}function na(e){return/traceback|sql|exception|stack|api[_ ]?key|password/i.test(e)}function cr(e){return{chunkId:e.chunk_id,source:e.source,score:e.score,title:e.title,...e.url?{url:e.url}:{},snippet:e.snippet}}function ar(e){return{toolName:e.tool_name,arguments:e.arguments??{},result:e.result??{}}}function lr(e){return{model:e.model,promptTokens:e.prompt_tokens,completionTokens:e.completion_tokens,totalTokens:e.total_tokens}}function ra(e){const t=e.role==="user"||e.role==="system"?e.role:"assistant";return{id:String(e.id),role:t,content:e.content,createdAt:e.created_at||new Date().toISOString(),status:"complete",usage:e.model?{model:e.model,promptTokens:e.prompt_tokens||0,completionTokens:e.completion_tokens||0,totalTokens:(e.prompt_tokens||0)+(e.completion_tokens||0)}:void 0}}async function ur(e){const t=await e.text();if(!t)return{};try{return JSON.parse(t)}catch{return{}}}function Kr(e){const t=wt(e);async function n(r,o){let s;const i=Tn(t,r);try{s=await fetch(i,{...o,headers:{"Content-Type":"application/json",...(o==null?void 0:o.headers)??{}}})}catch{throw{message:"Something went wrong while connecting. Please try again."}}if(s.status===204)return;const c=await ur(s);if(!s.ok)throw Go(c,"I couldn't process that request right now.",s.status);return zo(c)}return{apiBaseUrl:t,async listModels(){try{const r=await n("/api/v1/models");return{defaultModelId:r.default_model_id,complexModelId:r.complex_model_id,models:r.models||[]}}catch{return null}},async createSession(r){const o=await n("/api/v1/sessions",{method:"POST",signal:r,body:JSON.stringify({})});return{sessionId:o.session_id,createdAt:o.created_at}},async sendMessage(r,o,s,i){const c=await n(`/api/v1/sessions/${r}/messages`,{method:"POST",signal:i,body:JSON.stringify({message:o,...(s==null?void 0:s.roleId)!==void 0?{role_id:s.roleId}:{},...s!=null&&s.client?{client:s.client}:{},...s!=null&&s.service?{service:s.service}:{},...s!=null&&s.modelId?{model_id:s.modelId}:{}})});return{requestId:c.request_id,sessionId:c.session_id,answer:c.answer,sources:(c.sources||[]).map(cr),toolCalls:(c.tool_calls||[]).map(ar),usage:lr(c.usage),durationMs:c.duration_ms,suggestions:c.suggestions}},async sendMessageStream(r,o,s,i,c,a){var u,f;const l=Tn(t,`/api/v1/sessions/${r}/messages/stream`);try{const h=await fetch(l,{method:"POST",signal:a,headers:{"Content-Type":"application/json"},body:JSON.stringify({message:o,...(s==null?void 0:s.roleId)!==void 0?{role_id:s.roleId}:{},...s!=null&&s.client?{client:s.client}:{},...s!=null&&s.service?{service:s.service}:{},...s!=null&&s.modelId?{model_id:s.modelId}:{}})});if(!h.ok){if(h.status===404||h.status===405)return await this.sendMessage(r,o,s,a);const C=await ur(h);throw Go(C,"I couldn't process that request right now.",h.status)}if(!h.body||(f=(u=h.headers)==null?void 0:u.get("content-type"))!=null&&f.includes("application/json")){const C=zo(await ur(h));if(typeof C.answer!="string"||!C.usage)throw{message:"The response stream ended unexpectedly."};return{requestId:C.request_id,sessionId:C.session_id,answer:C.answer,sources:(C.sources||[]).map(cr),toolCalls:(C.tool_calls||[]).map(ar),usage:lr(C.usage),durationMs:C.duration_ms,suggestions:C.suggestions}}const m=h.body.getReader(),d=new TextDecoder;let g="";const b={value:null},v=C=>{const w=C.split(/\r?\n/).filter(S=>S.startsWith("data:")).map(S=>S.slice(5).trimStart()).join(`
|
|
2
|
+
`);if(!w)return;let E={};try{const S=JSON.parse(w);if(!S||typeof S!="object")return;E=S}catch{return}if(E.type==="progress"&&typeof E.stage=="string")i==null||i(E.stage);else if(E.type==="token"&&typeof E.text=="string")c==null||c(E.text);else if(E.type==="complete")b.value={requestId:E.request_id||"",sessionId:E.session_id||r,answer:E.answer||"",sources:(E.sources||[]).map(cr),toolCalls:(E.tool_calls||[]).map(ar),usage:E.usage?lr(E.usage):{model:"",promptTokens:0,completionTokens:0,totalTokens:0},durationMs:E.duration_ms,suggestions:E.suggestions};else if(E.type==="error")throw{message:E.message||"I couldn't process that request right now.",requestId:E.request_id}};try{for(;!b.value;){const{done:C,value:w}=await m.read();if(C)break;if(g+=d.decode(w,{stream:!0}),g.length>1e6)throw{message:"The response stream was too large."};const E=g.split(/\r?\n\r?\n/);g=E.pop()||"";for(const S of E)if(v(S),b.value)break}g+=d.decode(),!b.value&&g.trim()&&v(g)}finally{await m.cancel().catch(()=>{}),m.releaseLock()}const x=b.value;if(x)return x;throw{message:"The response stream ended before the answer was complete."}}catch(h){throw!(h instanceof Error)&&h&&typeof h=="object"&&"message"in h?h:{message:"Something went wrong while connecting. Please try again."}}},async getHistory(r){try{return((await n(`/api/v1/sessions/${r}/messages`)).messages||[]).map(ra)}catch{return[]}},async closeSession(r){try{await n(`/api/v1/sessions/${r}`,{method:"DELETE"})}catch{}},async createTicket(){throw new Error("Ticket creation has been removed.")},async checkHealth(){try{const r=Tn(t,"/health");return(await fetch(r)).ok}catch{return!1}}}}const oa=Kr(),sa=[{label:"How do I access my reports?",query:"How do I access my reports in the VPS Customer Portal?"},{label:"Where can I find sample status?",query:"Where can I find my sample status?"},{label:"How do I pre-register a sample?",query:"How do I pre-register a sample in the portal?"},{label:"How do I contact VPS Support?",query:"How can I contact VPS Customer Support?"}],$t=["vessel","tot"],Gs={1:{name:"CC Report",client:"web",services:$t,topics:"finding, filtering, and downloading reports",questions:["How do I download a fuel report?","How do I filter lubricant reports?","How do I find a transformer oil report?"],serviceQuestions:{vessel:["How do I download a fuel report?","How do I filter lubricant reports?"],tot:["How do I find a transformer oil report?","How do I download a transformer oil report as a PDF?"]}},2:{name:"Client Admin",client:"admin",services:$t,topics:"client access, Vessel and TOT workflows, and VPS support",questions:["How do I add a client user?","How do I find reports for a vessel or transformer?","Why is a portal menu missing for a client user?"]},6:{name:"Fleet Manager",client:"web",services:["vessel"],topics:"vessels, marine samples, reports, and fleet trends",questions:["How do I find reports for a vessel?","Where can I find a vessel's sample status?","How do I review fleet fuel trends?"]},7:{name:"High Level Management",client:"web",services:$t,topics:"management dashboards and trend comparisons",questions:["How do I compare fuel trends across vessels?","How do I review transformer oil trends?","Where is the CII Dashboard?"]},9:{name:"Sampler",client:"mobile",services:$t,topics:"sample pre-registration, barcode scanning, and labels in the mobile app",questions:["How do I pre-register a vessel sample in the mobile app?","How do I scan a sample label?","How do I pre-register a transformer sample in the mobile app?"],serviceQuestions:{vessel:["How do I pre-register a vessel sample in the mobile app?","How do I scan a vessel sample label?"],tot:["How do I pre-register a transformer sample in the mobile app?","How do I scan a transformer sample label?"]},webQuestions:["How do I pre-register a vessel sample in the portal?","How do I pre-register a transformer sample in the portal?"],webServiceQuestions:{vessel:["How do I pre-register a vessel sample in the portal?","Where can I download my fuel report?"],tot:["How do I pre-register a transformer sample in the portal?","Where can I download a transformer oil report?"]}},10:{name:"VPS Admin",client:"admin",services:$t,topics:"Vessel and TOT workflows, portal administration, and VPS support",questions:["How do I review a portal registration request?","Where do I find vessel reports?","How do I view transformer oil test trends?"]},11:{name:"Transoil",client:"web",services:["tot"],topics:"transformer assets, oil reports, and trends",questions:["How do I find my transformer equipment?","Where can I download a transformer oil report?","How do I review transformer oil trends?"]},12:{name:"Bunker Master Only",client:"mobile",services:["vessel"],topics:"Bunker Master access, calculators, and Fuel Change-Over",questions:["How do I request Bunker Master access?","Where can I find the Bunker Master calculators?","How do I download the Fuel Change-Over workbook?"]},13:{name:"Fleet Manager Transoil",client:"web",services:["tot"],topics:"transformer equipment, reports, and fleet trends",questions:["How do I compare transformer oil trends for equipment?","How do I filter transformer oil reports by site?","How do I pre-register a transformer sample?"]}};function Ks(e){return Gs[e]}const Ko="vps-chatbot-response-sound";function ia(){const[e,t]=O.useState(!0),n=O.useRef(!0),r=O.useRef(null);O.useEffect(()=>{try{n.current=window.localStorage.getItem(Ko)!=="off",t(n.current)}catch{}return()=>{var c;(c=r.current)==null||c.close().catch(()=>{}),r.current=null}},[]);const o=O.useCallback(()=>{if(!(!n.current||typeof AudioContext>"u"))try{const c=r.current??(r.current=new AudioContext);c.state!=="running"&&c.resume().catch(()=>{})}catch{}},[]),s=O.useCallback(()=>{const c=!n.current;n.current=c,t(c);try{window.localStorage.setItem(Ko,c?"on":"off")}catch{}c&&o()},[o]),i=O.useCallback(()=>{const c=r.current;if(!(!n.current||(c==null?void 0:c.state)!=="running"))try{const a=c.currentTime;for(const[l,u]of[660,880].entries()){const f=a+l*.09,h=c.createOscillator(),m=c.createGain();h.frequency.value=u,m.gain.setValueAtTime(.001,f),m.gain.exponentialRampToValueAtTime(.06,f+.015),m.gain.exponentialRampToValueAtTime(.001,f+.14),h.connect(m),m.connect(c.destination),h.onended=()=>{h.disconnect(),m.disconnect()},h.start(f),h.stop(f+.15)}}catch{}},[]);return{soundEnabled:e,toggleSound:s,prepareSound:o,playSound:i}}const Yr=O.createContext(null);function Ys(){const e=O.useContext(Yr);if(!e)throw new Error("useChatbot must be used inside ChatProvider.");return e}function Gn(){return O.useContext(Yr)}function It(e,t,n,r){if(typeof performance.measure!="function")return;const o=`vps-chatbot:${e}`;performance.clearMeasures(o),performance.measure(o,{start:t,end:n,detail:r?{requestId:r}:null})}const ca=`Hello! I am your **VPS Veritas assistant**.
|
|
3
3
|
|
|
4
4
|
I can help you with:
|
|
5
5
|
- **Fuel Quality Testing (FQT)** & **Oil Condition Monitoring (OCM)**
|
|
@@ -8,175 +8,175 @@ I can help you with:
|
|
|
8
8
|
- **FSC & FSQ E-Forms** — paperless fuel system checks and bunker sample pre-registration
|
|
9
9
|
- **Samplogic** sample logistics, report downloads, and support tickets
|
|
10
10
|
|
|
11
|
-
Feel free to ask a question or select one of the suggested topics below!`;function
|
|
11
|
+
Feel free to ask a question or select one of the suggested topics below!`;function Yo(e){return`${e}-${crypto.randomUUID()}`}function aa(e){if(e&&typeof e=="object"&&"message"in e){const t=String(e.message);if(t&&!/traceback|sql|exception|stack|api[_ ]?key|password/i.test(t))return t}return"I couldn't process that request right now."}const Xr=e=>{var o,s,i,c,a;const t=e.roleId??((o=e.userContext)==null?void 0:o.roleId),n=e.client??((s=e.userContext)==null?void 0:s.client)??((i=Ks(t))==null?void 0:i.client),r=JSON.stringify([t,n,(c=e.userContext)==null?void 0:c.customerId,(a=e.userContext)==null?void 0:a.email]);return p.jsx(la,{...e,roleId:t,client:n},r)},la=({children:e,userContext:t={},role:n,roleId:r,client:o,service:s,welcomeMessage:i,suggestions:c,disableSuggestions:a=!1,initialMessage:l,apiBaseUrl:u,apiUrl:f,proxyUrl:h,api:m,hideInspectSources:d=!1,showGroundedSources:g=!1,modelId:b="auto"})=>{var Le;const v=u??f??h,x=O.useMemo(()=>m??Kr(v),[m,v]),C=Ks(r),w=s??t.service,E=O.useMemo(()=>{if(c)return c;if(!C)return sa;const K=o==="web"&&C.webQuestions,J=K?C.webServiceQuestions:C.serviceQuestions;return(w&&(J==null?void 0:J[w])||K||C.questions).map(L=>({label:L,query:L}))},[w,o,C,c]),S=O.useMemo(()=>({...t,role:n??t.role??(C==null?void 0:C.name),...r!==void 0?{roleId:r}:{},...o!==void 0?{client:o}:{},...s!==void 0?{service:s}:{}}),[t,n,r,o,C,s]),R=O.useMemo(()=>i===""?null:{id:"welcome-default",role:"assistant",content:i??(C?`Hello! I’m your **VPS Veritas assistant**. I can help with ${C.topics}. What would you like to do?`:ca),createdAt:new Date().toISOString(),status:"complete"},[C,i]),[T,P]=O.useState(null),[k,M]=O.useState(()=>R?[R]:[]),[_,D]=O.useState("idle"),[N,I]=O.useState(null),F=O.useRef(null),U=O.useRef(!1),A=O.useRef(null),j=O.useRef(null),q=O.useRef(!1),[z,ae]=O.useState([]),[re,B]=O.useState(b),{soundEnabled:G,toggleSound:V,prepareSound:H,playSound:Z}=ia();O.useEffect(()=>B(b),[b]),O.useEffect(()=>{var J;let K=!0;return ae([]),(J=x.listModels)==null||J.call(x).then(ue=>{K&&ae((ue==null?void 0:ue.models)||[])}).catch(()=>{}),()=>{K=!1}},[x]);const oe=O.useCallback(K=>{!q.current&&(K==="auto"||z.some(J=>J.id===K&&J.configured))&&B(K)},[z]);O.useEffect(()=>()=>{var K;return(K=A.current)==null?void 0:K.abort()},[]),O.useLayoutEffect(()=>{const K=j.current;if(!K)return;const J=k.find(L=>L.id===K.messageId),ue=performance.now();(J==null?void 0:J.status)==="complete"&&K.completedAt!==void 0?(It("completion-to-commit",K.completedAt,ue),It("submit-to-complete-commit",K.startedAt,ue),j.current=null):(J==null?void 0:J.status)==="pending"&&J.content&&K.firstTokenAt!==void 0&&!K.firstCommitRecorded&&(It("first-token-to-commit",K.firstTokenAt,ue),K.firstCommitRecorded=!0)},[k]);const ee=O.useCallback(async K=>{if(T)return T;D("connecting");const J=await x.createSession(K);if(K.aborted)throw new DOMException("Aborted","AbortError");return P(J.sessionId),J.sessionId},[T,x]),te=O.useCallback(async K=>{if(q.current)return;H(),q.current=!0;const J=new AbortController;A.current=J;let ue,L="";const Y=()=>{ue!==void 0&&cancelAnimationFrame(ue),ue=void 0};F.current=K;const Ee={id:Yo("user"),role:"user",content:K,createdAt:new Date().toISOString(),status:"complete"},me=Yo("asst"),Re="Preparing your answer…",W={id:me,streamId:me,role:"assistant",content:"",createdAt:new Date().toISOString(),status:"pending",progressText:Re,progressSteps:[Re]},Q=performance.now(),X={messageId:me,startedAt:Q};j.current=X,M(Se=>[...Se,Ee,W]),D("awaiting"),I(null);const ie=Se=>{const de=Se.trim();!de||J.signal.aborted||M(_e=>_e.map(Te=>Te.id===me&&Te.progressText!==de?{...Te,progressText:de,progressSteps:[...Te.progressSteps??[],de]}:Te))};try{const Se=await ee(J.signal),de=performance.now();It("request-preparation",Q,de);const _e=x.sendMessageStream?await x.sendMessageStream(Se,K,{roleId:S.roleId,client:S.client,service:S.service,modelId:re},ie,Te=>{J.signal.aborted||(Te&&X.firstTokenAt===void 0&&(X.firstTokenAt=performance.now(),It("first-token-received",de,X.firstTokenAt)),L+=Te,ue===void 0&&(ue=requestAnimationFrame(()=>{ue=void 0,J.signal.aborted||M(qe=>qe.map($e=>$e.id===me?{...$e,content:L}:$e))})))},J.signal):await x.sendMessage(Se,K,{roleId:S.roleId,client:S.client,service:S.service,modelId:re},J.signal);if(Y(),J.signal.aborted)return;X.messageId=_e.requestId||me,X.completedAt=performance.now(),It("completion-received",de,X.completedAt,_e.requestId),M(Te=>Te.map(qe=>qe.id===me?{...qe,id:_e.requestId||me,content:_e.answer,status:"complete",progressText:void 0,sources:_e.sources,suggestions:_e.suggestions,toolCalls:_e.toolCalls,usage:_e.usage,durationMs:Math.max(Math.round(performance.now()-Q),_e.durationMs??0)}:qe)),D("idle"),Z()}catch(Se){if(Y(),j.current===X&&(j.current=null),J.signal.aborted)return;const de=aa(Se);M(_e=>_e.map(Te=>Te.id===me?{...Te,content:de,status:"error",progressText:void 0}:Te)),I(de),D("error")}finally{Y(),A.current===J&&(A.current=null,q.current=!1)}},[ee,x,S.client,S.roleId,S.service,re,H,Z]),$=O.useCallback(async K=>{const J=K.trim();!J||_==="awaiting"||_==="connecting"||await te(J)},[te,_]),ne=O.useCallback(async()=>{if(q.current)return;const K=F.current;K&&(M(J=>J.filter(ue=>ue.status!=="error")),await te(K))},[te]),se=O.useCallback(()=>{const K=A.current;K&&(K.abort(),A.current=null,q.current=!1,j.current=null,M(J=>J.map(ue=>ue.status==="pending"?{...ue,status:"stopped",progressText:void 0}:ue)),D("idle"))},[]),be=O.useCallback((K,J)=>{M(ue=>ue.map(L=>L.id===K?{...L,feedback:L.feedback===J?void 0:J}:L))},[]),ve=O.useCallback(async()=>{},[]),Oe=O.useCallback(()=>{},[]),Ae=O.useCallback(async()=>{var K;(K=A.current)==null||K.abort(),A.current=null,q.current=!1,P(null),M(R?[R]:[]),D("idle"),I(null),F.current=null,T&&await x.closeSession(T)},[T,x,R]);O.useEffect(()=>{!l||U.current||(U.current=!0,$(l))},[l,$]);const xe=(Le=k[k.length-1])==null?void 0:Le.suggestions,Me=O.useMemo(()=>({messages:k,status:_,error:N,sessionId:T,pendingTicket:null,ticketBusy:!1,lastTicket:null,suggestions:xe!=null&&xe.length?xe.map(K=>({label:K,query:K})):E,showSuggestions:!a&&_==="idle"&&(k.length===0||k.length===1&&k[0].id==="welcome-default"||k.some(K=>K.role==="assistant"&&K.status==="complete"&&!K.id.startsWith("welcome"))),suggestionBadgesEnabled:!a,userContext:S,apiBaseUrl:x.apiBaseUrl,hideInspectSources:d,showGroundedSources:g,soundEnabled:G,toggleSound:V,sendMessage:$,stopResponse:se,toggleMessageFeedback:be,retryLast:ne,confirmTicket:ve,cancelTicket:Oe,resetConversation:Ae,models:z,selectedModelId:re,selectModel:oe}),[k,_,N,T,E,xe,a,S,x.apiBaseUrl,d,g,G,V,$,se,be,ne,ve,Oe,Ae,z,re,oe]);return p.jsx(Yr.Provider,{value:Me,children:e})};function Xs(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Xs(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Qs(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Xs(e))&&(r&&(r+=" "),r+=t);return r}function le(...e){return Qs(e)}function Js({className:e,variant:t="default",...n}){return p.jsx("div",{...n,"data-slot":"marker","data-variant":t,className:le("chat-marker",e)})}function ua({className:e,...t}){return p.jsx("span",{...t,"data-slot":"marker-icon",className:le("chat-marker-icon",e),"aria-hidden":"true"})}function Zs({className:e,...t}){return p.jsx("span",{...t,"data-slot":"marker-content",className:le("chat-marker-content",e)})}function tn(){return Ys()}/**
|
|
12
12
|
* @license lucide-react v0.468.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const fa=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ei=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
17
17
|
* @license lucide-react v0.468.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/var
|
|
21
|
+
*/var da={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
22
22
|
* @license lucide-react v0.468.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const
|
|
26
|
+
*/const pa=O.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>O.createElement("svg",{ref:a,...da,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ei("lucide",o),...c},[...i.map(([l,u])=>O.createElement(l,u)),...Array.isArray(s)?s:[s]]));/**
|
|
27
27
|
* @license lucide-react v0.468.0 - ISC
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const ye=(e,t)=>{const n=
|
|
31
|
+
*/const ye=(e,t)=>{const n=O.forwardRef(({className:r,...o},s)=>O.createElement(pa,{ref:s,iconNode:t,className:ei(`lucide-${fa(e)}`,r),...o}));return n.displayName=`${e}`,n};/**
|
|
32
32
|
* @license lucide-react v0.468.0 - ISC
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the ISC license.
|
|
35
35
|
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const
|
|
36
|
+
*/const ha=ye("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
|
|
37
37
|
* @license lucide-react v0.468.0 - ISC
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the ISC license.
|
|
40
40
|
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const
|
|
41
|
+
*/const ma=ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
|
42
42
|
* @license lucide-react v0.468.0 - ISC
|
|
43
43
|
*
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
45
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const
|
|
46
|
+
*/const ga=ye("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
|
|
47
47
|
* @license lucide-react v0.468.0 - ISC
|
|
48
48
|
*
|
|
49
49
|
* This source code is licensed under the ISC license.
|
|
50
50
|
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const
|
|
51
|
+
*/const ba=ye("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
52
52
|
* @license lucide-react v0.468.0 - ISC
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the ISC license.
|
|
55
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const
|
|
56
|
+
*/const va=ye("BotMessageSquare",[["path",{d:"M12 6V2H8",key:"1155em"}],["path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z",key:"w2lp3e"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M9 11v2",key:"1ueba0"}],["path",{d:"M15 11v2",key:"i11awn"}],["path",{d:"M20 12h2",key:"1q8mjw"}]]);/**
|
|
57
57
|
* @license lucide-react v0.468.0 - ISC
|
|
58
58
|
*
|
|
59
59
|
* This source code is licensed under the ISC license.
|
|
60
60
|
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const
|
|
61
|
+
*/const Qr=ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
62
62
|
* @license lucide-react v0.468.0 - ISC
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the ISC license.
|
|
65
65
|
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const
|
|
66
|
+
*/const ya=ye("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
67
67
|
* @license lucide-react v0.468.0 - ISC
|
|
68
68
|
*
|
|
69
69
|
* This source code is licensed under the ISC license.
|
|
70
70
|
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const
|
|
71
|
+
*/const ti=ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
72
72
|
* @license lucide-react v0.468.0 - ISC
|
|
73
73
|
*
|
|
74
74
|
* This source code is licensed under the ISC license.
|
|
75
75
|
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const
|
|
76
|
+
*/const xa=ye("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
77
77
|
* @license lucide-react v0.468.0 - ISC
|
|
78
78
|
*
|
|
79
79
|
* This source code is licensed under the ISC license.
|
|
80
80
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const
|
|
81
|
+
*/const ni=ye("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
82
82
|
* @license lucide-react v0.468.0 - ISC
|
|
83
83
|
*
|
|
84
84
|
* This source code is licensed under the ISC license.
|
|
85
85
|
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const
|
|
86
|
+
*/const wa=ye("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/**
|
|
87
87
|
* @license lucide-react v0.468.0 - ISC
|
|
88
88
|
*
|
|
89
89
|
* This source code is licensed under the ISC license.
|
|
90
90
|
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/const
|
|
91
|
+
*/const ri=ye("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
92
92
|
* @license lucide-react v0.468.0 - ISC
|
|
93
93
|
*
|
|
94
94
|
* This source code is licensed under the ISC license.
|
|
95
95
|
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const
|
|
96
|
+
*/const Ca=ye("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
97
97
|
* @license lucide-react v0.468.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
100
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
-
*/const
|
|
101
|
+
*/const Sa=ye("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
|
|
102
102
|
* @license lucide-react v0.468.0 - ISC
|
|
103
103
|
*
|
|
104
104
|
* This source code is licensed under the ISC license.
|
|
105
105
|
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/const
|
|
106
|
+
*/const Ea=ye("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
|
|
107
107
|
* @license lucide-react v0.468.0 - ISC
|
|
108
108
|
*
|
|
109
109
|
* This source code is licensed under the ISC license.
|
|
110
110
|
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
-
*/const
|
|
111
|
+
*/const oi=ye("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
112
112
|
* @license lucide-react v0.468.0 - ISC
|
|
113
113
|
*
|
|
114
114
|
* This source code is licensed under the ISC license.
|
|
115
115
|
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
-
*/const
|
|
116
|
+
*/const Ra=ye("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
117
117
|
* @license lucide-react v0.468.0 - ISC
|
|
118
118
|
*
|
|
119
119
|
* This source code is licensed under the ISC license.
|
|
120
120
|
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
-
*/const
|
|
121
|
+
*/const Ta=ye("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/**
|
|
122
122
|
* @license lucide-react v0.468.0 - ISC
|
|
123
123
|
*
|
|
124
124
|
* This source code is licensed under the ISC license.
|
|
125
125
|
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
-
*/const
|
|
126
|
+
*/const Ia=ye("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
|
|
127
127
|
* @license lucide-react v0.468.0 - ISC
|
|
128
128
|
*
|
|
129
129
|
* This source code is licensed under the ISC license.
|
|
130
130
|
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
-
*/const
|
|
131
|
+
*/const Oa=ye("Pencil",[["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"}]]);/**
|
|
132
132
|
* @license lucide-react v0.468.0 - ISC
|
|
133
133
|
*
|
|
134
134
|
* This source code is licensed under the ISC license.
|
|
135
135
|
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
-
*/const
|
|
136
|
+
*/const Pa=ye("RefreshCw",[["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"}]]);/**
|
|
137
137
|
* @license lucide-react v0.468.0 - ISC
|
|
138
138
|
*
|
|
139
139
|
* This source code is licensed under the ISC license.
|
|
140
140
|
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
-
*/const
|
|
141
|
+
*/const si=ye("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
142
142
|
* @license lucide-react v0.468.0 - ISC
|
|
143
143
|
*
|
|
144
144
|
* This source code is licensed under the ISC license.
|
|
145
145
|
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
-
*/const
|
|
146
|
+
*/const ka=ye("TestTubeDiagonal",[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]]);/**
|
|
147
147
|
* @license lucide-react v0.468.0 - ISC
|
|
148
148
|
*
|
|
149
149
|
* This source code is licensed under the ISC license.
|
|
150
150
|
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
-
*/const
|
|
151
|
+
*/const _a=ye("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/**
|
|
152
152
|
* @license lucide-react v0.468.0 - ISC
|
|
153
153
|
*
|
|
154
154
|
* This source code is licensed under the ISC license.
|
|
155
155
|
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
-
*/const
|
|
156
|
+
*/const Aa=ye("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/**
|
|
157
157
|
* @license lucide-react v0.468.0 - ISC
|
|
158
158
|
*
|
|
159
159
|
* This source code is licensed under the ISC license.
|
|
160
160
|
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
-
*/const
|
|
161
|
+
*/const Na=ye("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
|
|
162
162
|
* @license lucide-react v0.468.0 - ISC
|
|
163
163
|
*
|
|
164
164
|
* This source code is licensed under the ISC license.
|
|
165
165
|
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
-
*/const
|
|
166
|
+
*/const Ma=ye("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/**
|
|
167
167
|
* @license lucide-react v0.468.0 - ISC
|
|
168
168
|
*
|
|
169
169
|
* This source code is licensed under the ISC license.
|
|
170
170
|
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
-
*/const
|
|
171
|
+
*/const ja=ye("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
|
|
172
172
|
* @license lucide-react v0.468.0 - ISC
|
|
173
173
|
*
|
|
174
174
|
* This source code is licensed under the ISC license.
|
|
175
175
|
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
-
*/const
|
|
177
|
-
`));return y.cloneElement(t,o)}return
|
|
178
|
-
`))},[r,n,e]);const{current:l}=y.useRef(t);y.useEffect(()=>{!o&&
|
|
179
|
-
`))},[t])}const a=y.useCallback(l=>{o||i(l)},[]);return[c,a]}function Xo(e){let t=0;const n=new WeakMap;try{return JSON.stringify(e,function(s,i){if(!(s==="_owner"&&this!=null&&typeof this=="object"&&"$$typeof"in this)){if(typeof i=="bigint")return`__bigint__:${i}`;if(i!==null&&typeof i=="object"){const c=n.get(i);if(c!==void 0)return`__object__:${c}`;n.set(i,t),t+=1}return i}})??`__top__:${typeof e}`}catch{return"__unserializable__"}}function mi(){const[,e]=y.useState({});return y.useCallback(()=>{e({})},[])}let Jo=0;function rl(e,t="mui"){const n=y.useRef(void 0),r=mi(),o=e??n.current;return y.useEffect(()=>{n.current==null&&(Jo+=1,n.current=`${t}-${Jo}`,e==null&&r())},[e,t,r]),o}const Zo=tt.useId;function Gn(e,t){if(Zo!==void 0){const n=Zo();return e??(t?`${t}-${n}`:n)}return rl(e,t)}function bi(e){return Gn(e,"base-ui")}function Pe(e,t,n,r){let o=!1,s=!1;const i=Fe;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...i}}const vi="none",Kn="trigger-press",We="trigger-hover",Pn="trigger-focus",ol="outside-press",sl="focus-out",no="escape-key",Or="imperative-action",il=()=>{},pe=typeof document<"u"?y.useLayoutEffect:il;function ro(e){y.useEffect(e,Va)}const pn=null;let Qo=globalThis.requestAnimationFrame;class cl{constructor(){ae(this,"callbacks",[]);ae(this,"callbacksCount",0);ae(this,"nextId",1);ae(this,"startId",1);ae(this,"isScheduled",!1);ae(this,"tick",t=>{var o;this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let s=0;s<n.length;s+=1)(o=n[s])==null||o.call(n,t)})}request(t){const n=this.nextId;this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1;const r=process.env.NODE_ENV!=="production"&&Qo!==requestAnimationFrame&&(Qo=requestAnimationFrame,!0);return(!this.isScheduled||r)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||this.callbacks[n]!==null&&(this.callbacks[n]=null,this.callbacksCount-=1)}}let hn=new cl;class Ne{constructor(){ae(this,"currentId",pn);ae(this,"cancel",()=>{this.currentId!==pn&&(hn.cancel(this.currentId),this.currentId=pn)});ae(this,"disposeEffect",()=>this.cancel)}static create(){return new Ne}static request(t){return hn.request(t)}static cancel(t){return hn.cancel(t)}request(t){this.cancel(),this.currentId=hn.request(()=>{this.currentId=pn,t()})}}function al(){const e=Ye(Ne.create).current;return ro(e.disposeEffect),e}function yi(e,t=!1,n=!1,r=!1){const[o,s]=y.useState(e&&t?"idle":void 0),[i,c]=y.useState(e&&!r);return e&&!i&&(c(!0),s("starting")),!e&&i&&o!=="ending"&&!n&&s("ending"),!e&&!i&&o==="ending"&&s(void 0),pe(()=>{if(!e&&i&&o!=="ending"&&n){const a=Ne.request(()=>{s("ending")});return()=>{Ne.cancel(a)}}},[e,i,o,n]),pe(()=>{if(!e||t||o===void 0)return;const a=Ne.request(()=>{s(void 0)});return()=>{Ne.cancel(a)}},[t,e,o]),pe(()=>{if(!e||!t)return;e&&i&&o!=="idle"&&s("starting");const a=Ne.request(()=>{s("idle")});return()=>{Ne.cancel(a)}},[t,e,i,o]),{mounted:i,setMounted:c,transitionStatus:o}}function ll(e){const{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:o}=e,[s,i]=nl({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:c,setMounted:a,transitionStatus:l}=yi(s,!0,!0),f=bi(),[u,h]=y.useState(),g=u===null?void 0:u??f,d=fe(m=>{const b=!s,v=Pe(Kn,m.nativeEvent);r(b,v),!v.isCanceled&&i(b)});return y.useMemo(()=>({defaultPanelId:f,disabled:o,handleTrigger:d,mounted:c,open:s,panelId:g,setMounted:a,setOpen:i,setPanelIdState:h,transitionStatus:l}),[f,o,d,c,s,g,a,i,h,l])}function ul(e,t){return function(r,...o){const s=new URL(e);return s.searchParams.set("code",r.toString()),o.forEach(i=>s.searchParams.append("args[]",i)),`${t} error #${r}; visit ${s} for the full message.`}}const wt=ul("https://base-ui.com/production-error","Base UI"),oo=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(oo.displayName="CollapsibleRootContext");function xi(){const e=y.useContext(oo);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>.":wt(15));return e}const so="data-starting-style",fl="data-ending-style",dl={[so]:""},pl={[fl]:""},io={transitionStatus(e){return e==="starting"?dl:e==="ending"?pl:null}},hl="data-open",gl="data-closed",gn=so,ml="data-panel-open",bl={[hl]:""},vl={[gl]:""},yl={open(e){return e?{[ml]:""}:null}},xl={open(e){return e?bl:vl}},Ei={...xl,...io},Si=y.forwardRef(function(t,n){const{render:r,className:o,defaultOpen:s=!1,disabled:i=!1,onOpenChange:c,open:a,style:l,...f}=t,u=fe(c),h=ll({open:a,defaultOpen:s,onOpenChange:u,disabled:i}),g=y.useMemo(()=>({open:h.open,disabled:h.disabled,transitionStatus:h.transitionStatus}),[h.open,h.disabled,h.transitionStatus]),d=y.useMemo(()=>({...h,onOpenChange:u,state:g}),[h,u,g]),m=pt("div",t,{state:g,ref:n,props:f,stateAttributesMapping:Ei});return p.jsx(oo.Provider,{value:d,children:m})});process.env.NODE_ENV!=="production"&&(Si.displayName="CollapsibleRoot");function Yn(){return typeof window<"u"}function Le(e){return co(e)?(e.nodeName||"").toLowerCase():"#document"}function Ie(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ot(e){var t;return(t=(co(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function co(e){return Yn()?e instanceof Node||e instanceof Ie(e).Node:!1}function me(e){return Yn()?e instanceof Element||e instanceof Ie(e).Element:!1}function _e(e){return Yn()?e instanceof HTMLElement||e instanceof Ie(e).HTMLElement:!1}function At(e){return!Yn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ie(e).ShadowRoot}function Xn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=$e(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function El(e){return/^(table|td|th)$/.test(Le(e))}function Jn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Sl=/transform|translate|scale|rotate|perspective|filter/,wl=/paint|layout|strict|content/,mt=e=>!!e&&e!=="none";let fr;function ao(e){const t=me(e)?$e(e):e;return mt(t.transform)||mt(t.translate)||mt(t.scale)||mt(t.rotate)||mt(t.perspective)||!lo()&&(mt(t.backdropFilter)||mt(t.filter))||Sl.test(t.willChange||"")||wl.test(t.contain||"")}function Cl(e){let t=lt(e);for(;_e(t)&&!ct(t);){if(ao(t))return t;if(Jn(t))return null;t=lt(t)}return null}function lo(){return fr==null&&(fr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),fr}function ct(e){return/^(html|body|#document)$/.test(Le(e))}function $e(e){return Ie(e).getComputedStyle(e)}function Zn(e){return me(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lt(e){if(Le(e)==="html")return e;const t=e.assignedSlot||e.parentNode||At(e)&&e.host||ot(e);return At(t)?t.host:t}function wi(e){const t=lt(e);return ct(t)?(e.ownerDocument||e).body:_e(t)&&Xn(t)?t:wi(t)}function Gt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=wi(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ie(o);if(s){const c=Ir(i);return t.concat(i,i.visualViewport||[],Xn(o)?o:[],c&&n?Gt(c):[])}else return t.concat(o,Gt(o,[],n))}function Ir(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Ci=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ci.displayName="CompositeRootContext");function Rl(e=!1){const t=y.useContext(Ci);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.":wt(16));return t}function Tl(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,i=r&&t!==!1,c=r&&t===!1;return{props:y.useMemo(()=>{const l={onKeyDown(f){n&&t&&f.key!=="Tab"&&f.preventDefault()}};return r||(l.tabIndex=o,!s&&n&&(l.tabIndex=t?o:-1)),(s&&(t||i)||!s&&n)&&(l["aria-disabled"]=n),s&&(!t||c)&&(l.disabled=n),l},[r,n,t,i,c,s,o])}}function Ke(e){return(e==null?void 0:e.ownerDocument)||document}function dr(e,t,{detail:n=0,pointerType:r=""}={}){e.dispatchEvent(new(Ie(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,pointerType:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Ri(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0,composite:s}=e,i=y.useRef(null),c=Rl(!0),a=s??c!==void 0,{props:l}=Tl({focusableWhenDisabled:n,disabled:t,composite:a,tabIndex:r,isNativeButton:o});process.env.NODE_ENV!=="production"&&y.useEffect(()=>{var d,m;if(!i.current)return;const g=mn(i.current);if(o){if(!g){const b=((d=tt.captureOwnerStack)==null?void 0:d.call(tt))||"";Nn(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${b}`)}}else if(g){const b=((m=tt.captureOwnerStack)==null?void 0:m.call(tt))||"";Nn(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${b}`)}},[o]);const f=y.useCallback(()=>{const g=i.current;mn(g)&&a&&t&&l.disabled===void 0&&g.disabled&&(g.disabled=!1)},[t,l.disabled,a]);pe(f,[f]);const u=y.useCallback((g={})=>{const{onClick:d,onMouseDown:m,onKeyUp:b,onKeyDown:v,onPointerDown:x,...S}=g;return to({onClick(E){if(t){E.preventDefault();return}d==null||d(E)},onMouseDown(E){t||m==null||m(E)},onKeyDown(E){if(t||(An(E),v==null||v(E),E.baseUIHandlerPrevented))return;const C=E.target===E.currentTarget,w=E.currentTarget,R=mn(w),P=!o&&Pl(w),O=C&&(o?R:!P),M=E.key==="Enter",F=E.key===" ",A=w.getAttribute("role"),D=(A==null?void 0:A.startsWith("menuitem"))||A==="option"||A==="gridcell";if(C&&a&&F){if(E.defaultPrevented&&D)return;E.preventDefault(),(!o||R)&&(E.preventBaseUIHandler(),dr(w,E));return}if(!O||o||!F&&!M){C&&P&&F&&E.preventDefault();return}E.defaultPrevented||(E.preventDefault(),M&&(E.preventBaseUIHandler(),dr(w,E)))},onKeyUp(E){if(!t){if(An(E),b==null||b(E),E.target===E.currentTarget&&o&&a&&mn(E.currentTarget)&&E.key===" "){E.preventDefault();return}E.baseUIHandlerPrevented||E.target===E.currentTarget&&!o&&!a&&!E.defaultPrevented&&E.key===" "&&(E.preventBaseUIHandler(),dr(E.currentTarget,E))}},onPointerDown(E){if(t){E.preventDefault();return}x==null||x(E)}},o?{type:"button"}:{role:"button"},l,S)},[t,l,a,o]),h=fe(g=>{i.current=g,f()});return{getButtonProps:u,buttonRef:h}}function mn(e){return _e(e)&&e.tagName==="BUTTON"}function Pl(e){return _e(e)&&e.tagName==="A"&&!!e.href}const Ol={...yl,...io},Ti=y.forwardRef(function(t,n){const{panelId:r,open:o,handleTrigger:s,state:i,disabled:c}=xi(),{className:a,disabled:l=c,render:f,nativeButton:u=!0,style:h,...g}=t,{getButtonProps:d,buttonRef:m}=Ri({disabled:l,native:u});return pt("button",t,{state:i,ref:[n,m],props:[{"aria-controls":o?r:void 0,"aria-expanded":o,onClick:s},g,d],stateAttributesMapping:Ol})});process.env.NODE_ENV!=="production"&&(Ti.displayName="CollapsibleTrigger");function Ee(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}const Ht=0;class ut{constructor(){ae(this,"currentId",Ht);ae(this,"clear",()=>{this.currentId!==Ht&&(clearTimeout(this.currentId),this.currentId=Ht)});ae(this,"disposeEffect",()=>this.clear)}static create(){return new ut}start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ht,n()},t)}isStarted(){return this.currentId!==Ht}}function zt(){const e=Ye(ut.create).current;return ro(e.disposeEffect),e}function qe(e){const t=Ye(Il,e).current;return t.next=e,pe(t.effect),t}function Il(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function _l(e){return e==null?e:"current"in e?e.current:e}function es(e,t){return e.getAnimations(t).filter(n=>{var o;const r=(o=n.effect)==null?void 0:o.getTiming();return(r==null?void 0:r.duration)!==1/0&&(r==null?void 0:r.iterations)!==1/0})}let bn=null;function kl(e){if(!bn){const t=[];bn=t,queueMicrotask(()=>{bn=null,dt.flushSync(()=>{for(const n of t)n()})})}bn.push(e)}function Pi(e,t=!1,n=!1){const r=al();return fe((o,s=null)=>{r.cancel();const i=_l(e);if(i==null)return;const c=i,a=()=>{if(!n){dt.flushSync(o);return}kl(()=>{s!=null&&s.aborted||o()})};if(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){o();return}function l(){Promise.all(es(c).map(f=>f.finished.then(eo))).then(()=>{s!=null&&s.aborted||a()},()=>{if(s!=null&&s.aborted)return;if(es(c).some(u=>u.pending||u.playState!=="finished")){l();return}a()})}if(t){const f=so;if(!c.hasAttribute(f)){r.request(l);return}const u=new MutationObserver(()=>{c.hasAttribute(f)||(u.disconnect(),l())});u.observe(c,{attributes:!0,attributeFilter:[f]}),s==null||s.addEventListener("abort",()=>u.disconnect(),{once:!0});return}r.request(l)})}function uo(e){const{enabled:t=!0,open:n,ref:r,batch:o=!1,onComplete:s}=e,i=fe(s),c=Pi(r,n,o);y.useEffect(()=>{if(!t)return;const a=new AbortController;return c(i,a.signal),()=>{a.abort()}},[t,n,i,c])}const Ot={height:void 0,width:void 0};function Al(e){const{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:o,mounted:s,onOpenChange:i,open:c,setMounted:a,setOpen:l,transitionStatus:f}=e,u=y.useRef(null),h=y.useRef(null),[g,d]=y.useState(Ot),m=y.useRef(Ot),b=y.useRef(!1),v=y.useRef(c),x=y.useRef(!1),[S,E]=y.useState(!1),C=y.useRef(null),w=Rr(t,u),R=qe(c),P=Pi(u),O=!c&&!s,M=S?"idle":f,F=c&&(v.current||x.current),A=!c&&s&&h.current==="css-animation"&&g.height===void 0&&g.width===void 0?m.current:g,D=n&&O&&h.current!=="css-animation",_=fe((N,Y=!0)=>{Y&&(m.current=N),d(N)}),T=fe(()=>{var N;(N=C.current)==null||N.call(C),C.current=null}),k=fe(N=>{T(),C.current=()=>{C.current=null,N()}}),U=fe(()=>{c&&s&&h.current==="css-animation"&&(x.current=!0)});pe(()=>{!S||f==="starting"||E(!1)},[S,f]),y.useEffect(()=>()=>{U(),T()},[U,T]),pe(()=>{c||(v.current=!1,x.current=!1);const N=u.current;if(!N)return;!c&&C.current&&T();const Y=Nl(N,F);if(h.current=Y,c&&f==="idle"&&v.current&&Y==="css-animation"){m.current=It(N);return}if(c&&f==="starting"){const ie=b.current;if(b.current=!1,Y==="none"){_(It(N)),E(!0);return}if(Y==="css-transition"){const B=jl(N);if(_(It(N)),!ie)return B;const $=vn(N,"transition-duration","0s");return k($),E(!0),B}_(It(N));const L=vn(N,"animation-name","none");if(!ie){L();return}const X=vn(N,"animation-duration","0s");L(),k(X),E(!0);return}if(!c&&s&&(f==="idle"||f==="starting")){if(Y==="none"){_(Ot,!1),a(!1);return}_(It(N));return}if(f!=="ending")return;if(Y==="none"){a(!1);return}const K=It(N);if(!(K.height>0||K.width>0)){a(!1);return}_(K),Y==="css-animation"&&vn(N,"animation-name","none")()},[s,c,T,_,a,k,F,f]),uo({enabled:c&&s&&M==="idle",open:!0,ref:u,onComplete(){c&&_(Ot,!1)}}),y.useEffect(()=>{if(c||!s||M!=="ending")return;if(!u.current){a(!1),_(Ot,!1);return}const Y=new AbortController;let K=-1;function le(){R.current||(a(!1),_(Ot,!1))}return K=Ne.request(()=>{P(le,Y.signal)}),()=>{Ne.cancel(K),Y.abort()}},[R,s,c,M,P,_,a]),pe(()=>{const N=u.current;!N||!n||!O||N.setAttribute("hidden","until-found")},[O,n]),y.useEffect(function(){const Y=u.current;if(!Y)return;const K=ut.create();let le=-1;const ie=(B,$)=>{K.start(0,()=>{R.current||(le=Ne.request(()=>{R.current||(B&&(b.current=!1),$&&Y.setAttribute(gn,""),Y.setAttribute("hidden","until-found"))}))})},X=Ee(Y,"beforematch",B=>{const $=Pe(vi,B);if(i(!0,$),$.isCanceled){ie(!1,!1);return}b.current=!0;const Q=Y.hasAttribute(gn);Y.removeAttribute(gn),l(!0),ie(!0,Q)});return()=>{K.clear(),Ne.cancel(le),X()}},[R,i,l]);const j=o||n||s||c;return{height:A.height,props:{...D?{[gn]:""}:void 0,hidden:O,id:r},ref:w,shouldPreventOpenAnimation:F,shouldRender:j,transitionStatus:M,width:A.width}}function It(e){return{height:e.scrollHeight,width:e.scrollWidth}}function Nl(e,t){const n=Ie(e).getComputedStyle(e),r=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&ts(n.animationDuration),o=ts(n.transitionDuration);return r&&o?(process.env.NODE_ENV!=="production"&&Qr("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.","Only one of either animation type should be used."),"css-transition"):o?"css-transition":r?"css-animation":"none"}function ts(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function vn(e,t,n){const r=e.style.getPropertyValue(t),o=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===""){e.style.removeProperty(t);return}e.style.setProperty(t,r,o)}}function jl(e){const t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(o=>{e.style.setProperty(o,"initial","important")});function n(){Object.entries(t).forEach(([o,s])=>{if(s===""){e.style.removeProperty(o);return}e.style.setProperty(o,s)})}const r=Ne.request(n);return()=>{Ne.cancel(r),n()}}const Ml="--collapsible-panel-height",Dl="--collapsible-panel-width",Oi=y.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,render:i,id:c,style:a,...l}=t;process.env.NODE_ENV!=="production"&&y.useEffect(()=>{o&&s===!1&&Qr("The `keepMounted={false}` prop on `Collapsible.Panel` is ignored when `hiddenUntilFound` is enabled, since the panel must remain mounted while closed.")},[o,s]);const{defaultPanelId:f,mounted:u,onOpenChange:h,open:g,setMounted:d,setPanelIdState:m,setOpen:b,state:v,transitionStatus:x}=xi(),S=o??!1,E=s??!1,C=c||void 0,w=C??f;pe(()=>(m(U=>C??(U===null?void 0:U)),()=>{m(U=>U===C?null:U)}),[C,m]);const{height:R,props:P,ref:O,shouldPreventOpenAnimation:M,shouldRender:F,transitionStatus:A,width:D}=Al({externalRef:n,hiddenUntilFound:S,id:w,keepMounted:E,mounted:u,onOpenChange:h,open:g,setMounted:d,setOpen:b,transitionStatus:x}),_={...v,transitionStatus:A},T=li(a,_),k=pt("div",{...t,style:void 0},{state:_,ref:O,props:[P,{style:{[Ml]:R===void 0?"auto":`${R}px`,[Dl]:D===void 0?"auto":`${D}px`}},l,T?{style:T}:void 0,M?{style:{animationName:"none"}}:void 0],stateAttributesMapping:Ei});return F?k:null});process.env.NODE_ENV!=="production"&&(Oi.displayName="CollapsiblePanel");function bt({className:e,...t}){return p.jsx("div",{"data-slot":"trace",className:ue("trace",e),...t})}function Nt({className:e,status:t,...n}){return p.jsx("span",{"data-slot":"trace-line","data-status":t,className:ue("trace-line",e),...n})}function xt({className:e,...t}){return p.jsx("span",{"data-slot":"trace-icon",className:ue("trace-icon",e),...t,"aria-hidden":"true"})}function jt({className:e,...t}){return p.jsx("span",{"data-slot":"trace-title",className:ue("trace-title",e),...t})}function Kt({className:e,...t}){return p.jsx("span",{"data-slot":"trace-description",className:ue("trace-description",e),...t})}function Ii(e){return p.jsx(Si,{"data-slot":"trace-collapsible",...e})}function _i({children:e,className:t,...n}){return p.jsxs(Ti,{type:"button","data-slot":"trace-collapsible-trigger",className:ue("trace-trigger",t),...n,children:[e,p.jsx(xt,{className:"trace-chevron",children:p.jsx(Zs,{size:13})})]})}function ki({className:e,...t}){return p.jsx(Oi,{...t,"data-slot":"trace-collapsible-content",className:ue("trace-content",e)})}const Fl=({message:e,onRetry:t})=>p.jsx(Jr,{className:"chat-error-banner",role:"alert",children:p.jsxs(Zr,{children:[p.jsx(bt,{className:"chat-message-body",children:p.jsxs(Nt,{status:"error",children:[p.jsx(xt,{children:p.jsx(ma,{size:14})}),p.jsx(jt,{className:"chat-error-title",children:e})]})}),t&&p.jsx(Cr,{children:p.jsx("button",{type:"button",onClick:t,className:"chat-error-retry-btn",children:"Try again"})})]})}),Ll={alpha:{label:"Alpha",Icon:ya,variant:"env-badge--alpha",tooltip:"Alpha build — internal testing only"},beta:{label:"Beta",Icon:Ra,variant:"env-badge--beta",tooltip:"Beta build — public pre-release"},gamma:{label:"Gamma",Icon:Ea,variant:"env-badge--gamma",tooltip:"Gamma / Release Candidate"},qa:{label:"QA",Icon:ba,variant:"env-badge--qa",tooltip:"Quality Assurance build"}},Bl=({stage:e,pulse:t=!0,className:n=""})=>{if(!e)return null;const{label:r,Icon:o,variant:s,tooltip:i}=Ll[e];return p.jsxs("span",{className:`env-badge-inline ${s} ${n}`.trim(),title:i,"aria-label":`${r} build`,role:"status",children:[p.jsx(o,{size:10,className:"env-badge-icon","aria-hidden":"true"}),p.jsx("span",{className:"env-badge-inline-label",children:r})]})},Vl=e=>p.jsx("svg",{width:e.width||"24px",height:e.height||"24px",viewBox:"0 0 24 24",role:"img",xmlns:"http://www.w3.org/2000/svg",fill:e.Color||"currentColor",...e,children:p.jsx("path",{d:"M11.999 0c-2.25 0-4.5.06-6.6.21a5.57 5.57 0 0 0-5.19 5.1c-.24 3.21-.27 6.39-.06 9.6a5.644 5.644 0 0 0 5.7 5.19h3.15v-3.9h-3.15c-.93.03-1.74-.63-1.83-1.56-.18-3-.15-6 .06-9 .06-.84.72-1.47 1.56-1.53 2.04-.15 4.2-.21 6.36-.21s4.32.09 6.36.18c.81.06 1.5.69 1.56 1.53.24 3 .24 6 .06 9-.12.93-.9 1.62-1.83 1.59h-3.15l-6 3.9V24l6-3.9h3.15c2.97.03 5.46-2.25 5.7-5.19.21-3.18.18-6.39-.03-9.57a5.57 5.57 0 0 0-5.19-5.1c-2.13-.18-4.38-.24-6.63-.24zm-5.04 8.76c-.36 0-.66.3-.66.66v2.34c0 .33.18.63.48.78 1.62.78 3.42 1.2 5.22 1.26 1.8-.06 3.6-.48 5.22-1.26.3-.15.48-.45.48-.78V9.42c0-.09-.03-.15-.09-.21a.648.648 0 0 0-.87-.36c-1.5.66-3.12 1.02-4.77 1.05-1.65-.03-3.27-.42-4.77-1.08a.566.566 0 0 0-.24-.06z"})}),$l=({title:e="VPS AI Assistant",subtitle:t="Customer portal support",onClose:n,onReset:r,onBack:o,soundEnabled:s,onToggleSound:i,showMinimize:c=!1,envStage:a,envPulse:l=!0})=>p.jsxs("header",{className:"chat-header",children:[p.jsxs("div",{className:"chat-header-left",children:[o&&p.jsx("button",{type:"button",onClick:o,className:"icon-btn-back","aria-label":"Back",children:p.jsx(da,{size:16})}),p.jsx("div",{className:"avatar-circle","aria-hidden":"true",children:p.jsx(Vl,{width:"16px",height:"16px",color:"white"})}),p.jsxs("div",{children:[p.jsxs("div",{className:"chat-header-title-row",children:[p.jsx("h2",{className:"chat-header-title",children:e}),p.jsx(Bl,{stage:a,pulse:l})]}),p.jsx("p",{className:"chat-header-subtitle",children:t||"Customer portal support"})]})]}),p.jsxs("div",{className:"chat-header-actions",children:[i&&p.jsx("button",{type:"button",className:"icon-btn-action chat-sound-btn","aria-label":"Response sound","aria-pressed":!!s,title:s?"Mute response sound":"Enable response sound",onClick:i,children:s?p.jsx(Oa,{size:16,"aria-hidden":"true"}):p.jsx(Ia,{size:16,"aria-hidden":"true"})}),r&&p.jsx("button",{type:"button",onClick:r,className:"icon-btn-action","aria-label":"Start a new conversation",title:"New conversation",children:p.jsx(Ca,{size:15})}),n&&p.jsx("button",{type:"button",onClick:n,className:"icon-btn-action","aria-label":c?"Minimize chat":"Close chat",children:p.jsx(Sa,{size:16})})]})]});function Hl(e,t){const n=I.useRef(e);I.useEffect(()=>{var r;n.current&&!e&&((r=t.current)==null||r.focus()),n.current=e},[e,t])}function Ul({className:e,...t}){return p.jsx("div",{...t,"data-slot":"input-group",className:ue("chat-input-group",e)})}function zl({className:e,...t}){return p.jsx("textarea",{...t,"data-slot":"input-group-textarea",className:ue("chat-textarea",e)})}function Wl({className:e,...t}){return p.jsx("div",{...t,"data-slot":"input-group-addon",className:ue("chat-input-actions",e)})}function ns({className:e,...t}){return p.jsx("button",{type:"button",...t,"data-slot":"input-group-button",className:ue("chat-send-btn",e)})}const Ai=y.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,focusableWhenDisabled:i=!1,nativeButton:c=!0,style:a,...l}=t,{getButtonProps:f,buttonRef:u}=Ri({disabled:s,focusableWhenDisabled:i,native:c});return pt("button",t,{state:{disabled:s},ref:[n,u],props:[l,f]})});process.env.NODE_ENV!=="production"&&(Ai.displayName="Button");const rs=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,os=Gs,ql=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return os(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(l=>{const f=n==null?void 0:n[l],u=s==null?void 0:s[l];if(f===null)return null;const h=rs(f)||rs(u);return o[l][h]}),c=n&&Object.entries(n).reduce((l,f)=>{let[u,h]=f;return h===void 0||(l[u]=h),l},{}),a=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((l,f)=>{let{class:u,className:h,...g}=f;return Object.entries(g).every(d=>{let[m,b]=d;return Array.isArray(b)?b.includes({...s,...c}[m]):{...s,...c}[m]===b})?[...l,u,h]:l},[]);return os(e,i,a,n==null?void 0:n.class,n==null?void 0:n.className)},Gl=ql("vps-ui-button",{variants:{variant:{default:"vps-ui-button--default",outline:"vps-ui-button--outline",secondary:"vps-ui-button--secondary",ghost:"vps-ui-button--ghost",destructive:"vps-ui-button--destructive",link:"vps-ui-button--link"},size:{default:"vps-ui-button--size-default",xs:"vps-ui-button--size-xs",sm:"vps-ui-button--size-sm",lg:"vps-ui-button--size-lg",icon:"vps-ui-button--size-icon","icon-xs":"vps-ui-button--size-icon-xs","icon-sm":"vps-ui-button--size-icon-sm","icon-lg":"vps-ui-button--size-icon-lg"}},defaultVariants:{variant:"default",size:"default"}});function fo({className:e,variant:t,size:n,...r}){return p.jsx(Ai,{type:"button","data-slot":"button",...r,className:o=>ue(Gl({variant:t,size:n}),typeof e=="function"?e(o):e)})}function Kl({className:e,...t}){return p.jsx("div",{...t,className:ue("flex scroll-fade-x scrollbar-none gap-2 overflow-x-auto overscroll-x-contain",e),"data-slot":"suggestions"})}function Yl({suggestion:e,onClick:t,children:n,className:r,variant:o="outline",size:s="sm",...i}){return p.jsx(fo,{...i,variant:o,size:s,className:c=>ue("shrink-0",typeof r=="function"?r(c):r),onClick:()=>t==null?void 0:t(e),children:n??e})}function Xl(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>r.label.toLowerCase().includes(n)||r.query.toLowerCase().includes(n)):e}const Jl=({suggestions:e,onSelect:t,disabled:n,variant:r="list"})=>e.length?p.jsx(Kl,{className:r==="badge"?"chat-suggestion-strip":"suggestions-list",role:"list","aria-label":"Suggested questions",children:e.map(o=>p.jsx("div",{role:"listitem",children:p.jsx(Yl,{suggestion:o.query,disabled:n,onClick:()=>t(o),title:o.query,children:o.label})},o.query))}):null,Zl=({onSend:e,onStop:t,disabled:n=!1,placeholder:r="Ask something…",ref:o})=>{const{suggestions:s,showSuggestions:i,suggestionBadgesEnabled:c,models:a,selectedModelId:l,selectModel:f}=en(),[u,h]=I.useState(""),g=I.useRef(null),d=I.useId(),m=I.useId(),b=E=>{E&&(E.style.height="auto",E.style.height=`${Math.min(E.scrollHeight,96)}px`)};Hl(n,g),I.useImperativeHandle(o,()=>({edit(E){var C;n||(h(E),(C=g.current)==null||C.focus())}}),[n]),I.useEffect(()=>{b(g.current)},[u]);const v=I.useMemo(()=>{if(!c||n)return[];const E=u.trim();return E?Xl(s,E):i?s:[]},[n,i,c,s,u]),x=E=>{h(E.query);const C=g.current;C==null||C.focus()},S=()=>{const E=u.trim();!E||n||(e(E),h(""))};return p.jsxs("div",{className:"chat-input-wrapper",children:[p.jsx(Jl,{variant:"badge",suggestions:v,onSelect:x,disabled:n}),p.jsxs("form",{onSubmit:E=>{E.preventDefault(),S()},children:[p.jsx("label",{htmlFor:d,className:"sr-only",children:"Chat message"}),p.jsxs(Ul,{children:[p.jsx(zl,{id:d,ref:g,rows:1,value:u,disabled:n,placeholder:r,onChange:E=>h(E.target.value),onKeyDown:E=>{var C;E.key==="Enter"&&!E.shiftKey&&!E.nativeEvent.isComposing&&(E.preventDefault(),(C=E.currentTarget.form)==null||C.requestSubmit())}}),p.jsxs(Wl,{children:[a.length>1&&p.jsxs("div",{className:"chat-model-picker",children:[p.jsx("label",{htmlFor:m,className:"sr-only",children:"AI model"}),p.jsxs("select",{id:m,value:l,disabled:n,onChange:E=>f(E.target.value),children:[p.jsx("option",{value:"auto",children:"Automatic"}),a.map(E=>p.jsx("option",{value:E.id,disabled:!E.configured,children:E.label},E.id))]})]}),t?p.jsx(ns,{onClick:t,"aria-label":"Stop response",title:"Stop response",children:p.jsx(ri,{size:13,fill:"currentColor","aria-hidden":"true"})}):p.jsx(ns,{type:"submit",disabled:n||!u.trim(),"aria-label":"Send message",title:"Send message",children:p.jsx(pa,{size:16,"aria-hidden":"true"})})]})]})]}),p.jsxs("p",{className:"chat-input-footer",children:[p.jsx("span",{className:"chat-input-note",children:"AI can make mistakes."}),"Powered by ",p.jsx("span",{className:"chat-input-footer-brand",children:"VPS Veritas AI"})]})]})};function Ql({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:o}){let s=_r(eu(r,o),t);if(!n)return y.createElement(e,s);if(typeof n=="function")return n(s,r);if(!y.isValidElement(n))return null;let i=n.props,c={..._r(s,i),ref:tn(s.ref,i.ref)};return y.cloneElement(n,c)}function _r(...e){let t={};for(let n of e){if(!n)continue;let r=n;for(let o of Object.keys(r)){let s=r[o];if(s===void 0)continue;let i=t[o];o==="className"?t[o]=[i,s].filter(Boolean).join(" "):o==="style"?t[o]={...i,...s}:o==="ref"?t[o]=tn(i,s):nu(o)&&typeof i=="function"&&typeof s=="function"?t[o]=tu(s,i):t[o]=s}}return t}function eu(e,t){var r;let n={};for(let o of Object.keys(e)){let s=e[o],i=(r=t==null?void 0:t[o])==null?void 0:r.call(t,s);if(i){Object.assign(n,i);continue}if(o==="slot"){n["data-slot"]=s;continue}let c=`data-${String(o).replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`)}`;typeof s=="boolean"?n[c]=s?"":void 0:s!=null&&(n[c]=String(s))}return n}function tu(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function nu(e){return/^on[A-Z]/.test(e)}function tn(...e){let t=e.filter(Boolean);if(t.length!==0)return n=>{for(let r of t)typeof r=="function"?r(n):r&&(r.current=n)}}var ru=8,ou=64,su=0,jn=.5,iu=180,cu=new Set(["ArrowDown","ArrowUp","End","Home","PageDown","PageUp"," "]),Ni={start:!1,end:!1},au=[],Mn={currentAnchorId:null,visibleMessageIds:au};function lu({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return Ni;let o=po({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:o-r.scrollTop-r.clientHeight>t}}function uu({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:o,visibleMessageIds:s}){if(!e||!o)return Mn;let i=o.getBoundingClientRect(),c=i.top+t+n,a=typeof IntersectionObserver>"u",l=[],f=null;for(let u of Yt(e,r)){let h=u.dataset.messageId;if(!h)continue;let g=u.dataset.scrollAnchor==="true",d=g||a?u.getBoundingClientRect():null;(a&&d?d.bottom>c&&d.top<i.bottom:s.has(h))&&l.push(h),g&&d&&d.top<=c+jn&&(f=h)}return l.length===0&&f===null?Mn:{currentAnchorId:f,visibleMessageIds:l}}function Yt(e,t){return Array.from(e.children).filter(n=>n instanceof HTMLElement&&n!==t)}function fu(e,t){for(let n=t;n<e.length;n++){let r=e[n];if((r==null?void 0:r.dataset.scrollAnchor)==="true")return r}return null}function du(e,t){for(let n of e)if(n.dataset.scrollAnchor==="true"&&!t.has(n))return n;return null}function pu(e,t){var r;let n=0;for(let o=t;o<e.length;o++)if(((r=e[o])==null?void 0:r.dataset.scrollAnchor)==="true"&&(n+=1,n>1))return!0;return!1}function hu(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if((n==null?void 0:n.dataset.scrollAnchor)==="true")return n}return null}function gu({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let o of Yt(e,t)){if(!o.dataset.messageId)continue;let s=o.getBoundingClientRect();if(s.bottom>r.top&&s.top<r.bottom)return o}return null}function mu({align:e,element:t,scrollMargin:n,spacer:r,viewport:o}){let s=ji(t,o),i=t.getBoundingClientRect().height,c=yu(r);if(e==="center"){let a=Math.max(0,o.clientHeight-c.start-c.end);return s-c.start-(a-i)/2-n}if(e==="end")return s-o.clientHeight+i+c.end+n;if(e==="nearest"){let a=s+i,l=o.scrollTop+c.start,f=o.scrollTop+o.clientHeight-c.end;return s>=l&&a<=f?o.scrollTop:s<l?s-c.start-n:a-o.clientHeight+c.end+n}return s-c.start-n}function ji(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function On(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function bu({content:e,scrollTop:t,spacer:n,viewport:r}){let o=po({content:e,spacer:n,viewport:r});return t+r.clientHeight-o}function po({content:e,spacer:t,viewport:n}){let r=Yt(e,t),o=Mi(e),s=n.getBoundingClientRect(),i=n.scrollTop,c=o.start+o.end;for(let a of r){let l=a.getBoundingClientRect();c=Math.max(c,l.bottom-s.top+i+o.end)}return c}function vu(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Mi(e){let t=window.getComputedStyle(e);return{end:kr(t.paddingBlockEnd||t.paddingBottom),start:kr(t.paddingBlockStart||t.paddingTop)}}function yu(e){let t=e==null?void 0:e.parentElement;return t?Mi(t):{end:0,start:0}}function xu(e){if(!e)return 0;let t=window.getComputedStyle(e),n=t.rowGap==="normal"?t.gap:t.rowGap;return kr(n)}function kr(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Di(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:o=>{t(n,o)||(n=o,r.forEach(s=>s()))},subscribe:(o,s,i)=>{let c=r.size===0;return r.add(o),c&&(s==null||s()),()=>{r.delete(o),r.size===0&&(i==null||i())}}}}function ss(e,t){return Di(e,t)}function Eu(){return Di(Mn,wu)}function Su(e,t){return e.start===t.start&&e.end===t.end}function wu(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((n,r)=>n===t.visibleMessageIds[r])}function Cu({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:r,scrollPreviousItemPeek:o}){let s=y.useRef(e),i=y.useRef(!1),c=y.useRef(null),a=y.useRef(!1),l=y.useRef(n),f=y.useRef(0),u=y.useRef(null),h=y.useRef(0),g=y.useRef(e?"following-bottom":"free-scrolling"),d=y.useRef(new Map),m=y.useRef(null),b=y.useRef(null),v=y.useRef(null),x=y.useRef(o),S=y.useRef(!0),E=y.useRef(null),C=y.useRef(r),w=y.useRef(null),R=y.useRef(0),P=y.useRef(0),O=y.useRef(null),M=y.useRef(null),F=y.useRef(null),A=y.useRef(null),D=y.useRef(null),_=y.useRef(null),T=y.useRef(null),k=y.useRef(null),U=y.useRef(null),j=y.useRef(new Set),N=y.useRef(new WeakSet);return F.current===null&&(F.current=ss(t==="end"||t==="last-anchor",(Y,K)=>Y===K)),A.current===null&&(A.current=ss(Ni,Su)),U.current===null&&(U.current=Eu()),s.current=e,l.current=n,C.current=r,x.current=o,{autoScrollRef:s,autoscrollingRef:i,autoscrollingTimeoutRef:D,streamingTurnRef:v,contentRef:c,defaultScrollPositionAppliedRef:a,firstItemRef:u,itemCountRef:f,lastScrollTopRef:h,messageElementsRef:d,modeRef:g,pendingScrollFrameRef:w,pendingScrollToMessageRef:m,prependRestoreRef:b,preserveScrollOnPrependRef:S,pendingDefaultScrollStore:F.current,rootRef:E,scrollEdgeThresholdRef:l,scrollMarginRef:C,scrollPreviousItemPeekRef:x,spacerGapRef:R,spacerHeightRef:P,spacerRef:O,stateFrameRef:M,stateStore:A.current,viewportRef:_,visibilityFrameRef:T,visibilityObserverRef:k,visibilityStore:U.current,visibleMessageIdsRef:j,handledScrollAnchorsRef:N}}function Fi(e){e.pendingDefaultScrollStore.setSnapshot(!1)}function In(e){e.defaultScrollPositionAppliedRef.current=!0,Fi(e)}function Ru({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:i,autoscrollingTimeoutRef:c,contentRef:a,itemCountRef:l,messageElementsRef:f,modeRef:u,pendingScrollToMessageRef:h,prependRestoreRef:g,scrollMarginRef:d,scrollPreviousItemPeekRef:m,spacerGapRef:b,spacerHeightRef:v,spacerRef:x,viewportRef:S}=e,E=y.useCallback(A=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null),i.current!==A&&(i.current=A,t()),A&&(c.current=window.setTimeout(()=>{c.current=null,i.current=!1,t()},iu))},[t]),C=y.useCallback(A=>{let D=x.current;if(!D)return;let _=Math.max(0,Math.ceil(A));v.current!==_&&(v.current=_,D.hidden=_===0,D.style.height=`${_}px`,D.style.marginTop=_>0?`${-b.current}px`:"")},[]),w=y.useCallback((A,{behavior:D="auto",autoscrolling:_=!1}={})=>{let T=S.current;if(!T)return;let k=Math.max(0,A);if(Math.abs(T.scrollTop-k)<=jn){T.scrollTop=k,t();return}_&&E(!0),T.scrollTo({top:k,behavior:D}),n()},[t,n,E]),R=y.useCallback(({behavior:A="auto"}={})=>S.current?(C(0),o.current=null,u.current="free-scrolling",w(0,{behavior:A}),r(),!0):!1,[r,w,C]),P=y.useCallback(({behavior:A="auto"}={})=>{let D=S.current;return D?(C(0),o.current=null,u.current=s.current?"following-bottom":"free-scrolling",w(vu(D),{autoscrolling:!0,behavior:A}),r(),!0):!1},[r,w,C]),O=y.useCallback((A,{align:D="start",behavior:_="auto",scrollMargin:T=d.current}={},{keepPreviousPeek:k=!1}={})=>{let U=a.current,j=S.current;if(!U||!j||!U.contains(A))return!1;let N=mu({align:D,element:A,scrollMargin:k?T+m.current:T,spacer:x.current,viewport:j}),Y=bu({content:U,scrollTop:N,spacer:x.current,viewport:j});return C(Y),g.current={element:A,viewportTop:On(A,j)},u.current=k?"anchored-to-message":"settling-jump",o.current=k?A:null,w(N,{behavior:_}),r(),!0},[r,w,C]),M=y.useCallback(()=>{let A=o.current;return!A||!A.isConnected||u.current!=="anchored-to-message"?!1:O(A,{align:"start"},{keepPreviousPeek:!0})},[O]),F=y.useCallback((A,D)=>{let _=f.current.get(A);return _?(In(e),O(_,D)?(h.current=null,!0):(h.current={messageId:A,options:D},!0)):l.current===0?(h.current={messageId:A,options:D},In(e),!0):!1},[O]);return{flushPendingScrollToMessage:y.useCallback(()=>{let A=h.current;if(!A)return!1;let D=f.current.get(A.messageId);return!D||!O(D,A.options)?!1:(h.current=null,In(e),!0)},[O]),reanchorToAnchoredMessage:M,scrollToElement:O,scrollToEnd:P,scrollToMessage:F,scrollToStart:R}}function is(e,t){return y.useCallback(n=>{e.current=n,n&&t()},[e,t])}function Tu({autoScroll:e=!1,defaultScrollPosition:t="end",scrollEdgeThreshold:n=ru,scrollPreviousItemPeek:r=ou,scrollMargin:o=su}){let s=Cu({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:o,scrollPreviousItemPeek:r}),{streamingTurnRef:i,autoScrollRef:c,autoscrollingRef:a,autoscrollingTimeoutRef:l,contentRef:f,defaultScrollPositionAppliedRef:u,firstItemRef:h,itemCountRef:g,lastScrollTopRef:d,messageElementsRef:m,modeRef:b,pendingScrollFrameRef:v,pendingScrollToMessageRef:x,prependRestoreRef:S,preserveScrollOnPrependRef:E,pendingDefaultScrollStore:C,rootRef:w,scrollEdgeThresholdRef:R,scrollMarginRef:P,scrollPreviousItemPeekRef:O,spacerGapRef:M,spacerHeightRef:F,spacerRef:A,stateFrameRef:D,stateStore:_,viewportRef:T,visibilityFrameRef:k,visibilityObserverRef:U,visibilityStore:j,visibleMessageIdsRef:N,handledScrollAnchorsRef:Y}=s,K=y.useRef(t);K.current!==t&&(K.current=t,u.current=!1);let le=y.useCallback(V=>{let q=w.current,Z=T.current,se=[V.start&&"start",V.end&&"end"].filter(Boolean).join(" "),ke=a.current;for(let Ce of[q,Z])Ce&&(se?Ce.setAttribute("data-scrollable",se):Ce.removeAttribute("data-scrollable"),Ce.toggleAttribute("data-autoscrolling",ke))},[]),ie=y.useCallback(V=>{var se;let q=((se=T.current)==null?void 0:se.scrollTop)??0,Z=q<d.current-jn;d.current=q,c.current&&!V.end&&b.current!=="settling-jump"&&b.current!=="anchored-to-message"?b.current="following-bottom":b.current==="following-bottom"&&V.end&&Z&&!a.current&&(b.current="free-scrolling")},[]),L=y.useCallback(()=>{let V=lu({content:f.current,scrollEdgeThreshold:R.current,spacer:A.current,viewport:T.current});ie(V);let q=b.current==="following-bottom"?{...V,end:!1}:V;le(q),_.setSnapshot(q)},[ie,_,le]),X=y.useCallback(()=>{D.current===null&&(D.current=window.requestAnimationFrame(()=>{D.current=null,L()}))},[L]),B=y.useCallback(()=>{j.hasListeners()&&k.current===null&&(k.current=window.requestAnimationFrame(()=>{k.current=null,j.hasListeners()&&j.setSnapshot(uu({content:f.current,scrollMargin:P.current,scrollPreviousItemPeek:O.current,spacer:A.current,viewport:T.current,visibleMessageIds:N.current}))}))},[j]),{flushPendingScrollToMessage:$,reanchorToAnchoredMessage:Q,scrollToElement:re,scrollToEnd:ee,scrollToMessage:te,scrollToStart:W}=Ru({refs:s,commitScrollState:L,scheduleStateCommit:X,scheduleVisibilitySync:B}),ne=y.useCallback(()=>{let V=S.current,q=T.current;if(!V||!q||!V.element.isConnected)return!1;let Z=On(V.element,q)-V.viewportTop;return Math.abs(Z)<=jn?!1:(q.scrollTop+=Z,V.viewportTop=On(V.element,q),X(),B(),!0)},[X,B]),oe=y.useCallback(()=>{let V=f.current,q=T.current;if(!V||!q){S.current=null;return}let Z=gu({content:V,spacer:A.current,viewport:q});S.current=Z?{element:Z,viewportTop:On(Z,q)}:null},[]),ve=y.useCallback(()=>{v.current===null&&(v.current=window.requestAnimationFrame(()=>{v.current=null,$()&&oe()}))},[oe,$]),z=y.useCallback(()=>{if(!t||u.current||g.current===0)return!1;let V=!1;if(t==="last-anchor"){let q=f.current,Z=T.current,se=q&&Z?hu(Yt(q,A.current)):null;if(!q||!Z||!se)V=ee({behavior:"auto"});else{let ke=ji(se,Z);V=po({content:q,spacer:A.current,viewport:Z})-ke<=Z.clientHeight?ee({behavior:"auto"}):re(se,{align:"start"},{keepPreviousPeek:!0})}}else V=t==="end"?ee({behavior:"auto"}):W({behavior:"auto"});return V?(In(s),!0):!1},[t,re,ee,W]),J=y.useCallback(()=>{let V=f.current;if(!V)return;let q=Yt(V,A.current),Z=g.current,se=h.current;g.current=q.length,h.current=q[0]??null,(()=>{if($())return;if(Z===0){if(z()||q.length>0&&c.current&&ee({behavior:"auto"}))return;L(),B();return}let ke=se?q.indexOf(se):-1;if(E.current&&ke>0){ne();return}if(q.length>Z){let Ce=fu(q,Z);if(Ce){if(c.current&&b.current==="following-bottom"&&pu(q,Z)){ee({behavior:"auto"});return}re(Ce,{align:"start"},{keepPreviousPeek:!0}),Y.current.add(Ce);return}}if(q.length===Z){let Ce=du(q,Y.current);if(Ce){re(Ce,{align:"start"},{keepPreviousPeek:!0}),Y.current.add(Ce);return}}b.current==="following-bottom"&&c.current?ee({behavior:"auto"}):(L(),B())})(),oe()},[z,oe,L,$,ne,B,re,ee]),ce=y.useCallback(()=>{if(b.current==="following-bottom"&&c.current){ee({behavior:"auto"});return}let V=F.current;if(Q()){c.current&&V>0&&F.current===0&&ee({behavior:"auto"});return}X(),B()},[Q,X,B,ee]),he=y.useCallback(()=>{let V=T.current;if(!(!V||!j.hasListeners())){if(typeof IntersectionObserver>"u"){B();return}U.current||(U.current=new IntersectionObserver(q=>{for(let Z of q){let se=Z.target.dataset.messageId;se&&(Z.isIntersecting?N.current.add(se):N.current.delete(se))}B()},{root:V,rootMargin:`${-(P.current+O.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]})),m.current.forEach(q=>{var Z;(Z=U.current)==null||Z.observe(q)}),B()}},[B,j]),Oe=y.useCallback(()=>{var V;k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null),(V=U.current)==null||V.disconnect(),U.current=null,N.current.clear(),j.setSnapshot(Mn)},[j]),je=y.useCallback((V,q,Z)=>{var se,ke,Ce;if(q){m.current.set(V,q),(se=U.current)==null||se.observe(q),B(),((ke=x.current)==null?void 0:ke.messageId)===V&&ve();return}Z&&m.current.get(V)===Z&&(m.current.delete(V),N.current.delete(V),(Ce=U.current)==null||Ce.unobserve(Z),B())},[ve,B]),Re=y.useCallback(()=>{(b.current==="following-bottom"||b.current==="anchored-to-message"||b.current==="settling-jump")&&(i.current=null,b.current="free-scrolling")},[]),Me=y.useCallback(()=>le(_.getSnapshot()),[_,le]),Be=is(w,Me),H=is(T,Me),G=y.useCallback(V=>{f.current=V},[]),Se=y.useCallback(V=>{A.current=V,M.current=xu((V==null?void 0:V.parentElement)??null)},[]),be=y.useCallback(()=>{L(),B(),oe()},[oe,L,B]),ge=y.useMemo(()=>({handleContentChange:J,handleResize:ce,observeVisibility:he,pendingDefaultScrollStore:C,preserveScrollOnPrependRef:E,scrollToEnd:ee,scrollToMessage:te,scrollToStart:W,setContentElement:G,setRootElement:Be,setSpacerElement:Se,setViewportElement:H,stateStore:_,syncAfterScroll:be,unobserveVisibility:Oe,userScrollIntent:Re,viewportRef:T,visibilityStore:j}),[J,ce,he,C,ee,te,W,G,Be,Se,H,_,be,Oe,Re,j]);return y.useLayoutEffect(()=>{z()||g.current===0&&Fi(s)},[z]),y.useEffect(()=>()=>{var V;D.current!==null&&(window.cancelAnimationFrame(D.current),D.current=null),k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),v.current!==null&&(window.cancelAnimationFrame(v.current),v.current=null),(V=U.current)==null||V.disconnect(),U.current=null},[]),y.useLayoutEffect(()=>{if(e&&b.current==="following-bottom"&&g.current>0){ee({behavior:"auto"});return}L()},[e,L,ee]),{context:ge,registerMessage:je}}function Pu(e){let t=y.useRef(e);return t.current=e,t}var Li=y.createContext(null),Bi=y.createContext(null);function nn(){let e=y.useContext(Li);if(!e)throw new Error("useMessageScroller must be used within a MessageScroller.");return e}function Ou(){let e=y.useContext(Bi);if(!e)throw new Error("MessageScrollerItem must be used within a MessageScroller.");return e}function Iu({autoScroll:e=!1,children:t,defaultScrollPosition:n="end",scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:s}){let{context:i,registerMessage:c}=Tu({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:s});return p.jsx(Li.Provider,{value:i,children:p.jsx(Bi.Provider,{value:c,children:t})})}function Vi(){let{pendingDefaultScrollStore:e}=nn();return y.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function _u({children:e,...t}){let{setRootElement:n}=nn(),r=Vi();return p.jsx("div",{ref:n,...t,...r?{"data-pending-scroll":""}:null,children:e})}function ku({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:o,onWheel:s,preserveScrollOnPrepend:i=!0,ref:c,role:a,tabIndex:l,...f}){let{handleResize:u,preserveScrollOnPrependRef:h,setViewportElement:g,syncAfterScroll:d,userScrollIntent:m,viewportRef:b}=nn(),v=Vi();h.current=i;let x=y.useCallback(R=>{var P;g(R),(P=tn(c))==null||P(R)},[c,g]);function S(R){d(),r==null||r(R)}function E(R){m(),s==null||s(R)}function C(R){m(),o==null||o(R)}function w(R){cu.has(R.key)&&m(),n==null||n(R)}return y.useEffect(()=>{let R=b.current;if(!R||typeof ResizeObserver>"u")return;let P=0,O=new ResizeObserver(()=>{window.cancelAnimationFrame(P),P=window.requestAnimationFrame(u)});return O.observe(R),()=>{window.cancelAnimationFrame(P),O.disconnect()}},[u,b]),p.jsx("div",{ref:x,role:a??"region","aria-label":e??"Messages",tabIndex:l??0,onKeyDown:w,onScroll:S,onTouchMove:C,onWheel:E,...f,...v?{"data-pending-scroll":""}:null,children:t})}function Au({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:o,...s}){let{handleContentChange:i,handleResize:c,setContentElement:a,setSpacerElement:l}=nn(),f=y.useRef(null),u=y.useCallback(h=>{var g;f.current=h,a(h),(g=tn(n))==null||g(h)},[n,a]);return y.useLayoutEffect(()=>{let h=f.current;if(!h||(i(),typeof MutationObserver>"u"))return;let g=new MutationObserver(()=>{i()});return g.observe(h,{childList:!0}),()=>g.disconnect()},[i]),y.useEffect(()=>{let h=f.current;if(!h||typeof ResizeObserver>"u")return;let g=0,d=new ResizeObserver(()=>{window.cancelAnimationFrame(g),g=window.requestAnimationFrame(c)});return d.observe(h),()=>{window.cancelAnimationFrame(g),d.disconnect()}},[c]),p.jsxs("div",{ref:u,role:r??"log","aria-relevant":e??"additions",...s,children:[t,p.jsx("div",{ref:l,"aria-hidden":"true","data-message-scroller-spacer":"",hidden:!0,className:o})]})}function Nu({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let o=Ou(),s=y.useRef(null),i=y.useCallback(c=>{var l;let a=s.current;s.current=c,e&&o(e,c,a),(l=tn(t))==null||l(c)},[e,t,o]);return p.jsx("div",{ref:i,"data-message-id":e,"data-scroll-anchor":n?"true":"false",...r})}function ju({behavior:e="smooth",children:t,direction:n="end",onClick:r,render:o,tabIndex:s,type:i="button",...c}){let{scrollToEnd:a,scrollToStart:l,stateStore:f}=nn(),u=Pu(r),h=y.useCallback(b=>f.subscribe(b),[f]),g=y.useCallback(()=>{let b=f.getSnapshot();return n==="start"?b.start:b.end},[n,f]),d=y.useSyncExternalStore(h,g,g),m=y.useCallback(b=>{var v;d&&((v=u.current)==null||v.call(u,b),b.defaultPrevented||(b.currentTarget.blur(),n==="start"?l({behavior:e}):a({behavior:e})))},[e,n,d,u,a,l]);return Ql({defaultTagName:"button",props:_r({type:i,inert:!d,tabIndex:d?s:-1,children:t??p.jsxs("span",{children:["Scroll to ",n]}),onClick:m},c),render:o,state:{active:d,direction:n},stateAttributesMapping:{active:b=>({"data-active":b?"true":"false"})}})}var Ft={Provider:Iu,Root:_u,Viewport:ku,Content:Au,Item:Nu,Button:ju};function Mu(e){return p.jsx(Ft.Provider,{...e})}function Du({className:e,...t}){return p.jsx(Ft.Root,{"data-slot":"message-scroller",className:ue("msg-scroller-root",e),...t})}function Fu({className:e,...t}){return p.jsx(Ft.Viewport,{"data-slot":"message-scroller-viewport",className:ue("msg-scroller-viewport",e),...t})}function Lu({className:e,...t}){return p.jsx(Ft.Content,{"data-slot":"message-scroller-content",className:ue("msg-scroller-content",e),...t})}function cs({className:e,scrollAnchor:t=!1,...n}){return p.jsx(Ft.Item,{"data-slot":"message-scroller-item",scrollAnchor:t,className:ue("msg-scroller-item",e),...n})}function Bu({direction:e="end",className:t,children:n,...r}){return p.jsx(Ft.Button,{"data-slot":"message-scroller-button",direction:e,className:ue("msg-scroller-btn",t),...r,children:n??p.jsxs(p.Fragment,{children:[p.jsx(fa,{size:16,"aria-hidden":"true",className:e==="start"?"rotate-180":void 0}),p.jsx("span",{className:"sr-only",children:e==="end"?"Jump to latest":"Jump to start"})]})})}function Ar({align:e="start",variant:t="muted",className:n,...r}){return p.jsx("div",{...r,"data-slot":"bubble","data-align":e,"data-variant":t,className:ue("chat-bubble",n)})}function Nr({className:e,...t}){return p.jsx("div",{...t,"data-slot":"bubble-content",className:ue("chat-bubble-content",e)})}const Vu=()=>p.jsxs(Jr,{children:[p.jsx(oi,{className:"avatar-circle","aria-hidden":"true",children:p.jsx(Js,{size:15})}),p.jsx(Zr,{children:p.jsx(Ar,{children:p.jsx(Nr,{children:"Hello — I am the VPS Veritas assistant. Ask about reports, sample status, registration, or support, or choose a suggested question."})})})]});function $i(){const[e,t]=I.useState("idle");I.useEffect(()=>{if(e!=="copied")return;const r=window.setTimeout(()=>t("idle"),2e3);return()=>window.clearTimeout(r)},[e]);async function n(r){t("copying");try{await navigator.clipboard.writeText(r),t("copied")}catch{t("failed")}}return{status:e,copy:n}}function $u({message:e,onFeedback:t}){const{status:n,copy:r}=$i();return p.jsxs("div",{className:"chat-message-actions",role:"group","aria-label":"Response actions",children:[p.jsx("button",{type:"button",className:"chat-message-action","aria-label":"Copy response",title:"Copy response",disabled:n==="copying",onClick:()=>void r(e.content),children:n==="copied"?p.jsx(Xr,{size:16,"aria-hidden":"true"}):p.jsx(ei,{size:16,"aria-hidden":"true"})}),p.jsx("button",{type:"button",className:"chat-message-action","aria-label":"Like response",title:"Like response","aria-pressed":e.feedback==="like",onClick:()=>t(e.id,"like"),children:p.jsx(Pa,{size:16,"aria-hidden":"true"})}),p.jsx("button",{type:"button",className:"chat-message-action","aria-label":"Dislike response",title:"Dislike response","aria-pressed":e.feedback==="dislike",onClick:()=>t(e.id,"dislike"),children:p.jsx(Ta,{size:16,"aria-hidden":"true"})}),p.jsxs("span",{className:"chat-message-copy-status",role:"status",children:[n==="copied"&&"Copied",n==="failed"&&"Couldn’t copy"]})]})}function ho(e){const t=e.trim();if(!/[\u0000-\u001f\u007f]/.test(t)&&/^(https?:\/\/|mailto:|\/(?!\/)|#)/i.test(t))return t}function Hu(e){return Object.prototype.toString.call(e)==="[object Object]"}function as(e){return Hu(e)||Array.isArray(e)}function Uu(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function go(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const o=JSON.stringify(Object.keys(e.breakpoints||{})),s=JSON.stringify(Object.keys(t.breakpoints||{}));return o!==s?!1:n.every(i=>{const c=e[i],a=t[i];return typeof c=="function"?`${c}`==`${a}`:!as(c)||!as(a)?c===a:go(c,a)})}function ls(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function zu(e,t){if(e.length!==t.length)return!1;const n=ls(e),r=ls(t);return n.every((o,s)=>{const i=r[s];return go(o,i)})}function mo(e){return typeof e=="number"}function jr(e){return typeof e=="string"}function Qn(e){return typeof e=="boolean"}function us(e){return Object.prototype.toString.call(e)==="[object Object]"}function we(e){return Math.abs(e)}function bo(e){return Math.sign(e)}function Wt(e,t){return we(e-t)}function Wu(e,t){if(e===0||t===0||we(e)<=we(t))return 0;const n=Wt(we(e),we(t));return we(n/e)}function qu(e){return Math.round(e*100)/100}function Xt(e){return Jt(e).map(Number)}function Ge(e){return e[rn(e)]}function rn(e){return Math.max(0,e.length-1)}function vo(e,t){return t===rn(e)}function fs(e,t=0){return Array.from(Array(e),(n,r)=>t+r)}function Jt(e){return Object.keys(e)}function Hi(e,t){return[e,t].reduce((n,r)=>(Jt(r).forEach(o=>{const s=n[o],i=r[o],c=us(s)&&us(i);n[o]=c?Hi(s,i):i}),n),{})}function Mr(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function Gu(e,t){const n={start:r,center:o,end:s};function r(){return 0}function o(a){return s(a)/2}function s(a){return t-a}function i(a,l){return jr(e)?n[e](a):e(t,a,l)}return{measure:i}}function Zt(){let e=[];function t(o,s,i,c={passive:!0}){let a;if("addEventListener"in o)o.addEventListener(s,i,c),a=()=>o.removeEventListener(s,i,c);else{const l=o;l.addListener(i),a=()=>l.removeListener(i)}return e.push(a),r}function n(){e=e.filter(o=>o())}const r={add:t,clear:n};return r}function Ku(e,t,n,r){const o=Zt(),s=1e3/60;let i=null,c=0,a=0;function l(){o.add(e,"visibilitychange",()=>{e.hidden&&d()})}function f(){g(),o.clear()}function u(b){if(!a)return;i||(i=b,n(),n());const v=b-i;for(i=b,c+=v;c>=s;)n(),c-=s;const x=c/s;r(x),a&&(a=t.requestAnimationFrame(u))}function h(){a||(a=t.requestAnimationFrame(u))}function g(){t.cancelAnimationFrame(a),i=null,c=0,a=0}function d(){i=null,c=0}return{init:l,destroy:f,start:h,stop:g,update:n,render:r}}function Yu(e,t){const n=t==="rtl",r=e==="y",o=r?"y":"x",s=r?"x":"y",i=!r&&n?-1:1,c=f(),a=u();function l(d){const{height:m,width:b}=d;return r?m:b}function f(){return r?"top":n?"right":"left"}function u(){return r?"bottom":n?"left":"right"}function h(d){return d*i}return{scroll:o,cross:s,startEdge:c,endEdge:a,measureSize:l,direction:h}}function Et(e=0,t=0){const n=we(e-t);function r(l){return l<e}function o(l){return l>t}function s(l){return r(l)||o(l)}function i(l){return s(l)?r(l)?e:t:l}function c(l){return n?l-n*Math.ceil((l-t)/n):l}return{length:n,max:t,min:e,constrain:i,reachedAny:s,reachedMax:o,reachedMin:r,removeOffset:c}}function Ui(e,t,n){const{constrain:r}=Et(0,e),o=e+1;let s=i(t);function i(h){return n?we((o+h)%o):r(h)}function c(){return s}function a(h){return s=i(h),u}function l(h){return f().set(c()+h)}function f(){return Ui(e,c(),n)}const u={get:c,set:a,add:l,clone:f};return u}function Xu(e,t,n,r,o,s,i,c,a,l,f,u,h,g,d,m,b,v,x){const{cross:S,direction:E}=e,C=["INPUT","SELECT","TEXTAREA"],w={passive:!1},R=Zt(),P=Zt(),O=Et(50,225).constrain(g.measure(20)),M={mouse:300,touch:400},F={mouse:500,touch:600},A=d?43:25;let D=!1,_=0,T=0,k=!1,U=!1,j=!1,N=!1;function Y(W){if(!x)return;function ne(ve){(Qn(x)||x(W,ve))&&B(ve)}const oe=t;R.add(oe,"dragstart",ve=>ve.preventDefault(),w).add(oe,"touchmove",()=>{},w).add(oe,"touchend",()=>{}).add(oe,"touchstart",ne).add(oe,"mousedown",ne).add(oe,"touchcancel",Q).add(oe,"contextmenu",Q).add(oe,"click",re,!0)}function K(){R.clear(),P.clear()}function le(){const W=N?n:t;P.add(W,"touchmove",$,w).add(W,"touchend",Q).add(W,"mousemove",$,w).add(W,"mouseup",Q)}function ie(W){const ne=W.nodeName||"";return C.includes(ne)}function L(){return(d?F:M)[N?"mouse":"touch"]}function X(W,ne){const oe=u.add(bo(W)*-1),ve=f.byDistance(W,!d).distance;return d||we(W)<O?ve:b&&ne?ve*.5:f.byIndex(oe.get(),0).distance}function B(W){const ne=Mr(W,r);N=ne,j=d&&ne&&!W.buttons&&D,D=Wt(o.get(),i.get())>=2,!(ne&&W.button!==0)&&(ie(W.target)||(k=!0,s.pointerDown(W),l.useFriction(0).useDuration(0),o.set(i),le(),_=s.readPoint(W),T=s.readPoint(W,S),h.emit("pointerDown")))}function $(W){if(!Mr(W,r)&&W.touches.length>=2)return Q(W);const oe=s.readPoint(W),ve=s.readPoint(W,S),z=Wt(oe,_),J=Wt(ve,T);if(!U&&!N&&(!W.cancelable||(U=z>J,!U)))return Q(W);const ce=s.pointerMove(W);z>m&&(j=!0),l.useFriction(.3).useDuration(.75),c.start(),o.add(E(ce)),W.preventDefault()}function Q(W){const oe=f.byDistance(0,!1).index!==u.get(),ve=s.pointerUp(W)*L(),z=X(E(ve),oe),J=Wu(ve,z),ce=A-10*J,he=v+J/50;U=!1,k=!1,P.clear(),l.useDuration(ce).useFriction(he),a.distance(z,!d),N=!1,h.emit("pointerUp")}function re(W){j&&(W.stopPropagation(),W.preventDefault(),j=!1)}function ee(){return k}return{init:Y,destroy:K,pointerDown:ee}}function Ju(e,t){let r,o;function s(u){return u.timeStamp}function i(u,h){const d=`client${(h||e.scroll)==="x"?"X":"Y"}`;return(Mr(u,t)?u:u.touches[0])[d]}function c(u){return r=u,o=u,i(u)}function a(u){const h=i(u)-i(o),g=s(u)-s(r)>170;return o=u,g&&(r=u),h}function l(u){if(!r||!o)return 0;const h=i(o)-i(r),g=s(u)-s(r),d=s(u)-s(o)>170,m=h/g;return g&&!d&&we(m)>.1?m:0}return{pointerDown:c,pointerMove:a,pointerUp:l,readPoint:i}}function Zu(){function e(n){const{offsetTop:r,offsetLeft:o,offsetWidth:s,offsetHeight:i}=n;return{top:r,right:o+s,bottom:r+i,left:o,width:s,height:i}}return{measure:e}}function Qu(e){function t(r){return e*(r/100)}return{measure:t}}function ef(e,t,n,r,o,s,i){const c=[e].concat(r);let a,l,f=[],u=!1;function h(b){return o.measureSize(i.measure(b))}function g(b){if(!s)return;l=h(e),f=r.map(h);function v(x){for(const S of x){if(u)return;const E=S.target===e,C=r.indexOf(S.target),w=E?l:f[C],R=h(E?e:r[C]);if(we(R-w)>=.5){b.reInit(),t.emit("resize");break}}}a=new ResizeObserver(x=>{(Qn(s)||s(b,x))&&v(x)}),n.requestAnimationFrame(()=>{c.forEach(x=>a.observe(x))})}function d(){u=!0,a&&a.disconnect()}return{init:g,destroy:d}}function tf(e,t,n,r,o,s){let i=0,c=0,a=o,l=s,f=e.get(),u=0;function h(){const w=r.get()-e.get(),R=!a;let P=0;return R?(i=0,n.set(r),e.set(r),P=w):(n.set(e),i+=w/a,i*=l,f+=i,e.add(i),P=f-u),c=bo(P),u=f,C}function g(){const w=r.get()-t.get();return we(w)<.001}function d(){return a}function m(){return c}function b(){return i}function v(){return S(o)}function x(){return E(s)}function S(w){return a=w,C}function E(w){return l=w,C}const C={direction:m,duration:d,velocity:b,seek:h,settled:g,useBaseFriction:x,useBaseDuration:v,useFriction:E,useDuration:S};return C}function nf(e,t,n,r,o){const s=o.measure(10),i=o.measure(50),c=Et(.1,.99);let a=!1;function l(){return!(a||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function f(g){if(!l())return;const d=e.reachedMin(t.get())?"min":"max",m=we(e[d]-t.get()),b=n.get()-t.get(),v=c.constrain(m/i);n.subtract(b*v),!g&&we(b)<s&&(n.set(e.constrain(n.get())),r.useDuration(25).useBaseFriction())}function u(g){a=!g}return{shouldConstrain:l,constrain:f,toggleActive:u}}function rf(e,t,n,r,o){const s=Et(-t+e,0),i=u(),c=f(),a=h();function l(d,m){return Wt(d,m)<=1}function f(){const d=i[0],m=Ge(i),b=i.lastIndexOf(d),v=i.indexOf(m)+1;return Et(b,v)}function u(){return n.map((d,m)=>{const{min:b,max:v}=s,x=s.constrain(d),S=!m,E=vo(n,m);return S?v:E||l(b,x)?b:l(v,x)?v:x}).map(d=>parseFloat(d.toFixed(3)))}function h(){if(t<=e+o)return[s.max];if(r==="keepSnaps")return i;const{min:d,max:m}=c;return i.slice(d,m)}return{snapsContained:a,scrollContainLimit:c}}function of(e,t,n){const r=t[0],o=n?r-e:Ge(t);return{limit:Et(o,r)}}function sf(e,t,n,r){const s=t.min+.1,i=t.max+.1,{reachedMin:c,reachedMax:a}=Et(s,i);function l(h){return h===1?a(n.get()):h===-1?c(n.get()):!1}function f(h){if(!l(h))return;const g=e*(h*-1);r.forEach(d=>d.add(g))}return{loop:f}}function cf(e){const{max:t,length:n}=e;function r(s){const i=s-t;return n?i/-n:0}return{get:r}}function af(e,t,n,r,o){const{startEdge:s,endEdge:i}=e,{groupSlides:c}=o,a=u().map(t.measure),l=h(),f=g();function u(){return c(r).map(m=>Ge(m)[i]-m[0][s]).map(we)}function h(){return r.map(m=>n[s]-m[s]).map(m=>-we(m))}function g(){return c(l).map(m=>m[0]).map((m,b)=>m+a[b])}return{snaps:l,snapsAligned:f}}function lf(e,t,n,r,o,s){const{groupSlides:i}=o,{min:c,max:a}=r,l=f();function f(){const h=i(s),g=!e||t==="keepSnaps";return n.length===1?[s]:g?h:h.slice(c,a).map((d,m,b)=>{const v=!m,x=vo(b,m);if(v){const S=Ge(b[0])+1;return fs(S)}if(x){const S=rn(s)-Ge(b)[0]+1;return fs(S,Ge(b)[0])}return d})}return{slideRegistry:l}}function uf(e,t,n,r,o){const{reachedAny:s,removeOffset:i,constrain:c}=r;function a(d){return d.concat().sort((m,b)=>we(m)-we(b))[0]}function l(d){const m=e?i(d):c(d),b=t.map((x,S)=>({diff:f(x-m,0),index:S})).sort((x,S)=>we(x.diff)-we(S.diff)),{index:v}=b[0];return{index:v,distance:m}}function f(d,m){const b=[d,d+n,d-n];if(!e)return d;if(!m)return a(b);const v=b.filter(x=>bo(x)===m);return v.length?a(v):Ge(b)-n}function u(d,m){const b=t[d]-o.get(),v=f(b,m);return{index:d,distance:v}}function h(d,m){const b=o.get()+d,{index:v,distance:x}=l(b),S=!e&&s(b);if(!m||S)return{index:v,distance:d};const E=t[v]-x,C=d+f(E,0);return{index:v,distance:C}}return{byDistance:h,byIndex:u,shortcut:f}}function ff(e,t,n,r,o,s,i){function c(u){const h=u.distance,g=u.index!==t.get();s.add(h),h&&(r.duration()?e.start():(e.update(),e.render(1),e.update())),g&&(n.set(t.get()),t.set(u.index),i.emit("select"))}function a(u,h){const g=o.byDistance(u,h);c(g)}function l(u,h){const g=t.clone().set(u),d=o.byIndex(g.get(),h);c(d)}return{distance:a,index:l}}function df(e,t,n,r,o,s,i,c){const a={passive:!0,capture:!0};let l=0;function f(g){if(!c)return;function d(m){if(new Date().getTime()-l>10)return;i.emit("slideFocusStart"),e.scrollLeft=0;const x=n.findIndex(S=>S.includes(m));mo(x)&&(o.useDuration(0),r.index(x,0),i.emit("slideFocus"))}s.add(document,"keydown",u,!1),t.forEach((m,b)=>{s.add(m,"focus",v=>{(Qn(c)||c(g,v))&&d(b)},a)})}function u(g){g.code==="Tab"&&(l=new Date().getTime())}return{init:f}}function Ut(e){let t=e;function n(){return t}function r(a){t=i(a)}function o(a){t+=i(a)}function s(a){t-=i(a)}function i(a){return mo(a)?a:a.get()}return{get:n,set:r,add:o,subtract:s}}function zi(e,t){const n=e.scroll==="x"?i:c,r=t.style;let o=null,s=!1;function i(h){return`translate3d(${h}px,0px,0px)`}function c(h){return`translate3d(0px,${h}px,0px)`}function a(h){if(s)return;const g=qu(e.direction(h));g!==o&&(r.transform=n(g),o=g)}function l(h){s=!h}function f(){s||(r.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:f,to:a,toggleActive:l}}function pf(e,t,n,r,o,s,i,c,a){const f=Xt(o),u=Xt(o).reverse(),h=v().concat(x());function g(R,P){return R.reduce((O,M)=>O-o[M],P)}function d(R,P){return R.reduce((O,M)=>g(O,P)>0?O.concat([M]):O,[])}function m(R){return s.map((P,O)=>({start:P-r[O]+.5+R,end:P+t-.5+R}))}function b(R,P,O){const M=m(P);return R.map(F=>{const A=O?0:-n,D=O?n:0,_=O?"end":"start",T=M[F][_];return{index:F,loopPoint:T,slideLocation:Ut(-1),translate:zi(e,a[F]),target:()=>c.get()>T?A:D}})}function v(){const R=i[0],P=d(u,R);return b(P,n,!1)}function x(){const R=t-i[0]-1,P=d(f,R);return b(P,-n,!0)}function S(){return h.every(({index:R})=>{const P=f.filter(O=>O!==R);return g(P,t)<=.1})}function E(){h.forEach(R=>{const{target:P,translate:O,slideLocation:M}=R,F=P();F!==M.get()&&(O.to(F),M.set(F))})}function C(){h.forEach(R=>R.translate.clear())}return{canLoop:S,clear:C,loop:E,loopPoints:h}}function hf(e,t,n){let r,o=!1;function s(a){if(!n)return;function l(f){for(const u of f)if(u.type==="childList"){a.reInit(),t.emit("slidesChanged");break}}r=new MutationObserver(f=>{o||(Qn(n)||n(a,f))&&l(f)}),r.observe(e,{childList:!0})}function i(){r&&r.disconnect(),o=!0}return{init:s,destroy:i}}function gf(e,t,n,r){const o={};let s=null,i=null,c,a=!1;function l(){c=new IntersectionObserver(d=>{a||(d.forEach(m=>{const b=t.indexOf(m.target);o[b]=m}),s=null,i=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:r}),t.forEach(d=>c.observe(d))}function f(){c&&c.disconnect(),a=!0}function u(d){return Jt(o).reduce((m,b)=>{const v=parseInt(b),{isIntersecting:x}=o[v];return(d&&x||!d&&!x)&&m.push(v),m},[])}function h(d=!0){if(d&&s)return s;if(!d&&i)return i;const m=u(d);return d&&(s=m),d||(i=m),m}return{init:l,destroy:f,get:h}}function mf(e,t,n,r,o,s){const{measureSize:i,startEdge:c,endEdge:a}=e,l=n[0]&&o,f=d(),u=m(),h=n.map(i),g=b();function d(){if(!l)return 0;const x=n[0];return we(t[c]-x[c])}function m(){if(!l)return 0;const x=s.getComputedStyle(Ge(r));return parseFloat(x.getPropertyValue(`margin-${a}`))}function b(){return n.map((x,S,E)=>{const C=!S,w=vo(E,S);return C?h[S]+f:w?h[S]+u:E[S+1][c]-x[c]}).map(we)}return{slideSizes:h,slideSizesWithGaps:g,startGap:f,endGap:u}}function bf(e,t,n,r,o,s,i,c,a){const{startEdge:l,endEdge:f,direction:u}=e,h=mo(n);function g(v,x){return Xt(v).filter(S=>S%x===0).map(S=>v.slice(S,S+x))}function d(v){return v.length?Xt(v).reduce((x,S,E)=>{const C=Ge(x)||0,w=C===0,R=S===rn(v),P=o[l]-s[C][l],O=o[l]-s[S][f],M=!r&&w?u(i):0,F=!r&&R?u(c):0,A=we(O-F-(P+M));return E&&A>t+a&&x.push(S),R&&x.push(v.length),x},[]).map((x,S,E)=>{const C=Math.max(E[S-1]||0);return v.slice(C,x)}):[]}function m(v){return h?g(v,n):d(v)}return{groupSlides:m}}function vf(e,t,n,r,o,s,i){const{align:c,axis:a,direction:l,startIndex:f,loop:u,duration:h,dragFree:g,dragThreshold:d,inViewThreshold:m,slidesToScroll:b,skipSnaps:v,containScroll:x,watchResize:S,watchSlides:E,watchDrag:C,watchFocus:w}=s,R=2,P=Zu(),O=P.measure(t),M=n.map(P.measure),F=Yu(a,l),A=F.measureSize(O),D=Qu(A),_=Gu(c,A),T=!u&&!!x,k=u||!!x,{slideSizes:U,slideSizesWithGaps:j,startGap:N,endGap:Y}=mf(F,O,M,n,k,o),K=bf(F,A,b,u,O,M,N,Y,R),{snaps:le,snapsAligned:ie}=af(F,_,O,M,K),L=-Ge(le)+Ge(j),{snapsContained:X,scrollContainLimit:B}=rf(A,L,ie,x,R),$=T?X:ie,{limit:Q}=of(L,$,u),re=Ui(rn($),f,u),ee=re.clone(),te=Xt(n),W=({dragHandler:V,scrollBody:q,scrollBounds:Z,options:{loop:se}})=>{se||Z.constrain(V.pointerDown()),q.seek()},ne=({scrollBody:V,translate:q,location:Z,offsetLocation:se,previousLocation:ke,scrollLooper:Ce,slideLooper:Ct,dragHandler:st,animation:Rt,eventHandler:Ze,scrollBounds:Qe,options:{loop:ht}},gt)=>{const Lt=V.settled(),an=!Qe.shouldConstrain(),Bt=ht?Lt:Lt&&an,Vt=Bt&&!st.pointerDown();Vt&&Rt.stop();const ln=Z.get()*gt+ke.get()*(1-gt);se.set(ln),ht&&(Ce.loop(V.direction()),Ct.loop()),q.to(se.get()),Vt&&Ze.emit("settle"),Bt||Ze.emit("scroll")},oe=Ku(r,o,()=>W(ge),V=>ne(ge,V)),ve=.68,z=$[re.get()],J=Ut(z),ce=Ut(z),he=Ut(z),Oe=Ut(z),je=tf(J,he,ce,Oe,h,ve),Re=uf(u,$,L,Q,Oe),Me=ff(oe,re,ee,je,Re,Oe,i),Be=cf(Q),H=Zt(),G=gf(t,n,i,m),{slideRegistry:Se}=lf(T,x,$,B,K,te),be=df(e,n,Se,Me,je,H,i,w),ge={ownerDocument:r,ownerWindow:o,eventHandler:i,containerRect:O,slideRects:M,animation:oe,axis:F,dragHandler:Xu(F,e,r,o,Oe,Ju(F,o),J,oe,Me,je,Re,re,i,D,g,d,v,ve,C),eventStore:H,percentOfView:D,index:re,indexPrevious:ee,limit:Q,location:J,offsetLocation:he,previousLocation:ce,options:s,resizeHandler:ef(t,i,o,n,F,S,P),scrollBody:je,scrollBounds:nf(Q,he,Oe,je,D),scrollLooper:sf(L,Q,he,[J,he,ce,Oe]),scrollProgress:Be,scrollSnapList:$.map(Be.get),scrollSnaps:$,scrollTarget:Re,scrollTo:Me,slideLooper:pf(F,A,L,U,j,le,$,he,n),slideFocus:be,slidesHandler:hf(t,i,E),slidesInView:G,slideIndexes:te,slideRegistry:Se,slidesToScroll:K,target:Oe,translate:zi(F,t)};return ge}function yf(){let e={},t;function n(l){t=l}function r(l){return e[l]||[]}function o(l){return r(l).forEach(f=>f(t,l)),a}function s(l,f){return e[l]=r(l).concat([f]),a}function i(l,f){return e[l]=r(l).filter(u=>u!==f),a}function c(){e={}}const a={init:n,emit:o,off:i,on:s,clear:c};return a}const xf={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function Ef(e){function t(s,i){return Hi(s,i||{})}function n(s){const i=s.breakpoints||{},c=Jt(i).filter(a=>e.matchMedia(a).matches).map(a=>i[a]).reduce((a,l)=>t(a,l),{});return t(s,c)}function r(s){return s.map(i=>Jt(i.breakpoints||{})).reduce((i,c)=>i.concat(c),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:r}}function Sf(e){let t=[];function n(s,i){return t=i.filter(({options:c})=>e.optionsAtMedia(c).active!==!1),t.forEach(c=>c.init(s,e)),i.reduce((c,a)=>Object.assign(c,{[a.name]:a}),{})}function r(){t=t.filter(s=>s.destroy())}return{init:n,destroy:r}}function Dn(e,t,n){const r=e.ownerDocument,o=r.defaultView,s=Ef(o),i=Sf(s),c=Zt(),a=yf(),{mergeOptions:l,optionsAtMedia:f,optionsMediaQueries:u}=s,{on:h,off:g,emit:d}=a,m=F;let b=!1,v,x=l(xf,Dn.globalOptions),S=l(x),E=[],C,w,R;function P(){const{container:te,slides:W}=S;w=(jr(te)?e.querySelector(te):te)||e.children[0];const oe=jr(W)?w.querySelectorAll(W):W;R=[].slice.call(oe||w.children)}function O(te){const W=vf(e,w,R,r,o,te,a);if(te.loop&&!W.slideLooper.canLoop()){const ne=Object.assign({},te,{loop:!1});return O(ne)}return W}function M(te,W){b||(x=l(x,te),S=f(x),E=W||E,P(),v=O(S),u([x,...E.map(({options:ne})=>ne)]).forEach(ne=>c.add(ne,"change",F)),S.active&&(v.translate.to(v.location.get()),v.animation.init(),v.slidesInView.init(),v.slideFocus.init(ee),v.eventHandler.init(ee),v.resizeHandler.init(ee),v.slidesHandler.init(ee),v.options.loop&&v.slideLooper.loop(),w.offsetParent&&R.length&&v.dragHandler.init(ee),C=i.init(ee,E)))}function F(te,W){const ne=K();A(),M(l({startIndex:ne},te),W),a.emit("reInit")}function A(){v.dragHandler.destroy(),v.eventStore.clear(),v.translate.clear(),v.slideLooper.clear(),v.resizeHandler.destroy(),v.slidesHandler.destroy(),v.slidesInView.destroy(),v.animation.destroy(),i.destroy(),c.clear()}function D(){b||(b=!0,c.clear(),A(),a.emit("destroy"),a.clear())}function _(te,W,ne){!S.active||b||(v.scrollBody.useBaseFriction().useDuration(W===!0?0:S.duration),v.scrollTo.index(te,ne||0))}function T(te){const W=v.index.add(1).get();_(W,te,-1)}function k(te){const W=v.index.add(-1).get();_(W,te,1)}function U(){return v.index.add(1).get()!==K()}function j(){return v.index.add(-1).get()!==K()}function N(){return v.scrollSnapList}function Y(){return v.scrollProgress.get(v.offsetLocation.get())}function K(){return v.index.get()}function le(){return v.indexPrevious.get()}function ie(){return v.slidesInView.get()}function L(){return v.slidesInView.get(!1)}function X(){return C}function B(){return v}function $(){return e}function Q(){return w}function re(){return R}const ee={canScrollNext:U,canScrollPrev:j,containerNode:Q,internalEngine:B,destroy:D,off:g,on:h,emit:d,plugins:X,previousScrollSnap:le,reInit:m,rootNode:$,scrollNext:T,scrollPrev:k,scrollProgress:Y,scrollSnapList:N,scrollTo:_,selectedScrollSnap:K,slideNodes:re,slidesInView:ie,slidesNotInView:L};return M(t,n),setTimeout(()=>a.emit("init"),0),ee}Dn.globalOptions=void 0;function yo(e={},t=[]){const n=I.useRef(e),r=I.useRef(t),[o,s]=I.useState(),[i,c]=I.useState(),a=I.useCallback(()=>{o&&o.reInit(n.current,r.current)},[o]);return I.useEffect(()=>{go(n.current,e)||(n.current=e,a())},[e,a]),I.useEffect(()=>{zu(r.current,t)||(r.current=t,a())},[t,a]),I.useEffect(()=>{if(Uu()&&i){Dn.globalOptions=yo.globalOptions;const l=Dn(i,n.current,r.current);return s(l),()=>l.destroy()}else s(void 0)},[i,s]),[c,o]}yo.globalOptions=void 0;const Dr=[];let Fr;function wf(){return Fr}function Cf(e){Dr.push(e)}function Wi(e){const t=(n,r)=>{const o=Ye(Tf).current;let s;try{Fr=o;for(const i of Dr)i.before(o);s=e(n,r);for(const i of Dr)i.after(o);o.didInitialize=!0}finally{Fr=void 0}return s};return t.displayName=e.displayName||e.name,t}function Rf(e){return y.forwardRef(Wi(e))}function Tf(){return{didInitialize:!1}}function Pf(){if(typeof navigator>"u")return{userAgent:"",platform:"",maxTouchPoints:0};if(process.env.NODE_ENV!=="production"){const e=navigator.userAgentData;if(e&&Array.isArray(e.brands))return{userAgent:e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "),platform:e.platform??navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}return{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:Of,platform:If,maxTouchPoints:_f}=Pf(),er=Of.toLowerCase(),Qt=If.toLowerCase(),qi=/^i(os$|p)/.test(Qt)||Qt==="macintel"&&_f>1,ds="android",kf=Qt===ds||er.includes(ds),Gi=!qi&&Qt.startsWith("mac");Qt.startsWith("win");const Af=Gi||qi;var Us;const on=typeof CSS<"u"&&!!((Us=CSS.supports)!=null&&Us.call(CSS,"-webkit-backdrop-filter:none"));!on&&er.includes("firefox");!on&&er.includes("chrom");const Nf=Af,jf=/jsdom|happydom/.test(er);function Mf(e){return"nativeEvent"in e}function Df(e){return e.pointerType===""&&e.isTrusted?!0:kf&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Lr(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}function Ff(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Br(e){var n;let t=e.activeElement;for(;((n=t==null?void 0:t.shadowRoot)==null?void 0:n.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function Te(e,t){var r;if(!e||!t)return!1;const n=(r=t.getRootNode)==null?void 0:r.call(t);if(e.contains(t))return!0;if(n&&At(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Vr(e,t){let n=e;for(;n;){if(me(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(At(n)?n.host:null)}return null}function vt(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const Lf="data-base-ui-focusable",Ki="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Bf="data-open",Vf="data-closed",$f="data-anchor-hidden",Hf="data-popup-open",Uf={[Hf]:""},zf={[Bf]:""},Wf={[Vf]:""},qf={[$f]:""},Gf={open(e){return e?Uf:null}},Yi={open(e){return e?zf:Wf},anchorHidden(e){return e?qf:null}},Kf={...Yi,...io},ps="data-trigger-disabled";function Fn(e,t){if(!me(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute(ps);for(const[,r]of t.entries())if(Te(r,n))return!r.hasAttribute(ps);return!1}function pr(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Yf(e){return e.matches("html,body")}function Xf(e){return _e(e)&&e.matches(Ki)}function Jf(e){return Vr(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Ki}`)!=null}function Zf(e){if(!e||jf)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Qf(e,t){return t!=null&&!Lr(t)?0:typeof e=="function"?e():e}function $r(e,t,n){const r=Qf(e,n);return typeof r=="number"?r:r==null?void 0:r[t]}function hs(e){return typeof e=="function"?e():e}function Xi(e,t){return t||e==="click"||e==="mousedown"}function ed(e){return(e==null?void 0:e.includes("mouse"))&&e!=="mousedown"}function at(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}const td={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},nd={...td,position:"fixed",margin:0,top:0,left:0},Hr=y.forwardRef(function(t,n){const[r,o]=y.useState();pe(()=>{Nf&&on&&o("button")},[]);const s={tabIndex:0,role:r};return p.jsx("span",{...t,ref:n,style:nd,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});process.env.NODE_ENV!=="production"&&(Hr.displayName="FocusGuard");const Mt=Math.min,nt=Math.max,Ln=Math.round,yn=Math.floor,rt=e=>({x:e,y:e}),rd={left:"right",right:"left",bottom:"top",top:"bottom"};function Ji(e,t,n){return nt(e,Mt(t,n))}function ft(e,t){return typeof e=="function"?e(t):e}function Ve(e){return e.split("-")[0]}function Je(e){return e.split("-")[1]}function xo(e){return e==="x"?"y":"x"}function Eo(e){return e==="y"?"height":"width"}function Ue(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function So(e){return xo(Ue(e))}function od(e,t,n){n===void 0&&(n=!1);const r=Je(e),o=So(e),s=Eo(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Bn(i)),[i,Bn(i)]}function sd(e){const t=Bn(e);return[Ur(e),t,Ur(t)]}function Ur(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const gs=["left","right"],ms=["right","left"],id=["top","bottom"],cd=["bottom","top"];function ad(e,t,n){switch(e){case"top":case"bottom":return n?t?ms:gs:t?gs:ms;case"left":case"right":return t?id:cd;default:return[]}}function ld(e,t,n,r){const o=Je(e);let s=ad(Ve(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Ur)))),s}function Bn(e){const t=Ve(e);return rd[t]+e.slice(t.length)}function ud(e){var t,n,r,o;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(o=e.left)!=null?o:0}}function Zi(e){return typeof e!="number"?ud(e):{top:e,right:e,bottom:e,left:e}}function Vn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function fd(e){return e.visibility==="hidden"||e.visibility==="collapse"}function dd(e,t=e?$e(e):null){return!e||!e.isConnected||!t||fd(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const pd='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function hd(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return At(n)?n.host:null}function zr(e){for(const t of Array.from(e.children))if(Le(t)==="summary")return t;return null}function gd(e,t){const n=zr(t);return!!n&&(e===n||Te(n,e))}function Qi(e){const t=e?Le(e):"";return e!=null&&e.matches(pd)&&(t!=="summary"||e.parentElement!=null&&Le(e.parentElement)==="details"&&zr(e.parentElement)===e)&&(t!=="details"||zr(e)==null)&&(t!=="input"||e.type!=="hidden")}function md(e){if(!Qi(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=hd(t)){const n=t!==e,r=Le(t)==="slot";if(t.hasAttribute("inert")||n&&Le(t)==="details"&&!t.open&&!gd(e,t)||t.hasAttribute("hidden")||!r&&!bd(t,n))return!1}return!0}function bd(e,t){const n=$e(e);return t?n.display!=="none":dd(e,n)}function vd(e){const t=e.tabIndex;if(t<0){const n=Le(e);if(n==="details"||n==="audio"||n==="video"||_e(e)&&e.isContentEditable)return 0}return t}function hr(e){if(Le(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function yd(e,t){const n=hr(e);if(!n)return!0;const r=t.find(o=>{const s=hr(o);return(s==null?void 0:s.name)===n.name&&s.form===n.form&&s.checked});return r?r===n:t.find(o=>{const s=hr(o);return(s==null?void 0:s.name)===n.name&&s.form===n.form})===n}function ec(e){if(_e(e)&&Le(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return _e(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function tc(e,t){ec(e).forEach(n=>{Qi(n)&&t.push(n),tc(n,t)})}function nc(e,t,n){ec(e).forEach(r=>{_e(r)&&r.matches(t)&&n.push(r),nc(r,t,n)})}function xd(e){const t=[];return tc(e,t),t.filter(md)}function rc(e){const t=xd(e);return t.filter(n=>vd(n)>=0&&yd(n,t))}function oc(e,t){const n=rc(e),r=n.length;if(r===0)return;const o=Br(Ke(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function Ed(e){return oc(Ke(e).body,1)||e}function Sd(e){return oc(Ke(e).body,-1)||e}function gr(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Te(n,r)}function wd(e){rc(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function bs(e){const t=[];nc(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Dt(e,t,n=!0){return e.filter(o=>o.parentId===t).flatMap(o=>{var s;return[...!n||(s=o.context)!=null&&s.open?[o]:[],...Dt(e,o.id,n)]})}function wo(e){return`data-base-ui-${e}`}const Cd={style:{transition:"none"}},Rd={fallbackAxisSide:"end"},Td={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Co=y.createContext(null);process.env.NODE_ENV!=="production"&&(Co.displayName="PortalContext");const Pd=()=>y.useContext(Co),Od=wo("portal");function sc(e={}){const{ref:t,container:n,componentProps:r=Fe,elementProps:o}=e,s=Gn(),i=Pd(),c=i==null?void 0:i.portalNode,[a,l]=y.useState(null),[f,u]=y.useState(null),h=fe(b=>{b!==null&&u(b)}),g=y.useRef(null);pe(()=>{if(n===null){g.current&&(g.current=null,u(null),l(null));return}const b=(n&&(co(n)?n:n.current))??c??document.body;if(b==null){g.current&&(g.current=null,u(null),l(null));return}g.current!==b&&(g.current=b,u(null),l(b))},[n,c]);const d=pt("div",r,{ref:[t,h],props:[{id:s,[Od]:""},o]}),m=a&&d?dt.createPortal(d,a):null;return{node:f,nodeId:y.isValidElement(d)?d.props.id:void 0,subtree:m}}const Id=y.forwardRef(function(t,n){const{render:r,className:o,style:s,children:i,container:c,portalOwnerRole:a,...l}=t,{node:f,nodeId:u,subtree:h}=sc({container:c,ref:n,componentProps:t,elementProps:l}),g=y.useRef(null),d=y.useRef(null),m=y.useRef(null),b=y.useRef(null),[v,x]=y.useState(null),S=y.useRef(!1),E=v==null?void 0:v.modal,C=v==null?void 0:v.open,w=!!v&&!v.modal&&v.open&&!!f;y.useEffect(()=>{if(!f||E)return;function P(O){f&&O.relatedTarget&&gr(O)&&(O.type==="focusin"?S.current&&(bs(f),S.current=!1):(wd(f),S.current=!0))}return at(Ee(f,"focusin",P,!0),Ee(f,"focusout",P,!0))},[f,E]),pe(()=>{!f||C!==!0||!S.current||(bs(f),S.current=!1)},[C,f]);const R=y.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:d,beforeInsideRef:m,afterInsideRef:b,portalNode:f,setFocusManagerState:x}),[f]);return p.jsxs(y.Fragment,{children:[h,p.jsxs(Co.Provider,{value:R,children:[w&&f&&p.jsx(Hr,{"data-type":"outside",ref:g,onFocus:P=>{var O;if(gr(P,f))(O=m.current)==null||O.focus();else{const M=v?v.domReference:null,F=Sd(M);F==null||F.focus()}}}),w&&f&&p.jsx("span",{role:a,"aria-owns":u,style:Td}),f&&dt.createPortal(i,f),w&&f&&p.jsx(Hr,{"data-type":"outside",ref:d,onFocus:P=>{var O;if(gr(P,f))(O=b.current)==null||O.focus();else{const M=v?v.domReference:null,F=Ed(M);F==null||F.focus(),v!=null&&v.closeOnFocusOut&&(v==null||v.onOpenChange(!1,Pe(sl,P.nativeEvent)))}}})]})]})});process.env.NODE_ENV!=="production"&&(Id.displayName="FloatingPortal");function ic(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}class _d{constructor(){ae(this,"nodesRef",{current:[]});ae(this,"events",ic())}addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Ro=y.createContext(null);process.env.NODE_ENV!=="production"&&(Ro.displayName="FloatingNodeContext");const To=y.createContext(null);process.env.NODE_ENV!=="production"&&(To.displayName="FloatingTreeContext");const tr=()=>{var e;return((e=y.useContext(Ro))==null?void 0:e.id)||null},sn=e=>{const t=y.useContext(To);return e??t};function kd(e){const t=Gn(),n=sn(e),r=tr();return pe(()=>{if(!t)return;const o={id:t,parentId:r};return n==null||n.addNode(o),()=>{n==null||n.removeNode(o)}},[n,t,r]),t}function Ad(e){const{children:t,id:n}=e,r=tr();return p.jsx(Ro.Provider,{value:y.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Nd(e){const{children:t,externalTree:n}=e,r=Ye(()=>n??new _d).current;return p.jsx(To.Provider,{value:r,children:t})}function jd(){return!1}function Md(e){return{escapeKey:typeof e=="boolean"?e:(e==null?void 0:e.escapeKey)??!1,outsidePress:typeof e=="boolean"?e:(e==null?void 0:e.outsidePress)??!0}}function Dd(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:o=!0,outsidePressEvent:s="sloppy",referencePress:i=jd,bubbles:c,externalTree:a}=t,l=e.useState("open"),f=e.useState("floatingElement"),{dataRef:u,events:h}=e.context,g=sn(a),d=fe(typeof o=="function"?o:()=>!1),m=typeof o=="function"?d:o,b=m!==!1,v=fe(()=>s),{escapeKey:x,outsidePress:S}=Md(c),E=y.useRef(!1),C=y.useRef(!1),w=y.useRef(!1),R=y.useRef(!1),P=y.useRef(!1),O=y.useRef(""),M=y.useRef(null),F=zt(),A=zt(),D=zt(),_=fe(()=>{A.clear(),u.current.insideReactTree=!1}),T=fe(L=>{var $;const X=($=u.current.floatingContext)==null?void 0:$.nodeId;return(g?Dt(g.nodesRef.current,X):[]).some(Q=>{var re;return((re=Q.context)==null?void 0:re.open)&&!Q.context.dataRef.current[L]})}),k=fe(L=>pr(L,e.select("floatingElement"))||pr(L,e.select("domReferenceElement"))),U=fe(L=>{i()&&e.setOpen(!1,Pe(Kn,L.nativeEvent))}),j=fe(L=>{if(!l||!n||!r||L.key!=="Escape")return;const X=Mf(L)?L.nativeEvent:L;if(P.current||X.isComposing||!x&&T("__escapeKeyBubbles"))return;const B=Pe(no,X);e.setOpen(!1,B),B.isCanceled||L.preventDefault(),!x&&!B.isPropagationAllowed&&L.stopPropagation()}),N=fe(()=>{u.current.insideReactTree=!0,A.start(0,_)}),Y=fe(L=>{if(!l||!n||L.button!==0)return;const X=vt(L.nativeEvent);Te(e.select("floatingElement"),X)&&(E.current||(E.current=!0,C.current=!1))}),K=fe(L=>{!l||!n||(L.defaultPrevented||L.nativeEvent.defaultPrevented)&&E.current&&(C.current=!0)});y.useEffect(()=>{function L(X){X.open||(R.current=!1)}return h.on("openchange",L),()=>{h.off("openchange",L)}},[h]),y.useEffect(()=>_,[_]),y.useEffect(()=>{if(!l||!n)return l||(R.current=!1,P.current=!1,O.current="",M.current=null),_;u.current.__escapeKeyBubbles=x,u.current.__outsidePressBubbles=S;const L=new ut,X=Ke(f);function B(){D.clear(),P.current=!0}function $(){P.current=!0,D.start(on?5:0,()=>{P.current=!1})}function Q(){w.current=!0,L.start(0,()=>{w.current=!1})}function re(){E.current=!1,C.current=!1}function ee(){const H=O.current,G=H==="pen"||!H?"mouse":H,Se=v(),be=typeof Se=="function"?Se():Se;return typeof be=="string"?be:be[G]}function te(H){const G=ee();return G==="intentional"&&H.type!=="click"||G==="sloppy"&&H.type==="click"}function W(H){var be;const G=(be=u.current.floatingContext)==null?void 0:be.nodeId,Se=g&&Dt(g.nodesRef.current,G).some(ge=>{var V;return pr(H,(V=ge.context)==null?void 0:V.elements.floating)});return k(H)||Se}function ne(H){if(te(H)){H.type!=="click"&&!k(H)&&(L.clear(),w.current=!1),_();return}if(u.current.insideReactTree){_();return}const G=vt(H),Se=`[${wo("inert")}]`,be=me(G)?G.getRootNode():null,ge=Array.from((At(be)?be:Ke(e.select("floatingElement"))).querySelectorAll(Se)),V=e.context.triggerElements;if(G&&(V.hasElement(G)||V.hasMatchingElement(Z=>Te(Z,G))))return;let q=me(G)?G:null;for(;q&&!ct(q);){const Z=lt(q);if(ct(Z)||!me(Z))break;q=Z}if(!(ge.length&&me(G)&&!Yf(G)&&!Te(G,e.select("floatingElement"))&&ge.every(Z=>!Te(q,Z)))){if(_e(G)&&!("touches"in H)){const Z=ct(G),se=$e(G),ke=/auto|scroll/,Ce=Z||ke.test(se.overflowX),Ct=Z||ke.test(se.overflowY),st=Ce&&G.clientWidth>0&&G.scrollWidth>G.clientWidth,Rt=Ct&&G.clientHeight>0&&G.scrollHeight>G.clientHeight,Ze=se.direction==="rtl",Qe=Rt&&(Ze?H.offsetX<=G.offsetWidth-G.clientWidth:H.offsetX>G.clientWidth),ht=st&&H.offsetY>G.clientHeight;if(Qe||ht)return}if(!W(H)){if(ee()==="intentional"){if(H.detail!==0&&!Df(H)&&!R.current)return;if(w.current){L.clear(),w.current=!1;return}}typeof m=="function"&&!m(H)||T("__outsidePressBubbles")||(e.setOpen(!1,Pe(ol,H)),_())}}}function oe(H){ee()!=="sloppy"||H.pointerType==="touch"||!e.select("open")||!n||k(H)||ne(H)}function ve(H){if(ee()!=="sloppy"||!e.select("open")||!n||k(H))return;const G=H.touches[0];G&&(M.current={startTime:Date.now(),startX:G.clientX,startY:G.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},F.start(1e3,()=>{M.current&&(M.current.dismissOnTouchEnd=!1,M.current.dismissOnMouseDown=!1)}))}function z(H,G){const Se=vt(H);if(!Se)return;const be=Ee(Se,H.type,()=>{G(H),be()})}function J(H){O.current="touch",z(H,ve)}function ce(H){F.clear(),H.type==="pointerdown"&&(H.button===0&&(R.current=!0),O.current=H.pointerType),!(H.type==="mousedown"&&M.current&&!M.current.dismissOnMouseDown)&&z(H,G=>{G.type==="pointerdown"?oe(G):ne(G)})}function he(H){if(H.type==="pointercancel"&&(R.current=!1),!E.current)return;const G=C.current;if(re(),ee()==="intentional"){if(H.type==="pointercancel"){G&&Q();return}if(!W(H)){if(G){Q();return}typeof m=="function"&&!m(H)||(L.clear(),w.current=!0,_())}}}function Oe(H){if(ee()!=="sloppy"||!M.current||k(H))return;const G=H.touches[0];if(!G)return;const Se=Math.abs(G.clientX-M.current.startX),be=Math.abs(G.clientY-M.current.startY),ge=Math.sqrt(Se*Se+be*be);ge>5&&(M.current.dismissOnTouchEnd=!0),ge>10&&(ne(H),F.clear(),M.current=null)}function je(H){z(H,Oe)}function Re(H){ee()!=="sloppy"||!M.current||k(H)||(M.current.dismissOnTouchEnd&&ne(H),F.clear(),M.current=null)}function Me(H){z(H,Re)}const Be=at(r&&at(Ee(X,"keydown",j),Ee(X,"compositionstart",B),Ee(X,"compositionend",$)),b&&at(Ee(X,"click",ce,!0),Ee(X,"pointerdown",ce,!0),Ee(X,"pointerup",he,!0),Ee(X,"pointercancel",he,!0),Ee(X,"mousedown",ce,!0),Ee(X,"mouseup",he,!0),Ee(X,"touchstart",J,{capture:!0,passive:!0}),Ee(X,"touchmove",je,{capture:!0,passive:!0}),Ee(X,"touchend",Me,{capture:!0,passive:!0})));return()=>{Be(),L.clear(),re(),w.current=!1}},[u,f,r,b,m,l,n,x,S,j,_,v,T,k,g,e,F,D]);const le=y.useMemo(()=>({onKeyDown:j,onPointerDown:U,onClick:U}),[j,U]),ie=y.useMemo(()=>({onKeyDown:j,onPointerDown:K,onMouseDown:K,onClickCapture:N,onMouseDownCapture(L){N(),Y(L)},onPointerDownCapture(L){N(),Y(L)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[j,N,Y,K]);return y.useMemo(()=>n?{reference:le,floating:ie,trigger:le}:{},[n,le,ie])}function $n(e,t,n,r){return{left:e,top:t,right:n,bottom:r,x:e,y:t,width:n-e,height:r-t}}function Fd(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function cc(e){const t=[];let n,r=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const c of Array.from(e).sort((a,l)=>a.top-l.top)){if(r=Math.min(r,c.left),o=Math.min(o,c.top),s=Math.max(s,c.right),i=Math.max(i,c.bottom),!n||c.top-n.top>n.height/2)t.push(Fd(c));else{const a=t[t.length-1];a.left=Math.min(a.left,c.left),a.right=Math.max(a.right,c.right),a.bottom=Math.max(a.bottom,c.bottom),a.width=a.right-a.left,a.height=a.bottom-a.top}n=c}return{lines:t,fallback:$n(r,o,s,i)}}function ac(e,t,n){return e.findIndex(r=>t>r.left-2&&t<r.right+2&&n>r.top-2&&n<r.bottom+2)}function vs(e){return $n(e.left,e.top,e.right,e.bottom)}function Ld(e,t,n){const{lines:r}=cc(e.getClientRects());if(r.length<2)return;const o=ac(r,t,n);return{x:t,y:n,lineIndex:o===-1?void 0:o,element:e}}function Bd(e,t,n){const{lines:r,fallback:o}=cc(e.getClientRects());if(r.length<2)return null;const s=n==null?void 0:n.x,i=n==null?void 0:n.y,c=t[0];if((n==null?void 0:n.lineIndex)!=null&&r[n.lineIndex])return vs(r[n.lineIndex]);if(s!=null&&i!=null){const d=ac(r,s,i);if(d!==-1)return vs(r[d])}if(r.length===2&&r[0].left>r[1].right&&s!=null&&i!=null)return o;if(c==="t"||c==="b"){const d=r[0],m=r[r.length-1],b=c==="t"?d:m;return $n(b.left,d.top,b.right,m.bottom)}const a=c==="l";let l=r[0].left,f=r[0].right,u=a?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY,h=r[0],g=r[0];for(const d of r){l=Math.min(l,d.left),f=Math.max(f,d.right);const m=a?d.left:d.right;a&&m<u||!a&&m>u?(u=m,h=d,g=d):m===u&&(g=d)}return $n(l,h.top,f,g.bottom)}function Vd(e){return"contextElement"in e&&e.contextElement?e.contextElement:me(e)?e:void 0}function $d(e,t){function n(o){lc(e,o.currentTarget,o.clientX,o.clientY)}function r(o){t||n(o)}return{onFocus(){e.current=void 0},onMouseEnter:r,onMouseMove:r}}function lc(e,t,n,r){const o=Ld(t,n,r);return e.current=o,o}function Hd(e){return{name:"inline",async fn(t){const n=t.elements.reference;if(typeof(n==null?void 0:n.getClientRects)!="function")return{};const r=Vd(n),o=e.current,s=(o==null?void 0:o.element)===n||(o==null?void 0:o.element)===r?o:void 0,i=Bd(n,t.placement,s);if(!i||typeof t.platform.getElementRects!="function")return{};const c=await t.platform.getElementRects({reference:{contextElement:r,getBoundingClientRect(){return i}},floating:t.elements.floating,strategy:t.strategy});return t.rects.reference.x===c.reference.x&&t.rects.reference.y===c.reference.y&&t.rects.reference.width===c.reference.width&&t.rects.reference.height===c.reference.height?{}:{reset:{rects:c}}}}}class Ud{constructor(t,n,r=!0){ae(this,"attachedStores",[]);ae(this,"attachedStoreValue",null);ae(this,"storeListeners",new Set);this.fallbackStore=t,this.componentName=n,this.throwOnMissingTrigger=r}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(t){return this.storeListeners.add(t),()=>{this.storeListeners.delete(t)}}attachStore(t){if(this.attachedStores.push(t),this.setActiveStore(t),process.env.NODE_ENV!=="production"&&this.attachedStores.length>1){const n=this;(n.overlapWarningFrame??(n.overlapWarningFrame=Ne.create())).request(()=>{this.attachedStores.length>1&&console.warn("Base UI: A handle is attached to more than one mounted root at the same time. The most recently mounted root takes over and the previous one stops being controlled by the handle. A handle should be used by a single root that stays mounted for the lifetime of the handle.")})}return()=>{const n=this.attachedStores.lastIndexOf(t);n!==-1&&this.attachedStores.splice(n,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(t){this.attachedStoreValue!==t&&(this.attachedStoreValue=t,this.storeListeners.forEach(n=>{n()}))}openByTrigger(t){const n=this.attachedStore;if(n===null){process.env.NODE_ENV!=="production"&&console.warn(`Base UI: ${this.componentName}Handle.open() was called while no root using this handle is mounted. The call was ignored; mount a root with this handle before opening it imperatively.`);return}let r;if(t){for(let o=this.attachedStores.length-1;o>=0&&!r;o-=1)r=this.attachedStores[o].context.triggerElements.getById(t);r??(r=this.fallbackStore.context.triggerElements.getById(t))}if(t&&!r){if(this.throwOnMissingTrigger)throw new Error(process.env.NODE_ENV!=="production"?`Base UI: ${this.componentName}Handle.open() was called with the trigger id "${t}", but no matching trigger is registered with this handle. An anchored popup cannot open without a trigger to anchor to. Pass the id of a mounted ${this.componentName}.Trigger that has this handle set on its "handle" prop.`:wt(99,this.componentName,t,this.componentName));process.env.NODE_ENV!=="production"&&console.warn(`Base UI: ${this.componentName}Handle.open: No trigger found with id "${t}". The popup will open, but the trigger will not be associated with it.`)}n.setOpen(!0,Pe(Or,void 0,r))}closePopup(){const t=this.attachedStore;if(t===null){process.env.NODE_ENV!=="production"&&console.warn(`Base UI: ${this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`);return}t.setOpen(!1,Pe(Or))}}function zd(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:o,nested:s,onOpenChange:i}=e,c=t.useState("open"),a=t.useState("activeTriggerElement"),l=t.useState(n?"popupElement":"positionerElement"),f=i;return t.useSyncedValue("floatingId",o),pe(()=>{const u={open:c,floatingId:o,referenceElement:a,floatingElement:l};me(a)&&(u.domReferenceElement=a),r.state.positionReference===r.state.referenceElement&&(u.positionReference=a),r.update(u)},[c,o,a,l,r]),r.context.onOpenChange=f,r.context.nested=s,r}function Wd(e){const{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:o,onUnmount:s,animateInitialOpen:i}=e,c=fe(o),{mounted:a,setMounted:l,transitionStatus:f}=yi(t,!1,!1,i),u=t?!1:r;pe(()=>{t&&c(!1)},[t,c]);const h=y.useRef(a),g=y.useRef(!1),d=mi(),m=()=>{h.current=!1,l(!1),s()};pe(()=>{h.current=a,g.current&&(g.current=!1,!t&&a&&m())});const b=fe(()=>{if(h.current){if(t){g.current=!0,d();return}m()}});return uo({enabled:a&&!t&&!u,open:t,ref:n,onComplete(){t||b()}}),{mounted:a,transitionStatus:f,preventUnmountingOnClose:u,forceUnmount:b}}const qd={tabIndex:-1,[Lf]:""};function Gd(e,t=!1){const n=Gn(),r=tr()!=null,o=Ye(()=>e(n,r)).current;return zd({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:o.setOpen}),o}function Kd({handle:e,store:t}){return pe(()=>e.attachStore(t),[e,t]),null}function ys(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function Yd(e,t){const n=y.useRef(null);return fe(r=>{const o=n.current;if(o!==null){if(o.element===r&&o.store===t&&o.id===e)return;n.current=null;const s=o.store;s.context.triggerElements.getById(o.id)===o.element&&(s.context.triggerElements.delete(o.id),ys(s))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),ys(t))})}function Xd(e,t,n,r=!1){let o=e.preventUnmountingOnClose;t?o=!1:r&&(o=!0);const s=(n==null?void 0:n.id)??null;let i=e.activeTriggerId,c=e.activeTriggerElement;return(s||t)&&(i=s,c=n??null),{open:t,preventUnmountingOnClose:o,activeTriggerId:i,activeTriggerElement:c,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function Jd(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Zd(e,t,n,r={}){var f,u,h;const o=n.reason,s=o===We,i=t&&o===Pn,c=!t&&(o===Kn||o===no),a=Jd(n);if((u=(f=e.context).onOpenChange)==null||u.call(f,t,n),n.isCanceled)return;(h=r.onBeforeDispatch)==null||h.call(r),e.state.floatingRootContext.dispatchOpenChange(t,n);const l=()=>{const g=Xd(e.state,t,n.trigger,a()),d={...r.extraState,...g};i?d.instantType="focus":c?d.instantType="dismiss":s&&(d.instantType=void 0),e.update(d)};s?dt.flushSync(l):l()}function Qd(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=Yd(e,n),i=fe(a=>{const l=n.select("open"),f=n.select("activeTriggerId");if(f===e){const u={activeTriggerElement:a,...l?r:null};n.update(u);return}if(f==null&&l&&!n.state.openedWithoutTrigger){const u={activeTriggerId:e??null,activeTriggerElement:a,...r};n.update(u)}}),c=fe(a=>{s(a),a&&i(a)});return pe(()=>(c(t.current),()=>c(null)),[c,t,n,e]),pe(()=>{if(o){const a={activeTriggerElement:t.current,...r};n.update(a)}},[o,n,t,...Object.values(r)]),{registerTrigger:c,isMountedByThisTrigger:o}}function ep(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=y.useRef(null),o=e.useState("open"),s=e.useState("triggerCount"),i=e.useState("activeTriggerId"),c=e.useState("activeTriggerElement");pe(()=>{if(!o){r.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0),e.state.openedWithoutTrigger&&e.set("openedWithoutTrigger",!1);return}const a=e.context.triggerElements.size,l={};e.state.triggerCount!==a&&(l.triggerCount=a);const f=e.select("activeTriggerId");let u=null;if(f){const h=e.context.triggerElements.getById(f);if(h)r.current=f,h!==e.state.activeTriggerElement&&(l.activeTriggerElement=h);else{for(const[g,d]of e.context.triggerElements.entries())if(d===e.state.activeTriggerElement){l.activeTriggerId=g,l.activeTriggerElement=d,r.current=g;break}l.activeTriggerId===void 0&&(r.current===f?u=f:r.current=null)}}else r.current=null;if(!u&&!f&&!e.state.openedWithoutTrigger&&a===1){const h=e.context.triggerElements.entries().next();if(!h.done){const[g,d]=h.value;l.activeTriggerId=g,l.activeTriggerElement=d,r.current=g}}(l.triggerCount!==void 0||l.activeTriggerId!==void 0||l.activeTriggerElement!==void 0)&&e.update(l),u&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===u&&!e.context.triggerElements.getById(u)){const h=Pe(vi);e.setOpen(!1,h),h.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,s,i,c,n])}function tp(e,t,n,r){const{mounted:o,transitionStatus:s,forceUnmount:i}=Wd({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState("preventUnmountingOnClose"),setPreventUnmountOnClose:c=>t.set("preventUnmountingOnClose",c),animateInitialOpen:r,onUnmount(){var c,a;t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n==null||n(),(a=(c=t.context).onOpenChangeComplete)==null||a.call(c,!1)}});return Ye(()=>(t.set("mounted",o),null)),t.useSyncedValues({mounted:o,transitionStatus:s}),{forceUnmount:i,transitionStatus:s}}function np(e,t){e.useSyncedValues(t),pe(()=>()=>{e.update({activeTriggerProps:Fe,inactiveTriggerProps:Fe,popupProps:Fe})},[e])}let _t;function rp(e){_t??(_t=new WeakMap);let t=_t.get(e);return t||(t=new WeakMap,_t.set(e,t)),t}class uc{constructor(){ae(this,"idMap",new Map)}add(t,n){if(process.env.NODE_ENV!=="production"){const r=rp(this),o=r.get(n);if(o!==void 0&&o!==t)throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.");const s=this.idMap.get(t);s!==void 0&&s!==n&&r.delete(s),r.set(n,t)}this.idMap.set(t,n)}delete(t){var n;if(process.env.NODE_ENV!=="production"){const r=this.idMap.get(t);r!==void 0&&((n=_t==null?void 0:_t.get(this))==null||n.delete(r))}this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}var xn={exports:{}},mr={};/**
|
|
176
|
+
*/const Da=ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Jr({align:e="start",className:t,...n}){return p.jsx("div",{...n,"data-slot":"message","data-align":e,className:le("chat-message",t)})}function ii({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-avatar",className:le("chat-message-avatar",e)})}function Zr({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-content",className:le("chat-message-content",e)})}function Fa({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-header",className:le("chat-message-header",e)})}function Rr({className:e,...t}){return p.jsx("div",{...t,"data-slot":"message-footer",className:le("chat-message-footer",e)})}const ot={...y},Xo={};function Ze(e,t){const n=y.useRef(Xo);return n.current===Xo&&(n.current=e(t)),n}const fr=ot.useInsertionEffect,La=fr&&fr!==ot.useLayoutEffect?fr:e=>e();function fe(e){const t=Ze(Ba).current;return t.next=e,La(t.effect),t.trampoline}function Ba(){const e={next:void 0,callback:Va,trampoline:(...t)=>{var n;return(n=e.callback)==null?void 0:n.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function Va(){if(process.env.NODE_ENV!=="production")throw new Error("Base UI: Cannot call an event handler while rendering.")}function Tr(e,t,n,r){const o=Ze(ci).current;return $a(o,e,t,n,r)&&ai(o,[e,t,n,r]),o.callback}function Ha(e){const t=Ze(ci).current;return Ua(t,e)&&ai(t,e),t.callback}function ci(){return{callback:null,cleanup:null,refs:[]}}function $a(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function Ua(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function ai(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=s(n);typeof i=="function"&&(r[o]=i);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=r[o];typeof i=="function"?i():s(null);break}case"object":{s.current=null;break}}}}}}}const Wa=parseInt(y.version,10);function li(e){return Wa>=e}function Qo(e){if(!y.isValidElement(e))return null;const t=e,n=t.props;return(li(19)?n==null?void 0:n.ref:t.ref)??null}function Ir(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}let Or;process.env.NODE_ENV!=="production"&&(Or=new Set);function ui(e,t){return function(...r){if(process.env.NODE_ENV!=="production"){const o=r.join(" "),s=`${t}: ${o}`,i=`${e}:${s}`;Or.has(i)||(Or.add(i),e==="warn"?console.warn(s):console.error(s))}}}const eo=ui("warn","Base UI");function to(){}const qa=Object.freeze([]),Ve=Object.freeze({});function za(e,t){const n={};for(const r in e){const o=e[r];if(t!=null&&t.hasOwnProperty(r)){const s=t[r](o);s!=null&&Object.assign(n,s);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function Ga(e,t){return typeof e=="function"?e(t):e}function fi(e,t){return typeof e=="function"?e(t):e}const di={};function no(e,t,n,r,o){if(!n&&!r&&!e)return An(t);let s=An(e);return t&&(s=In(s,t)),n&&(s=In(s,n)),r&&(s=In(s,r)),s}function Ka(e){if(e.length===0)return di;if(e.length===1)return An(e[0]);let t=An(e[0]);for(let n=1;n<e.length;n+=1)t=In(t,e[n]);return t}function An(e){return hi(e)?{...e(di)}:Ya(e)}function In(e,t){return hi(t)?t(e):Xa(e,t)}function Ya(e){const t={...e};for(const n in t){const r=t[n];pi(n,r)&&(t[n]=mi(r))}return t}function Xa(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=Ir(e.style,r);break}case"className":{e[n]=gi(e.className,r);break}default:pi(n,r)?e[n]=Qa(e[n],r):e[n]=r}}return e}function pi(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function hi(e){return typeof e=="function"}function Qa(e,t){return t?e?(...n)=>{const r=n[0];if(bi(r)){const s=r;Nn(s);const i=t(...n);return s.baseUIHandlerPrevented||e==null||e(...n),i}const o=t(...n);return e==null||e(...n),o}:mi(t):e}function mi(e){return e&&((...t)=>{const n=t[0];return bi(n)&&Nn(n),e(...t)})}function Nn(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function gi(e,t){return t?e?t+" "+e:t:e}function bi(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function mt(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=rl(r));const o=Ja(t,n,r);if(n.enabled===!1)return null;const s=n.state??Ve;return ol(e,r,o,s)}function Ja(e,t,n){const{className:r,style:o}=e,{state:s=Ve,ref:i,props:c,stateAttributesMapping:a,enabled:l=!0}=t,u=l?Ga(r,s):void 0,f=l?fi(o,s):void 0,h=l?za(s,a):Ve,m=l&&c?Za(c):void 0,d=l?Ir(h,m)??{}:Ve;return typeof document<"u"&&(l?Array.isArray(i)?d.ref=Ha([d.ref,Qo(n),...i]):d.ref=Tr(d.ref,Qo(n),i):Tr(null,null)),l?(u!==void 0&&(d.className=gi(d.className,u)),f!==void 0&&(d.style=Ir(d.style,f)),d):Ve}function Za(e){return Array.isArray(e)?Ka(e):no(void 0,e)}const el=Symbol.for("react.lazy"),tl=/^[A-Z][A-Za-z0-9$]*$/,nl=/[a-z]/;function rl(e){if((e==null?void 0:e.$$typeof)!==el)return e;const t=y.Children.toArray(e)[0];return y.isValidElement(t)?t:e}function ol(e,t,n,r){if(t){if(typeof t=="function")return process.env.NODE_ENV!=="production"&&sl(t),t(n,r);const o=no(n,t.props);if(o.ref=n.ref,process.env.NODE_ENV!=="production"&&!y.isValidElement(t))throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.","A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.","https://base-ui.com/r/invalid-render-prop"].join(`
|
|
177
|
+
`));return y.cloneElement(t,o)}return il(e,n)}function sl(e){const t=e.name;t.length!==0&&tl.test(t)&&nl.test(t)&&eo(`The \`render\` prop received a function named \`${t}\` that starts with an uppercase letter.`,"This usually means a React component was passed directly as `render={Component}`.","Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.","If this is an intentional render callback, rename it to start with a lowercase letter.","Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.","https://base-ui.com/r/invalid-render-prop")}function il(e,t){return e==="button"?O.createElement("button",{type:"button",...t,key:t.key}):e==="img"?O.createElement("img",{alt:"",...t,key:t.key}):y.createElement(e,t)}const Mn=ui("error","Base UI");function cl({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=y.useRef(e!==void 0),[s,i]=y.useState(()=>t),c=o&&e!==void 0?e:s;if(process.env.NODE_ENV!=="production"){y.useEffect(()=>{o!==(e!==void 0)&&Mn([`A component is changing the ${o?"":"un"}controlled ${r} state of ${n} to be ${o?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
|
|
178
|
+
`))},[r,n,e]);const{current:l}=y.useRef(t);y.useEffect(()=>{!o&&Jo(l)!==Jo(t)&&Mn([`A component is changing the default ${r} state of an uncontrolled ${n} after being initialized. To suppress this warning opt to use a controlled ${n}.`].join(`
|
|
179
|
+
`))},[t])}const a=y.useCallback(l=>{o||i(l)},[]);return[c,a]}function Jo(e){let t=0;const n=new WeakMap;try{return JSON.stringify(e,function(s,i){if(!(s==="_owner"&&this!=null&&typeof this=="object"&&"$$typeof"in this)){if(typeof i=="bigint")return`__bigint__:${i}`;if(i!==null&&typeof i=="object"){const c=n.get(i);if(c!==void 0)return`__object__:${c}`;n.set(i,t),t+=1}return i}})??`__top__:${typeof e}`}catch{return"__unserializable__"}}function vi(){const[,e]=y.useState({});return y.useCallback(()=>{e({})},[])}let Zo=0;function al(e,t="mui"){const n=y.useRef(void 0),r=vi(),o=e??n.current;return y.useEffect(()=>{n.current==null&&(Zo+=1,n.current=`${t}-${Zo}`,e==null&&r())},[e,t,r]),o}const es=ot.useId;function Kn(e,t){if(es!==void 0){const n=es();return e??(t?`${t}-${n}`:n)}return al(e,t)}function yi(e){return Kn(e,"base-ui")}function ke(e,t,n,r){let o=!1,s=!1;const i=Ve;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...i}}const xi="none",Yn="trigger-press",Ye="trigger-hover",On="trigger-focus",ll="outside-press",ul="focus-out",ro="escape-key",Pr="imperative-action",fl=()=>{},he=typeof document<"u"?y.useLayoutEffect:fl;function oo(e){y.useEffect(e,qa)}const hn=null;let ts=globalThis.requestAnimationFrame;class dl{constructor(){ce(this,"callbacks",[]);ce(this,"callbacksCount",0);ce(this,"nextId",1);ce(this,"startId",1);ce(this,"isScheduled",!1);ce(this,"tick",t=>{var o;this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let s=0;s<n.length;s+=1)(o=n[s])==null||o.call(n,t)})}request(t){const n=this.nextId;this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1;const r=process.env.NODE_ENV!=="production"&&ts!==requestAnimationFrame&&(ts=requestAnimationFrame,!0);return(!this.isScheduled||r)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||this.callbacks[n]!==null&&(this.callbacks[n]=null,this.callbacksCount-=1)}}let mn=new dl;class Fe{constructor(){ce(this,"currentId",hn);ce(this,"cancel",()=>{this.currentId!==hn&&(mn.cancel(this.currentId),this.currentId=hn)});ce(this,"disposeEffect",()=>this.cancel)}static create(){return new Fe}static request(t){return mn.request(t)}static cancel(t){return mn.cancel(t)}request(t){this.cancel(),this.currentId=mn.request(()=>{this.currentId=hn,t()})}}function pl(){const e=Ze(Fe.create).current;return oo(e.disposeEffect),e}function wi(e,t=!1,n=!1,r=!1){const[o,s]=y.useState(e&&t?"idle":void 0),[i,c]=y.useState(e&&!r);return e&&!i&&(c(!0),s("starting")),!e&&i&&o!=="ending"&&!n&&s("ending"),!e&&!i&&o==="ending"&&s(void 0),he(()=>{if(!e&&i&&o!=="ending"&&n){const a=Fe.request(()=>{s("ending")});return()=>{Fe.cancel(a)}}},[e,i,o,n]),he(()=>{if(!e||t||o===void 0)return;const a=Fe.request(()=>{s(void 0)});return()=>{Fe.cancel(a)}},[t,e,o]),he(()=>{if(!e||!t)return;e&&i&&o!=="idle"&&s("starting");const a=Fe.request(()=>{s("idle")});return()=>{Fe.cancel(a)}},[t,e,i,o]),{mounted:i,setMounted:c,transitionStatus:o}}function hl(e){const{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:o}=e,[s,i]=cl({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:c,setMounted:a,transitionStatus:l}=wi(s,!0,!0),u=yi(),[f,h]=y.useState(),m=f===null?void 0:f??u,d=fe(g=>{const b=!s,v=ke(Yn,g.nativeEvent);r(b,v),!v.isCanceled&&i(b)});return y.useMemo(()=>({defaultPanelId:u,disabled:o,handleTrigger:d,mounted:c,open:s,panelId:m,setMounted:a,setOpen:i,setPanelIdState:h,transitionStatus:l}),[u,o,d,c,s,m,a,i,h,l])}function ml(e,t){return function(r,...o){const s=new URL(e);return s.searchParams.set("code",r.toString()),o.forEach(i=>s.searchParams.append("args[]",i)),`${t} error #${r}; visit ${s} for the full message.`}}const Rt=ml("https://base-ui.com/production-error","Base UI"),so=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(so.displayName="CollapsibleRootContext");function Ci(){const e=y.useContext(so);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>.":Rt(15));return e}const io="data-starting-style",gl="data-ending-style",bl={[io]:""},vl={[gl]:""},co={transitionStatus(e){return e==="starting"?bl:e==="ending"?vl:null}},yl="data-open",xl="data-closed",gn=io,wl="data-panel-open",Cl={[yl]:""},Sl={[xl]:""},El={open(e){return e?{[wl]:""}:null}},Rl={open(e){return e?Cl:Sl}},Si={...Rl,...co},Ei=y.forwardRef(function(t,n){const{render:r,className:o,defaultOpen:s=!1,disabled:i=!1,onOpenChange:c,open:a,style:l,...u}=t,f=fe(c),h=hl({open:a,defaultOpen:s,onOpenChange:f,disabled:i}),m=y.useMemo(()=>({open:h.open,disabled:h.disabled,transitionStatus:h.transitionStatus}),[h.open,h.disabled,h.transitionStatus]),d=y.useMemo(()=>({...h,onOpenChange:f,state:m}),[h,f,m]),g=mt("div",t,{state:m,ref:n,props:u,stateAttributesMapping:Si});return p.jsx(so.Provider,{value:d,children:g})});process.env.NODE_ENV!=="production"&&(Ei.displayName="CollapsibleRoot");function Xn(){return typeof window<"u"}function He(e){return ao(e)?(e.nodeName||"").toLowerCase():"#document"}function Ne(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ct(e){var t;return(t=(ao(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ao(e){return Xn()?e instanceof Node||e instanceof Ne(e).Node:!1}function ge(e){return Xn()?e instanceof Element||e instanceof Ne(e).Element:!1}function je(e){return Xn()?e instanceof HTMLElement||e instanceof Ne(e).HTMLElement:!1}function At(e){return!Xn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ne(e).ShadowRoot}function Qn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=We(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function Tl(e){return/^(table|td|th)$/.test(He(e))}function Jn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Il=/transform|translate|scale|rotate|perspective|filter/,Ol=/paint|layout|strict|content/,vt=e=>!!e&&e!=="none";let dr;function lo(e){const t=ge(e)?We(e):e;return vt(t.transform)||vt(t.translate)||vt(t.scale)||vt(t.rotate)||vt(t.perspective)||!uo()&&(vt(t.backdropFilter)||vt(t.filter))||Il.test(t.willChange||"")||Ol.test(t.contain||"")}function Pl(e){let t=ft(e);for(;je(t)&&!lt(t);){if(lo(t))return t;if(Jn(t))return null;t=ft(t)}return null}function uo(){return dr==null&&(dr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),dr}function lt(e){return/^(html|body|#document)$/.test(He(e))}function We(e){return Ne(e).getComputedStyle(e)}function Zn(e){return ge(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ft(e){if(He(e)==="html")return e;const t=e.assignedSlot||e.parentNode||At(e)&&e.host||ct(e);return At(t)?t.host:t}function Ri(e){const t=ft(e);return lt(t)?(e.ownerDocument||e).body:je(t)&&Qn(t)?t:Ri(t)}function Kt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ri(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ne(o);if(s){const c=kr(i);return t.concat(i,i.visualViewport||[],Qn(o)?o:[],c&&n?Kt(c):[])}else return t.concat(o,Kt(o,[],n))}function kr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Ti=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ti.displayName="CompositeRootContext");function kl(e=!1){const t=y.useContext(Ti);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.":Rt(16));return t}function _l(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,i=r&&t!==!1,c=r&&t===!1;return{props:y.useMemo(()=>{const l={onKeyDown(u){n&&t&&u.key!=="Tab"&&u.preventDefault()}};return r||(l.tabIndex=o,!s&&n&&(l.tabIndex=t?o:-1)),(s&&(t||i)||!s&&n)&&(l["aria-disabled"]=n),s&&(!t||c)&&(l.disabled=n),l},[r,n,t,i,c,s,o])}}function Je(e){return(e==null?void 0:e.ownerDocument)||document}function pr(e,t,{detail:n=0,pointerType:r=""}={}){e.dispatchEvent(new(Ne(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,pointerType:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Ii(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0,composite:s}=e,i=y.useRef(null),c=kl(!0),a=s??c!==void 0,{props:l}=_l({focusableWhenDisabled:n,disabled:t,composite:a,tabIndex:r,isNativeButton:o});process.env.NODE_ENV!=="production"&&y.useEffect(()=>{var d,g;if(!i.current)return;const m=bn(i.current);if(o){if(!m){const b=((d=ot.captureOwnerStack)==null?void 0:d.call(ot))||"";Mn(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${b}`)}}else if(m){const b=((g=ot.captureOwnerStack)==null?void 0:g.call(ot))||"";Mn(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${b}`)}},[o]);const u=y.useCallback(()=>{const m=i.current;bn(m)&&a&&t&&l.disabled===void 0&&m.disabled&&(m.disabled=!1)},[t,l.disabled,a]);he(u,[u]);const f=y.useCallback((m={})=>{const{onClick:d,onMouseDown:g,onKeyUp:b,onKeyDown:v,onPointerDown:x,...C}=m;return no({onClick(w){if(t){w.preventDefault();return}d==null||d(w)},onMouseDown(w){t||g==null||g(w)},onKeyDown(w){if(t||(Nn(w),v==null||v(w),w.baseUIHandlerPrevented))return;const E=w.target===w.currentTarget,S=w.currentTarget,R=bn(S),T=!o&&Al(S),P=E&&(o?R:!T),k=w.key==="Enter",M=w.key===" ",_=S.getAttribute("role"),D=(_==null?void 0:_.startsWith("menuitem"))||_==="option"||_==="gridcell";if(E&&a&&M){if(w.defaultPrevented&&D)return;w.preventDefault(),(!o||R)&&(w.preventBaseUIHandler(),pr(S,w));return}if(!P||o||!M&&!k){E&&T&&M&&w.preventDefault();return}w.defaultPrevented||(w.preventDefault(),k&&(w.preventBaseUIHandler(),pr(S,w)))},onKeyUp(w){if(!t){if(Nn(w),b==null||b(w),w.target===w.currentTarget&&o&&a&&bn(w.currentTarget)&&w.key===" "){w.preventDefault();return}w.baseUIHandlerPrevented||w.target===w.currentTarget&&!o&&!a&&!w.defaultPrevented&&w.key===" "&&(w.preventBaseUIHandler(),pr(w.currentTarget,w))}},onPointerDown(w){if(t){w.preventDefault();return}x==null||x(w)}},o?{type:"button"}:{role:"button"},l,C)},[t,l,a,o]),h=fe(m=>{i.current=m,u()});return{getButtonProps:f,buttonRef:h}}function bn(e){return je(e)&&e.tagName==="BUTTON"}function Al(e){return je(e)&&e.tagName==="A"&&!!e.href}const Nl={...El,...co},Oi=y.forwardRef(function(t,n){const{panelId:r,open:o,handleTrigger:s,state:i,disabled:c}=Ci(),{className:a,disabled:l=c,render:u,nativeButton:f=!0,style:h,...m}=t,{getButtonProps:d,buttonRef:g}=Ii({disabled:l,native:f});return mt("button",t,{state:i,ref:[n,g],props:[{"aria-controls":o?r:void 0,"aria-expanded":o,onClick:s},m,d],stateAttributesMapping:Nl})});process.env.NODE_ENV!=="production"&&(Oi.displayName="CollapsibleTrigger");function Ce(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}const Ut=0;class dt{constructor(){ce(this,"currentId",Ut);ce(this,"clear",()=>{this.currentId!==Ut&&(clearTimeout(this.currentId),this.currentId=Ut)});ce(this,"disposeEffect",()=>this.clear)}static create(){return new dt}start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ut,n()},t)}isStarted(){return this.currentId!==Ut}}function qt(){const e=Ze(dt.create).current;return oo(e.disposeEffect),e}function Xe(e){const t=Ze(Ml,e).current;return t.next=e,he(t.effect),t}function Ml(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function jl(e){return e==null?e:"current"in e?e.current:e}function ns(e,t){return e.getAnimations(t).filter(n=>{var o;const r=(o=n.effect)==null?void 0:o.getTiming();return(r==null?void 0:r.duration)!==1/0&&(r==null?void 0:r.iterations)!==1/0})}let vn=null;function Dl(e){if(!vn){const t=[];vn=t,queueMicrotask(()=>{vn=null,ht.flushSync(()=>{for(const n of t)n()})})}vn.push(e)}function Pi(e,t=!1,n=!1){const r=pl();return fe((o,s=null)=>{r.cancel();const i=jl(e);if(i==null)return;const c=i,a=()=>{if(!n){ht.flushSync(o);return}Dl(()=>{s!=null&&s.aborted||o()})};if(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){o();return}function l(){Promise.all(ns(c).map(u=>u.finished.then(to))).then(()=>{s!=null&&s.aborted||a()},()=>{if(s!=null&&s.aborted)return;if(ns(c).some(f=>f.pending||f.playState!=="finished")){l();return}a()})}if(t){const u=io;if(!c.hasAttribute(u)){r.request(l);return}const f=new MutationObserver(()=>{c.hasAttribute(u)||(f.disconnect(),l())});f.observe(c,{attributes:!0,attributeFilter:[u]}),s==null||s.addEventListener("abort",()=>f.disconnect(),{once:!0});return}r.request(l)})}function fo(e){const{enabled:t=!0,open:n,ref:r,batch:o=!1,onComplete:s}=e,i=fe(s),c=Pi(r,n,o);y.useEffect(()=>{if(!t)return;const a=new AbortController;return c(i,a.signal),()=>{a.abort()}},[t,n,i,c])}const Ot={height:void 0,width:void 0};function Fl(e){const{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:o,mounted:s,onOpenChange:i,open:c,setMounted:a,setOpen:l,transitionStatus:u}=e,f=y.useRef(null),h=y.useRef(null),[m,d]=y.useState(Ot),g=y.useRef(Ot),b=y.useRef(!1),v=y.useRef(c),x=y.useRef(!1),[C,w]=y.useState(!1),E=y.useRef(null),S=Tr(t,f),R=Xe(c),T=Pi(f),P=!c&&!s,k=C?"idle":u,M=c&&(v.current||x.current),_=!c&&s&&h.current==="css-animation"&&m.height===void 0&&m.width===void 0?g.current:m,D=n&&P&&h.current!=="css-animation",N=fe((j,q=!0)=>{q&&(g.current=j),d(j)}),I=fe(()=>{var j;(j=E.current)==null||j.call(E),E.current=null}),F=fe(j=>{I(),E.current=()=>{E.current=null,j()}}),U=fe(()=>{c&&s&&h.current==="css-animation"&&(x.current=!0)});he(()=>{!C||u==="starting"||w(!1)},[C,u]),y.useEffect(()=>()=>{U(),I()},[U,I]),he(()=>{c||(v.current=!1,x.current=!1);const j=f.current;if(!j)return;!c&&E.current&&I();const q=Ll(j,M);if(h.current=q,c&&u==="idle"&&v.current&&q==="css-animation"){g.current=Pt(j);return}if(c&&u==="starting"){const re=b.current;if(b.current=!1,q==="none"){N(Pt(j)),w(!0);return}if(q==="css-transition"){const V=Bl(j);if(N(Pt(j)),!re)return V;const H=yn(j,"transition-duration","0s");return F(H),w(!0),V}N(Pt(j));const B=yn(j,"animation-name","none");if(!re){B();return}const G=yn(j,"animation-duration","0s");B(),F(G),w(!0);return}if(!c&&s&&(u==="idle"||u==="starting")){if(q==="none"){N(Ot,!1),a(!1);return}N(Pt(j));return}if(u!=="ending")return;if(q==="none"){a(!1);return}const z=Pt(j);if(!(z.height>0||z.width>0)){a(!1);return}N(z),q==="css-animation"&&yn(j,"animation-name","none")()},[s,c,I,N,a,F,M,u]),fo({enabled:c&&s&&k==="idle",open:!0,ref:f,onComplete(){c&&N(Ot,!1)}}),y.useEffect(()=>{if(c||!s||k!=="ending")return;if(!f.current){a(!1),N(Ot,!1);return}const q=new AbortController;let z=-1;function ae(){R.current||(a(!1),N(Ot,!1))}return z=Fe.request(()=>{T(ae,q.signal)}),()=>{Fe.cancel(z),q.abort()}},[R,s,c,k,T,N,a]),he(()=>{const j=f.current;!j||!n||!P||j.setAttribute("hidden","until-found")},[P,n]),y.useEffect(function(){const q=f.current;if(!q)return;const z=dt.create();let ae=-1;const re=(V,H)=>{z.start(0,()=>{R.current||(ae=Fe.request(()=>{R.current||(V&&(b.current=!1),H&&q.setAttribute(gn,""),q.setAttribute("hidden","until-found"))}))})},G=Ce(q,"beforematch",V=>{const H=ke(xi,V);if(i(!0,H),H.isCanceled){re(!1,!1);return}b.current=!0;const Z=q.hasAttribute(gn);q.removeAttribute(gn),l(!0),re(!0,Z)});return()=>{z.clear(),Fe.cancel(ae),G()}},[R,i,l]);const A=o||n||s||c;return{height:_.height,props:{...D?{[gn]:""}:void 0,hidden:P,id:r},ref:S,shouldPreventOpenAnimation:M,shouldRender:A,transitionStatus:k,width:_.width}}function Pt(e){return{height:e.scrollHeight,width:e.scrollWidth}}function Ll(e,t){const n=Ne(e).getComputedStyle(e),r=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&rs(n.animationDuration),o=rs(n.transitionDuration);return r&&o?(process.env.NODE_ENV!=="production"&&eo("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.","Only one of either animation type should be used."),"css-transition"):o?"css-transition":r?"css-animation":"none"}function rs(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function yn(e,t,n){const r=e.style.getPropertyValue(t),o=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===""){e.style.removeProperty(t);return}e.style.setProperty(t,r,o)}}function Bl(e){const t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(o=>{e.style.setProperty(o,"initial","important")});function n(){Object.entries(t).forEach(([o,s])=>{if(s===""){e.style.removeProperty(o);return}e.style.setProperty(o,s)})}const r=Fe.request(n);return()=>{Fe.cancel(r),n()}}const Vl="--collapsible-panel-height",Hl="--collapsible-panel-width",ki=y.forwardRef(function(t,n){const{className:r,hiddenUntilFound:o,keepMounted:s,render:i,id:c,style:a,...l}=t;process.env.NODE_ENV!=="production"&&y.useEffect(()=>{o&&s===!1&&eo("The `keepMounted={false}` prop on `Collapsible.Panel` is ignored when `hiddenUntilFound` is enabled, since the panel must remain mounted while closed.")},[o,s]);const{defaultPanelId:u,mounted:f,onOpenChange:h,open:m,setMounted:d,setPanelIdState:g,setOpen:b,state:v,transitionStatus:x}=Ci(),C=o??!1,w=s??!1,E=c||void 0,S=E??u;he(()=>(g(U=>E??(U===null?void 0:U)),()=>{g(U=>U===E?null:U)}),[E,g]);const{height:R,props:T,ref:P,shouldPreventOpenAnimation:k,shouldRender:M,transitionStatus:_,width:D}=Fl({externalRef:n,hiddenUntilFound:C,id:S,keepMounted:w,mounted:f,onOpenChange:h,open:m,setMounted:d,setOpen:b,transitionStatus:x}),N={...v,transitionStatus:_},I=fi(a,N),F=mt("div",{...t,style:void 0},{state:N,ref:P,props:[T,{style:{[Vl]:R===void 0?"auto":`${R}px`,[Hl]:D===void 0?"auto":`${D}px`}},l,I?{style:I}:void 0,k?{style:{animationName:"none"}}:void 0],stateAttributesMapping:Si});return M?F:null});process.env.NODE_ENV!=="production"&&(ki.displayName="CollapsiblePanel");function yt({className:e,...t}){return p.jsx("div",{"data-slot":"trace",className:le("trace",e),...t})}function Nt({className:e,status:t,...n}){return p.jsx("span",{"data-slot":"trace-line","data-status":t,className:le("trace-line",e),...n})}function Ct({className:e,...t}){return p.jsx("span",{"data-slot":"trace-icon",className:le("trace-icon",e),...t,"aria-hidden":"true"})}function Mt({className:e,...t}){return p.jsx("span",{"data-slot":"trace-title",className:le("trace-title",e),...t})}function Yt({className:e,...t}){return p.jsx("span",{"data-slot":"trace-description",className:le("trace-description",e),...t})}function _i(e){return p.jsx(Ei,{"data-slot":"trace-collapsible",...e})}function Ai({children:e,className:t,...n}){return p.jsxs(Oi,{type:"button","data-slot":"trace-collapsible-trigger",className:le("trace-trigger",t),...n,children:[e,p.jsx(Ct,{className:"trace-chevron",children:p.jsx(ti,{size:13})})]})}function Ni({className:e,...t}){return p.jsx(ki,{...t,"data-slot":"trace-collapsible-content",className:le("trace-content",e)})}const $l=({message:e,onRetry:t})=>p.jsx(Jr,{className:"chat-error-banner",role:"alert",children:p.jsxs(Zr,{children:[p.jsx(yt,{className:"chat-message-body",children:p.jsxs(Nt,{status:"error",children:[p.jsx(Ct,{children:p.jsx(xa,{size:14})}),p.jsx(Mt,{className:"chat-error-title",children:e})]})}),t&&p.jsx(Rr,{children:p.jsx("button",{type:"button",onClick:t,className:"chat-error-retry-btn",children:"Try again"})})]})}),Ul={alpha:{label:"Alpha",Icon:Sa,variant:"env-badge--alpha",tooltip:"Alpha build — internal testing only"},beta:{label:"Beta",Icon:ka,variant:"env-badge--beta",tooltip:"Beta build — public pre-release"},gamma:{label:"Gamma",Icon:Ta,variant:"env-badge--gamma",tooltip:"Gamma / Release Candidate"},qa:{label:"QA",Icon:wa,variant:"env-badge--qa",tooltip:"Quality Assurance build"}},Wl=({stage:e,pulse:t=!0,className:n=""})=>{if(!e)return null;const{label:r,Icon:o,variant:s,tooltip:i}=Ul[e];return p.jsxs("span",{className:`env-badge-inline ${s} ${n}`.trim(),title:i,"aria-label":`${r} build`,role:"status",children:[p.jsx(o,{size:10,className:"env-badge-icon","aria-hidden":"true"}),p.jsx("span",{className:"env-badge-inline-label",children:r})]})},po="data:image/svg+xml,%3csvg%20width='300'%20height='322'%20viewBox='0%200%20300%20322'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M213.058%2052.9833C228.726%2054.9056%20244.193%2057.9635%20259.583%2061.4059C269.998%2063.5987%20280.269%2066.4233%20290.34%2069.864C292.753%2070.7216%20295.072%2071.8691%20297.438%2072.8214C298.27%2073.1024%20298.978%2073.6651%20299.439%2074.4125C299.9%2075.1598%20300.085%2076.0447%20299.963%2076.9144C299.963%2077.4408%20299.963%2077.9672%20299.963%2078.4936C299.963%20112.823%20299.963%20147.15%20299.963%20181.475C299.985%20185.264%20298.951%20188.983%20296.976%20192.217C289.695%20204.395%20281.876%20216.225%20273.844%20227.918C264.972%20240.848%20255.632%20253.458%20245.66%20265.577C240.775%20271.492%20235.924%20277.472%20230.944%20283.322C227.815%20286.989%20224.438%20290.419%20221.232%20294.039C214.578%20301.551%20207.54%20308.696%20200.394%20315.728C199.125%20317.122%20197.691%20318.355%20196.124%20319.402C194.628%20320.262%20192.963%20320.789%20191.244%20320.945C187.118%20321.36%20182.97%20321.524%20178.823%20321.436C155.756%20320.549%20132.653%20321.288%20109.568%20321.04C108.093%20321.056%20106.63%20320.771%20105.27%20320.203C103.909%20319.634%20102.679%20318.794%20101.654%20317.734C95.4904%20311.523%2089.2326%20305.419%2083.1227%20299.132C79.4615%20295.346%2076.0664%20291.295%2072.5767%20287.349C69.087%20283.404%2065.4258%20279.382%2061.9893%20275.289C57.9732%20270.492%2053.9925%20265.66%2050.2071%20260.686C43.1094%20251.323%2035.9466%20241.966%2029.1269%20232.39C23.2654%20224.156%2017.7884%20215.651%2012.2403%20207.205C9.05229%20202.354%206.0712%20197.362%202.97778%20192.447C0.696594%20189.116%20-0.326373%20185.083%200.091433%20181.067C0.156556%20180.164%200.168387%20179.257%200.126902%20178.352V78.3221C0.126902%2073.8446%200.387122%2073.2532%204.69898%2071.7212C10.661%2069.5978%2016.6645%2067.5336%2022.739%2065.8065C34.7232%2062.4186%2046.872%2059.643%2059.1384%2057.4904C68.2649%2055.8283%2077.4741%2054.4916%2086.6006%2053.0129C87.0442%2052.936%2087.4937%2052.8591%2087.9314%2052.7526L90.2973%2052.2913C90.2973%2052.8236%2090.2973%2056.68%2090.2973%2057.2064C90.2973%2098.2351%2090.2815%20139.27%2090.25%20180.31C90.1517%20184.707%2091.5027%20189.013%2094.0946%20192.566C99.4178%20199.953%20104.611%20207.488%20110.106%20214.764C117.925%20225.103%20125.88%20235.341%20133.972%20245.479C138.059%20250.583%20142.536%20255.386%20146.984%20260.207C149.823%20263.294%20150.569%20263.164%20153.378%20260.023L153.68%20259.686C155.555%20257.527%20157.448%20255.38%20159.317%20253.215C162.363%20249.667%20165.539%20246.236%20168.413%20242.569C175.381%20233.697%20182.307%20224.724%20189.062%20215.657C194.977%20207.743%20200.631%20199.646%20206.374%20191.607C208.444%20188.701%20209.517%20185.202%20209.432%20181.635C209.373%20160.815%20209.403%20139.995%20209.403%20119.175V56.9107C209.403%2056.2305%20209.403%2053.2495%20209.403%2052.5693'%20fill='white'/%3e%3cpath%20d='M90.3197%2052.5822C90.3612%2049.0806%2090.3197%2043.1185%2090.3197%2039.6347V8.54682C90.3197%207.87845%2090.3197%207.20414%2090.3197%206.53578C90.2821%206.17841%2090.3153%205.81714%2090.4174%205.47261C90.5195%205.12808%2090.6886%204.80708%2090.915%204.52799C91.1413%204.24889%2091.4205%204.01719%2091.7365%203.84613C92.0525%203.67507%2092.3992%203.56802%2092.7566%203.53111C94.2873%203.22177%2095.8362%203.01037%2097.3938%202.89822C101.534%202.4901%20105.674%202.11747%20109.815%201.75075C112.849%201.47867%20115.895%201.24801%20118.935%200.993674C119.231%200.993674%20119.527%200.904963%20119.823%200.893134C124.134%200.72752%20128.452%200.526411%20132.77%200.414031C139.696%200.236588%20146.622%200.0118295%20153.548%200C159.357%200%20165.165%200.171503%20170.967%200.455411C177.805%200.792552%20184.636%201.2835%20191.462%201.804C195.987%202.15297%20200.5%202.67346%20205.019%203.14072C208.284%203.47786%20209.283%204.55433%20209.301%207.94348C209.336%2014.9466%20209.301%2021.9555%20209.301%2028.9645C209.301%2035.8197%20209.301%2045.727%20209.301%2052.5822L206.344%2052.316C203.315%2051.9729%20200.281%2051.6299%20197.241%2051.3637C190.569%2050.7722%20183.909%2050.0861%20177.225%2049.6958C171.311%2049.3468%20165.313%2049.1753%20159.363%2049.2167C148.633%2049.3054%20137.898%2048.7375%20127.175%2049.6011C122.135%2050.0092%20117.066%2050.1216%20112.027%2050.5238C105.799%2051.0147%2099.606%2051.6358%2093.36%2052.2628'%20fill='%23FF4717'/%3e%3c/svg%3e",ql=({title:e="VPS AI Assistant",subtitle:t="Customer portal support",onClose:n,onReset:r,onBack:o,soundEnabled:s,onToggleSound:i,showMinimize:c=!1,envStage:a,envPulse:l=!0})=>p.jsxs("header",{className:"chat-header",children:[p.jsxs("div",{className:"chat-header-left",children:[o&&p.jsx("button",{type:"button",onClick:o,className:"icon-btn-back","aria-label":"Back",children:p.jsx(ma,{size:16})}),p.jsx("div",{className:"avatar-circle","aria-hidden":"true",children:p.jsx("img",{src:po,alt:"VPS Logo",style:{width:"16px",height:"16px"}})}),p.jsxs("div",{children:[p.jsxs("div",{className:"chat-header-title-row",children:[p.jsx("h2",{className:"chat-header-title",children:e}),p.jsx(Wl,{stage:a,pulse:l})]}),p.jsx("p",{className:"chat-header-subtitle",children:t||"Customer portal support"})]})]}),p.jsxs("div",{className:"chat-header-actions",children:[i&&p.jsx("button",{type:"button",className:"icon-btn-action chat-sound-btn","aria-label":"Response sound","aria-pressed":!!s,title:s?"Mute response sound":"Enable response sound",onClick:i,children:s?p.jsx(Na,{size:16,"aria-hidden":"true"}):p.jsx(Ma,{size:16,"aria-hidden":"true"})}),r&&p.jsx("button",{type:"button",onClick:r,className:"icon-btn-action","aria-label":"Start a new conversation",title:"New conversation",children:p.jsx(Pa,{size:15})}),n&&p.jsx("button",{type:"button",onClick:n,className:"icon-btn-action","aria-label":c?"Minimize chat":"Close chat",children:p.jsx(Ia,{size:16})})]})]});function zl(e,t){const n=O.useRef(e);O.useEffect(()=>{var r;n.current&&!e&&((r=t.current)==null||r.focus()),n.current=e},[e,t])}function Gl({className:e,...t}){return p.jsx("div",{...t,"data-slot":"input-group",className:le("chat-input-group",e)})}function Kl({className:e,...t}){return p.jsx("textarea",{...t,"data-slot":"input-group-textarea",className:le("chat-textarea",e)})}function Yl({className:e,...t}){return p.jsx("div",{...t,"data-slot":"input-group-addon",className:le("chat-input-actions",e)})}function os({className:e,...t}){return p.jsx("button",{type:"button",...t,"data-slot":"input-group-button",className:le("chat-send-btn",e)})}const Mi=y.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,focusableWhenDisabled:i=!1,nativeButton:c=!0,style:a,...l}=t,{getButtonProps:u,buttonRef:f}=Ii({disabled:s,focusableWhenDisabled:i,native:c});return mt("button",t,{state:{disabled:s},ref:[n,f],props:[l,u]})});process.env.NODE_ENV!=="production"&&(Mi.displayName="Button");const ss=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,is=Qs,Xl=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return is(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(l=>{const u=n==null?void 0:n[l],f=s==null?void 0:s[l];if(u===null)return null;const h=ss(u)||ss(f);return o[l][h]}),c=n&&Object.entries(n).reduce((l,u)=>{let[f,h]=u;return h===void 0||(l[f]=h),l},{}),a=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((l,u)=>{let{class:f,className:h,...m}=u;return Object.entries(m).every(d=>{let[g,b]=d;return Array.isArray(b)?b.includes({...s,...c}[g]):{...s,...c}[g]===b})?[...l,f,h]:l},[]);return is(e,i,a,n==null?void 0:n.class,n==null?void 0:n.className)},Ql=Xl("vps-ui-button",{variants:{variant:{default:"vps-ui-button--default",outline:"vps-ui-button--outline",secondary:"vps-ui-button--secondary",ghost:"vps-ui-button--ghost",destructive:"vps-ui-button--destructive",link:"vps-ui-button--link"},size:{default:"vps-ui-button--size-default",xs:"vps-ui-button--size-xs",sm:"vps-ui-button--size-sm",lg:"vps-ui-button--size-lg",icon:"vps-ui-button--size-icon","icon-xs":"vps-ui-button--size-icon-xs","icon-sm":"vps-ui-button--size-icon-sm","icon-lg":"vps-ui-button--size-icon-lg"}},defaultVariants:{variant:"default",size:"default"}});function ho({className:e,variant:t,size:n,...r}){return p.jsx(Mi,{type:"button","data-slot":"button",...r,className:o=>le(Ql({variant:t,size:n}),typeof e=="function"?e(o):e)})}function Jl({className:e,...t}){return p.jsx("div",{...t,className:le("flex scroll-fade-x scrollbar-none gap-2 overflow-x-auto overscroll-x-contain",e),"data-slot":"suggestions"})}function Zl({suggestion:e,onClick:t,children:n,className:r,variant:o="outline",size:s="sm",...i}){return p.jsx(ho,{...i,variant:o,size:s,className:c=>le("shrink-0",typeof r=="function"?r(c):r),onClick:()=>t==null?void 0:t(e),children:n??e})}function eu(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>r.label.toLowerCase().includes(n)||r.query.toLowerCase().includes(n)):e}const tu=({suggestions:e,onSelect:t,disabled:n,variant:r="list"})=>e.length?p.jsx(Jl,{className:r==="badge"?"chat-suggestion-strip":"suggestions-list",role:"list","aria-label":"Suggested questions",children:e.map(o=>p.jsx("div",{role:"listitem",children:p.jsx(Zl,{suggestion:o.query,disabled:n,onClick:()=>t(o),title:o.query,children:o.label})},o.query))}):null,nu=({onSend:e,onStop:t,disabled:n=!1,placeholder:r="Ask something…",ref:o})=>{const{suggestions:s,showSuggestions:i,suggestionBadgesEnabled:c,models:a,selectedModelId:l,selectModel:u}=tn(),[f,h]=O.useState(""),m=O.useRef(null),d=O.useId(),g=O.useId(),b=w=>{w&&(w.style.height="auto",w.style.height=`${Math.min(w.scrollHeight,96)}px`)};zl(n,m),O.useImperativeHandle(o,()=>({edit(w){var E;n||(h(w),(E=m.current)==null||E.focus())}}),[n]),O.useEffect(()=>{b(m.current)},[f]);const v=O.useMemo(()=>{if(!c||n)return[];const w=f.trim();return w?eu(s,w):i?s:[]},[n,i,c,s,f]),x=w=>{h(w.query);const E=m.current;E==null||E.focus()},C=()=>{const w=f.trim();!w||n||(e(w),h(""))};return p.jsxs("div",{className:"chat-input-wrapper",children:[p.jsx(tu,{variant:"badge",suggestions:v,onSelect:x,disabled:n}),p.jsxs("form",{onSubmit:w=>{w.preventDefault(),C()},children:[p.jsx("label",{htmlFor:d,className:"sr-only",children:"Chat message"}),p.jsxs(Gl,{children:[p.jsx(Kl,{id:d,ref:m,rows:1,value:f,disabled:n,placeholder:r,onChange:w=>h(w.target.value),onKeyDown:w=>{var E;w.key==="Enter"&&!w.shiftKey&&!w.nativeEvent.isComposing&&(w.preventDefault(),(E=w.currentTarget.form)==null||E.requestSubmit())}}),p.jsxs(Yl,{children:[a.length>1&&p.jsxs("div",{className:"chat-model-picker",children:[p.jsx("label",{htmlFor:g,className:"sr-only",children:"AI model"}),p.jsxs("select",{id:g,value:l,disabled:n,onChange:w=>u(w.target.value),children:[p.jsx("option",{value:"auto",children:"Automatic"}),a.map(w=>p.jsx("option",{value:w.id,disabled:!w.configured,children:w.label},w.id))]})]}),t?p.jsx(os,{onClick:t,"aria-label":"Stop response",title:"Stop response",children:p.jsx(si,{size:13,fill:"currentColor","aria-hidden":"true"})}):p.jsx(os,{type:"submit",disabled:n||!f.trim(),"aria-label":"Send message",title:"Send message",children:p.jsx(ga,{size:16,"aria-hidden":"true"})})]})]})]}),p.jsxs("p",{className:"chat-input-footer",children:[p.jsx("span",{className:"chat-input-note",children:"AI can make mistakes."}),"Powered by ",p.jsx("span",{className:"chat-input-footer-brand",children:"VPS Veritas AI"})]})]})};function ru({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:o}){let s=_r(ou(r,o),t);if(!n)return y.createElement(e,s);if(typeof n=="function")return n(s,r);if(!y.isValidElement(n))return null;let i=n.props,c={..._r(s,i),ref:nn(s.ref,i.ref)};return y.cloneElement(n,c)}function _r(...e){let t={};for(let n of e){if(!n)continue;let r=n;for(let o of Object.keys(r)){let s=r[o];if(s===void 0)continue;let i=t[o];o==="className"?t[o]=[i,s].filter(Boolean).join(" "):o==="style"?t[o]={...i,...s}:o==="ref"?t[o]=nn(i,s):iu(o)&&typeof i=="function"&&typeof s=="function"?t[o]=su(s,i):t[o]=s}}return t}function ou(e,t){var r;let n={};for(let o of Object.keys(e)){let s=e[o],i=(r=t==null?void 0:t[o])==null?void 0:r.call(t,s);if(i){Object.assign(n,i);continue}if(o==="slot"){n["data-slot"]=s;continue}let c=`data-${String(o).replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`)}`;typeof s=="boolean"?n[c]=s?"":void 0:s!=null&&(n[c]=String(s))}return n}function su(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function iu(e){return/^on[A-Z]/.test(e)}function nn(...e){let t=e.filter(Boolean);if(t.length!==0)return n=>{for(let r of t)typeof r=="function"?r(n):r&&(r.current=n)}}var cu=8,au=64,lu=0,jn=.5,uu=180,fu=new Set(["ArrowDown","ArrowUp","End","Home","PageDown","PageUp"," "]),ji={start:!1,end:!1},du=[],Dn={currentAnchorId:null,visibleMessageIds:du};function pu({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return ji;let o=mo({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:o-r.scrollTop-r.clientHeight>t}}function hu({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:o,visibleMessageIds:s}){if(!e||!o)return Dn;let i=o.getBoundingClientRect(),c=i.top+t+n,a=typeof IntersectionObserver>"u",l=[],u=null;for(let f of Xt(e,r)){let h=f.dataset.messageId;if(!h)continue;let m=f.dataset.scrollAnchor==="true",d=m||a?f.getBoundingClientRect():null;(a&&d?d.bottom>c&&d.top<i.bottom:s.has(h))&&l.push(h),m&&d&&d.top<=c+jn&&(u=h)}return l.length===0&&u===null?Dn:{currentAnchorId:u,visibleMessageIds:l}}function Xt(e,t){return Array.from(e.children).filter(n=>n instanceof HTMLElement&&n!==t)}function mu(e,t){for(let n=t;n<e.length;n++){let r=e[n];if((r==null?void 0:r.dataset.scrollAnchor)==="true")return r}return null}function gu(e,t){for(let n of e)if(n.dataset.scrollAnchor==="true"&&!t.has(n))return n;return null}function bu(e,t){var r;let n=0;for(let o=t;o<e.length;o++)if(((r=e[o])==null?void 0:r.dataset.scrollAnchor)==="true"&&(n+=1,n>1))return!0;return!1}function vu(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if((n==null?void 0:n.dataset.scrollAnchor)==="true")return n}return null}function yu({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let o of Xt(e,t)){if(!o.dataset.messageId)continue;let s=o.getBoundingClientRect();if(s.bottom>r.top&&s.top<r.bottom)return o}return null}function xu({align:e,element:t,scrollMargin:n,spacer:r,viewport:o}){let s=Di(t,o),i=t.getBoundingClientRect().height,c=Su(r);if(e==="center"){let a=Math.max(0,o.clientHeight-c.start-c.end);return s-c.start-(a-i)/2-n}if(e==="end")return s-o.clientHeight+i+c.end+n;if(e==="nearest"){let a=s+i,l=o.scrollTop+c.start,u=o.scrollTop+o.clientHeight-c.end;return s>=l&&a<=u?o.scrollTop:s<l?s-c.start-n:a-o.clientHeight+c.end+n}return s-c.start-n}function Di(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function Pn(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function wu({content:e,scrollTop:t,spacer:n,viewport:r}){let o=mo({content:e,spacer:n,viewport:r});return t+r.clientHeight-o}function mo({content:e,spacer:t,viewport:n}){let r=Xt(e,t),o=Fi(e),s=n.getBoundingClientRect(),i=n.scrollTop,c=o.start+o.end;for(let a of r){let l=a.getBoundingClientRect();c=Math.max(c,l.bottom-s.top+i+o.end)}return c}function Cu(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Fi(e){let t=window.getComputedStyle(e);return{end:Ar(t.paddingBlockEnd||t.paddingBottom),start:Ar(t.paddingBlockStart||t.paddingTop)}}function Su(e){let t=e==null?void 0:e.parentElement;return t?Fi(t):{end:0,start:0}}function Eu(e){if(!e)return 0;let t=window.getComputedStyle(e),n=t.rowGap==="normal"?t.gap:t.rowGap;return Ar(n)}function Ar(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Li(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:o=>{t(n,o)||(n=o,r.forEach(s=>s()))},subscribe:(o,s,i)=>{let c=r.size===0;return r.add(o),c&&(s==null||s()),()=>{r.delete(o),r.size===0&&(i==null||i())}}}}function cs(e,t){return Li(e,t)}function Ru(){return Li(Dn,Iu)}function Tu(e,t){return e.start===t.start&&e.end===t.end}function Iu(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((n,r)=>n===t.visibleMessageIds[r])}function Ou({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:r,scrollPreviousItemPeek:o}){let s=y.useRef(e),i=y.useRef(!1),c=y.useRef(null),a=y.useRef(!1),l=y.useRef(n),u=y.useRef(0),f=y.useRef(null),h=y.useRef(0),m=y.useRef(e?"following-bottom":"free-scrolling"),d=y.useRef(new Map),g=y.useRef(null),b=y.useRef(null),v=y.useRef(null),x=y.useRef(o),C=y.useRef(!0),w=y.useRef(null),E=y.useRef(r),S=y.useRef(null),R=y.useRef(0),T=y.useRef(0),P=y.useRef(null),k=y.useRef(null),M=y.useRef(null),_=y.useRef(null),D=y.useRef(null),N=y.useRef(null),I=y.useRef(null),F=y.useRef(null),U=y.useRef(null),A=y.useRef(new Set),j=y.useRef(new WeakSet);return M.current===null&&(M.current=cs(t==="end"||t==="last-anchor",(q,z)=>q===z)),_.current===null&&(_.current=cs(ji,Tu)),U.current===null&&(U.current=Ru()),s.current=e,l.current=n,E.current=r,x.current=o,{autoScrollRef:s,autoscrollingRef:i,autoscrollingTimeoutRef:D,streamingTurnRef:v,contentRef:c,defaultScrollPositionAppliedRef:a,firstItemRef:f,itemCountRef:u,lastScrollTopRef:h,messageElementsRef:d,modeRef:m,pendingScrollFrameRef:S,pendingScrollToMessageRef:g,prependRestoreRef:b,preserveScrollOnPrependRef:C,pendingDefaultScrollStore:M.current,rootRef:w,scrollEdgeThresholdRef:l,scrollMarginRef:E,scrollPreviousItemPeekRef:x,spacerGapRef:R,spacerHeightRef:T,spacerRef:P,stateFrameRef:k,stateStore:_.current,viewportRef:N,visibilityFrameRef:I,visibilityObserverRef:F,visibilityStore:U.current,visibleMessageIdsRef:A,handledScrollAnchorsRef:j}}function Bi(e){e.pendingDefaultScrollStore.setSnapshot(!1)}function kn(e){e.defaultScrollPositionAppliedRef.current=!0,Bi(e)}function Pu({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:i,autoscrollingTimeoutRef:c,contentRef:a,itemCountRef:l,messageElementsRef:u,modeRef:f,pendingScrollToMessageRef:h,prependRestoreRef:m,scrollMarginRef:d,scrollPreviousItemPeekRef:g,spacerGapRef:b,spacerHeightRef:v,spacerRef:x,viewportRef:C}=e,w=y.useCallback(_=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null),i.current!==_&&(i.current=_,t()),_&&(c.current=window.setTimeout(()=>{c.current=null,i.current=!1,t()},uu))},[t]),E=y.useCallback(_=>{let D=x.current;if(!D)return;let N=Math.max(0,Math.ceil(_));v.current!==N&&(v.current=N,D.hidden=N===0,D.style.height=`${N}px`,D.style.marginTop=N>0?`${-b.current}px`:"")},[]),S=y.useCallback((_,{behavior:D="auto",autoscrolling:N=!1}={})=>{let I=C.current;if(!I)return;let F=Math.max(0,_);if(Math.abs(I.scrollTop-F)<=jn){I.scrollTop=F,t();return}N&&w(!0),I.scrollTo({top:F,behavior:D}),n()},[t,n,w]),R=y.useCallback(({behavior:_="auto"}={})=>C.current?(E(0),o.current=null,f.current="free-scrolling",S(0,{behavior:_}),r(),!0):!1,[r,S,E]),T=y.useCallback(({behavior:_="auto"}={})=>{let D=C.current;return D?(E(0),o.current=null,f.current=s.current?"following-bottom":"free-scrolling",S(Cu(D),{autoscrolling:!0,behavior:_}),r(),!0):!1},[r,S,E]),P=y.useCallback((_,{align:D="start",behavior:N="auto",scrollMargin:I=d.current}={},{keepPreviousPeek:F=!1}={})=>{let U=a.current,A=C.current;if(!U||!A||!U.contains(_))return!1;let j=xu({align:D,element:_,scrollMargin:F?I+g.current:I,spacer:x.current,viewport:A}),q=wu({content:U,scrollTop:j,spacer:x.current,viewport:A});return E(q),m.current={element:_,viewportTop:Pn(_,A)},f.current=F?"anchored-to-message":"settling-jump",o.current=F?_:null,S(j,{behavior:N}),r(),!0},[r,S,E]),k=y.useCallback(()=>{let _=o.current;return!_||!_.isConnected||f.current!=="anchored-to-message"?!1:P(_,{align:"start"},{keepPreviousPeek:!0})},[P]),M=y.useCallback((_,D)=>{let N=u.current.get(_);return N?(kn(e),P(N,D)?(h.current=null,!0):(h.current={messageId:_,options:D},!0)):l.current===0?(h.current={messageId:_,options:D},kn(e),!0):!1},[P]);return{flushPendingScrollToMessage:y.useCallback(()=>{let _=h.current;if(!_)return!1;let D=u.current.get(_.messageId);return!D||!P(D,_.options)?!1:(h.current=null,kn(e),!0)},[P]),reanchorToAnchoredMessage:k,scrollToElement:P,scrollToEnd:T,scrollToMessage:M,scrollToStart:R}}function as(e,t){return y.useCallback(n=>{e.current=n,n&&t()},[e,t])}function ku({autoScroll:e=!1,defaultScrollPosition:t="end",scrollEdgeThreshold:n=cu,scrollPreviousItemPeek:r=au,scrollMargin:o=lu}){let s=Ou({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:o,scrollPreviousItemPeek:r}),{streamingTurnRef:i,autoScrollRef:c,autoscrollingRef:a,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:f,firstItemRef:h,itemCountRef:m,lastScrollTopRef:d,messageElementsRef:g,modeRef:b,pendingScrollFrameRef:v,pendingScrollToMessageRef:x,prependRestoreRef:C,preserveScrollOnPrependRef:w,pendingDefaultScrollStore:E,rootRef:S,scrollEdgeThresholdRef:R,scrollMarginRef:T,scrollPreviousItemPeekRef:P,spacerGapRef:k,spacerHeightRef:M,spacerRef:_,stateFrameRef:D,stateStore:N,viewportRef:I,visibilityFrameRef:F,visibilityObserverRef:U,visibilityStore:A,visibleMessageIdsRef:j,handledScrollAnchorsRef:q}=s,z=y.useRef(t);z.current!==t&&(z.current=t,f.current=!1);let ae=y.useCallback(W=>{let Q=S.current,X=I.current,ie=[W.start&&"start",W.end&&"end"].filter(Boolean).join(" "),Se=a.current;for(let de of[Q,X])de&&(ie?de.setAttribute("data-scrollable",ie):de.removeAttribute("data-scrollable"),de.toggleAttribute("data-autoscrolling",Se))},[]),re=y.useCallback(W=>{var ie;let Q=((ie=I.current)==null?void 0:ie.scrollTop)??0,X=Q<d.current-jn;d.current=Q,c.current&&!W.end&&b.current!=="settling-jump"&&b.current!=="anchored-to-message"?b.current="following-bottom":b.current==="following-bottom"&&W.end&&X&&!a.current&&(b.current="free-scrolling")},[]),B=y.useCallback(()=>{let W=pu({content:u.current,scrollEdgeThreshold:R.current,spacer:_.current,viewport:I.current});re(W);let Q=b.current==="following-bottom"?{...W,end:!1}:W;ae(Q),N.setSnapshot(Q)},[re,N,ae]),G=y.useCallback(()=>{D.current===null&&(D.current=window.requestAnimationFrame(()=>{D.current=null,B()}))},[B]),V=y.useCallback(()=>{A.hasListeners()&&F.current===null&&(F.current=window.requestAnimationFrame(()=>{F.current=null,A.hasListeners()&&A.setSnapshot(hu({content:u.current,scrollMargin:T.current,scrollPreviousItemPeek:P.current,spacer:_.current,viewport:I.current,visibleMessageIds:j.current}))}))},[A]),{flushPendingScrollToMessage:H,reanchorToAnchoredMessage:Z,scrollToElement:oe,scrollToEnd:ee,scrollToMessage:te,scrollToStart:$}=Pu({refs:s,commitScrollState:B,scheduleStateCommit:G,scheduleVisibilitySync:V}),ne=y.useCallback(()=>{let W=C.current,Q=I.current;if(!W||!Q||!W.element.isConnected)return!1;let X=Pn(W.element,Q)-W.viewportTop;return Math.abs(X)<=jn?!1:(Q.scrollTop+=X,W.viewportTop=Pn(W.element,Q),G(),V(),!0)},[G,V]),se=y.useCallback(()=>{let W=u.current,Q=I.current;if(!W||!Q){C.current=null;return}let X=yu({content:W,spacer:_.current,viewport:Q});C.current=X?{element:X,viewportTop:Pn(X,Q)}:null},[]),be=y.useCallback(()=>{v.current===null&&(v.current=window.requestAnimationFrame(()=>{v.current=null,H()&&se()}))},[se,H]),ve=y.useCallback(()=>{if(!t||f.current||m.current===0)return!1;let W=!1;if(t==="last-anchor"){let Q=u.current,X=I.current,ie=Q&&X?vu(Xt(Q,_.current)):null;if(!Q||!X||!ie)W=ee({behavior:"auto"});else{let Se=Di(ie,X);W=mo({content:Q,spacer:_.current,viewport:X})-Se<=X.clientHeight?ee({behavior:"auto"}):oe(ie,{align:"start"},{keepPreviousPeek:!0})}}else W=t==="end"?ee({behavior:"auto"}):$({behavior:"auto"});return W?(kn(s),!0):!1},[t,oe,ee,$]),Oe=y.useCallback(()=>{let W=u.current;if(!W)return;let Q=Xt(W,_.current),X=m.current,ie=h.current;m.current=Q.length,h.current=Q[0]??null,(()=>{if(H())return;if(X===0){if(ve()||Q.length>0&&c.current&&ee({behavior:"auto"}))return;B(),V();return}let Se=ie?Q.indexOf(ie):-1;if(w.current&&Se>0){ne();return}if(Q.length>X){let de=mu(Q,X);if(de){if(c.current&&b.current==="following-bottom"&&bu(Q,X)){ee({behavior:"auto"});return}oe(de,{align:"start"},{keepPreviousPeek:!0}),q.current.add(de);return}}if(Q.length===X){let de=gu(Q,q.current);if(de){oe(de,{align:"start"},{keepPreviousPeek:!0}),q.current.add(de);return}}b.current==="following-bottom"&&c.current?ee({behavior:"auto"}):(B(),V())})(),se()},[ve,se,B,H,ne,V,oe,ee]),Ae=y.useCallback(()=>{if(b.current==="following-bottom"&&c.current){ee({behavior:"auto"});return}let W=M.current;if(Z()){c.current&&W>0&&M.current===0&&ee({behavior:"auto"});return}G(),V()},[Z,G,V,ee]),xe=y.useCallback(()=>{let W=I.current;if(!(!W||!A.hasListeners())){if(typeof IntersectionObserver>"u"){V();return}U.current||(U.current=new IntersectionObserver(Q=>{for(let X of Q){let ie=X.target.dataset.messageId;ie&&(X.isIntersecting?j.current.add(ie):j.current.delete(ie))}V()},{root:W,rootMargin:`${-(T.current+P.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]})),g.current.forEach(Q=>{var X;(X=U.current)==null||X.observe(Q)}),V()}},[V,A]),Me=y.useCallback(()=>{var W;F.current!==null&&(window.cancelAnimationFrame(F.current),F.current=null),(W=U.current)==null||W.disconnect(),U.current=null,j.current.clear(),A.setSnapshot(Dn)},[A]),Le=y.useCallback((W,Q,X)=>{var ie,Se,de;if(Q){g.current.set(W,Q),(ie=U.current)==null||ie.observe(Q),V(),((Se=x.current)==null?void 0:Se.messageId)===W&&be();return}X&&g.current.get(W)===X&&(g.current.delete(W),j.current.delete(W),(de=U.current)==null||de.unobserve(X),V())},[be,V]),K=y.useCallback(()=>{(b.current==="following-bottom"||b.current==="anchored-to-message"||b.current==="settling-jump")&&(i.current=null,b.current="free-scrolling")},[]),J=y.useCallback(()=>ae(N.getSnapshot()),[N,ae]),ue=as(S,J),L=as(I,J),Y=y.useCallback(W=>{u.current=W},[]),Ee=y.useCallback(W=>{_.current=W,k.current=Eu((W==null?void 0:W.parentElement)??null)},[]),me=y.useCallback(()=>{B(),V(),se()},[se,B,V]),Re=y.useMemo(()=>({handleContentChange:Oe,handleResize:Ae,observeVisibility:xe,pendingDefaultScrollStore:E,preserveScrollOnPrependRef:w,scrollToEnd:ee,scrollToMessage:te,scrollToStart:$,setContentElement:Y,setRootElement:ue,setSpacerElement:Ee,setViewportElement:L,stateStore:N,syncAfterScroll:me,unobserveVisibility:Me,userScrollIntent:K,viewportRef:I,visibilityStore:A}),[Oe,Ae,xe,E,ee,te,$,Y,ue,Ee,L,N,me,Me,K,A]);return y.useLayoutEffect(()=>{ve()||m.current===0&&Bi(s)},[ve]),y.useEffect(()=>()=>{var W;D.current!==null&&(window.cancelAnimationFrame(D.current),D.current=null),F.current!==null&&(window.cancelAnimationFrame(F.current),F.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),v.current!==null&&(window.cancelAnimationFrame(v.current),v.current=null),(W=U.current)==null||W.disconnect(),U.current=null},[]),y.useLayoutEffect(()=>{if(e&&b.current==="following-bottom"&&m.current>0){ee({behavior:"auto"});return}B()},[e,B,ee]),{context:Re,registerMessage:Le}}function _u(e){let t=y.useRef(e);return t.current=e,t}var Vi=y.createContext(null),Hi=y.createContext(null);function rn(){let e=y.useContext(Vi);if(!e)throw new Error("useMessageScroller must be used within a MessageScroller.");return e}function Au(){let e=y.useContext(Hi);if(!e)throw new Error("MessageScrollerItem must be used within a MessageScroller.");return e}function Nu({autoScroll:e=!1,children:t,defaultScrollPosition:n="end",scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:s}){let{context:i,registerMessage:c}=ku({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:s});return p.jsx(Vi.Provider,{value:i,children:p.jsx(Hi.Provider,{value:c,children:t})})}function $i(){let{pendingDefaultScrollStore:e}=rn();return y.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function Mu({children:e,...t}){let{setRootElement:n}=rn(),r=$i();return p.jsx("div",{ref:n,...t,...r?{"data-pending-scroll":""}:null,children:e})}function ju({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:o,onWheel:s,preserveScrollOnPrepend:i=!0,ref:c,role:a,tabIndex:l,...u}){let{handleResize:f,preserveScrollOnPrependRef:h,setViewportElement:m,syncAfterScroll:d,userScrollIntent:g,viewportRef:b}=rn(),v=$i();h.current=i;let x=y.useCallback(R=>{var T;m(R),(T=nn(c))==null||T(R)},[c,m]);function C(R){d(),r==null||r(R)}function w(R){g(),s==null||s(R)}function E(R){g(),o==null||o(R)}function S(R){fu.has(R.key)&&g(),n==null||n(R)}return y.useEffect(()=>{let R=b.current;if(!R||typeof ResizeObserver>"u")return;let T=0,P=new ResizeObserver(()=>{window.cancelAnimationFrame(T),T=window.requestAnimationFrame(f)});return P.observe(R),()=>{window.cancelAnimationFrame(T),P.disconnect()}},[f,b]),p.jsx("div",{ref:x,role:a??"region","aria-label":e??"Messages",tabIndex:l??0,onKeyDown:S,onScroll:C,onTouchMove:E,onWheel:w,...u,...v?{"data-pending-scroll":""}:null,children:t})}function Du({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:o,...s}){let{handleContentChange:i,handleResize:c,setContentElement:a,setSpacerElement:l}=rn(),u=y.useRef(null),f=y.useCallback(h=>{var m;u.current=h,a(h),(m=nn(n))==null||m(h)},[n,a]);return y.useLayoutEffect(()=>{let h=u.current;if(!h||(i(),typeof MutationObserver>"u"))return;let m=new MutationObserver(()=>{i()});return m.observe(h,{childList:!0}),()=>m.disconnect()},[i]),y.useEffect(()=>{let h=u.current;if(!h||typeof ResizeObserver>"u")return;let m=0,d=new ResizeObserver(()=>{window.cancelAnimationFrame(m),m=window.requestAnimationFrame(c)});return d.observe(h),()=>{window.cancelAnimationFrame(m),d.disconnect()}},[c]),p.jsxs("div",{ref:f,role:r??"log","aria-relevant":e??"additions",...s,children:[t,p.jsx("div",{ref:l,"aria-hidden":"true","data-message-scroller-spacer":"",hidden:!0,className:o})]})}function Fu({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let o=Au(),s=y.useRef(null),i=y.useCallback(c=>{var l;let a=s.current;s.current=c,e&&o(e,c,a),(l=nn(t))==null||l(c)},[e,t,o]);return p.jsx("div",{ref:i,"data-message-id":e,"data-scroll-anchor":n?"true":"false",...r})}function Lu({behavior:e="smooth",children:t,direction:n="end",onClick:r,render:o,tabIndex:s,type:i="button",...c}){let{scrollToEnd:a,scrollToStart:l,stateStore:u}=rn(),f=_u(r),h=y.useCallback(b=>u.subscribe(b),[u]),m=y.useCallback(()=>{let b=u.getSnapshot();return n==="start"?b.start:b.end},[n,u]),d=y.useSyncExternalStore(h,m,m),g=y.useCallback(b=>{var v;d&&((v=f.current)==null||v.call(f,b),b.defaultPrevented||(b.currentTarget.blur(),n==="start"?l({behavior:e}):a({behavior:e})))},[e,n,d,f,a,l]);return ru({defaultTagName:"button",props:_r({type:i,inert:!d,tabIndex:d?s:-1,children:t??p.jsxs("span",{children:["Scroll to ",n]}),onClick:g},c),render:o,state:{active:d,direction:n},stateAttributesMapping:{active:b=>({"data-active":b?"true":"false"})}})}var Ft={Provider:Nu,Root:Mu,Viewport:ju,Content:Du,Item:Fu,Button:Lu};function Bu(e){return p.jsx(Ft.Provider,{...e})}function Vu({className:e,...t}){return p.jsx(Ft.Root,{"data-slot":"message-scroller",className:le("msg-scroller-root",e),...t})}function Hu({className:e,...t}){return p.jsx(Ft.Viewport,{"data-slot":"message-scroller-viewport",className:le("msg-scroller-viewport",e),...t})}function $u({className:e,...t}){return p.jsx(Ft.Content,{"data-slot":"message-scroller-content",className:le("msg-scroller-content",e),...t})}function ls({className:e,scrollAnchor:t=!1,...n}){return p.jsx(Ft.Item,{"data-slot":"message-scroller-item",scrollAnchor:t,className:le("msg-scroller-item",e),...n})}function Uu({direction:e="end",className:t,children:n,...r}){return p.jsx(Ft.Button,{"data-slot":"message-scroller-button",direction:e,className:le("msg-scroller-btn",t),...r,children:n??p.jsxs(p.Fragment,{children:[p.jsx(ha,{size:16,"aria-hidden":"true",className:e==="start"?"rotate-180":void 0}),p.jsx("span",{className:"sr-only",children:e==="end"?"Jump to latest":"Jump to start"})]})})}function Nr({align:e="start",variant:t="muted",className:n,...r}){return p.jsx("div",{...r,"data-slot":"bubble","data-align":e,"data-variant":t,className:le("chat-bubble",n)})}function Mr({className:e,...t}){return p.jsx("div",{...t,"data-slot":"bubble-content",className:le("chat-bubble-content",e)})}const Wu=()=>p.jsxs(Jr,{children:[p.jsx(ii,{className:"avatar-circle","aria-hidden":"true",children:p.jsx(va,{size:15})}),p.jsx(Zr,{children:p.jsx(Nr,{children:p.jsx(Mr,{children:"Hello — I am the VPS Veritas assistant. Ask about reports, sample status, registration, or support, or choose a suggested question."})})})]});function Ui(){const[e,t]=O.useState("idle");O.useEffect(()=>{if(e!=="copied")return;const r=window.setTimeout(()=>t("idle"),2e3);return()=>window.clearTimeout(r)},[e]);async function n(r){t("copying");try{await navigator.clipboard.writeText(r),t("copied")}catch{t("failed")}}return{status:e,copy:n}}function qu({message:e,onFeedback:t}){const{status:n,copy:r}=Ui();return p.jsxs("div",{className:"chat-message-actions",role:"group","aria-label":"Response actions",children:[p.jsx("button",{type:"button",className:"chat-message-action","aria-label":"Copy response",title:"Copy response",disabled:n==="copying",onClick:()=>void r(e.content),children:n==="copied"?p.jsx(Qr,{size:16,"aria-hidden":"true"}):p.jsx(ri,{size:16,"aria-hidden":"true"})}),p.jsx("button",{type:"button",className:"chat-message-action","aria-label":"Like response",title:"Like response","aria-pressed":e.feedback==="like",onClick:()=>t(e.id,"like"),children:p.jsx(Aa,{size:16,"aria-hidden":"true"})}),p.jsx("button",{type:"button",className:"chat-message-action","aria-label":"Dislike response",title:"Dislike response","aria-pressed":e.feedback==="dislike",onClick:()=>t(e.id,"dislike"),children:p.jsx(_a,{size:16,"aria-hidden":"true"})}),p.jsxs("span",{className:"chat-message-copy-status",role:"status",children:[n==="copied"&&"Copied",n==="failed"&&"Couldn’t copy"]})]})}function go(e){const t=e.trim();if(!/[\u0000-\u001f\u007f]/.test(t)&&/^(https?:\/\/|mailto:|\/(?!\/)|#)/i.test(t))return t}function zu(e){return Object.prototype.toString.call(e)==="[object Object]"}function us(e){return zu(e)||Array.isArray(e)}function Gu(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function bo(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const o=JSON.stringify(Object.keys(e.breakpoints||{})),s=JSON.stringify(Object.keys(t.breakpoints||{}));return o!==s?!1:n.every(i=>{const c=e[i],a=t[i];return typeof c=="function"?`${c}`==`${a}`:!us(c)||!us(a)?c===a:bo(c,a)})}function fs(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function Ku(e,t){if(e.length!==t.length)return!1;const n=fs(e),r=fs(t);return n.every((o,s)=>{const i=r[s];return bo(o,i)})}function vo(e){return typeof e=="number"}function jr(e){return typeof e=="string"}function er(e){return typeof e=="boolean"}function ds(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ie(e){return Math.abs(e)}function yo(e){return Math.sign(e)}function zt(e,t){return Ie(e-t)}function Yu(e,t){if(e===0||t===0||Ie(e)<=Ie(t))return 0;const n=zt(Ie(e),Ie(t));return Ie(n/e)}function Xu(e){return Math.round(e*100)/100}function Qt(e){return Jt(e).map(Number)}function Qe(e){return e[on(e)]}function on(e){return Math.max(0,e.length-1)}function xo(e,t){return t===on(e)}function ps(e,t=0){return Array.from(Array(e),(n,r)=>t+r)}function Jt(e){return Object.keys(e)}function Wi(e,t){return[e,t].reduce((n,r)=>(Jt(r).forEach(o=>{const s=n[o],i=r[o],c=ds(s)&&ds(i);n[o]=c?Wi(s,i):i}),n),{})}function Dr(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function Qu(e,t){const n={start:r,center:o,end:s};function r(){return 0}function o(a){return s(a)/2}function s(a){return t-a}function i(a,l){return jr(e)?n[e](a):e(t,a,l)}return{measure:i}}function Zt(){let e=[];function t(o,s,i,c={passive:!0}){let a;if("addEventListener"in o)o.addEventListener(s,i,c),a=()=>o.removeEventListener(s,i,c);else{const l=o;l.addListener(i),a=()=>l.removeListener(i)}return e.push(a),r}function n(){e=e.filter(o=>o())}const r={add:t,clear:n};return r}function Ju(e,t,n,r){const o=Zt(),s=1e3/60;let i=null,c=0,a=0;function l(){o.add(e,"visibilitychange",()=>{e.hidden&&d()})}function u(){m(),o.clear()}function f(b){if(!a)return;i||(i=b,n(),n());const v=b-i;for(i=b,c+=v;c>=s;)n(),c-=s;const x=c/s;r(x),a&&(a=t.requestAnimationFrame(f))}function h(){a||(a=t.requestAnimationFrame(f))}function m(){t.cancelAnimationFrame(a),i=null,c=0,a=0}function d(){i=null,c=0}return{init:l,destroy:u,start:h,stop:m,update:n,render:r}}function Zu(e,t){const n=t==="rtl",r=e==="y",o=r?"y":"x",s=r?"x":"y",i=!r&&n?-1:1,c=u(),a=f();function l(d){const{height:g,width:b}=d;return r?g:b}function u(){return r?"top":n?"right":"left"}function f(){return r?"bottom":n?"left":"right"}function h(d){return d*i}return{scroll:o,cross:s,startEdge:c,endEdge:a,measureSize:l,direction:h}}function St(e=0,t=0){const n=Ie(e-t);function r(l){return l<e}function o(l){return l>t}function s(l){return r(l)||o(l)}function i(l){return s(l)?r(l)?e:t:l}function c(l){return n?l-n*Math.ceil((l-t)/n):l}return{length:n,max:t,min:e,constrain:i,reachedAny:s,reachedMax:o,reachedMin:r,removeOffset:c}}function qi(e,t,n){const{constrain:r}=St(0,e),o=e+1;let s=i(t);function i(h){return n?Ie((o+h)%o):r(h)}function c(){return s}function a(h){return s=i(h),f}function l(h){return u().set(c()+h)}function u(){return qi(e,c(),n)}const f={get:c,set:a,add:l,clone:u};return f}function ef(e,t,n,r,o,s,i,c,a,l,u,f,h,m,d,g,b,v,x){const{cross:C,direction:w}=e,E=["INPUT","SELECT","TEXTAREA"],S={passive:!1},R=Zt(),T=Zt(),P=St(50,225).constrain(m.measure(20)),k={mouse:300,touch:400},M={mouse:500,touch:600},_=d?43:25;let D=!1,N=0,I=0,F=!1,U=!1,A=!1,j=!1;function q($){if(!x)return;function ne(be){(er(x)||x($,be))&&V(be)}const se=t;R.add(se,"dragstart",be=>be.preventDefault(),S).add(se,"touchmove",()=>{},S).add(se,"touchend",()=>{}).add(se,"touchstart",ne).add(se,"mousedown",ne).add(se,"touchcancel",Z).add(se,"contextmenu",Z).add(se,"click",oe,!0)}function z(){R.clear(),T.clear()}function ae(){const $=j?n:t;T.add($,"touchmove",H,S).add($,"touchend",Z).add($,"mousemove",H,S).add($,"mouseup",Z)}function re($){const ne=$.nodeName||"";return E.includes(ne)}function B(){return(d?M:k)[j?"mouse":"touch"]}function G($,ne){const se=f.add(yo($)*-1),be=u.byDistance($,!d).distance;return d||Ie($)<P?be:b&&ne?be*.5:u.byIndex(se.get(),0).distance}function V($){const ne=Dr($,r);j=ne,A=d&&ne&&!$.buttons&&D,D=zt(o.get(),i.get())>=2,!(ne&&$.button!==0)&&(re($.target)||(F=!0,s.pointerDown($),l.useFriction(0).useDuration(0),o.set(i),ae(),N=s.readPoint($),I=s.readPoint($,C),h.emit("pointerDown")))}function H($){if(!Dr($,r)&&$.touches.length>=2)return Z($);const se=s.readPoint($),be=s.readPoint($,C),ve=zt(se,N),Oe=zt(be,I);if(!U&&!j&&(!$.cancelable||(U=ve>Oe,!U)))return Z($);const Ae=s.pointerMove($);ve>g&&(A=!0),l.useFriction(.3).useDuration(.75),c.start(),o.add(w(Ae)),$.preventDefault()}function Z($){const se=u.byDistance(0,!1).index!==f.get(),be=s.pointerUp($)*B(),ve=G(w(be),se),Oe=Yu(be,ve),Ae=_-10*Oe,xe=v+Oe/50;U=!1,F=!1,T.clear(),l.useDuration(Ae).useFriction(xe),a.distance(ve,!d),j=!1,h.emit("pointerUp")}function oe($){A&&($.stopPropagation(),$.preventDefault(),A=!1)}function ee(){return F}return{init:q,destroy:z,pointerDown:ee}}function tf(e,t){let r,o;function s(f){return f.timeStamp}function i(f,h){const d=`client${(h||e.scroll)==="x"?"X":"Y"}`;return(Dr(f,t)?f:f.touches[0])[d]}function c(f){return r=f,o=f,i(f)}function a(f){const h=i(f)-i(o),m=s(f)-s(r)>170;return o=f,m&&(r=f),h}function l(f){if(!r||!o)return 0;const h=i(o)-i(r),m=s(f)-s(r),d=s(f)-s(o)>170,g=h/m;return m&&!d&&Ie(g)>.1?g:0}return{pointerDown:c,pointerMove:a,pointerUp:l,readPoint:i}}function nf(){function e(n){const{offsetTop:r,offsetLeft:o,offsetWidth:s,offsetHeight:i}=n;return{top:r,right:o+s,bottom:r+i,left:o,width:s,height:i}}return{measure:e}}function rf(e){function t(r){return e*(r/100)}return{measure:t}}function of(e,t,n,r,o,s,i){const c=[e].concat(r);let a,l,u=[],f=!1;function h(b){return o.measureSize(i.measure(b))}function m(b){if(!s)return;l=h(e),u=r.map(h);function v(x){for(const C of x){if(f)return;const w=C.target===e,E=r.indexOf(C.target),S=w?l:u[E],R=h(w?e:r[E]);if(Ie(R-S)>=.5){b.reInit(),t.emit("resize");break}}}a=new ResizeObserver(x=>{(er(s)||s(b,x))&&v(x)}),n.requestAnimationFrame(()=>{c.forEach(x=>a.observe(x))})}function d(){f=!0,a&&a.disconnect()}return{init:m,destroy:d}}function sf(e,t,n,r,o,s){let i=0,c=0,a=o,l=s,u=e.get(),f=0;function h(){const S=r.get()-e.get(),R=!a;let T=0;return R?(i=0,n.set(r),e.set(r),T=S):(n.set(e),i+=S/a,i*=l,u+=i,e.add(i),T=u-f),c=yo(T),f=u,E}function m(){const S=r.get()-t.get();return Ie(S)<.001}function d(){return a}function g(){return c}function b(){return i}function v(){return C(o)}function x(){return w(s)}function C(S){return a=S,E}function w(S){return l=S,E}const E={direction:g,duration:d,velocity:b,seek:h,settled:m,useBaseFriction:x,useBaseDuration:v,useFriction:w,useDuration:C};return E}function cf(e,t,n,r,o){const s=o.measure(10),i=o.measure(50),c=St(.1,.99);let a=!1;function l(){return!(a||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function u(m){if(!l())return;const d=e.reachedMin(t.get())?"min":"max",g=Ie(e[d]-t.get()),b=n.get()-t.get(),v=c.constrain(g/i);n.subtract(b*v),!m&&Ie(b)<s&&(n.set(e.constrain(n.get())),r.useDuration(25).useBaseFriction())}function f(m){a=!m}return{shouldConstrain:l,constrain:u,toggleActive:f}}function af(e,t,n,r,o){const s=St(-t+e,0),i=f(),c=u(),a=h();function l(d,g){return zt(d,g)<=1}function u(){const d=i[0],g=Qe(i),b=i.lastIndexOf(d),v=i.indexOf(g)+1;return St(b,v)}function f(){return n.map((d,g)=>{const{min:b,max:v}=s,x=s.constrain(d),C=!g,w=xo(n,g);return C?v:w||l(b,x)?b:l(v,x)?v:x}).map(d=>parseFloat(d.toFixed(3)))}function h(){if(t<=e+o)return[s.max];if(r==="keepSnaps")return i;const{min:d,max:g}=c;return i.slice(d,g)}return{snapsContained:a,scrollContainLimit:c}}function lf(e,t,n){const r=t[0],o=n?r-e:Qe(t);return{limit:St(o,r)}}function uf(e,t,n,r){const s=t.min+.1,i=t.max+.1,{reachedMin:c,reachedMax:a}=St(s,i);function l(h){return h===1?a(n.get()):h===-1?c(n.get()):!1}function u(h){if(!l(h))return;const m=e*(h*-1);r.forEach(d=>d.add(m))}return{loop:u}}function ff(e){const{max:t,length:n}=e;function r(s){const i=s-t;return n?i/-n:0}return{get:r}}function df(e,t,n,r,o){const{startEdge:s,endEdge:i}=e,{groupSlides:c}=o,a=f().map(t.measure),l=h(),u=m();function f(){return c(r).map(g=>Qe(g)[i]-g[0][s]).map(Ie)}function h(){return r.map(g=>n[s]-g[s]).map(g=>-Ie(g))}function m(){return c(l).map(g=>g[0]).map((g,b)=>g+a[b])}return{snaps:l,snapsAligned:u}}function pf(e,t,n,r,o,s){const{groupSlides:i}=o,{min:c,max:a}=r,l=u();function u(){const h=i(s),m=!e||t==="keepSnaps";return n.length===1?[s]:m?h:h.slice(c,a).map((d,g,b)=>{const v=!g,x=xo(b,g);if(v){const C=Qe(b[0])+1;return ps(C)}if(x){const C=on(s)-Qe(b)[0]+1;return ps(C,Qe(b)[0])}return d})}return{slideRegistry:l}}function hf(e,t,n,r,o){const{reachedAny:s,removeOffset:i,constrain:c}=r;function a(d){return d.concat().sort((g,b)=>Ie(g)-Ie(b))[0]}function l(d){const g=e?i(d):c(d),b=t.map((x,C)=>({diff:u(x-g,0),index:C})).sort((x,C)=>Ie(x.diff)-Ie(C.diff)),{index:v}=b[0];return{index:v,distance:g}}function u(d,g){const b=[d,d+n,d-n];if(!e)return d;if(!g)return a(b);const v=b.filter(x=>yo(x)===g);return v.length?a(v):Qe(b)-n}function f(d,g){const b=t[d]-o.get(),v=u(b,g);return{index:d,distance:v}}function h(d,g){const b=o.get()+d,{index:v,distance:x}=l(b),C=!e&&s(b);if(!g||C)return{index:v,distance:d};const w=t[v]-x,E=d+u(w,0);return{index:v,distance:E}}return{byDistance:h,byIndex:f,shortcut:u}}function mf(e,t,n,r,o,s,i){function c(f){const h=f.distance,m=f.index!==t.get();s.add(h),h&&(r.duration()?e.start():(e.update(),e.render(1),e.update())),m&&(n.set(t.get()),t.set(f.index),i.emit("select"))}function a(f,h){const m=o.byDistance(f,h);c(m)}function l(f,h){const m=t.clone().set(f),d=o.byIndex(m.get(),h);c(d)}return{distance:a,index:l}}function gf(e,t,n,r,o,s,i,c){const a={passive:!0,capture:!0};let l=0;function u(m){if(!c)return;function d(g){if(new Date().getTime()-l>10)return;i.emit("slideFocusStart"),e.scrollLeft=0;const x=n.findIndex(C=>C.includes(g));vo(x)&&(o.useDuration(0),r.index(x,0),i.emit("slideFocus"))}s.add(document,"keydown",f,!1),t.forEach((g,b)=>{s.add(g,"focus",v=>{(er(c)||c(m,v))&&d(b)},a)})}function f(m){m.code==="Tab"&&(l=new Date().getTime())}return{init:u}}function Wt(e){let t=e;function n(){return t}function r(a){t=i(a)}function o(a){t+=i(a)}function s(a){t-=i(a)}function i(a){return vo(a)?a:a.get()}return{get:n,set:r,add:o,subtract:s}}function zi(e,t){const n=e.scroll==="x"?i:c,r=t.style;let o=null,s=!1;function i(h){return`translate3d(${h}px,0px,0px)`}function c(h){return`translate3d(0px,${h}px,0px)`}function a(h){if(s)return;const m=Xu(e.direction(h));m!==o&&(r.transform=n(m),o=m)}function l(h){s=!h}function u(){s||(r.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:u,to:a,toggleActive:l}}function bf(e,t,n,r,o,s,i,c,a){const u=Qt(o),f=Qt(o).reverse(),h=v().concat(x());function m(R,T){return R.reduce((P,k)=>P-o[k],T)}function d(R,T){return R.reduce((P,k)=>m(P,T)>0?P.concat([k]):P,[])}function g(R){return s.map((T,P)=>({start:T-r[P]+.5+R,end:T+t-.5+R}))}function b(R,T,P){const k=g(T);return R.map(M=>{const _=P?0:-n,D=P?n:0,N=P?"end":"start",I=k[M][N];return{index:M,loopPoint:I,slideLocation:Wt(-1),translate:zi(e,a[M]),target:()=>c.get()>I?_:D}})}function v(){const R=i[0],T=d(f,R);return b(T,n,!1)}function x(){const R=t-i[0]-1,T=d(u,R);return b(T,-n,!0)}function C(){return h.every(({index:R})=>{const T=u.filter(P=>P!==R);return m(T,t)<=.1})}function w(){h.forEach(R=>{const{target:T,translate:P,slideLocation:k}=R,M=T();M!==k.get()&&(P.to(M),k.set(M))})}function E(){h.forEach(R=>R.translate.clear())}return{canLoop:C,clear:E,loop:w,loopPoints:h}}function vf(e,t,n){let r,o=!1;function s(a){if(!n)return;function l(u){for(const f of u)if(f.type==="childList"){a.reInit(),t.emit("slidesChanged");break}}r=new MutationObserver(u=>{o||(er(n)||n(a,u))&&l(u)}),r.observe(e,{childList:!0})}function i(){r&&r.disconnect(),o=!0}return{init:s,destroy:i}}function yf(e,t,n,r){const o={};let s=null,i=null,c,a=!1;function l(){c=new IntersectionObserver(d=>{a||(d.forEach(g=>{const b=t.indexOf(g.target);o[b]=g}),s=null,i=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:r}),t.forEach(d=>c.observe(d))}function u(){c&&c.disconnect(),a=!0}function f(d){return Jt(o).reduce((g,b)=>{const v=parseInt(b),{isIntersecting:x}=o[v];return(d&&x||!d&&!x)&&g.push(v),g},[])}function h(d=!0){if(d&&s)return s;if(!d&&i)return i;const g=f(d);return d&&(s=g),d||(i=g),g}return{init:l,destroy:u,get:h}}function xf(e,t,n,r,o,s){const{measureSize:i,startEdge:c,endEdge:a}=e,l=n[0]&&o,u=d(),f=g(),h=n.map(i),m=b();function d(){if(!l)return 0;const x=n[0];return Ie(t[c]-x[c])}function g(){if(!l)return 0;const x=s.getComputedStyle(Qe(r));return parseFloat(x.getPropertyValue(`margin-${a}`))}function b(){return n.map((x,C,w)=>{const E=!C,S=xo(w,C);return E?h[C]+u:S?h[C]+f:w[C+1][c]-x[c]}).map(Ie)}return{slideSizes:h,slideSizesWithGaps:m,startGap:u,endGap:f}}function wf(e,t,n,r,o,s,i,c,a){const{startEdge:l,endEdge:u,direction:f}=e,h=vo(n);function m(v,x){return Qt(v).filter(C=>C%x===0).map(C=>v.slice(C,C+x))}function d(v){return v.length?Qt(v).reduce((x,C,w)=>{const E=Qe(x)||0,S=E===0,R=C===on(v),T=o[l]-s[E][l],P=o[l]-s[C][u],k=!r&&S?f(i):0,M=!r&&R?f(c):0,_=Ie(P-M-(T+k));return w&&_>t+a&&x.push(C),R&&x.push(v.length),x},[]).map((x,C,w)=>{const E=Math.max(w[C-1]||0);return v.slice(E,x)}):[]}function g(v){return h?m(v,n):d(v)}return{groupSlides:g}}function Cf(e,t,n,r,o,s,i){const{align:c,axis:a,direction:l,startIndex:u,loop:f,duration:h,dragFree:m,dragThreshold:d,inViewThreshold:g,slidesToScroll:b,skipSnaps:v,containScroll:x,watchResize:C,watchSlides:w,watchDrag:E,watchFocus:S}=s,R=2,T=nf(),P=T.measure(t),k=n.map(T.measure),M=Zu(a,l),_=M.measureSize(P),D=rf(_),N=Qu(c,_),I=!f&&!!x,F=f||!!x,{slideSizes:U,slideSizesWithGaps:A,startGap:j,endGap:q}=xf(M,P,k,n,F,o),z=wf(M,_,b,f,P,k,j,q,R),{snaps:ae,snapsAligned:re}=df(M,N,P,k,z),B=-Qe(ae)+Qe(A),{snapsContained:G,scrollContainLimit:V}=af(_,B,re,x,R),H=I?G:re,{limit:Z}=lf(B,H,f),oe=qi(on(H),u,f),ee=oe.clone(),te=Qt(n),$=({dragHandler:W,scrollBody:Q,scrollBounds:X,options:{loop:ie}})=>{ie||X.constrain(W.pointerDown()),Q.seek()},ne=({scrollBody:W,translate:Q,location:X,offsetLocation:ie,previousLocation:Se,scrollLooper:de,slideLooper:_e,dragHandler:Te,animation:qe,eventHandler:$e,scrollBounds:nt,options:{loop:gt}},bt)=>{const Lt=W.settled(),ln=!nt.shouldConstrain(),Bt=gt?Lt:Lt&&ln,Vt=Bt&&!Te.pointerDown();Vt&&qe.stop();const un=X.get()*bt+Se.get()*(1-bt);ie.set(un),gt&&(de.loop(W.direction()),_e.loop()),Q.to(ie.get()),Vt&&$e.emit("settle"),Bt||$e.emit("scroll")},se=Ju(r,o,()=>$(Re),W=>ne(Re,W)),be=.68,ve=H[oe.get()],Oe=Wt(ve),Ae=Wt(ve),xe=Wt(ve),Me=Wt(ve),Le=sf(Oe,xe,Ae,Me,h,be),K=hf(f,H,B,Z,Me),J=mf(se,oe,ee,Le,K,Me,i),ue=ff(Z),L=Zt(),Y=yf(t,n,i,g),{slideRegistry:Ee}=pf(I,x,H,V,z,te),me=gf(e,n,Ee,J,Le,L,i,S),Re={ownerDocument:r,ownerWindow:o,eventHandler:i,containerRect:P,slideRects:k,animation:se,axis:M,dragHandler:ef(M,e,r,o,Me,tf(M,o),Oe,se,J,Le,K,oe,i,D,m,d,v,be,E),eventStore:L,percentOfView:D,index:oe,indexPrevious:ee,limit:Z,location:Oe,offsetLocation:xe,previousLocation:Ae,options:s,resizeHandler:of(t,i,o,n,M,C,T),scrollBody:Le,scrollBounds:cf(Z,xe,Me,Le,D),scrollLooper:uf(B,Z,xe,[Oe,xe,Ae,Me]),scrollProgress:ue,scrollSnapList:H.map(ue.get),scrollSnaps:H,scrollTarget:K,scrollTo:J,slideLooper:bf(M,_,B,U,A,ae,H,xe,n),slideFocus:me,slidesHandler:vf(t,i,w),slidesInView:Y,slideIndexes:te,slideRegistry:Ee,slidesToScroll:z,target:Me,translate:zi(M,t)};return Re}function Sf(){let e={},t;function n(l){t=l}function r(l){return e[l]||[]}function o(l){return r(l).forEach(u=>u(t,l)),a}function s(l,u){return e[l]=r(l).concat([u]),a}function i(l,u){return e[l]=r(l).filter(f=>f!==u),a}function c(){e={}}const a={init:n,emit:o,off:i,on:s,clear:c};return a}const Ef={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function Rf(e){function t(s,i){return Wi(s,i||{})}function n(s){const i=s.breakpoints||{},c=Jt(i).filter(a=>e.matchMedia(a).matches).map(a=>i[a]).reduce((a,l)=>t(a,l),{});return t(s,c)}function r(s){return s.map(i=>Jt(i.breakpoints||{})).reduce((i,c)=>i.concat(c),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:r}}function Tf(e){let t=[];function n(s,i){return t=i.filter(({options:c})=>e.optionsAtMedia(c).active!==!1),t.forEach(c=>c.init(s,e)),i.reduce((c,a)=>Object.assign(c,{[a.name]:a}),{})}function r(){t=t.filter(s=>s.destroy())}return{init:n,destroy:r}}function Fn(e,t,n){const r=e.ownerDocument,o=r.defaultView,s=Rf(o),i=Tf(s),c=Zt(),a=Sf(),{mergeOptions:l,optionsAtMedia:u,optionsMediaQueries:f}=s,{on:h,off:m,emit:d}=a,g=M;let b=!1,v,x=l(Ef,Fn.globalOptions),C=l(x),w=[],E,S,R;function T(){const{container:te,slides:$}=C;S=(jr(te)?e.querySelector(te):te)||e.children[0];const se=jr($)?S.querySelectorAll($):$;R=[].slice.call(se||S.children)}function P(te){const $=Cf(e,S,R,r,o,te,a);if(te.loop&&!$.slideLooper.canLoop()){const ne=Object.assign({},te,{loop:!1});return P(ne)}return $}function k(te,$){b||(x=l(x,te),C=u(x),w=$||w,T(),v=P(C),f([x,...w.map(({options:ne})=>ne)]).forEach(ne=>c.add(ne,"change",M)),C.active&&(v.translate.to(v.location.get()),v.animation.init(),v.slidesInView.init(),v.slideFocus.init(ee),v.eventHandler.init(ee),v.resizeHandler.init(ee),v.slidesHandler.init(ee),v.options.loop&&v.slideLooper.loop(),S.offsetParent&&R.length&&v.dragHandler.init(ee),E=i.init(ee,w)))}function M(te,$){const ne=z();_(),k(l({startIndex:ne},te),$),a.emit("reInit")}function _(){v.dragHandler.destroy(),v.eventStore.clear(),v.translate.clear(),v.slideLooper.clear(),v.resizeHandler.destroy(),v.slidesHandler.destroy(),v.slidesInView.destroy(),v.animation.destroy(),i.destroy(),c.clear()}function D(){b||(b=!0,c.clear(),_(),a.emit("destroy"),a.clear())}function N(te,$,ne){!C.active||b||(v.scrollBody.useBaseFriction().useDuration($===!0?0:C.duration),v.scrollTo.index(te,ne||0))}function I(te){const $=v.index.add(1).get();N($,te,-1)}function F(te){const $=v.index.add(-1).get();N($,te,1)}function U(){return v.index.add(1).get()!==z()}function A(){return v.index.add(-1).get()!==z()}function j(){return v.scrollSnapList}function q(){return v.scrollProgress.get(v.offsetLocation.get())}function z(){return v.index.get()}function ae(){return v.indexPrevious.get()}function re(){return v.slidesInView.get()}function B(){return v.slidesInView.get(!1)}function G(){return E}function V(){return v}function H(){return e}function Z(){return S}function oe(){return R}const ee={canScrollNext:U,canScrollPrev:A,containerNode:Z,internalEngine:V,destroy:D,off:m,on:h,emit:d,plugins:G,previousScrollSnap:ae,reInit:g,rootNode:H,scrollNext:I,scrollPrev:F,scrollProgress:q,scrollSnapList:j,scrollTo:N,selectedScrollSnap:z,slideNodes:oe,slidesInView:re,slidesNotInView:B};return k(t,n),setTimeout(()=>a.emit("init"),0),ee}Fn.globalOptions=void 0;function wo(e={},t=[]){const n=O.useRef(e),r=O.useRef(t),[o,s]=O.useState(),[i,c]=O.useState(),a=O.useCallback(()=>{o&&o.reInit(n.current,r.current)},[o]);return O.useEffect(()=>{bo(n.current,e)||(n.current=e,a())},[e,a]),O.useEffect(()=>{Ku(r.current,t)||(r.current=t,a())},[t,a]),O.useEffect(()=>{if(Gu()&&i){Fn.globalOptions=wo.globalOptions;const l=Fn(i,n.current,r.current);return s(l),()=>l.destroy()}else s(void 0)},[i,s]),[c,o]}wo.globalOptions=void 0;const Fr=[];let Lr;function If(){return Lr}function Of(e){Fr.push(e)}function Gi(e){const t=(n,r)=>{const o=Ze(kf).current;let s;try{Lr=o;for(const i of Fr)i.before(o);s=e(n,r);for(const i of Fr)i.after(o);o.didInitialize=!0}finally{Lr=void 0}return s};return t.displayName=e.displayName||e.name,t}function Pf(e){return y.forwardRef(Gi(e))}function kf(){return{didInitialize:!1}}function _f(){if(typeof navigator>"u")return{userAgent:"",platform:"",maxTouchPoints:0};if(process.env.NODE_ENV!=="production"){const e=navigator.userAgentData;if(e&&Array.isArray(e.brands))return{userAgent:e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "),platform:e.platform??navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}return{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:Af,platform:Nf,maxTouchPoints:Mf}=_f(),tr=Af.toLowerCase(),en=Nf.toLowerCase(),Ki=/^i(os$|p)/.test(en)||en==="macintel"&&Mf>1,hs="android",jf=en===hs||tr.includes(hs),Yi=!Ki&&en.startsWith("mac");en.startsWith("win");const Df=Yi||Ki;var qs;const sn=typeof CSS<"u"&&!!((qs=CSS.supports)!=null&&qs.call(CSS,"-webkit-backdrop-filter:none"));!sn&&tr.includes("firefox");!sn&&tr.includes("chrom");const Ff=Df,Lf=/jsdom|happydom/.test(tr);function Bf(e){return"nativeEvent"in e}function Vf(e){return e.pointerType===""&&e.isTrusted?!0:jf&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Br(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}function Hf(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Vr(e){var n;let t=e.activeElement;for(;((n=t==null?void 0:t.shadowRoot)==null?void 0:n.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function Pe(e,t){var r;if(!e||!t)return!1;const n=(r=t.getRootNode)==null?void 0:r.call(t);if(e.contains(t))return!0;if(n&&At(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Hr(e,t){let n=e;for(;n;){if(ge(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(At(n)?n.host:null)}return null}function xt(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const $f="data-base-ui-focusable",Xi="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Uf="data-open",Wf="data-closed",qf="data-anchor-hidden",zf="data-popup-open",Gf={[zf]:""},Kf={[Uf]:""},Yf={[Wf]:""},Xf={[qf]:""},Qf={open(e){return e?Gf:null}},Qi={open(e){return e?Kf:Yf},anchorHidden(e){return e?Xf:null}},Jf={...Qi,...co},ms="data-trigger-disabled";function Ln(e,t){if(!ge(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute(ms);for(const[,r]of t.entries())if(Pe(r,n))return!r.hasAttribute(ms);return!1}function hr(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Zf(e){return e.matches("html,body")}function ed(e){return je(e)&&e.matches(Xi)}function td(e){return Hr(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Xi}`)!=null}function nd(e){if(!e||Lf)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function rd(e,t){return t!=null&&!Br(t)?0:typeof e=="function"?e():e}function $r(e,t,n){const r=rd(e,n);return typeof r=="number"?r:r==null?void 0:r[t]}function gs(e){return typeof e=="function"?e():e}function Ji(e,t){return t||e==="click"||e==="mousedown"}function od(e){return(e==null?void 0:e.includes("mouse"))&&e!=="mousedown"}function ut(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}const sd={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},id={...sd,position:"fixed",margin:0,top:0,left:0},Ur=y.forwardRef(function(t,n){const[r,o]=y.useState();he(()=>{Ff&&sn&&o("button")},[]);const s={tabIndex:0,role:r};return p.jsx("span",{...t,ref:n,style:id,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});process.env.NODE_ENV!=="production"&&(Ur.displayName="FocusGuard");const jt=Math.min,st=Math.max,Bn=Math.round,xn=Math.floor,it=e=>({x:e,y:e}),cd={left:"right",right:"left",bottom:"top",top:"bottom"};function Zi(e,t,n){return st(e,jt(t,n))}function pt(e,t){return typeof e=="function"?e(t):e}function Ue(e){return e.split("-")[0]}function tt(e){return e.split("-")[1]}function Co(e){return e==="x"?"y":"x"}function So(e){return e==="y"?"height":"width"}function Ge(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Eo(e){return Co(Ge(e))}function ad(e,t,n){n===void 0&&(n=!1);const r=tt(e),o=Eo(e),s=So(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Vn(i)),[i,Vn(i)]}function ld(e){const t=Vn(e);return[Wr(e),t,Wr(t)]}function Wr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const bs=["left","right"],vs=["right","left"],ud=["top","bottom"],fd=["bottom","top"];function dd(e,t,n){switch(e){case"top":case"bottom":return n?t?vs:bs:t?bs:vs;case"left":case"right":return t?ud:fd;default:return[]}}function pd(e,t,n,r){const o=tt(e);let s=dd(Ue(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Wr)))),s}function Vn(e){const t=Ue(e);return cd[t]+e.slice(t.length)}function hd(e){var t,n,r,o;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(o=e.left)!=null?o:0}}function ec(e){return typeof e!="number"?hd(e):{top:e,right:e,bottom:e,left:e}}function Hn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function md(e){return e.visibility==="hidden"||e.visibility==="collapse"}function gd(e,t=e?We(e):null){return!e||!e.isConnected||!t||md(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const bd='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function vd(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return At(n)?n.host:null}function qr(e){for(const t of Array.from(e.children))if(He(t)==="summary")return t;return null}function yd(e,t){const n=qr(t);return!!n&&(e===n||Pe(n,e))}function tc(e){const t=e?He(e):"";return e!=null&&e.matches(bd)&&(t!=="summary"||e.parentElement!=null&&He(e.parentElement)==="details"&&qr(e.parentElement)===e)&&(t!=="details"||qr(e)==null)&&(t!=="input"||e.type!=="hidden")}function xd(e){if(!tc(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=vd(t)){const n=t!==e,r=He(t)==="slot";if(t.hasAttribute("inert")||n&&He(t)==="details"&&!t.open&&!yd(e,t)||t.hasAttribute("hidden")||!r&&!wd(t,n))return!1}return!0}function wd(e,t){const n=We(e);return t?n.display!=="none":gd(e,n)}function Cd(e){const t=e.tabIndex;if(t<0){const n=He(e);if(n==="details"||n==="audio"||n==="video"||je(e)&&e.isContentEditable)return 0}return t}function mr(e){if(He(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function Sd(e,t){const n=mr(e);if(!n)return!0;const r=t.find(o=>{const s=mr(o);return(s==null?void 0:s.name)===n.name&&s.form===n.form&&s.checked});return r?r===n:t.find(o=>{const s=mr(o);return(s==null?void 0:s.name)===n.name&&s.form===n.form})===n}function nc(e){if(je(e)&&He(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return je(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function rc(e,t){nc(e).forEach(n=>{tc(n)&&t.push(n),rc(n,t)})}function oc(e,t,n){nc(e).forEach(r=>{je(r)&&r.matches(t)&&n.push(r),oc(r,t,n)})}function Ed(e){const t=[];return rc(e,t),t.filter(xd)}function sc(e){const t=Ed(e);return t.filter(n=>Cd(n)>=0&&Sd(n,t))}function ic(e,t){const n=sc(e),r=n.length;if(r===0)return;const o=Vr(Je(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function Rd(e){return ic(Je(e).body,1)||e}function Td(e){return ic(Je(e).body,-1)||e}function gr(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Pe(n,r)}function Id(e){sc(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function ys(e){const t=[];oc(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Dt(e,t,n=!0){return e.filter(o=>o.parentId===t).flatMap(o=>{var s;return[...!n||(s=o.context)!=null&&s.open?[o]:[],...Dt(e,o.id,n)]})}function Ro(e){return`data-base-ui-${e}`}const Od={style:{transition:"none"}},Pd={fallbackAxisSide:"end"},kd={clipPath:"inset(50%)",position:"fixed",top:0,left:0},To=y.createContext(null);process.env.NODE_ENV!=="production"&&(To.displayName="PortalContext");const _d=()=>y.useContext(To),Ad=Ro("portal");function cc(e={}){const{ref:t,container:n,componentProps:r=Ve,elementProps:o}=e,s=Kn(),i=_d(),c=i==null?void 0:i.portalNode,[a,l]=y.useState(null),[u,f]=y.useState(null),h=fe(b=>{b!==null&&f(b)}),m=y.useRef(null);he(()=>{if(n===null){m.current&&(m.current=null,f(null),l(null));return}const b=(n&&(ao(n)?n:n.current))??c??document.body;if(b==null){m.current&&(m.current=null,f(null),l(null));return}m.current!==b&&(m.current=b,f(null),l(b))},[n,c]);const d=mt("div",r,{ref:[t,h],props:[{id:s,[Ad]:""},o]}),g=a&&d?ht.createPortal(d,a):null;return{node:u,nodeId:y.isValidElement(d)?d.props.id:void 0,subtree:g}}const Nd=y.forwardRef(function(t,n){const{render:r,className:o,style:s,children:i,container:c,portalOwnerRole:a,...l}=t,{node:u,nodeId:f,subtree:h}=cc({container:c,ref:n,componentProps:t,elementProps:l}),m=y.useRef(null),d=y.useRef(null),g=y.useRef(null),b=y.useRef(null),[v,x]=y.useState(null),C=y.useRef(!1),w=v==null?void 0:v.modal,E=v==null?void 0:v.open,S=!!v&&!v.modal&&v.open&&!!u;y.useEffect(()=>{if(!u||w)return;function T(P){u&&P.relatedTarget&&gr(P)&&(P.type==="focusin"?C.current&&(ys(u),C.current=!1):(Id(u),C.current=!0))}return ut(Ce(u,"focusin",T,!0),Ce(u,"focusout",T,!0))},[u,w]),he(()=>{!u||E!==!0||!C.current||(ys(u),C.current=!1)},[E,u]);const R=y.useMemo(()=>({beforeOutsideRef:m,afterOutsideRef:d,beforeInsideRef:g,afterInsideRef:b,portalNode:u,setFocusManagerState:x}),[u]);return p.jsxs(y.Fragment,{children:[h,p.jsxs(To.Provider,{value:R,children:[S&&u&&p.jsx(Ur,{"data-type":"outside",ref:m,onFocus:T=>{var P;if(gr(T,u))(P=g.current)==null||P.focus();else{const k=v?v.domReference:null,M=Td(k);M==null||M.focus()}}}),S&&u&&p.jsx("span",{role:a,"aria-owns":f,style:kd}),u&&ht.createPortal(i,u),S&&u&&p.jsx(Ur,{"data-type":"outside",ref:d,onFocus:T=>{var P;if(gr(T,u))(P=b.current)==null||P.focus();else{const k=v?v.domReference:null,M=Rd(k);M==null||M.focus(),v!=null&&v.closeOnFocusOut&&(v==null||v.onOpenChange(!1,ke(ul,T.nativeEvent)))}}})]})]})});process.env.NODE_ENV!=="production"&&(Nd.displayName="FloatingPortal");function ac(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}class Md{constructor(){ce(this,"nodesRef",{current:[]});ce(this,"events",ac())}addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Io=y.createContext(null);process.env.NODE_ENV!=="production"&&(Io.displayName="FloatingNodeContext");const Oo=y.createContext(null);process.env.NODE_ENV!=="production"&&(Oo.displayName="FloatingTreeContext");const nr=()=>{var e;return((e=y.useContext(Io))==null?void 0:e.id)||null},cn=e=>{const t=y.useContext(Oo);return e??t};function jd(e){const t=Kn(),n=cn(e),r=nr();return he(()=>{if(!t)return;const o={id:t,parentId:r};return n==null||n.addNode(o),()=>{n==null||n.removeNode(o)}},[n,t,r]),t}function Dd(e){const{children:t,id:n}=e,r=nr();return p.jsx(Io.Provider,{value:y.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Fd(e){const{children:t,externalTree:n}=e,r=Ze(()=>n??new Md).current;return p.jsx(Oo.Provider,{value:r,children:t})}function Ld(){return!1}function Bd(e){return{escapeKey:typeof e=="boolean"?e:(e==null?void 0:e.escapeKey)??!1,outsidePress:typeof e=="boolean"?e:(e==null?void 0:e.outsidePress)??!0}}function Vd(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:o=!0,outsidePressEvent:s="sloppy",referencePress:i=Ld,bubbles:c,externalTree:a}=t,l=e.useState("open"),u=e.useState("floatingElement"),{dataRef:f,events:h}=e.context,m=cn(a),d=fe(typeof o=="function"?o:()=>!1),g=typeof o=="function"?d:o,b=g!==!1,v=fe(()=>s),{escapeKey:x,outsidePress:C}=Bd(c),w=y.useRef(!1),E=y.useRef(!1),S=y.useRef(!1),R=y.useRef(!1),T=y.useRef(!1),P=y.useRef(""),k=y.useRef(null),M=qt(),_=qt(),D=qt(),N=fe(()=>{_.clear(),f.current.insideReactTree=!1}),I=fe(B=>{var H;const G=(H=f.current.floatingContext)==null?void 0:H.nodeId;return(m?Dt(m.nodesRef.current,G):[]).some(Z=>{var oe;return((oe=Z.context)==null?void 0:oe.open)&&!Z.context.dataRef.current[B]})}),F=fe(B=>hr(B,e.select("floatingElement"))||hr(B,e.select("domReferenceElement"))),U=fe(B=>{i()&&e.setOpen(!1,ke(Yn,B.nativeEvent))}),A=fe(B=>{if(!l||!n||!r||B.key!=="Escape")return;const G=Bf(B)?B.nativeEvent:B;if(T.current||G.isComposing||!x&&I("__escapeKeyBubbles"))return;const V=ke(ro,G);e.setOpen(!1,V),V.isCanceled||B.preventDefault(),!x&&!V.isPropagationAllowed&&B.stopPropagation()}),j=fe(()=>{f.current.insideReactTree=!0,_.start(0,N)}),q=fe(B=>{if(!l||!n||B.button!==0)return;const G=xt(B.nativeEvent);Pe(e.select("floatingElement"),G)&&(w.current||(w.current=!0,E.current=!1))}),z=fe(B=>{!l||!n||(B.defaultPrevented||B.nativeEvent.defaultPrevented)&&w.current&&(E.current=!0)});y.useEffect(()=>{function B(G){G.open||(R.current=!1)}return h.on("openchange",B),()=>{h.off("openchange",B)}},[h]),y.useEffect(()=>N,[N]),y.useEffect(()=>{if(!l||!n)return l||(R.current=!1,T.current=!1,P.current="",k.current=null),N;f.current.__escapeKeyBubbles=x,f.current.__outsidePressBubbles=C;const B=new dt,G=Je(u);function V(){D.clear(),T.current=!0}function H(){T.current=!0,D.start(sn?5:0,()=>{T.current=!1})}function Z(){S.current=!0,B.start(0,()=>{S.current=!1})}function oe(){w.current=!1,E.current=!1}function ee(){const L=P.current,Y=L==="pen"||!L?"mouse":L,Ee=v(),me=typeof Ee=="function"?Ee():Ee;return typeof me=="string"?me:me[Y]}function te(L){const Y=ee();return Y==="intentional"&&L.type!=="click"||Y==="sloppy"&&L.type==="click"}function $(L){var me;const Y=(me=f.current.floatingContext)==null?void 0:me.nodeId,Ee=m&&Dt(m.nodesRef.current,Y).some(Re=>{var W;return hr(L,(W=Re.context)==null?void 0:W.elements.floating)});return F(L)||Ee}function ne(L){if(te(L)){L.type!=="click"&&!F(L)&&(B.clear(),S.current=!1),N();return}if(f.current.insideReactTree){N();return}const Y=xt(L),Ee=`[${Ro("inert")}]`,me=ge(Y)?Y.getRootNode():null,Re=Array.from((At(me)?me:Je(e.select("floatingElement"))).querySelectorAll(Ee)),W=e.context.triggerElements;if(Y&&(W.hasElement(Y)||W.hasMatchingElement(X=>Pe(X,Y))))return;let Q=ge(Y)?Y:null;for(;Q&&!lt(Q);){const X=ft(Q);if(lt(X)||!ge(X))break;Q=X}if(!(Re.length&&ge(Y)&&!Zf(Y)&&!Pe(Y,e.select("floatingElement"))&&Re.every(X=>!Pe(Q,X)))){if(je(Y)&&!("touches"in L)){const X=lt(Y),ie=We(Y),Se=/auto|scroll/,de=X||Se.test(ie.overflowX),_e=X||Se.test(ie.overflowY),Te=de&&Y.clientWidth>0&&Y.scrollWidth>Y.clientWidth,qe=_e&&Y.clientHeight>0&&Y.scrollHeight>Y.clientHeight,$e=ie.direction==="rtl",nt=qe&&($e?L.offsetX<=Y.offsetWidth-Y.clientWidth:L.offsetX>Y.clientWidth),gt=Te&&L.offsetY>Y.clientHeight;if(nt||gt)return}if(!$(L)){if(ee()==="intentional"){if(L.detail!==0&&!Vf(L)&&!R.current)return;if(S.current){B.clear(),S.current=!1;return}}typeof g=="function"&&!g(L)||I("__outsidePressBubbles")||(e.setOpen(!1,ke(ll,L)),N())}}}function se(L){ee()!=="sloppy"||L.pointerType==="touch"||!e.select("open")||!n||F(L)||ne(L)}function be(L){if(ee()!=="sloppy"||!e.select("open")||!n||F(L))return;const Y=L.touches[0];Y&&(k.current={startTime:Date.now(),startX:Y.clientX,startY:Y.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},M.start(1e3,()=>{k.current&&(k.current.dismissOnTouchEnd=!1,k.current.dismissOnMouseDown=!1)}))}function ve(L,Y){const Ee=xt(L);if(!Ee)return;const me=Ce(Ee,L.type,()=>{Y(L),me()})}function Oe(L){P.current="touch",ve(L,be)}function Ae(L){M.clear(),L.type==="pointerdown"&&(L.button===0&&(R.current=!0),P.current=L.pointerType),!(L.type==="mousedown"&&k.current&&!k.current.dismissOnMouseDown)&&ve(L,Y=>{Y.type==="pointerdown"?se(Y):ne(Y)})}function xe(L){if(L.type==="pointercancel"&&(R.current=!1),!w.current)return;const Y=E.current;if(oe(),ee()==="intentional"){if(L.type==="pointercancel"){Y&&Z();return}if(!$(L)){if(Y){Z();return}typeof g=="function"&&!g(L)||(B.clear(),S.current=!0,N())}}}function Me(L){if(ee()!=="sloppy"||!k.current||F(L))return;const Y=L.touches[0];if(!Y)return;const Ee=Math.abs(Y.clientX-k.current.startX),me=Math.abs(Y.clientY-k.current.startY),Re=Math.sqrt(Ee*Ee+me*me);Re>5&&(k.current.dismissOnTouchEnd=!0),Re>10&&(ne(L),M.clear(),k.current=null)}function Le(L){ve(L,Me)}function K(L){ee()!=="sloppy"||!k.current||F(L)||(k.current.dismissOnTouchEnd&&ne(L),M.clear(),k.current=null)}function J(L){ve(L,K)}const ue=ut(r&&ut(Ce(G,"keydown",A),Ce(G,"compositionstart",V),Ce(G,"compositionend",H)),b&&ut(Ce(G,"click",Ae,!0),Ce(G,"pointerdown",Ae,!0),Ce(G,"pointerup",xe,!0),Ce(G,"pointercancel",xe,!0),Ce(G,"mousedown",Ae,!0),Ce(G,"mouseup",xe,!0),Ce(G,"touchstart",Oe,{capture:!0,passive:!0}),Ce(G,"touchmove",Le,{capture:!0,passive:!0}),Ce(G,"touchend",J,{capture:!0,passive:!0})));return()=>{ue(),B.clear(),oe(),S.current=!1}},[f,u,r,b,g,l,n,x,C,A,N,v,I,F,m,e,M,D]);const ae=y.useMemo(()=>({onKeyDown:A,onPointerDown:U,onClick:U}),[A,U]),re=y.useMemo(()=>({onKeyDown:A,onPointerDown:z,onMouseDown:z,onClickCapture:j,onMouseDownCapture(B){j(),q(B)},onPointerDownCapture(B){j(),q(B)},onMouseUpCapture:j,onTouchEndCapture:j,onTouchMoveCapture:j}),[A,j,q,z]);return y.useMemo(()=>n?{reference:ae,floating:re,trigger:ae}:{},[n,ae,re])}function $n(e,t,n,r){return{left:e,top:t,right:n,bottom:r,x:e,y:t,width:n-e,height:r-t}}function Hd(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function lc(e){const t=[];let n,r=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const c of Array.from(e).sort((a,l)=>a.top-l.top)){if(r=Math.min(r,c.left),o=Math.min(o,c.top),s=Math.max(s,c.right),i=Math.max(i,c.bottom),!n||c.top-n.top>n.height/2)t.push(Hd(c));else{const a=t[t.length-1];a.left=Math.min(a.left,c.left),a.right=Math.max(a.right,c.right),a.bottom=Math.max(a.bottom,c.bottom),a.width=a.right-a.left,a.height=a.bottom-a.top}n=c}return{lines:t,fallback:$n(r,o,s,i)}}function uc(e,t,n){return e.findIndex(r=>t>r.left-2&&t<r.right+2&&n>r.top-2&&n<r.bottom+2)}function xs(e){return $n(e.left,e.top,e.right,e.bottom)}function $d(e,t,n){const{lines:r}=lc(e.getClientRects());if(r.length<2)return;const o=uc(r,t,n);return{x:t,y:n,lineIndex:o===-1?void 0:o,element:e}}function Ud(e,t,n){const{lines:r,fallback:o}=lc(e.getClientRects());if(r.length<2)return null;const s=n==null?void 0:n.x,i=n==null?void 0:n.y,c=t[0];if((n==null?void 0:n.lineIndex)!=null&&r[n.lineIndex])return xs(r[n.lineIndex]);if(s!=null&&i!=null){const d=uc(r,s,i);if(d!==-1)return xs(r[d])}if(r.length===2&&r[0].left>r[1].right&&s!=null&&i!=null)return o;if(c==="t"||c==="b"){const d=r[0],g=r[r.length-1],b=c==="t"?d:g;return $n(b.left,d.top,b.right,g.bottom)}const a=c==="l";let l=r[0].left,u=r[0].right,f=a?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY,h=r[0],m=r[0];for(const d of r){l=Math.min(l,d.left),u=Math.max(u,d.right);const g=a?d.left:d.right;a&&g<f||!a&&g>f?(f=g,h=d,m=d):g===f&&(m=d)}return $n(l,h.top,u,m.bottom)}function Wd(e){return"contextElement"in e&&e.contextElement?e.contextElement:ge(e)?e:void 0}function qd(e,t){function n(o){fc(e,o.currentTarget,o.clientX,o.clientY)}function r(o){t||n(o)}return{onFocus(){e.current=void 0},onMouseEnter:r,onMouseMove:r}}function fc(e,t,n,r){const o=$d(t,n,r);return e.current=o,o}function zd(e){return{name:"inline",async fn(t){const n=t.elements.reference;if(typeof(n==null?void 0:n.getClientRects)!="function")return{};const r=Wd(n),o=e.current,s=(o==null?void 0:o.element)===n||(o==null?void 0:o.element)===r?o:void 0,i=Ud(n,t.placement,s);if(!i||typeof t.platform.getElementRects!="function")return{};const c=await t.platform.getElementRects({reference:{contextElement:r,getBoundingClientRect(){return i}},floating:t.elements.floating,strategy:t.strategy});return t.rects.reference.x===c.reference.x&&t.rects.reference.y===c.reference.y&&t.rects.reference.width===c.reference.width&&t.rects.reference.height===c.reference.height?{}:{reset:{rects:c}}}}}class Gd{constructor(t,n,r=!0){ce(this,"attachedStores",[]);ce(this,"attachedStoreValue",null);ce(this,"storeListeners",new Set);this.fallbackStore=t,this.componentName=n,this.throwOnMissingTrigger=r}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(t){return this.storeListeners.add(t),()=>{this.storeListeners.delete(t)}}attachStore(t){if(this.attachedStores.push(t),this.setActiveStore(t),process.env.NODE_ENV!=="production"&&this.attachedStores.length>1){const n=this;(n.overlapWarningFrame??(n.overlapWarningFrame=Fe.create())).request(()=>{this.attachedStores.length>1&&console.warn("Base UI: A handle is attached to more than one mounted root at the same time. The most recently mounted root takes over and the previous one stops being controlled by the handle. A handle should be used by a single root that stays mounted for the lifetime of the handle.")})}return()=>{const n=this.attachedStores.lastIndexOf(t);n!==-1&&this.attachedStores.splice(n,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(t){this.attachedStoreValue!==t&&(this.attachedStoreValue=t,this.storeListeners.forEach(n=>{n()}))}openByTrigger(t){const n=this.attachedStore;if(n===null){process.env.NODE_ENV!=="production"&&console.warn(`Base UI: ${this.componentName}Handle.open() was called while no root using this handle is mounted. The call was ignored; mount a root with this handle before opening it imperatively.`);return}let r;if(t){for(let o=this.attachedStores.length-1;o>=0&&!r;o-=1)r=this.attachedStores[o].context.triggerElements.getById(t);r??(r=this.fallbackStore.context.triggerElements.getById(t))}if(t&&!r){if(this.throwOnMissingTrigger)throw new Error(process.env.NODE_ENV!=="production"?`Base UI: ${this.componentName}Handle.open() was called with the trigger id "${t}", but no matching trigger is registered with this handle. An anchored popup cannot open without a trigger to anchor to. Pass the id of a mounted ${this.componentName}.Trigger that has this handle set on its "handle" prop.`:Rt(99,this.componentName,t,this.componentName));process.env.NODE_ENV!=="production"&&console.warn(`Base UI: ${this.componentName}Handle.open: No trigger found with id "${t}". The popup will open, but the trigger will not be associated with it.`)}n.setOpen(!0,ke(Pr,void 0,r))}closePopup(){const t=this.attachedStore;if(t===null){process.env.NODE_ENV!=="production"&&console.warn(`Base UI: ${this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`);return}t.setOpen(!1,ke(Pr))}}function Kd(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:o,nested:s,onOpenChange:i}=e,c=t.useState("open"),a=t.useState("activeTriggerElement"),l=t.useState(n?"popupElement":"positionerElement"),u=i;return t.useSyncedValue("floatingId",o),he(()=>{const f={open:c,floatingId:o,referenceElement:a,floatingElement:l};ge(a)&&(f.domReferenceElement=a),r.state.positionReference===r.state.referenceElement&&(f.positionReference=a),r.update(f)},[c,o,a,l,r]),r.context.onOpenChange=u,r.context.nested=s,r}function Yd(e){const{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:o,onUnmount:s,animateInitialOpen:i}=e,c=fe(o),{mounted:a,setMounted:l,transitionStatus:u}=wi(t,!1,!1,i),f=t?!1:r;he(()=>{t&&c(!1)},[t,c]);const h=y.useRef(a),m=y.useRef(!1),d=vi(),g=()=>{h.current=!1,l(!1),s()};he(()=>{h.current=a,m.current&&(m.current=!1,!t&&a&&g())});const b=fe(()=>{if(h.current){if(t){m.current=!0,d();return}g()}});return fo({enabled:a&&!t&&!f,open:t,ref:n,onComplete(){t||b()}}),{mounted:a,transitionStatus:u,preventUnmountingOnClose:f,forceUnmount:b}}const Xd={tabIndex:-1,[$f]:""};function Qd(e,t=!1){const n=Kn(),r=nr()!=null,o=Ze(()=>e(n,r)).current;return Kd({popupStore:o,treatPopupAsFloatingElement:t,floatingRootContext:o.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:o.setOpen}),o}function Jd({handle:e,store:t}){return he(()=>e.attachStore(t),[e,t]),null}function ws(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function Zd(e,t){const n=y.useRef(null);return fe(r=>{const o=n.current;if(o!==null){if(o.element===r&&o.store===t&&o.id===e)return;n.current=null;const s=o.store;s.context.triggerElements.getById(o.id)===o.element&&(s.context.triggerElements.delete(o.id),ws(s))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),ws(t))})}function ep(e,t,n,r=!1){let o=e.preventUnmountingOnClose;t?o=!1:r&&(o=!0);const s=(n==null?void 0:n.id)??null;let i=e.activeTriggerId,c=e.activeTriggerElement;return(s||t)&&(i=s,c=n??null),{open:t,preventUnmountingOnClose:o,activeTriggerId:i,activeTriggerElement:c,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function tp(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function np(e,t,n,r={}){var u,f,h;const o=n.reason,s=o===Ye,i=t&&o===On,c=!t&&(o===Yn||o===ro),a=tp(n);if((f=(u=e.context).onOpenChange)==null||f.call(u,t,n),n.isCanceled)return;(h=r.onBeforeDispatch)==null||h.call(r),e.state.floatingRootContext.dispatchOpenChange(t,n);const l=()=>{const m=ep(e.state,t,n.trigger,a()),d={...r.extraState,...m};i?d.instantType="focus":c?d.instantType="dismiss":s&&(d.instantType=void 0),e.update(d)};s?ht.flushSync(l):l()}function rp(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=Zd(e,n),i=fe(a=>{const l=n.select("open"),u=n.select("activeTriggerId");if(u===e){const f={activeTriggerElement:a,...l?r:null};n.update(f);return}if(u==null&&l&&!n.state.openedWithoutTrigger){const f={activeTriggerId:e??null,activeTriggerElement:a,...r};n.update(f)}}),c=fe(a=>{s(a),a&&i(a)});return he(()=>(c(t.current),()=>c(null)),[c,t,n,e]),he(()=>{if(o){const a={activeTriggerElement:t.current,...r};n.update(a)}},[o,n,t,...Object.values(r)]),{registerTrigger:c,isMountedByThisTrigger:o}}function op(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=y.useRef(null),o=e.useState("open"),s=e.useState("triggerCount"),i=e.useState("activeTriggerId"),c=e.useState("activeTriggerElement");he(()=>{if(!o){r.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0),e.state.openedWithoutTrigger&&e.set("openedWithoutTrigger",!1);return}const a=e.context.triggerElements.size,l={};e.state.triggerCount!==a&&(l.triggerCount=a);const u=e.select("activeTriggerId");let f=null;if(u){const h=e.context.triggerElements.getById(u);if(h)r.current=u,h!==e.state.activeTriggerElement&&(l.activeTriggerElement=h);else{for(const[m,d]of e.context.triggerElements.entries())if(d===e.state.activeTriggerElement){l.activeTriggerId=m,l.activeTriggerElement=d,r.current=m;break}l.activeTriggerId===void 0&&(r.current===u?f=u:r.current=null)}}else r.current=null;if(!f&&!u&&!e.state.openedWithoutTrigger&&a===1){const h=e.context.triggerElements.entries().next();if(!h.done){const[m,d]=h.value;l.activeTriggerId=m,l.activeTriggerElement=d,r.current=m}}(l.triggerCount!==void 0||l.activeTriggerId!==void 0||l.activeTriggerElement!==void 0)&&e.update(l),f&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===f&&!e.context.triggerElements.getById(f)){const h=ke(xi);e.setOpen(!1,h),h.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,s,i,c,n])}function sp(e,t,n,r){const{mounted:o,transitionStatus:s,forceUnmount:i}=Yd({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState("preventUnmountingOnClose"),setPreventUnmountOnClose:c=>t.set("preventUnmountingOnClose",c),animateInitialOpen:r,onUnmount(){var c,a;t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n==null||n(),(a=(c=t.context).onOpenChangeComplete)==null||a.call(c,!1)}});return Ze(()=>(t.set("mounted",o),null)),t.useSyncedValues({mounted:o,transitionStatus:s}),{forceUnmount:i,transitionStatus:s}}function ip(e,t){e.useSyncedValues(t),he(()=>()=>{e.update({activeTriggerProps:Ve,inactiveTriggerProps:Ve,popupProps:Ve})},[e])}let kt;function cp(e){kt??(kt=new WeakMap);let t=kt.get(e);return t||(t=new WeakMap,kt.set(e,t)),t}class dc{constructor(){ce(this,"idMap",new Map)}add(t,n){if(process.env.NODE_ENV!=="production"){const r=cp(this),o=r.get(n);if(o!==void 0&&o!==t)throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.");const s=this.idMap.get(t);s!==void 0&&s!==n&&r.delete(s),r.set(n,t)}this.idMap.set(t,n)}delete(t){var n;if(process.env.NODE_ENV!=="production"){const r=this.idMap.get(t);r!==void 0&&((n=kt==null?void 0:kt.get(this))==null||n.delete(r))}this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}var wn={exports:{}},br={};/**
|
|
180
180
|
* @license React
|
|
181
181
|
* use-sync-external-store-shim.production.js
|
|
182
182
|
*
|
|
@@ -184,7 +184,7 @@ Feel free to ask a question or select one of the suggested topics below!`;functi
|
|
|
184
184
|
*
|
|
185
185
|
* This source code is licensed under the MIT license found in the
|
|
186
186
|
* LICENSE file in the root directory of this source tree.
|
|
187
|
-
*/var
|
|
187
|
+
*/var Cs;function ap(){if(Cs)return br;Cs=1;var e=O;function t(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function c(f,h){var m=h(),d=r({inst:{value:m,getSnapshot:h}}),g=d[0].inst,b=d[1];return s(function(){g.value=m,g.getSnapshot=h,a(g)&&b({inst:g})},[f,m,h]),o(function(){return a(g)&&b({inst:g}),f(function(){a(g)&&b({inst:g})})},[f]),i(m),m}function a(f){var h=f.getSnapshot;f=f.value;try{var m=h();return!n(f,m)}catch{return!0}}function l(f,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:c;return br.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,br}var vr={};/**
|
|
188
188
|
* @license React
|
|
189
189
|
* use-sync-external-store-shim.development.js
|
|
190
190
|
*
|
|
@@ -192,7 +192,7 @@ Feel free to ask a question or select one of the suggested topics below!`;functi
|
|
|
192
192
|
*
|
|
193
193
|
* This source code is licensed under the MIT license found in the
|
|
194
194
|
* LICENSE file in the root directory of this source tree.
|
|
195
|
-
*/var
|
|
195
|
+
*/var Ss;function lp(){return Ss||(Ss=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,d){return m===d&&(m!==0||1/m===1/d)||m!==m&&d!==d}function t(m,d){u||o.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var g=d();if(!f){var b=d();s(g,b)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}b=i({inst:{value:g,getSnapshot:d}});var v=b[0].inst,x=b[1];return a(function(){v.value=g,v.getSnapshot=d,n(v)&&x({inst:v})},[m,g,d]),c(function(){return n(v)&&x({inst:v}),m(function(){n(v)&&x({inst:v})})},[m]),l(g),g}function n(m){var d=m.getSnapshot;m=m.value;try{var g=d();return!s(m,g)}catch{return!0}}function r(m,d){return d()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=O,s=typeof Object.is=="function"?Object.is:e,i=o.useState,c=o.useEffect,a=o.useLayoutEffect,l=o.useDebugValue,u=!1,f=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;vr.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),vr}var Es;function Po(){return Es||(Es=1,process.env.NODE_ENV==="production"?wn.exports=ap():wn.exports=lp()),wn.exports}var ko=Po(),Cn={exports:{}},yr={};/**
|
|
196
196
|
* @license React
|
|
197
197
|
* use-sync-external-store-shim/with-selector.production.js
|
|
198
198
|
*
|
|
@@ -200,7 +200,7 @@ Feel free to ask a question or select one of the suggested topics below!`;functi
|
|
|
200
200
|
*
|
|
201
201
|
* This source code is licensed under the MIT license found in the
|
|
202
202
|
* LICENSE file in the root directory of this source tree.
|
|
203
|
-
*/var
|
|
203
|
+
*/var Rs;function up(){if(Rs)return yr;Rs=1;var e=O,t=Po();function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,c=e.useMemo,a=e.useDebugValue;return yr.useSyncExternalStoreWithSelector=function(l,u,f,h,m){var d=s(null);if(d.current===null){var g={hasValue:!1,value:null};d.current=g}else g=d.current;d=c(function(){function v(S){if(!x){if(x=!0,C=S,S=h(S),m!==void 0&&g.hasValue){var R=g.value;if(m(R,S))return w=R}return w=S}if(R=w,r(C,S))return R;var T=h(S);return m!==void 0&&m(R,T)?(C=S,R):(C=S,w=T)}var x=!1,C,w,E=f===void 0?null:f;return[function(){return v(u())},E===null?void 0:function(){return v(E())}]},[u,f,h,m]);var b=o(l,d[0],d[1]);return i(function(){g.hasValue=!0,g.value=b},[b]),a(b),b},yr}var xr={};/**
|
|
204
204
|
* @license React
|
|
205
205
|
* use-sync-external-store-shim/with-selector.development.js
|
|
206
206
|
*
|
|
@@ -208,8 +208,8 @@ Feel free to ask a question or select one of the suggested topics below!`;functi
|
|
|
208
208
|
*
|
|
209
209
|
* This source code is licensed under the MIT license found in the
|
|
210
210
|
* LICENSE file in the root directory of this source tree.
|
|
211
|
-
*/var Cs;function cp(){return Cs||(Cs=1,process.env.NODE_ENV!=="production"&&(function(){function e(l,f){return l===f&&(l!==0||1/l===1/f)||l!==l&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=I,n=Po(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,c=t.useMemo,a=t.useDebugValue;yr.useSyncExternalStoreWithSelector=function(l,f,u,h,g){var d=s(null);if(d.current===null){var m={hasValue:!1,value:null};d.current=m}else m=d.current;d=c(function(){function v(w){if(!x){if(x=!0,S=w,w=h(w),g!==void 0&&m.hasValue){var R=m.value;if(g(R,w))return E=R}return E=w}if(R=E,r(S,w))return R;var P=h(w);return g!==void 0&&g(R,P)?(S=w,R):(S=w,E=P)}var x=!1,S,E,C=u===void 0?null:u;return[function(){return v(f())},C===null?void 0:function(){return v(C())}]},[f,u,h,g]);var b=o(l,d[0],d[1]);return i(function(){m.hasValue=!0,m.value=b},[b]),a(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),yr}var Rs;function ap(){return Rs||(Rs=1,process.env.NODE_ENV==="production"?En.exports=ip():En.exports=cp()),En.exports}var lp=ap();const up=ci(19),fp=up?pp:hp;function fc(e,t,n,r,o){return fp(e,t,n,r,o)}function dp(e,t,n,r,o){const s=y.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return Oo.useSyncExternalStore(e.subscribe,s,s)}Cf({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const r=e.syncHooks[n],o=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,o)||(t=!0,r.value=o)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const o of e.syncHooks)n.add(o.store);const r=[];for(const o of n)r.push(o.subscribe(t));return()=>{for(const o of r)o()}}),Oo.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function pp(e,t,n,r,o){const s=wf();if(!s)return dp(e,t,n,r,o);const i=s.syncIndex;s.syncIndex+=1;let c;return s.didInitialize?(c=s.syncHooks[i],(c.store!==e||c.selector!==t||!Object.is(c.a1,n)||!Object.is(c.a2,r)||!Object.is(c.a3,o))&&(c.store!==e&&(s.didChangeStore=!0),c.store=e,c.selector=t,c.a1=n,c.a2=r,c.a3=o,c.value=t(e.getSnapshot(),n,r,o))):(c={store:e,selector:t,a1:n,a2:r,a3:o,value:t(e.getSnapshot(),n,r,o)},s.syncHooks.push(c)),c.value}function hp(e,t,n,r,o){return lp.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class gp{constructor(t){ae(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));ae(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}static create(t){return new this(t)}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,o){return fc(this,t,n,r,o)}}class Io extends gp{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){y.useDebugValue(t);const r=this;pe(()=>{r.state[t]!==n&&r.set(t,n)},[r,t,n])}useSyncedValueWithCleanup(t,n){const r=this;pe(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this;if(process.env.NODE_ENV!=="production"){y.useDebugValue(t,i=>Object.keys(i));const o=y.useRef(Object.keys(t)).current,s=Object.keys(t);(o.length!==s.length||o.some((i,c)=>i!==s[c]))&&console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.")}const r=Object.values(t);pe(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){y.useDebugValue(t);const r=this,o=n!==void 0;if(pe(()=>{o&&!Object.is(r.state[t],n)&&r.setState({...r.state,[t]:n})},[r,t,n,o]),process.env.NODE_ENV!=="production"){const s=this.controlledValues??(this.controlledValues=new Map);s.has(t)||s.set(t,o);const i=s.get(t);i!==void 0&&i!==o&&console.error(`A component is changing the ${i?"":"un"}controlled state of ${t.toString()} to be ${i?"un":""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`)}}select(t,n,r,o){const s=this.selectors[t];return s(this.state,n,r,o)}useState(t,n,r,o){return y.useDebugValue(t),fc(this,this.selectors[t],n,r,o)}useContextCallback(t,n){y.useDebugValue(t);const r=fe(n??eo);this.context[t]=r}useStateSetter(t){const n=y.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const c=o;o=i,n(i,c,this)}})}}const mp={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class bp extends Io{constructor(n){const{syncOnly:r,nested:o,onOpenChange:s,triggerElements:i,...c}=n;super({...c,positionReference:c.referenceElement,domReferenceElement:c.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:ic(),nested:o,triggerElements:i},mp);ae(this,"syncOpenEvent",(n,r)=>{(!n||!this.state.open||r!=null&&Ff(r))&&(this.context.dataRef.current.openEvent=n?r:void 0)});ae(this,"dispatchOpenChange",(n,r)=>{this.syncOpenEvent(n,r.event);const o={open:n,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",o)});ae(this,"setOpen",(n,r)=>{var o,s,i,c;if(this.syncOnly){(s=(o=this.context).onOpenChange)==null||s.call(o,n,r);return}this.dispatchOpenChange(n,r),(c=(i=this.context).onOpenChange)==null||c.call(i,n,r)});this.syncOnly=r}}function vp(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new bp({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Fe,inactiveTriggerProps:Fe,popupProps:Fe}}const qt=e=>e.triggerIdProp??e.activeTriggerId,Hn=e=>e.openProp??e.open,Ts=e=>{var n;return(((n=e.popupElement)==null?void 0:n.id)??e.floatingId)||void 0};function dc(e,t){return t!==void 0&&Hn(e)&&qt(e)===t}function yp(e,t){return dc(e,t)?!0:t!==void 0&&Hn(e)&&qt(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}const xp={open:Hn,mounted:e=>e.mounted,transitionStatus:e=>Hn(e)&&!e.mounted?"starting":e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:qt,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Ts,isTriggerActive:(e,t)=>t!==void 0&&qt(e)===t,isOpenedByTrigger:(e,t)=>dc(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&qt(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>yp(e,t)?Ts(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Ep(e){const t=y.useCallback(r=>e===void 0?eo:e.subscribeStore(r),[e]),n=y.useCallback(()=>e===void 0?void 0:e.store,[e]);return Oo.useSyncExternalStore(t,n,()=>e==null?void 0:e.serverStore)}const xr=Gi&&on;function Sp(e,t={}){const{enabled:n=!0,delay:r}=t,{events:o,dataRef:s}=e.context,i=y.useRef(!1),c=y.useRef(null),a=y.useRef(!0),l=zt();y.useEffect(()=>{const u=e.select("domReferenceElement");if(!n)return;const h=Ie(u);function g(){const b=e.select("domReferenceElement");!e.select("open")&&_e(b)&&b===Br(Ke(b))&&(i.current=!0,c.current=b)}function d(){a.current=!0}function m(){a.current=!1}return at(Ee(h,"blur",g),xr&&Ee(h,"keydown",d,!0),xr&&Ee(h,"pointerdown",m,!0))},[e,n]),y.useEffect(()=>{if(!n)return;function u(h){if(h.reason===Kn||h.reason===no){const g=e.select("domReferenceElement");me(g)&&(c.current=g,i.current=!0)}}return o.on("openchange",u),()=>{o.off("openchange",u)}},[o,n,e]);const f=y.useMemo(()=>{function u(){i.current=!1,c.current=null}return{onMouseLeave(){u()},onFocus(h){const g=h.currentTarget;if(i.current){if(c.current===g)return;u()}const d=vt(h.nativeEvent);if(me(d)){if(xr&&!h.relatedTarget){if(!a.current&&!Xf(d))return}else if(!Zf(d))return}const m=Fn(h.relatedTarget,e.context.triggerElements),{nativeEvent:b,currentTarget:v}=h;if(e.select("open")&&m||!r){e.setOpen(!0,Pe(Pn,b,v));return}l.start(r,()=>{i.current||e.setOpen(!0,Pe(Pn,b,v))})},onBlur(h){u();const g=h.relatedTarget,d=h.nativeEvent,m=me(g)&&g.hasAttribute(wo("focus-guard"))&&g.getAttribute("data-type")==="outside";l.start(0,()=>{var S;const b=e.select("domReferenceElement"),v=Br(Ke(b));!g&&v===b||Te((S=s.current.floatingContext)==null?void 0:S.refs.floating.current,v)||Te(b,v)||m||Fn(g??v,e.context.triggerElements)||e.setOpen(!1,Pe(Pn,d))})}}},[s,r,e,l]);return y.useMemo(()=>n?{reference:f,trigger:f}:{},[n,f])}class _o{constructor(){ae(this,"pointerType");ae(this,"interactedInside",!1);ae(this,"handler");ae(this,"blockMouseMove",!0);ae(this,"performedPointerEventsMutation",!1);ae(this,"pointerEventsScopeElement",null);ae(this,"pointerEventsReferenceElement",null);ae(this,"pointerEventsFloatingElement",null);ae(this,"restTimeoutPending",!1);ae(this,"openChangeTimeout",new ut);ae(this,"restTimeout",new ut);ae(this,"handleCloseOptions");ae(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});ae(this,"disposeEffect",()=>this.dispose)}static create(){return new _o}}const Un=new WeakMap;function zn(e){var n,r,o;if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Un.get(t)===e&&((n=e.pointerEventsScopeElement)==null||n.style.removeProperty("pointer-events"),(r=e.pointerEventsReferenceElement)==null||r.style.removeProperty("pointer-events"),(o=e.pointerEventsFloatingElement)==null||o.style.removeProperty("pointer-events"),Un.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function pc(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t,s=Un.get(n);s&&s!==e&&zn(s),zn(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,Un.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function hc(e){const t=e.context.dataRef.current,n=Ye(()=>t.hoverInteractionState??_o.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),ro(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function wp(e,t={}){const{enabled:n=!0,closeDelay:r=0,nodeId:o}=t,s=e.useState("open"),i=e.useState("floatingElement"),c=e.useState("domReferenceElement"),{dataRef:a}=e.context,l=sn(),f=tr(),u=hc(e),h=zt(),g=fe(()=>{var b;return Xi((b=a.current.openEvent)==null?void 0:b.type,u.interactedInside)}),d=fe(()=>{var b;return ed((b=a.current.openEvent)==null?void 0:b.type)}),m=fe(()=>{zn(u)});pe(()=>{s||(u.pointerType=void 0,u.restTimeoutPending=!1,u.interactedInside=!1,m())},[s,u,m]),y.useEffect(()=>m,[m]),pe(()=>{var b,v,x,S,E;if(n&&s&&(b=u.handleCloseOptions)!=null&&b.blockPointerEvents&&d()&&me(c)&&i){const C=c,w=i,R=Ke(i),P=(x=(v=l==null?void 0:l.nodesRef.current.find(A=>A.id===f))==null?void 0:v.context)==null?void 0:x.elements.floating;P&&(P.style.pointerEvents="");const O=u.pointerEventsScopeElement!==w?u.pointerEventsScopeElement:null,M=P!==w?P:null,F=((E=(S=u.handleCloseOptions)==null?void 0:S.getScope)==null?void 0:E.call(S))??O??M??Vr(C,"[data-rootownerid]")??R.body;return pc(u,{scopeElement:F,referenceElement:C,floatingElement:w}),()=>{m()}}},[n,s,c,i,u,d,l,f,m]),y.useEffect(()=>{if(!n)return;function b(){return!!(l&&f&&Dt(l.nodesRef.current,f).length>0)}function v(R){const P=$r(r,"close",u.pointerType),O=()=>{e.setOpen(!1,Pe(We,R)),l==null||l.events.emit("floating.closed",R)};P?u.openChangeTimeout.start(P,O):(u.openChangeTimeout.clear(),O())}function x(R){const P=vt(R);if(!Jf(P)){u.interactedInside=!1;return}u.interactedInside=Vr(P,"[aria-haspopup]")!=null}function S(){u.openChangeTimeout.clear(),h.clear(),l==null||l.events.off("floating.closed",C),m()}function E(R){var F;if(b()&&l){l.events.on("floating.closed",C);return}if(Fn(R.relatedTarget,e.context.triggerElements))return;const P=((F=a.current.floatingContext)==null?void 0:F.nodeId)??o,O=R.relatedTarget;if(!(l&&P&&me(O)&&Dt(l.nodesRef.current,P,!1).some(A=>{var D;return Te((D=A.context)==null?void 0:D.elements.floating,O)}))){if(u.handler){u.handler(R);return}m(),d()&&!g()&&v(R)}}function C(R){!l||!f||b()||h.start(0,()=>{l.events.off("floating.closed",C),e.setOpen(!1,Pe(We,R)),l.events.emit("floating.closed",R)})}const w=i;return at(w&&Ee(w,"mouseenter",S),w&&Ee(w,"mouseleave",E),w&&Ee(w,"pointerdown",x,!0),()=>{l==null||l.events.off("floating.closed",C)})},[n,i,e,a,r,o,d,g,m,u,l,f,h])}const Cp={current:null};function Rp(e,t={}){const{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:s=!1,restMs:i=0,move:c=!0,triggerElementRef:a=Cp,externalTree:l,isActiveTrigger:f=!0,getHandleCloseContext:u,isClosing:h,shouldOpen:g,guardStaleOpen:d=!1}=t,{dataRef:m,events:b}=e.context,v=sn(l),x=hc(e),S=y.useRef(!1),E=qe(o),C=qe(r),w=qe(i),R=qe(n),P=qe(g),O=qe(h),M=fe(()=>{var T;return Xi((T=m.current.openEvent)==null?void 0:T.type,x.interactedInside)}),F=fe(()=>{var T;return((T=P.current)==null?void 0:T.call(P))!==!1}),A=fe((T,k,U)=>{const j=e.context.triggerElements;if(j.hasElement(k))return!T||!Te(T,k);if(!me(U))return!1;const N=U;return j.hasMatchingElement(Y=>Te(Y,N))&&(!T||!Te(T,N))}),D=fe(()=>{if(!x.handler)return;Ke(e.select("domReferenceElement")).removeEventListener("mousemove",x.handler),x.handler=void 0}),_=fe(()=>{zn(x)});return f&&(x.handleCloseOptions=o==null?void 0:o.__options),y.useEffect(()=>D,[D]),y.useEffect(()=>{if(!n)return;function T(k){k.open?S.current=!1:(S.current=k.reason===We,D(),x.openChangeTimeout.clear(),x.restTimeout.clear(),x.blockMouseMove=!0,x.restTimeoutPending=!1)}return b.on("openchange",T),()=>{b.off("openchange",T)}},[n,b,x,D]),y.useEffect(()=>{if(!n)return;function T(K,le=!0){const ie=$r(C.current,"close",x.pointerType);ie?x.openChangeTimeout.start(ie,()=>{e.setOpen(!1,Pe(We,K)),v==null||v.events.emit("floating.closed",K)}):le&&(x.openChangeTimeout.clear(),e.setOpen(!1,Pe(We,K)),v==null||v.events.emit("floating.closed",K))}const k=a.current??(f?e.select("domReferenceElement"):null);if(!me(k))return;function U(K){var z;if(x.openChangeTimeout.clear(),x.blockMouseMove=!1,s&&!Lr(x.pointerType))return;const le=hs(w.current),ie=$r(C.current,"open",x.pointerType),L=vt(K),X=K.currentTarget??null,B=e.select("domReferenceElement");let $=X;if(me(L)&&!e.context.triggerElements.hasElement(L)){for(const J of e.context.triggerElements.elements())if(Te(J,L)){$=J;break}}me(X)&&me(B)&&!e.context.triggerElements.hasElement(X)&&Te(X,B)&&($=B);const Q=$==null?!1:A(B,$,L),re=e.select("open"),ee=((z=O.current)==null?void 0:z.call(O))??e.select("transitionStatus")==="ending",te=!re&&ee&&S.current,W=!Q&&me($)&&me(B)&&Te(B,$)&&te,ne=le>0&&!ie,oe=Q&&(re||te)||W,ve=!re||Q;if(oe){F()&&e.setOpen(!0,Pe(We,K,$));return}ne||(ie?x.openChangeTimeout.start(ie,()=>{ve&&F()&&e.setOpen(!0,Pe(We,K,$))}):ve&&F()&&e.setOpen(!0,Pe(We,K,$)))}function j(K){if(M()){_();return}D();const le=e.select("domReferenceElement"),ie=Ke(le);x.restTimeout.clear(),x.restTimeoutPending=!1;const L=m.current.floatingContext??(u==null?void 0:u());if(Fn(K.relatedTarget,e.context.triggerElements))return;if(E.current&&L){e.select("open")||x.openChangeTimeout.clear();const B=a.current;x.handler=E.current({...L,tree:v,x:K.clientX,y:K.clientY,onClose(){_(),D(),R.current&&!M()&&B===e.select("domReferenceElement")&&T(K,!0)}}),ie.addEventListener("mousemove",x.handler),x.handler(K);return}(x.pointerType==="touch"?!Te(e.select("floatingElement"),K.relatedTarget):!0)&&T(K)}function N(K){Te(k,K.relatedTarget)||(x.openChangeTimeout.clear(),x.restTimeout.clear(),x.restTimeoutPending=!1)}const Y=d?Ee(k,"mouseout",N):void 0;return c?at(Ee(k,"mousemove",U,{once:!0}),Ee(k,"mouseenter",U),Ee(k,"mouseleave",j),Y):at(Ee(k,"mouseenter",U),Ee(k,"mouseleave",j),Y)},[D,_,m,C,e,n,E,x,f,A,M,s,c,w,a,v,R,u,O,F,d]),y.useMemo(()=>{if(!n)return;function T(k){x.pointerType=k.pointerType}return{onPointerDown:T,onPointerEnter:T,onMouseMove(k){var L,X,B;const{nativeEvent:U}=k,j=k.currentTarget,N=e.select("domReferenceElement"),Y=e.select("open"),K=A(N,j,k.target);if(s&&!Lr(x.pointerType))return;if(Y&&K&&((L=x.handleCloseOptions)!=null&&L.blockPointerEvents)){const $=e.select("floatingElement");if($){const Q=((B=(X=x.handleCloseOptions)==null?void 0:X.getScope)==null?void 0:B.call(X))??j.ownerDocument.body;pc(x,{scopeElement:Q,referenceElement:j,floatingElement:$})}}const le=hs(w.current);if(Y&&!K||le===0||!K&&x.restTimeoutPending&&k.movementX**2+k.movementY**2<2)return;x.restTimeout.clear();function ie(){if(x.restTimeoutPending=!1,M())return;const $=e.select("open");!x.blockMouseMove&&(!$||K)&&F()&&e.setOpen(!0,Pe(We,U,j))}x.pointerType==="touch"?dt.flushSync(()=>{ie()}):K&&Y?ie():(x.restTimeoutPending=!0,x.restTimeout.start(le,ie))}}},[n,x,M,A,s,e,w,F])}const Ps=.1,Tp=Ps*Ps,xe=.5;function Sn(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function wn(e,t,n,r,o,s,i,c,a,l){let f=!1;return Sn(e,t,n,r,o,s)&&(f=!f),Sn(e,t,o,s,i,c)&&(f=!f),Sn(e,t,i,c,a,l)&&(f=!f),Sn(e,t,a,l,n,r)&&(f=!f),f}function Pp(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Cn(e,t,n,r,o,s){const i=Math.min(n,o),c=Math.max(n,o),a=Math.min(r,s),l=Math.max(r,s);return e>=i&&e<=c&&t>=a&&t<=l}function Op(e={}){const{blockPointerEvents:t=!1}=e,n=new ut,r=({x:o,y:s,placement:i,elements:c,onClose:a,nodeId:l,tree:f})=>{const u=i==null?void 0:i.split("-")[0];let h=!1,g=null,d=null,m=typeof performance<"u"?performance.now():0;function b(x,S){const E=performance.now(),C=E-m;if(g===null||d===null||C===0)return g=x,d=S,m=E,!1;const w=x-g,R=S-d,P=w*w+R*R,O=C*C*Tp;return g=x,d=S,m=E,P<O}function v(){n.clear(),a()}return function(S){n.clear();const E=c.domReference,C=c.floating;if(!E||!C||u==null||o==null||s==null)return;const{clientX:w,clientY:R}=S,P=vt(S),O=S.type==="mouseleave",M=Te(C,P),F=Te(E,P);if(M&&(h=!0,!O))return;if(F&&(h=!1,!O)){h=!0;return}if(O&&me(S.relatedTarget)&&Te(C,S.relatedTarget))return;function A(){return!!(f&&Dt(f.nodesRef.current,l).length>0)}function D(){A()||v()}if(A())return;const _=E.getBoundingClientRect(),T=C.getBoundingClientRect(),k=o>T.right-T.width/2,U=s>T.bottom-T.height/2,j=T.width>_.width,N=T.height>_.height,Y=(j?_:T).left,K=(j?_:T).right,le=(N?_:T).top,ie=(N?_:T).bottom;if(u==="top"&&s>=_.bottom-1||u==="bottom"&&s<=_.top+1||u==="left"&&o>=_.right-1||u==="right"&&o<=_.left+1){D();return}let L=!1;switch(u){case"top":L=Cn(w,R,Y,_.top+1,K,T.bottom-1);break;case"bottom":L=Cn(w,R,Y,T.top+1,K,_.bottom-1);break;case"left":L=Cn(w,R,T.right-1,ie,_.left+1,le);break;case"right":L=Cn(w,R,_.right-1,ie,T.left+1,le);break}if(L)return;if(h&&!Pp(w,R,_)){D();return}if(!O&&b(w,R)){D();return}let X=!1;switch(u){case"top":{const B=j?xe/2:xe*4,$=j||k?o+B:o-B,Q=j?o-B:k?o+B:o-B,re=s+xe+1,ee=k||j?T.bottom-xe:T.top,te=k?j?T.bottom-xe:T.top:T.bottom-xe;X=wn(w,R,$,re,Q,re,T.left,ee,T.right,te);break}case"bottom":{const B=j?xe/2:xe*4,$=j||k?o+B:o-B,Q=j?o-B:k?o+B:o-B,re=s-xe,ee=k||j?T.top+xe:T.bottom,te=k?j?T.top+xe:T.bottom:T.top+xe;X=wn(w,R,$,re,Q,re,T.left,ee,T.right,te);break}case"left":{const B=N?xe/2:xe*4,$=N||U?s+B:s-B,Q=N?s-B:U?s+B:s-B,re=o+xe+1,ee=U||N?T.right-xe:T.left,te=U?N?T.right-xe:T.left:T.right-xe;X=wn(w,R,ee,T.top,te,T.bottom,re,$,re,Q);break}case"right":{const B=N?xe/2:xe*4,$=N||U?s+B:s-B,Q=N?s-B:U?s+B:s-B,re=o-xe,ee=U||N?T.left+xe:T.right,te=U?N?T.left+xe:T.right:T.left+xe;X=wn(w,R,re,$,re,Q,ee,T.top,te,T.bottom);break}}X?h||n.start(40,D):D()}};return r.__options={...e,blockPointerEvents:t},r}function Os(e,t,n){let{reference:r,floating:o}=e;const s=Ue(t),i=So(t),c=Eo(i),a=Ve(t),l=s==="y",f=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,h=r[c]/2-o[c]/2;let g;switch(a){case"top":g={x:f,y:r.y-o.height};break;case"bottom":g={x:f,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:u};break;case"left":g={x:r.x-o.width,y:u};break;default:g={x:r.x,y:r.y}}const d=Je(t);return d&&(g[i]+=h*(d==="end"?1:-1)*(n&&l?-1:1)),g}async function Ip(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:h=!1,padding:g=0}=ft(t,e),d=Zi(g),b=c[h?u==="floating"?"reference":"floating":u],v=Vn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:f,strategy:a})),x=u==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),E=await(s.isElement==null?void 0:s.isElement(S))&&await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1},C=Vn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:S,strategy:a}):x);return{top:(v.top-C.top+d.top)/E.y,bottom:(C.bottom-v.bottom+d.bottom)/E.y,left:(v.left-C.left+d.left)/E.x,right:(C.right-v.right+d.right)/E.x}}const _p=50,kp=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Ip},a=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:u}=Os(l,r,a),h=r,g=0;const d={};for(let m=0;m<s.length;m++){const b=s[m];if(!b)continue;const{name:v,fn:x}=b,{x:S,y:E,data:C,reset:w}=await x({x:f,y:u,initialPlacement:r,placement:h,strategy:o,middlewareData:d,rects:l,platform:c,elements:{reference:e,floating:t}});f=S??f,u=E??u,d[v]={...d[v],...C},w&&g<_p&&(g++,typeof w=="object"&&(w.placement&&(h=w.placement),w.rects&&(l=w.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):w.rects),{x:f,y:u}=Os(l,h,a)),m=-1)}return{x:f,y:u,placement:h,strategy:o,middlewareData:d}},Ap=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:l}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:m=!0,...b}=ft(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=Ve(o),x=Ue(c),S=Ve(c)===c,E=await(a.isRTL==null?void 0:a.isRTL(l.floating)),C=h||(S||!m?[Bn(c)]:sd(c)),w=d!=="none";!h&&w&&C.push(...ld(c,m,d,E));const R=[c,...C],P=await a.detectOverflow(t,b),O=[];let M=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&O.push(P[v]),u){const _=od(o,i,E);O.push(P[_[0]],P[_[1]])}if(M=[...M,{placement:o,overflows:O}],!O.every(_=>_<=0)){var F,A;const _=(((F=s.flip)==null?void 0:F.index)||0)+1,T=R[_];if(T&&(!(u==="alignment"?x!==Ue(T):!1)||M.every(j=>Ue(j.placement)===x?j.overflows[0]>0:!0)))return{data:{index:_,overflows:M},reset:{placement:T}};let k=(A=M.filter(U=>U.overflows[0]<=0).sort((U,j)=>U.overflows[1]-j.overflows[1])[0])==null?void 0:A.placement;if(!k)switch(g){case"bestFit":{var D;const U=(D=M.filter(j=>{if(w){const N=Ue(j.placement);return N===x||N==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(N=>N>0).reduce((N,Y)=>N+Y,0)]).sort((j,N)=>j[1]-N[1])[0])==null?void 0:D[0];U&&(k=U);break}case"initialPlacement":k=c;break}if(o!==k)return{reset:{placement:k}}}return{}}}},gc=new Set(["left","top"]);async function Np(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ve(n),c=Je(n),a=Ue(n)==="y",l=gc.has(i)?-1:1,f=s&&a?-1:1,u=ft(t,e);let{mainAxis:h,crossAxis:g,alignmentAxis:d}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof d=="number"&&(g=c==="end"?d*-1:d),a?{x:g*f,y:h*l}:{x:h*l,y:g*f}}const jp=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await Np(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},Mp=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:a={fn:x=>{let{x:S,y:E}=x;return{x:S,y:E}}},...l}=ft(e,t),f={x:n,y:r},u=await s.detectOverflow(t,l),h=Ue(o),g=xo(h);let d=f[g],m=f[h];const b=(x,S)=>Ji(S+u[x==="y"?"top":"left"],S,S-u[x==="y"?"bottom":"right"]);i&&(d=b(g,d)),c&&(m=b(h,m));const v=a.fn({...t,[g]:d,[h]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[g]:i,[h]:c}}}}}},Dp=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:o,y:s,placement:i,rects:c,middlewareData:a}=t,{offset:l=0,mainAxis:f=!0,crossAxis:u=!0}=ft(e,t),h={x:o,y:s},g=Ue(i),d=xo(g);let m=h[d],b=h[g];const v=ft(l,t),x=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:(n=v.mainAxis)!=null?n:0,crossAxis:(r=v.crossAxis)!=null?r:0};if(f){const C=d==="y"?"height":"width",w=c.reference[d]-c.floating[C]+x.mainAxis,R=c.reference[d]+c.reference[C]-x.mainAxis;m<w?m=w:m>R&&(m=R)}if(u){var S,E;const C=d==="y"?"width":"height",w=gc.has(Ve(i)),R=c.reference[g]-c.floating[C]+(w&&((S=a.offset)==null?void 0:S[g])||0)+(w?0:x.crossAxis),P=c.reference[g]+c.reference[C]+(w?0:((E=a.offset)==null?void 0:E[g])||0)-(w?x.crossAxis:0);b<R?b=R:b>P&&(b=P)}return{[d]:m,[g]:b}}}},Fp=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...c}=ft(e,t),a=await o.detectOverflow(t,c),l=Ve(n),f=Je(n),u=Ue(n)==="y",{width:h,height:g}=r.floating;let d,m;l==="top"||l==="bottom"?(d=l,m=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(m=l,d=f==="end"?"top":"bottom");const b=g-a.top-a.bottom,v=h-a.left-a.right,x=Mt(g-a[d],b),S=Mt(h-a[m],v),E=t.middlewareData.shift,C=!E;let w=x,R=S;E!=null&&E.enabled.x&&(R=v),E!=null&&E.enabled.y&&(w=b),C&&!f&&(u?R=h-2*nt(a.left,a.right):w=g-2*nt(a.top,a.bottom)),await i({...t,availableWidth:R,availableHeight:w});const P=await o.getDimensions(s.floating);return h!==P.width||g!==P.height?{reset:{rects:!0}}:{}}}};function mc(e){const t=$e(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=_e(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Ln(n)!==s||Ln(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function ko(e){return me(e)?e:e.contextElement}function kt(e){const t=ko(e);if(!_e(t))return rt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=mc(t);let i=(s?Ln(n.width):n.width)/r,c=(s?Ln(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Lp=rt(0);function bc(e){const t=Ie(e);return!lo()||!t.visualViewport?Lp:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Bp(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ie(e)}function St(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ko(e);let i=rt(1);t&&(r?me(r)&&(i=kt(r)):i=kt(e));const c=Bp(s,n,r)?bc(s):rt(0);let a=(o.left+c.x)/i.x,l=(o.top+c.y)/i.y,f=o.width/i.x,u=o.height/i.y;if(s&&r){const h=Ie(s),g=me(r)?Ie(r):r;let d=h,m=Ir(d);for(;m&&g!==d;){const b=kt(m),v=m.getBoundingClientRect(),x=$e(m),S=v.left+(m.clientLeft+parseFloat(x.paddingLeft))*b.x,E=v.top+(m.clientTop+parseFloat(x.paddingTop))*b.y;a*=b.x,l*=b.y,f*=b.x,u*=b.y,a+=S,l+=E,d=Ie(m),m=Ir(d)}}return Vn({width:f,height:u,x:a,y:l})}function nr(e,t){const n=Zn(e).scrollLeft;return t?t.left+n:St(ot(e)).left+n}function vc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-nr(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Vp(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=ot(r),c=t?Jn(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},l=rt(1);const f=rt(0),u=_e(r);if((u||!s)&&((Le(r)!=="body"||Xn(i))&&(a=Zn(r)),u)){const g=St(r);l=kt(r),f.x=g.x+r.clientLeft,f.y=g.y+r.clientTop}const h=i&&!u&&!s?vc(i,a):rt(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+f.x+h.x,y:n.y*l.y-a.scrollTop*l.y+f.y+h.y}}function $p(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Hp(e){const t=Zn(e),n=e.ownerDocument.body,r=nt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=nt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+nr(e);const i=-t.scrollTop;return $e(n).direction==="rtl"&&(s+=nt(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:s,y:i}}const Up=25;function zp(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=Ie(e),s=ot(e),i=o.visualViewport;let c=s.clientWidth,a=s.clientHeight,l=0,f=0;if(i){const h=!lo()||t==="fixed";r?h||(l=-i.offsetLeft,f=-i.offsetTop):(c=i.width,a=i.height,h&&(l=i.offsetLeft,f=i.offsetTop))}if(nr(s)<=0){const h=s.ownerDocument,g=h.body,d=getComputedStyle(g),m=h.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,b=Math.abs(s.clientWidth-g.clientWidth-m),v=getComputedStyle(s).scrollbarGutter==="stable both-edges"?b/2:b;v<=Up&&(c-=v)}return{width:c,height:a,x:l,y:f}}function Wp(e,t){const n=St(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=kt(e),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,l=r*s.y;return{width:i,height:c,x:a,y:l}}function Is(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=zp(e,n,t);else if(t==="document")r=Hp(ot(e));else if(me(t))r=Wp(t,n);else{const o=bc(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Vn(r)}function qp(e,t){const n=t.get(e);if(n)return n;let r=Gt(e,[],!1).filter(c=>me(c)&&Le(c)!=="body"),o=null;const s=$e(e).position==="fixed";let i=s?lt(e):e;for(;me(i)&&!ct(i);){const c=$e(i),a=ao(i),l=o?o.position:s?"fixed":"";!a&&(l==="fixed"||l==="absolute"&&c.position==="static")?r=r.filter(u=>u!==i):o=c,i=lt(i)}return t.set(e,r),r}function Gp(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Jn(t)?[]:qp(t,this._c):[].concat(n),r],c=Is(t,i[0],o);let a=c.top,l=c.right,f=c.bottom,u=c.left;for(let h=1;h<i.length;h++){const g=Is(t,i[h],o);a=nt(g.top,a),l=Mt(g.right,l),f=Mt(g.bottom,f),u=nt(g.left,u)}return{width:l-u,height:f-a,x:u,y:a}}function Kp(e){const{width:t,height:n}=mc(e);return{width:t,height:n}}function Yp(e,t,n){const r=_e(t),o=ot(t),s=n==="fixed",i=St(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=rt(0);if((r||!s)&&((Le(t)!=="body"||Xn(o))&&(c=Zn(t)),r)){const h=St(t,!0,s,t);a.x=h.x+t.clientLeft,a.y=h.y+t.clientTop}!r&&o&&(a.x=nr(o));const l=o&&!r&&!s?vc(o,c):rt(0),f=i.left+c.scrollLeft-a.x-l.x,u=i.top+c.scrollTop-a.y-l.y;return{x:f,y:u,width:i.width,height:i.height}}function Er(e){return $e(e).position==="static"}function _s(e,t){if(!_e(e)||$e(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ot(e)===n&&(n=n.ownerDocument.body),n}function yc(e,t){const n=Ie(e);if(Jn(e))return n;if(!_e(e)){let o=lt(e);for(;o&&!ct(o);){if(me(o)&&!Er(o))return o;o=lt(o)}return n}let r=_s(e,t);for(;r&&El(r)&&Er(r);)r=_s(r,t);return r&&ct(r)&&Er(r)&&!ao(r)?n:r||Cl(e)||n}const Xp=async function(e){const t=this.getOffsetParent||yc,n=this.getDimensions,r=await n(e.floating);return{reference:Yp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jp(e){return $e(e).direction==="rtl"}const Zp={convertOffsetParentRelativeRectToViewportRelativeRect:Vp,getDocumentElement:ot,getClippingRect:Gp,getOffsetParent:yc,getElementRects:Xp,getClientRects:$p,getDimensions:Kp,getScale:kt,isElement:me,isRTL:Jp};function xc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qp(e,t,n){let r=null,o;const s=ot(e);function i(){var f;clearTimeout(o),(f=r)==null||f.disconnect(),r=null}function c(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),i();const h=e.getBoundingClientRect(),{left:g,top:d,width:m,height:b}=h;if(f||t(),!m||!b)return;const v=yn(d),x=yn(s.clientWidth-(g+m)),S=yn(s.clientHeight-(d+b)),E=yn(g),w={rootMargin:-v+"px "+-x+"px "+-S+"px "+-E+"px",threshold:nt(0,Mt(1,u))||1};let R=!0;function P(O){const M=O[0].intersectionRatio;if(!xc(h,e.getBoundingClientRect()))return c();if(M!==u){if(!R)return c();M?c(!1,M):o=setTimeout(()=>{c(!1,1e-7)},1e3)}R=!1}try{r=new IntersectionObserver(P,{...w,root:s.ownerDocument})}catch{r=new IntersectionObserver(P,w)}r.observe(e)}const a=Ie(e),l=()=>c(n);return a.addEventListener("resize",l),c(!0),()=>{a.removeEventListener("resize",l),i()}}function ks(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,l=ko(e),f=o||s?[...l?Gt(l):[],...t?Gt(t):[]]:[];f.forEach(v=>{o&&v.addEventListener("scroll",n),s&&v.addEventListener("resize",n)});const u=l&&c?Qp(l,n,s):null;let h=-1,g=null;i&&(g=new ResizeObserver(v=>{let[x]=v;x&&x.target===l&&g&&t&&(g.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var S;(S=g)==null||S.observe(t)})),n()}),l&&!a&&g.observe(l),t&&g.observe(t));let d,m=a?St(e):null;a&&b();function b(){const v=St(e);m&&!xc(m,v)&&n(),m=v,d=requestAnimationFrame(b)}return n(),()=>{var v;f.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),u==null||u(),(v=g)==null||v.disconnect(),g=null,a&&cancelAnimationFrame(d)}}const eh=jp,th=Mp,nh=Ap,rh=Fp,oh=Dp,sh=(e,t,n)=>{const r=new Map,o=n??{},s={...Zp,...o.platform,_c:r};return kp(e,t,{...o,platform:s})};var ih=typeof document<"u",ch=function(){},_n=ih?I.useLayoutEffect:ch;function Wn(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,o;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(!Wn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Wn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Ec(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function As(e,t){const n=Ec(e);return Math.round(t*n)/n}function Sr(e){const t=y.useRef(e);return _n(()=>{t.current=e}),t}function ah(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:l}=e,[f,u]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,g]=y.useState(r);Wn(h,r)||g(r);const[d,m]=y.useState(null),[b,v]=y.useState(null),x=y.useCallback(j=>{j!==w.current&&(w.current=j,m(j))},[]),S=y.useCallback(j=>{j!==R.current&&(R.current=j,v(j))},[]),E=s||d,C=i||b,w=y.useRef(null),R=y.useRef(null),P=y.useRef(f),O=a!=null,M=Sr(a),F=Sr(o),A=Sr(l),D=y.useCallback(()=>{if(!w.current||!R.current)return;const j={placement:t,strategy:n,middleware:h};F.current&&(j.platform=F.current),sh(w.current,R.current,j).then(N=>{const Y={...N,isPositioned:A.current!==!1};_.current&&!Wn(P.current,Y)&&(P.current=Y,dt.flushSync(()=>{u(Y)}))})},[h,t,n,F,A]);_n(()=>{l===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,u(j=>({...j,isPositioned:!1})))},[l]);const _=y.useRef(!1);_n(()=>(_.current=!0,()=>{_.current=!1}),[]),_n(()=>{if(E&&(w.current=E),C&&(R.current=C),E&&C){if(M.current)return M.current(E,C,D);D()}},[E,C,D,M,O]);const T=y.useMemo(()=>({reference:w,floating:R,setReference:x,setFloating:S}),[x,S]),k=y.useMemo(()=>({reference:E,floating:C}),[E,C]),U=y.useMemo(()=>{const j={position:n,left:0,top:0};if(!k.floating)return j;const N=As(k.floating,f.x),Y=As(k.floating,f.y);return c?{...j,transform:"translate("+N+"px, "+Y+"px)",...Ec(k.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:N,top:Y}},[n,c,k.floating,f.x,f.y]);return y.useMemo(()=>({...f,update:D,refs:T,elements:k,floatingStyles:U}),[f,D,T,k,U])}const lh=(e,t)=>{const n=eh(e);return{name:n.name,fn:n.fn,options:[e,t]}},uh=(e,t)=>{const n=th(e);return{name:n.name,fn:n.fn,options:[e,t]}},fh=(e,t)=>({fn:oh(e).fn,options:[e,t]}),dh=(e,t)=>{const n=nh(e);return{name:n.name,fn:n.fn,options:[e,t]}},ph=(e,t)=>{const n=rh(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ao=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ao.displayName="PreviewCardRootContext");function cn(e){const t=y.useContext(Ao);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PreviewCardRootContext is missing. PreviewCard parts must be placed within <PreviewCard.Root>.":wt(50));return t}class hh extends Io{setState(t){}update(t){}set(t,n){}notifyAll(){}}const gh=600,Sc=300,wc={...xp,instantType:e=>e.instantType,adaptiveOrigin:e=>e.adaptiveOrigin,closeDelay:e=>e.closeDelay};class mh extends Io{constructor(n,r,o){const s=new uc;super(Cc(n,s,r,o),Rc(s),wc);ae(this,"setOpen",(n,r)=>{const{inlineRectCoordsRef:o}=this.context;Zd(this,n,r,{onBeforeDispatch(){var i;const s=r.event;n&&r.reason===We&&r.trigger&&"clientX"in s&&"clientY"in s&&((i=o.current)==null?void 0:i.element)!==r.trigger&&lc(o,r.trigger,s.clientX,s.clientY)}})})}}function bh(){const e=new uc;return new hh(Object.freeze(Cc(void 0,e)),Object.freeze(Rc(e)),wc)}function Cc(e,t,n,r=!1){return{...vp(t,n,r),instantType:void 0,adaptiveOrigin:void 0,closeDelay:Sc,...e}}function Rc(e){return{popupRef:y.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e,inlineRectCoordsRef:{current:void 0}}}function Ns(e){const{open:t,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:o,actionsRef:s,handle:i,triggerId:c,defaultTriggerId:a=null,children:l}=e,f=Gd((v,x)=>new mh({open:n,openProp:t,activeTriggerId:a,triggerIdProp:c},v,x));f.useControlledProp("openProp",t),f.useControlledProp("triggerIdProp",c),f.useContextCallback("onOpenChange",r),f.useContextCallback("onOpenChangeComplete",o);const u=f.useState("open"),h=f.useState("activeTriggerId"),g=f.useState("mounted"),d=f.useState("payload");ep(f,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:m}=tp(u,f,()=>{f.context.inlineRectCoordsRef.current=void 0});pe(()=>{u&&h==null&&f.set("payload",void 0)},[f,h,u]),y.useImperativeHandle(s,()=>({unmount:m,close:()=>f.setOpen(!1,Pe(Or))}),[m,f]);const b=u||g||i!=null;return p.jsxs(Ao.Provider,{value:f,children:[i&&p.jsx(Kd,{handle:i,store:f}),b&&p.jsx(vh,{store:f}),typeof l=="function"?l({payload:d}):l]})}function vh({store:e}){const t=e.useState("floatingRootContext"),n=Dd(t);return np(e,{activeTriggerProps:n.reference,inactiveTriggerProps:n.trigger,popupProps:n.floating}),null}const Tc=Wi(function(t){return cn(!0)?p.jsx(Ns,{...t}):p.jsx(Nd,{children:p.jsx(Ns,{...t})})});process.env.NODE_ENV!=="production"&&(Tc.displayName="PreviewCardRoot");const No=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(No.displayName="PreviewCardPortalContext");function yh(){const e=y.useContext(No);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <PreviewCard.Portal> is missing.":wt(48));return e}const Pc=y.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,style:c,...a}=t,{node:l,subtree:f}=sc({container:o,ref:n,componentProps:t,elementProps:a});return!f&&!l?null:p.jsxs(y.Fragment,{children:[f,l&&dt.createPortal(r,l)]})});process.env.NODE_ENV!=="production"&&(Pc.displayName="FloatingPortalLite");const Oc=y.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return cn().useState("mounted")||r?p.jsx(No.Provider,{value:r,children:p.jsx(Pc,{ref:n,...o})}):null});process.env.NODE_ENV!=="production"&&(Oc.displayName="PreviewCardPortal");const Ic=Rf(function(t,n){const{render:r,className:o,delay:s,closeDelay:i,id:c,payload:a,handle:l,style:f,...u}=t,h=cn(!0),d=Ep(l)??h;if(!d)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <PreviewCard.Trigger> must be either used within a <PreviewCard.Root> component or provided with a handle.":wt(89));const m=bi(c),b=d.useState("isTriggerActive",m),v=d.useState("isOpenedByTrigger",m),x=d.useState("floatingRootContext"),S=d.context.inlineRectCoordsRef,E=y.useRef(null),C=s??gh,w=i??Sc,{registerTrigger:R,isMountedByThisTrigger:P}=Qd(m,E,d,{payload:a,closeDelay:w}),O=Rp(x,{mouseOnly:!0,move:!1,handleClose:Op(),delay:()=>({open:C,close:w}),triggerElementRef:E,isActiveTrigger:b,isClosing:()=>d.select("transitionStatus")==="ending"}),M=Sp(x,{delay:C}),F={open:v},A=d.useState("triggerProps",P),D=$d(S,v);return pt("a",t,{state:F,ref:[n,R,E],props:[O,M.reference,A,D,{id:m},u],stateAttributesMapping:Gf})});process.env.NODE_ENV!=="production"&&(Ic.displayName="PreviewCardTrigger");const jo=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(jo.displayName="PreviewCardPositionerContext");function xh(){const e=y.useContext(jo);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PreviewCardPositionerContext is missing. PreviewCardPositioner parts must be placed within <PreviewCard.Positioner>.":wt(49));return e}function Eh(e){const{nodeId:t,externalTree:n,rootContext:r}=e,o=r.useState("referenceElement"),s=r.useState("floatingElement"),i=r.useState("domReferenceElement"),c=r.useState("open"),a=r.useState("floatingId"),[l,f]=y.useState(null),u=y.useRef(null),h=sn(n),g=y.useMemo(()=>({reference:o,floating:s,domReference:i}),[o,s,i]),d=ah({...e,elements:{...g,...l&&{reference:l}}}),m=y.useCallback(S=>{const E=me(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),getClientRects:()=>S.getClientRects(),contextElement:S}:S;f(E),d.refs.setReference(E)},[d.refs]),b=y.useMemo(()=>({...d.refs,setPositionReference:m,domReference:u}),[d.refs,m]),v=y.useMemo(()=>({...d.elements,domReference:i}),[d.elements,i]),x=y.useMemo(()=>({...d,dataRef:r.context.dataRef,open:c,onOpenChange:r.setOpen,events:r.context.events,floatingId:a,refs:b,elements:v,nodeId:t,rootStore:r}),[d,b,v,t,r,c,a]);return pe(()=>{i&&(u.current=i)},[i]),pe(()=>{r.context.dataRef.current.floatingContext=x;const S=h==null?void 0:h.nodesRef.current.find(E=>E.id===t);S&&(S.context=x)}),y.useMemo(()=>({...d,context:x,refs:b,elements:v,rootStore:r}),[d,b,v,x,r])}const _c=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(_c.displayName="DirectionContext");function Sh(){const e=y.useContext(_c);return(e==null?void 0:e.direction)??"ltr"}const wh=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:l,padding:f=0}=ft(e,t)||{};if(l==null)return{};const u=Zi(f),h={x:n,y:r},g=So(o),d=Eo(g),m=await i.getDimensions(l),b=g==="y",v=b?"top":"left",x=b?"bottom":"right",S=b?"clientHeight":"clientWidth",E=s.reference[d]+s.reference[g]-h[g]-s.floating[d],C=h[g]-s.reference[g],w=c.floating[S]||s.floating[d],R=E/2-C/2,P=w/2-m[d]/2-1,O=Math.min(u[v],P),M=Math.min(u[x],P),F=O,A=w-m[d]-M,D=w/2-m[d]/2+R,_=Ji(F,D,A),T=!a.arrow&&Je(o)!=null&&D!==_&&s.reference[d]/2-(D<F?O:M)-m[d]/2<0,k=T?D<F?D-F:D-A:0;return{[g]:h[g]+k,data:{[g]:_,centerOffset:D-_-k,...T&&{alignmentOffset:k}},reset:T}}}),Ch=(e,t)=>{const{name:n,fn:r}=wh(e);return{name:n,fn:r,options:[e,t]}},Rh={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0,i=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:i.top-n>=0||i.right-t>=0||i.bottom-n>=0||i.left-t>=0||s}}}},Th={sideX:"left",sideY:"top"},Ph="--available-width",Oh="--available-height",Ih="--anchor-width",_h="--anchor-height",kh="--transform-origin",js=Ph,Ms=Oh;function kc(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function Ds(e,t,n){const{rects:r,placement:o}=e;return{side:kc(t,Ve(o),n),align:Je(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Ah(e){return Nh(e,Eh)}function Nh(e,t){var Vt,ln;const{anchor:n,positionMethod:r="absolute",side:o="bottom",sideOffset:s=0,align:i="center",alignOffset:c=0,collisionBoundary:a,collisionPadding:l=5,sticky:f=!1,arrowPadding:u=5,disableAnchorTracking:h=!1,inline:g,keepMounted:d=!1,floatingRootContext:m,mounted:b,collisionAvoidance:v,shift:x,nodeId:S,adaptiveOrigin:E,lazyFlip:C=!1,externalTree:w}=e,R=v.side||"flip",P=v.align||"flip",O=v.fallbackAxisSide||"end",M=(x==null?void 0:x.crossAxis)??!1,F=x==null?void 0:x.rootBoundary,A=typeof n=="function"?n:void 0,D=fe(A),_=A?D:n,T=qe(n),k=qe(b),j=Sh()==="rtl",[N,Y]=y.useState(null);!b&&N!==null&&Y(null);const K=C==="placement",le=N?Ve(N):null,ie=N&&K?Je(N)||"center":null,L=le||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":j?"left":"right","inline-start":j?"right":"left"}[o],X=ie||i,B=X==="center"?L:`${L}-${X}`;let $=l;typeof $=="number"?$={top:$,right:$,bottom:$,left:$}:$&&($={top:$.top||0,right:$.right||0,bottom:$.bottom||0,left:$.left||0});const Q=1,re=o==="bottom"?Q:0,ee=o==="top"?Q:0,te=o==="right"?Q:0,W=o==="left"?Q:0,ne={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:$},oe=y.useRef(null),ve=qe(s),z=qe(c),J=typeof s!="function"?s:0,ce=typeof c!="function"?c:0,he=[];g&&he.push(g),he.push(lh(de=>{const Ae=Ds(de,o,j),He=typeof ve.current=="function"?ve.current(Ae):ve.current,De=typeof z.current=="function"?z.current(Ae):z.current;return{mainAxis:He,crossAxis:De,alignmentAxis:De}},[J,ce,j,o]));const Oe=P==="none"&&R!=="shift",je=!Oe&&(f||M||R==="shift"),Re=R==="none"?null:dh({...ne,padding:{top:$.top+Q+re,right:$.right+Q+W,bottom:$.bottom+Q+ee,left:$.left+Q+te},mainAxis:!M&&R==="flip",crossAxis:P==="flip"?"alignment":!1,fallbackAxisSideDirection:O}),Me=Oe?null:uh({...ne,rootBoundary:F,mainAxis:P!=="none",crossAxis:je,limiter:f||M?void 0:fh(de=>{if(!oe.current)return{};const{width:Ae,height:He}=oe.current.getBoundingClientRect(),De=Ue(Ve(de.placement)),Xe=De==="y"?Ae:He,ze=De==="y"?$.left+$.right:$.top+$.bottom;return{offset:Xe/2+ze/2}})},[ne,f,M,F,$,P]);R==="shift"||P==="shift"||X==="center"?he.push(Me,Re):he.push(Re,Me),he.push(ph({...ne,apply({elements:{floating:de},availableWidth:Ae,availableHeight:He,rects:De}){if(!k.current)return;const Xe=de.style;Xe.setProperty(js,`${Ae}px`),Xe.setProperty(Ms,`${He}px`);const ze=Ie(de).devicePixelRatio||1,{x:un,y:Tt,width:fn,height:it}=De.reference,et=(Math.round((un+fn)*ze)-Math.round(un*ze))/ze,$t=(Math.round((Tt+it)*ze)-Math.round(Tt*ze))/ze;Xe.setProperty(Ih,`${et}px`),Xe.setProperty(_h,`${$t}px`)}}),Ch(de=>({element:oe.current||Ke(de.elements.floating).createElement("div"),padding:oe.current?u:0}),[u]),{name:"transformOrigin",fn(de){var Lo,Bo,Vo,$o,Ho,Uo;const{elements:{floating:Ae},middlewareData:He,placement:De,platform:Xe,rects:ze,y:un}=de,Tt=Ve(De),fn=Je(De),it=Ue(Tt)==="y",et=oe.current,$t=typeof s=="function"?s(Ds(de,o,j)):s;let dn;if(!et&&fn&&Math.abs(it?((Lo=He.shift)==null?void 0:Lo.x)||0:((Bo=He.shift)==null?void 0:Bo.y)||0)<=1)dn=fn==="start"===(it&&((Vo=Xe.isRTL)==null?void 0:Vo.call(Xe,Ae))===!0)?"100%":"0%";else{const Hc=it?(($o=He.arrow)==null?void 0:$o.x)||0:((Ho=He.arrow)==null?void 0:Ho.y)||0,Uc=it?(et==null?void 0:et.clientWidth)||0:(et==null?void 0:et.clientHeight)||0;dn=`${Hc+Uc/2}px`}let rr=Tt==="top"||Tt==="left"?`calc(100% + ${$t}px)`:`${-$t}px`;return je&&it&&Math.abs(((Uo=He.shift)==null?void 0:Uo.y)||0)>$t&&(rr=`${ze.reference.y+ze.reference.height/2-un}px`),Ae.style.setProperty(kh,it?`${dn} ${rr}`:`${rr} ${dn}`),{}}},Rh,E),pe(()=>{!b&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[b,m]);const Be=y.useMemo(()=>({ancestorScroll:!h,elementResize:!h&&typeof ResizeObserver<"u",layoutShift:!h&&typeof IntersectionObserver<"u"}),[h]),{refs:H,elements:G,x:Se,y:be,middlewareData:ge,update:V,placement:q,context:Z,isPositioned:se,floatingStyles:ke}=t({rootContext:m,open:d?b:void 0,placement:B,middleware:he,strategy:r,whileElementsMounted:d?void 0:(...de)=>ks(...de,Be),nodeId:S,externalTree:w}),{sideX:Ce,sideY:Ct}=ge.adaptiveOrigin||Th,st=se?r:"fixed",Rt=y.useMemo(()=>{let de;return se?E?de={position:st,[Ce]:Se,[Ct]:be}:de={...ke,position:st}:de={position:st,top:0,left:0},de[js]="100vw",de[Ms]="100vh",se||(de.opacity=0),de},[E,st,Ce,Se,Ct,be,ke,se]),Ze=y.useRef(null);pe(()=>{if(!b)return;const de=T.current,Ae=typeof de=="function"?de():de,De=(Fs(Ae)?Ae.current:Ae)||null||null;De!==Ze.current&&(H.setPositionReference(De),Ze.current=De)},[b,H,_,T]),y.useEffect(()=>{if(!b)return;const de=T.current;typeof de!="function"&&Fs(de)&&de.current!==Ze.current&&(H.setPositionReference(de.current),Ze.current=de.current)},[b,H,_,T]),y.useEffect(()=>{if(d&&b&&G.reference&&G.floating)return ks(G.reference,G.floating,V,Be)},[d,b,G,V,Be]);const Qe=Ve(q),ht=kc(o,Qe,j),gt=Je(q)||"center",Lt=!!((Vt=ge.hide)!=null&&Vt.referenceHidden);pe(()=>{C&&b&&se&&(Qe!==L||K&>!==X)&&Y(q)},[C,K,b,se,q,Qe,gt,L,X]);const an=y.useMemo(()=>{var de,Ae;return{position:"absolute",top:(de=ge.arrow)==null?void 0:de.y,left:(Ae=ge.arrow)==null?void 0:Ae.x}},[ge.arrow]),Bt=((ln=ge.arrow)==null?void 0:ln.centerOffset)!==0;return y.useMemo(()=>({positionerStyles:Rt,arrowStyles:an,arrowRef:oe,arrowUncentered:Bt,side:ht,align:gt,physicalSide:Qe,anchorHidden:Lt,refs:H,context:Z,isPositioned:se,update:V}),[Rt,an,oe,Bt,ht,gt,Qe,Lt,H,Z,se,V])}function Fs(e){return e!=null&&"current"in e}function Ac(e){return e==="starting"?Cd:Fe}function jh(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:c=!1}){const a={...n};return c&&(a.pointerEvents="none"),pt("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:a},Ac(r),o],stateAttributesMapping:Yi})}const Nc=y.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:c="bottom",align:a="center",sideOffset:l=0,alignOffset:f=0,collisionBoundary:u="clipping-ancestors",collisionPadding:h=5,arrowPadding:g=5,sticky:d=!1,disableAnchorTracking:m=!1,collisionAvoidance:b=Rd,style:v,...x}=t,S=cn(),E=yh(),C=kd(),w=S.useState("open"),R=S.useState("mounted"),P=S.useState("floatingRootContext"),O=S.useState("instantType"),M=S.useState("transitionStatus"),F=S.useState("adaptiveOrigin"),A=S.context.inlineRectCoordsRef,D=Ah({anchor:s,floatingRootContext:P,positionMethod:i,mounted:R,side:c,sideOffset:l,align:a,alignOffset:f,arrowPadding:g,collisionBoundary:u,collisionPadding:h,sticky:d,disableAnchorTracking:m,keepMounted:E,nodeId:C,collisionAvoidance:b,adaptiveOrigin:F,inline:Hd(A)}),_=D.update;pe(()=>{w&&R&&_()},[w,R,_]);const T={open:w,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:O},k=jh(t,T,{styles:D.positionerStyles,transitionStatus:M,props:x,refs:[n,S.useStateSetter("positionerElement")],hidden:!R,inert:!w});return p.jsx(jo.Provider,{value:D,children:p.jsx(Ad,{id:C,children:k})})});process.env.NODE_ENV!=="production"&&(Nc.displayName="PreviewCardPositioner");const jc=y.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,c=cn(),{side:a,align:l}=xh(),f=c.useState("open"),u=c.useState("instantType"),h=c.useState("transitionStatus"),g=c.useState("popupProps"),d=c.useState("floatingRootContext"),m=c.useState("closeDelay");return uo({open:f,ref:c.context.popupRef,onComplete(){var x,S;f&&((S=(x=c.context).onOpenChangeComplete)==null||S.call(x,!0))}}),wp(d,{closeDelay:m}),pt("div",t,{state:{open:f,side:a,align:l,instant:u,transitionStatus:h},ref:[n,c.context.popupRef,c.useStateSetter("popupElement")],props:[qd,g,Ac(h),i],stateAttributesMapping:Kf})});process.env.NODE_ENV!=="production"&&(jc.displayName="PreviewCardPopup");class Mh extends Ud{constructor(){super(bh(),"PreviewCard")}open(t){this.openByTrigger(t)}close(){this.closePopup()}get isOpen(){var t;return((t=this.attachedStore)==null?void 0:t.select("open"))??!1}}function Dh(){return new Mh}const Fh=Dh;function Lh(e){return p.jsx(Tc,{...e})}function Bh(e){return p.jsx(Ic,{"data-slot":"hover-card-trigger",...e})}function Vh({className:e,side:t="bottom",sideOffset:n=6,align:r="center",alignOffset:o=0,...s}){return p.jsx(Oc,{children:p.jsx(Nc,{align:r,alignOffset:o,side:t,sideOffset:n,className:"vps-hover-card-positioner",children:p.jsx(jc,{"data-slot":"hover-card-content",...s,className:i=>ue("vps-hover-card",typeof e=="function"?e(i):e)})})})}function $h({className:e,...t}){return p.jsx("span",{className:ue("inline-citation",e),...t})}const Mo=I.createContext(null);function Mc(e){!e.popup||!e.focusRequested||!e.handle.isOpen||(e.focusRequested=!1,e.popup.focus())}function Hh({handle:e,onOpenChange:t,openDelay:n=80,closeDelay:r=180,...o}){const[s]=I.useState(()=>Fh()),i=e??s,c=I.useMemo(()=>({handle:i,openDelay:n,closeDelay:r,trigger:null,popup:null,focusRequested:!1}),[i,n,r]);return p.jsx(Mo.Provider,{value:c,children:p.jsx(Lh,{...o,handle:i,onOpenChange:(a,l)=>{var f,u;t==null||t(a,l),!a&&l.reason==="escape-key"&&((f=c.popup)!=null&&f.contains(document.activeElement))&&((u=c.trigger)==null||u.focus())}})})}function Wr(e){try{return new URL(e).hostname||e}catch{return e}}function Uh({sources:e,delay:t,closeDelay:n,id:r,children:o,onClick:s,...i}){const c=I.useContext(Mo),a=I.useId(),l=r??a,f=e[0],u=f?Wr(f):"Source";return p.jsx(Bh,{id:l,handle:c==null?void 0:c.handle,delay:t??(c==null?void 0:c.openDelay)??80,closeDelay:n??(c==null?void 0:c.closeDelay)??180,render:p.jsx(fo,{variant:"secondary",size:"xs","aria-haspopup":"dialog",...i,onClick:h=>{s==null||s(h),!(!c||h.defaultPrevented)&&(c.trigger=h.currentTarget,c.focusRequested=!0,c.handle.open(l),Mc(c))}}),children:o??(e.length>1?`${u} +${e.length-1}`:u)})}function zh({ref:e,onBlur:t,...n}){const r=I.useContext(Mo);return p.jsx(Vh,{tabIndex:-1,role:"dialog","aria-label":"Source preview",...n,ref:o=>{typeof e=="function"?e(o):e&&(e.current=o),r&&(r.popup=o,o&&Mc(r))},onBlur:o=>{t==null||t(o),!(!r||o.defaultPrevented)&&o.relatedTarget!==r.trigger&&!o.currentTarget.contains(o.relatedTarget)&&r.handle.close()}})}const Dc=I.createContext(null);function Do(){const e=I.useContext(Dc);if(!e)throw new Error("Citation carousel parts must be rendered inside InlineCitationCarousel.");return e}function Wh({opts:e,plugins:t,orientation:n="horizontal",setApi:r,className:o,...s}){const[i,c]=yo({...e,axis:n==="vertical"?"y":"x"},t),[{selected:a,count:l},f]=I.useState({selected:0,count:0});return I.useEffect(()=>{if(!c)return;r==null||r(c);const u=()=>f({selected:c.selectedScrollSnap(),count:c.scrollSnapList().length});return u(),c.on("select",u).on("reInit",u),()=>{c.off("select",u).off("reInit",u)}},[c,r]),p.jsx(Dc.Provider,{value:{viewportRef:i,api:c,selected:a,count:l},children:p.jsx("div",{role:"region","aria-roledescription":"carousel",...s,className:ue("inline-citation-carousel",o),"data-orientation":n})})}function qh({className:e,...t}){const{viewportRef:n}=Do();return p.jsx("div",{ref:n,className:"inline-citation-viewport",children:p.jsx("div",{className:ue("inline-citation-track",e),...t})})}function Gh({className:e,...t}){return p.jsx("div",{role:"group","aria-roledescription":"slide",className:ue("inline-citation-slide",e),...t})}function Kh({className:e,...t}){return p.jsx("div",{className:ue("inline-citation-carousel-header",e),...t})}function Yh({children:e,...t}){const{selected:n,count:r}=Do();return p.jsx("div",{"aria-live":"polite",...t,children:e??(r?`${n+1}/${r}`:"")})}function Fc({next:e,children:t,disabled:n,onClick:r,...o}){const{api:s}=Do(),i=e?s==null?void 0:s.canScrollNext():s==null?void 0:s.canScrollPrev();return p.jsx(fo,{variant:"ghost",size:"icon-xs","aria-label":e?"Next source":"Previous source",...o,disabled:n||!i,onClick:c=>{r==null||r(c),!c.defaultPrevented&&(e?s==null||s.scrollNext():s==null||s.scrollPrev())},children:t??(e?p.jsx(Zs,{size:14,"aria-hidden":"true"}):p.jsx(ga,{size:14,"aria-hidden":"true"}))})}function Xh(e){return p.jsx(Fc,{...e,next:!1})}function Jh(e){return p.jsx(Fc,{...e,next:!0})}function Zh({title:e,url:t,description:n,className:r,children:o,...s}){const i=t?ho(t):void 0;return p.jsxs("div",{className:ue("inline-citation-source",r),...s,children:[p.jsx("div",{className:"inline-citation-title",children:e||(i?Wr(i):"Source")}),i&&p.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:[Wr(i),p.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}),n&&p.jsx("p",{children:n}),o]})}function Qh({className:e,...t}){return p.jsx("blockquote",{className:ue("inline-citation-quote",e),...t})}const eg={"fuel-defect-reporting":{label:"Fuel Defect Reporting",path:"/dashboard/fuel-Defect-Reporting"},"bunker-master":{label:"Bunker Master",path:"/dashboard/bunker-master"},"fsc-fsq-e-forms":{label:"Pre-Registration & E-Forms",path:"/dashboard/pre-registration"},"pre-registration-ship":{label:"Pre-Registration",path:"/dashboard/pre-registration"},"reports-fuel":{label:"Fuel Reports",path:"/dashboard/reports"},"sample-fuel":{label:"Sample Status",path:"/dashboard/sample-status"}};function Lc(e){const n=(e.split(/[/\\]/).pop()||"").replace(/\.md$/i,"").toLowerCase();for(const[r,o]of Object.entries(eg))if(n.includes(r))return o;return null}function qr(e){return e.title?e.title:(e.source.split(/[/\\]/).pop()||e.source).replace(/\.md$/i,"").replace(/[-_]/g," ").replace(/\b\w/g,n=>n.toUpperCase())}const tg=({sources:e,hideInspectSources:t=!1,showInspectSources:n=!0,defaultExpanded:r=!1,maxSources:o=5})=>{const s=t||n===!1,[i,c]=I.useState(r&&!s),[a,l]=I.useState(null);if(!e||!e.length)return null;const f=e.slice(0,o),u=f.length===1?"source":"sources",h=p.jsxs(Nt,{children:[p.jsx(xt,{children:p.jsx(xa,{size:14})}),p.jsx(jt,{children:`${f.length} retrieved VPS ${u}`}),!s&&p.jsx(Kt,{children:i?"Hide Details":"Inspect Sources"})]}),g=p.jsx(bt,{className:"grounded-source-rows",children:f.map((d,m)=>{const b=a===m,v=p.jsxs(Nt,{children:[p.jsx(xt,{children:p.jsx(ha,{size:13})}),p.jsxs(jt,{children:["[S",m+1,"] ",qr(d)]}),p.jsxs(Kt,{title:"Ranking score, not a probability of correctness",children:["Score ",d.score.toFixed(2)]})]});return s?p.jsx("div",{children:v},`${d.chunkId}-${m}`):p.jsx("button",{type:"button",className:`trace-trigger${i&&b?" grounded-source-selected":""}`,"aria-pressed":i&&b,onClick:()=>{c(!0),l(b?null:m)},title:d.source,children:v},`${d.chunkId}-${m}`)})});return s?p.jsxs(bt,{className:"grounded-sources-card",children:[h,g]}):p.jsx(bt,{className:"grounded-sources-card",children:p.jsxs(Ii,{open:i,onOpenChange:c,children:[p.jsx(_i,{children:h}),g,p.jsx(ki,{children:p.jsx("div",{className:"grounded-sources-details-list",children:f.map((d,m)=>{const b=qr(d),v=Lc(d.source),x=a===m;return p.jsxs("div",{className:`grounded-detail-item${x?" grounded-detail-item--highlighted":""}`,children:[p.jsxs("div",{className:"grounded-detail-top",children:[p.jsxs("div",{className:"grounded-detail-title-group",children:[p.jsxs("span",{className:"grounded-detail-index",children:["[",m+1,"]"]}),p.jsx("span",{className:"grounded-detail-title",children:b})]}),p.jsxs("div",{className:"grounded-detail-meta",children:[p.jsxs("span",{className:"grounded-detail-score",children:["Rank score ",d.score.toFixed(2)]}),v&&p.jsxs("a",{href:v.path,onClick:S=>{S.preventDefault(),window.location.href=v.path},className:"grounded-route-link",title:`Navigate to ${v.label}`,children:[p.jsx("span",{children:v.label}),p.jsx(va,{size:10,"aria-hidden":"true"})]})]})]}),p.jsx("div",{className:"grounded-detail-path",children:p.jsx("code",{children:d.source})}),d.snippet&&p.jsxs("p",{className:"grounded-detail-snippet",children:['"',d.snippet,'"']})]},`detail-${d.chunkId}-${m}`)})})})]})})};function ng({label:e,sources:t}){const n=t.map(r=>{var i;const o=qr(r),s=ho(r.url||r.source)??((i=Lc(r.source))==null?void 0:i.path);return{key:r.chunkId,label:s||o,content:p.jsxs(p.Fragment,{children:[p.jsx(Zh,{title:o,url:s}),r.snippet&&p.jsx(Qh,{children:r.snippet})]})}});return p.jsx($h,{children:p.jsxs(Hh,{children:[p.jsx(Uh,{sources:n.map(r=>r.label),"aria-label":"View sources "+e,children:e}),p.jsx(zh,{children:n.length===1?n[0].content:p.jsxs(Wh,{"aria-label":"Sources",children:[p.jsxs(Kh,{children:[p.jsx(Yh,{}),p.jsx(Xh,{}),p.jsx(Jh,{})]}),p.jsx(qh,{children:n.map((r,o)=>p.jsx(Gh,{"aria-label":"Source "+(o+1),children:r.content},r.key+"-"+o))})]})})]})})}function rg(e,t){if(!e)return[];const n=/(\[[^\]]+\]\([^)]+\)|\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|https?:\/\/[^\s]+|\[S\d+(?:\s*,\s*S\d+)*\])/g;return e.split(n).map((o,s)=>{if(!o)return null;if(t!=null&&t.length&&/^\[S\d+(?:\s*,\s*S\d+)*\]$/.test(o)){const c=[...new Set(o.match(/\d+/g))].map(a=>t[Number(a)-1]);if(c.every(a=>a!==void 0))return p.jsx(ng,{label:o,sources:c},s)}const i=o.match(/^\[([^\]]+)\]\(([^)]+)\)$/);if(i){const c=i[1],a=i[2],l=ho(a);if(!l)return p.jsx(I.Fragment,{children:c},s);const f=/^https?:\/\//i.test(a);return p.jsx("a",{href:l,target:f?"_blank":void 0,rel:f?"noopener noreferrer":void 0,className:"md-link",children:c},s)}return o.startsWith("**")&&o.endsWith("**")&&o.length>=4?p.jsx("strong",{children:o.slice(2,-2)},s):o.startsWith("*")&&o.endsWith("*")&&o.length>=2?p.jsx("em",{children:o.slice(1,-1)},s):o.startsWith("`")&&o.endsWith("`")&&o.length>=2?p.jsx("code",{className:"md-code",children:o.slice(1,-1)},s):/^https?:\/\//i.test(o)?p.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"md-link",children:o},s):p.jsx(I.Fragment,{children:o},s)})}function og(e){const t=e.replace(/\r\n/g,`
|
|
211
|
+
*/var Ts;function fp(){return Ts||(Ts=1,process.env.NODE_ENV!=="production"&&(function(){function e(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=O,n=Po(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,c=t.useMemo,a=t.useDebugValue;xr.useSyncExternalStoreWithSelector=function(l,u,f,h,m){var d=s(null);if(d.current===null){var g={hasValue:!1,value:null};d.current=g}else g=d.current;d=c(function(){function v(S){if(!x){if(x=!0,C=S,S=h(S),m!==void 0&&g.hasValue){var R=g.value;if(m(R,S))return w=R}return w=S}if(R=w,r(C,S))return R;var T=h(S);return m!==void 0&&m(R,T)?(C=S,R):(C=S,w=T)}var x=!1,C,w,E=f===void 0?null:f;return[function(){return v(u())},E===null?void 0:function(){return v(E())}]},[u,f,h,m]);var b=o(l,d[0],d[1]);return i(function(){g.hasValue=!0,g.value=b},[b]),a(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),xr}var Is;function dp(){return Is||(Is=1,process.env.NODE_ENV==="production"?Cn.exports=up():Cn.exports=fp()),Cn.exports}var pp=dp();const hp=li(19),mp=hp?bp:vp;function pc(e,t,n,r,o){return mp(e,t,n,r,o)}function gp(e,t,n,r,o){const s=y.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return ko.useSyncExternalStore(e.subscribe,s,s)}Of({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const r=e.syncHooks[n],o=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,o)||(t=!0,r.value=o)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const o of e.syncHooks)n.add(o.store);const r=[];for(const o of n)r.push(o.subscribe(t));return()=>{for(const o of r)o()}}),ko.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function bp(e,t,n,r,o){const s=If();if(!s)return gp(e,t,n,r,o);const i=s.syncIndex;s.syncIndex+=1;let c;return s.didInitialize?(c=s.syncHooks[i],(c.store!==e||c.selector!==t||!Object.is(c.a1,n)||!Object.is(c.a2,r)||!Object.is(c.a3,o))&&(c.store!==e&&(s.didChangeStore=!0),c.store=e,c.selector=t,c.a1=n,c.a2=r,c.a3=o,c.value=t(e.getSnapshot(),n,r,o))):(c={store:e,selector:t,a1:n,a2:r,a3:o,value:t(e.getSnapshot(),n,r,o)},s.syncHooks.push(c)),c.value}function vp(e,t,n,r,o){return pp.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class yp{constructor(t){ce(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));ce(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}static create(t){return new this(t)}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,o){return pc(this,t,n,r,o)}}class _o extends yp{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){y.useDebugValue(t);const r=this;he(()=>{r.state[t]!==n&&r.set(t,n)},[r,t,n])}useSyncedValueWithCleanup(t,n){const r=this;he(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this;if(process.env.NODE_ENV!=="production"){y.useDebugValue(t,i=>Object.keys(i));const o=y.useRef(Object.keys(t)).current,s=Object.keys(t);(o.length!==s.length||o.some((i,c)=>i!==s[c]))&&console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.")}const r=Object.values(t);he(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){y.useDebugValue(t);const r=this,o=n!==void 0;if(he(()=>{o&&!Object.is(r.state[t],n)&&r.setState({...r.state,[t]:n})},[r,t,n,o]),process.env.NODE_ENV!=="production"){const s=this.controlledValues??(this.controlledValues=new Map);s.has(t)||s.set(t,o);const i=s.get(t);i!==void 0&&i!==o&&console.error(`A component is changing the ${i?"":"un"}controlled state of ${t.toString()} to be ${i?"un":""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`)}}select(t,n,r,o){const s=this.selectors[t];return s(this.state,n,r,o)}useState(t,n,r,o){return y.useDebugValue(t),pc(this,this.selectors[t],n,r,o)}useContextCallback(t,n){y.useDebugValue(t);const r=fe(n??to);this.context[t]=r}useStateSetter(t){const n=y.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const c=o;o=i,n(i,c,this)}})}}const xp={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class wp extends _o{constructor(n){const{syncOnly:r,nested:o,onOpenChange:s,triggerElements:i,...c}=n;super({...c,positionReference:c.referenceElement,domReferenceElement:c.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:ac(),nested:o,triggerElements:i},xp);ce(this,"syncOpenEvent",(n,r)=>{(!n||!this.state.open||r!=null&&Hf(r))&&(this.context.dataRef.current.openEvent=n?r:void 0)});ce(this,"dispatchOpenChange",(n,r)=>{this.syncOpenEvent(n,r.event);const o={open:n,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",o)});ce(this,"setOpen",(n,r)=>{var o,s,i,c;if(this.syncOnly){(s=(o=this.context).onOpenChange)==null||s.call(o,n,r);return}this.dispatchOpenChange(n,r),(c=(i=this.context).onOpenChange)==null||c.call(i,n,r)});this.syncOnly=r}}function Cp(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new wp({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Ve,inactiveTriggerProps:Ve,popupProps:Ve}}const Gt=e=>e.triggerIdProp??e.activeTriggerId,Un=e=>e.openProp??e.open,Os=e=>{var n;return(((n=e.popupElement)==null?void 0:n.id)??e.floatingId)||void 0};function hc(e,t){return t!==void 0&&Un(e)&&Gt(e)===t}function Sp(e,t){return hc(e,t)?!0:t!==void 0&&Un(e)&&Gt(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}const Ep={open:Un,mounted:e=>e.mounted,transitionStatus:e=>Un(e)&&!e.mounted?"starting":e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Gt,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Os,isTriggerActive:(e,t)=>t!==void 0&&Gt(e)===t,isOpenedByTrigger:(e,t)=>hc(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Gt(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Sp(e,t)?Os(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Rp(e){const t=y.useCallback(r=>e===void 0?to:e.subscribeStore(r),[e]),n=y.useCallback(()=>e===void 0?void 0:e.store,[e]);return ko.useSyncExternalStore(t,n,()=>e==null?void 0:e.serverStore)}const wr=Yi&&sn;function Tp(e,t={}){const{enabled:n=!0,delay:r}=t,{events:o,dataRef:s}=e.context,i=y.useRef(!1),c=y.useRef(null),a=y.useRef(!0),l=qt();y.useEffect(()=>{const f=e.select("domReferenceElement");if(!n)return;const h=Ne(f);function m(){const b=e.select("domReferenceElement");!e.select("open")&&je(b)&&b===Vr(Je(b))&&(i.current=!0,c.current=b)}function d(){a.current=!0}function g(){a.current=!1}return ut(Ce(h,"blur",m),wr&&Ce(h,"keydown",d,!0),wr&&Ce(h,"pointerdown",g,!0))},[e,n]),y.useEffect(()=>{if(!n)return;function f(h){if(h.reason===Yn||h.reason===ro){const m=e.select("domReferenceElement");ge(m)&&(c.current=m,i.current=!0)}}return o.on("openchange",f),()=>{o.off("openchange",f)}},[o,n,e]);const u=y.useMemo(()=>{function f(){i.current=!1,c.current=null}return{onMouseLeave(){f()},onFocus(h){const m=h.currentTarget;if(i.current){if(c.current===m)return;f()}const d=xt(h.nativeEvent);if(ge(d)){if(wr&&!h.relatedTarget){if(!a.current&&!ed(d))return}else if(!nd(d))return}const g=Ln(h.relatedTarget,e.context.triggerElements),{nativeEvent:b,currentTarget:v}=h;if(e.select("open")&&g||!r){e.setOpen(!0,ke(On,b,v));return}l.start(r,()=>{i.current||e.setOpen(!0,ke(On,b,v))})},onBlur(h){f();const m=h.relatedTarget,d=h.nativeEvent,g=ge(m)&&m.hasAttribute(Ro("focus-guard"))&&m.getAttribute("data-type")==="outside";l.start(0,()=>{var C;const b=e.select("domReferenceElement"),v=Vr(Je(b));!m&&v===b||Pe((C=s.current.floatingContext)==null?void 0:C.refs.floating.current,v)||Pe(b,v)||g||Ln(m??v,e.context.triggerElements)||e.setOpen(!1,ke(On,d))})}}},[s,r,e,l]);return y.useMemo(()=>n?{reference:u,trigger:u}:{},[n,u])}class Ao{constructor(){ce(this,"pointerType");ce(this,"interactedInside",!1);ce(this,"handler");ce(this,"blockMouseMove",!0);ce(this,"performedPointerEventsMutation",!1);ce(this,"pointerEventsScopeElement",null);ce(this,"pointerEventsReferenceElement",null);ce(this,"pointerEventsFloatingElement",null);ce(this,"restTimeoutPending",!1);ce(this,"openChangeTimeout",new dt);ce(this,"restTimeout",new dt);ce(this,"handleCloseOptions");ce(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});ce(this,"disposeEffect",()=>this.dispose)}static create(){return new Ao}}const Wn=new WeakMap;function qn(e){var n,r,o;if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Wn.get(t)===e&&((n=e.pointerEventsScopeElement)==null||n.style.removeProperty("pointer-events"),(r=e.pointerEventsReferenceElement)==null||r.style.removeProperty("pointer-events"),(o=e.pointerEventsFloatingElement)==null||o.style.removeProperty("pointer-events"),Wn.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function mc(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t,s=Wn.get(n);s&&s!==e&&qn(s),qn(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,Wn.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function gc(e){const t=e.context.dataRef.current,n=Ze(()=>t.hoverInteractionState??Ao.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),oo(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Ip(e,t={}){const{enabled:n=!0,closeDelay:r=0,nodeId:o}=t,s=e.useState("open"),i=e.useState("floatingElement"),c=e.useState("domReferenceElement"),{dataRef:a}=e.context,l=cn(),u=nr(),f=gc(e),h=qt(),m=fe(()=>{var b;return Ji((b=a.current.openEvent)==null?void 0:b.type,f.interactedInside)}),d=fe(()=>{var b;return od((b=a.current.openEvent)==null?void 0:b.type)}),g=fe(()=>{qn(f)});he(()=>{s||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[s,f,g]),y.useEffect(()=>g,[g]),he(()=>{var b,v,x,C,w;if(n&&s&&(b=f.handleCloseOptions)!=null&&b.blockPointerEvents&&d()&&ge(c)&&i){const E=c,S=i,R=Je(i),T=(x=(v=l==null?void 0:l.nodesRef.current.find(_=>_.id===u))==null?void 0:v.context)==null?void 0:x.elements.floating;T&&(T.style.pointerEvents="");const P=f.pointerEventsScopeElement!==S?f.pointerEventsScopeElement:null,k=T!==S?T:null,M=((w=(C=f.handleCloseOptions)==null?void 0:C.getScope)==null?void 0:w.call(C))??P??k??Hr(E,"[data-rootownerid]")??R.body;return mc(f,{scopeElement:M,referenceElement:E,floatingElement:S}),()=>{g()}}},[n,s,c,i,f,d,l,u,g]),y.useEffect(()=>{if(!n)return;function b(){return!!(l&&u&&Dt(l.nodesRef.current,u).length>0)}function v(R){const T=$r(r,"close",f.pointerType),P=()=>{e.setOpen(!1,ke(Ye,R)),l==null||l.events.emit("floating.closed",R)};T?f.openChangeTimeout.start(T,P):(f.openChangeTimeout.clear(),P())}function x(R){const T=xt(R);if(!td(T)){f.interactedInside=!1;return}f.interactedInside=Hr(T,"[aria-haspopup]")!=null}function C(){f.openChangeTimeout.clear(),h.clear(),l==null||l.events.off("floating.closed",E),g()}function w(R){var M;if(b()&&l){l.events.on("floating.closed",E);return}if(Ln(R.relatedTarget,e.context.triggerElements))return;const T=((M=a.current.floatingContext)==null?void 0:M.nodeId)??o,P=R.relatedTarget;if(!(l&&T&&ge(P)&&Dt(l.nodesRef.current,T,!1).some(_=>{var D;return Pe((D=_.context)==null?void 0:D.elements.floating,P)}))){if(f.handler){f.handler(R);return}g(),d()&&!m()&&v(R)}}function E(R){!l||!u||b()||h.start(0,()=>{l.events.off("floating.closed",E),e.setOpen(!1,ke(Ye,R)),l.events.emit("floating.closed",R)})}const S=i;return ut(S&&Ce(S,"mouseenter",C),S&&Ce(S,"mouseleave",w),S&&Ce(S,"pointerdown",x,!0),()=>{l==null||l.events.off("floating.closed",E)})},[n,i,e,a,r,o,d,m,g,f,l,u,h])}const Op={current:null};function Pp(e,t={}){const{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:s=!1,restMs:i=0,move:c=!0,triggerElementRef:a=Op,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:f,isClosing:h,shouldOpen:m,guardStaleOpen:d=!1}=t,{dataRef:g,events:b}=e.context,v=cn(l),x=gc(e),C=y.useRef(!1),w=Xe(o),E=Xe(r),S=Xe(i),R=Xe(n),T=Xe(m),P=Xe(h),k=fe(()=>{var I;return Ji((I=g.current.openEvent)==null?void 0:I.type,x.interactedInside)}),M=fe(()=>{var I;return((I=T.current)==null?void 0:I.call(T))!==!1}),_=fe((I,F,U)=>{const A=e.context.triggerElements;if(A.hasElement(F))return!I||!Pe(I,F);if(!ge(U))return!1;const j=U;return A.hasMatchingElement(q=>Pe(q,j))&&(!I||!Pe(I,j))}),D=fe(()=>{if(!x.handler)return;Je(e.select("domReferenceElement")).removeEventListener("mousemove",x.handler),x.handler=void 0}),N=fe(()=>{qn(x)});return u&&(x.handleCloseOptions=o==null?void 0:o.__options),y.useEffect(()=>D,[D]),y.useEffect(()=>{if(!n)return;function I(F){F.open?C.current=!1:(C.current=F.reason===Ye,D(),x.openChangeTimeout.clear(),x.restTimeout.clear(),x.blockMouseMove=!0,x.restTimeoutPending=!1)}return b.on("openchange",I),()=>{b.off("openchange",I)}},[n,b,x,D]),y.useEffect(()=>{if(!n)return;function I(z,ae=!0){const re=$r(E.current,"close",x.pointerType);re?x.openChangeTimeout.start(re,()=>{e.setOpen(!1,ke(Ye,z)),v==null||v.events.emit("floating.closed",z)}):ae&&(x.openChangeTimeout.clear(),e.setOpen(!1,ke(Ye,z)),v==null||v.events.emit("floating.closed",z))}const F=a.current??(u?e.select("domReferenceElement"):null);if(!ge(F))return;function U(z){var ve;if(x.openChangeTimeout.clear(),x.blockMouseMove=!1,s&&!Br(x.pointerType))return;const ae=gs(S.current),re=$r(E.current,"open",x.pointerType),B=xt(z),G=z.currentTarget??null,V=e.select("domReferenceElement");let H=G;if(ge(B)&&!e.context.triggerElements.hasElement(B)){for(const Oe of e.context.triggerElements.elements())if(Pe(Oe,B)){H=Oe;break}}ge(G)&&ge(V)&&!e.context.triggerElements.hasElement(G)&&Pe(G,V)&&(H=V);const Z=H==null?!1:_(V,H,B),oe=e.select("open"),ee=((ve=P.current)==null?void 0:ve.call(P))??e.select("transitionStatus")==="ending",te=!oe&&ee&&C.current,$=!Z&&ge(H)&&ge(V)&&Pe(V,H)&&te,ne=ae>0&&!re,se=Z&&(oe||te)||$,be=!oe||Z;if(se){M()&&e.setOpen(!0,ke(Ye,z,H));return}ne||(re?x.openChangeTimeout.start(re,()=>{be&&M()&&e.setOpen(!0,ke(Ye,z,H))}):be&&M()&&e.setOpen(!0,ke(Ye,z,H)))}function A(z){if(k()){N();return}D();const ae=e.select("domReferenceElement"),re=Je(ae);x.restTimeout.clear(),x.restTimeoutPending=!1;const B=g.current.floatingContext??(f==null?void 0:f());if(Ln(z.relatedTarget,e.context.triggerElements))return;if(w.current&&B){e.select("open")||x.openChangeTimeout.clear();const V=a.current;x.handler=w.current({...B,tree:v,x:z.clientX,y:z.clientY,onClose(){N(),D(),R.current&&!k()&&V===e.select("domReferenceElement")&&I(z,!0)}}),re.addEventListener("mousemove",x.handler),x.handler(z);return}(x.pointerType==="touch"?!Pe(e.select("floatingElement"),z.relatedTarget):!0)&&I(z)}function j(z){Pe(F,z.relatedTarget)||(x.openChangeTimeout.clear(),x.restTimeout.clear(),x.restTimeoutPending=!1)}const q=d?Ce(F,"mouseout",j):void 0;return c?ut(Ce(F,"mousemove",U,{once:!0}),Ce(F,"mouseenter",U),Ce(F,"mouseleave",A),q):ut(Ce(F,"mouseenter",U),Ce(F,"mouseleave",A),q)},[D,N,g,E,e,n,w,x,u,_,k,s,c,S,a,v,R,f,P,M,d]),y.useMemo(()=>{if(!n)return;function I(F){x.pointerType=F.pointerType}return{onPointerDown:I,onPointerEnter:I,onMouseMove(F){var B,G,V;const{nativeEvent:U}=F,A=F.currentTarget,j=e.select("domReferenceElement"),q=e.select("open"),z=_(j,A,F.target);if(s&&!Br(x.pointerType))return;if(q&&z&&((B=x.handleCloseOptions)!=null&&B.blockPointerEvents)){const H=e.select("floatingElement");if(H){const Z=((V=(G=x.handleCloseOptions)==null?void 0:G.getScope)==null?void 0:V.call(G))??A.ownerDocument.body;mc(x,{scopeElement:Z,referenceElement:A,floatingElement:H})}}const ae=gs(S.current);if(q&&!z||ae===0||!z&&x.restTimeoutPending&&F.movementX**2+F.movementY**2<2)return;x.restTimeout.clear();function re(){if(x.restTimeoutPending=!1,k())return;const H=e.select("open");!x.blockMouseMove&&(!H||z)&&M()&&e.setOpen(!0,ke(Ye,U,A))}x.pointerType==="touch"?ht.flushSync(()=>{re()}):z&&q?re():(x.restTimeoutPending=!0,x.restTimeout.start(ae,re))}}},[n,x,k,_,s,e,S,M])}const Ps=.1,kp=Ps*Ps,we=.5;function Sn(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function En(e,t,n,r,o,s,i,c,a,l){let u=!1;return Sn(e,t,n,r,o,s)&&(u=!u),Sn(e,t,o,s,i,c)&&(u=!u),Sn(e,t,i,c,a,l)&&(u=!u),Sn(e,t,a,l,n,r)&&(u=!u),u}function _p(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Rn(e,t,n,r,o,s){const i=Math.min(n,o),c=Math.max(n,o),a=Math.min(r,s),l=Math.max(r,s);return e>=i&&e<=c&&t>=a&&t<=l}function Ap(e={}){const{blockPointerEvents:t=!1}=e,n=new dt,r=({x:o,y:s,placement:i,elements:c,onClose:a,nodeId:l,tree:u})=>{const f=i==null?void 0:i.split("-")[0];let h=!1,m=null,d=null,g=typeof performance<"u"?performance.now():0;function b(x,C){const w=performance.now(),E=w-g;if(m===null||d===null||E===0)return m=x,d=C,g=w,!1;const S=x-m,R=C-d,T=S*S+R*R,P=E*E*kp;return m=x,d=C,g=w,T<P}function v(){n.clear(),a()}return function(C){n.clear();const w=c.domReference,E=c.floating;if(!w||!E||f==null||o==null||s==null)return;const{clientX:S,clientY:R}=C,T=xt(C),P=C.type==="mouseleave",k=Pe(E,T),M=Pe(w,T);if(k&&(h=!0,!P))return;if(M&&(h=!1,!P)){h=!0;return}if(P&&ge(C.relatedTarget)&&Pe(E,C.relatedTarget))return;function _(){return!!(u&&Dt(u.nodesRef.current,l).length>0)}function D(){_()||v()}if(_())return;const N=w.getBoundingClientRect(),I=E.getBoundingClientRect(),F=o>I.right-I.width/2,U=s>I.bottom-I.height/2,A=I.width>N.width,j=I.height>N.height,q=(A?N:I).left,z=(A?N:I).right,ae=(j?N:I).top,re=(j?N:I).bottom;if(f==="top"&&s>=N.bottom-1||f==="bottom"&&s<=N.top+1||f==="left"&&o>=N.right-1||f==="right"&&o<=N.left+1){D();return}let B=!1;switch(f){case"top":B=Rn(S,R,q,N.top+1,z,I.bottom-1);break;case"bottom":B=Rn(S,R,q,I.top+1,z,N.bottom-1);break;case"left":B=Rn(S,R,I.right-1,re,N.left+1,ae);break;case"right":B=Rn(S,R,N.right-1,re,I.left+1,ae);break}if(B)return;if(h&&!_p(S,R,N)){D();return}if(!P&&b(S,R)){D();return}let G=!1;switch(f){case"top":{const V=A?we/2:we*4,H=A||F?o+V:o-V,Z=A?o-V:F?o+V:o-V,oe=s+we+1,ee=F||A?I.bottom-we:I.top,te=F?A?I.bottom-we:I.top:I.bottom-we;G=En(S,R,H,oe,Z,oe,I.left,ee,I.right,te);break}case"bottom":{const V=A?we/2:we*4,H=A||F?o+V:o-V,Z=A?o-V:F?o+V:o-V,oe=s-we,ee=F||A?I.top+we:I.bottom,te=F?A?I.top+we:I.bottom:I.top+we;G=En(S,R,H,oe,Z,oe,I.left,ee,I.right,te);break}case"left":{const V=j?we/2:we*4,H=j||U?s+V:s-V,Z=j?s-V:U?s+V:s-V,oe=o+we+1,ee=U||j?I.right-we:I.left,te=U?j?I.right-we:I.left:I.right-we;G=En(S,R,ee,I.top,te,I.bottom,oe,H,oe,Z);break}case"right":{const V=j?we/2:we*4,H=j||U?s+V:s-V,Z=j?s-V:U?s+V:s-V,oe=o-we,ee=U||j?I.left+we:I.right,te=U?j?I.left+we:I.right:I.left+we;G=En(S,R,oe,H,oe,Z,ee,I.top,te,I.bottom);break}}G?h||n.start(40,D):D()}};return r.__options={...e,blockPointerEvents:t},r}function ks(e,t,n){let{reference:r,floating:o}=e;const s=Ge(t),i=Eo(t),c=So(i),a=Ue(t),l=s==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[c]/2-o[c]/2;let m;switch(a){case"top":m={x:u,y:r.y-o.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-o.width,y:f};break;default:m={x:r.x,y:r.y}}const d=tt(t);return d&&(m[i]+=h*(d==="end"?1:-1)*(n&&l?-1:1)),m}async function Np(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=pt(t,e),d=ec(m),b=c[h?f==="floating"?"reference":"floating":f],v=Hn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:u,strategy:a})),x=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),w=await(s.isElement==null?void 0:s.isElement(C))&&await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1},E=Hn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:C,strategy:a}):x);return{top:(v.top-E.top+d.top)/w.y,bottom:(E.bottom-v.bottom+d.bottom)/w.y,left:(v.left-E.left+d.left)/w.x,right:(E.right-v.right+d.right)/w.x}}const Mp=50,jp=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Np},a=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=ks(l,r,a),h=r,m=0;const d={};for(let g=0;g<s.length;g++){const b=s[g];if(!b)continue;const{name:v,fn:x}=b,{x:C,y:w,data:E,reset:S}=await x({x:u,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:d,rects:l,platform:c,elements:{reference:e,floating:t}});u=C??u,f=w??f,d[v]={...d[v],...E},S&&m<Mp&&(m++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(l=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:u,y:f}=ks(l,h,a)),g=-1)}return{x:u,y:f,placement:h,strategy:o,middlewareData:d}},Dp=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:l}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:d="none",flipAlignment:g=!0,...b}=pt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=Ue(o),x=Ge(c),C=Ue(c)===c,w=await(a.isRTL==null?void 0:a.isRTL(l.floating)),E=h||(C||!g?[Vn(c)]:ld(c)),S=d!=="none";!h&&S&&E.push(...pd(c,g,d,w));const R=[c,...E],T=await a.detectOverflow(t,b),P=[];let k=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&P.push(T[v]),f){const N=ad(o,i,w);P.push(T[N[0]],T[N[1]])}if(k=[...k,{placement:o,overflows:P}],!P.every(N=>N<=0)){var M,_;const N=(((M=s.flip)==null?void 0:M.index)||0)+1,I=R[N];if(I&&(!(f==="alignment"?x!==Ge(I):!1)||k.every(A=>Ge(A.placement)===x?A.overflows[0]>0:!0)))return{data:{index:N,overflows:k},reset:{placement:I}};let F=(_=k.filter(U=>U.overflows[0]<=0).sort((U,A)=>U.overflows[1]-A.overflows[1])[0])==null?void 0:_.placement;if(!F)switch(m){case"bestFit":{var D;const U=(D=k.filter(A=>{if(S){const j=Ge(A.placement);return j===x||j==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(j=>j>0).reduce((j,q)=>j+q,0)]).sort((A,j)=>A[1]-j[1])[0])==null?void 0:D[0];U&&(F=U);break}case"initialPlacement":F=c;break}if(o!==F)return{reset:{placement:F}}}return{}}}},bc=new Set(["left","top"]);async function Fp(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ue(n),c=tt(n),a=Ge(n)==="y",l=bc.has(i)?-1:1,u=s&&a?-1:1,f=pt(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:d}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof d=="number"&&(m=c==="end"?d*-1:d),a?{x:m*u,y:h*l}:{x:h*l,y:m*u}}const Lp=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await Fp(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},Bp=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:a={fn:x=>{let{x:C,y:w}=x;return{x:C,y:w}}},...l}=pt(e,t),u={x:n,y:r},f=await s.detectOverflow(t,l),h=Ge(o),m=Co(h);let d=u[m],g=u[h];const b=(x,C)=>Zi(C+f[x==="y"?"top":"left"],C,C-f[x==="y"?"bottom":"right"]);i&&(d=b(m,d)),c&&(g=b(h,g));const v=a.fn({...t,[m]:d,[h]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[m]:i,[h]:c}}}}}},Vp=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:o,y:s,placement:i,rects:c,middlewareData:a}=t,{offset:l=0,mainAxis:u=!0,crossAxis:f=!0}=pt(e,t),h={x:o,y:s},m=Ge(i),d=Co(m);let g=h[d],b=h[m];const v=pt(l,t),x=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:(n=v.mainAxis)!=null?n:0,crossAxis:(r=v.crossAxis)!=null?r:0};if(u){const E=d==="y"?"height":"width",S=c.reference[d]-c.floating[E]+x.mainAxis,R=c.reference[d]+c.reference[E]-x.mainAxis;g<S?g=S:g>R&&(g=R)}if(f){var C,w;const E=d==="y"?"width":"height",S=bc.has(Ue(i)),R=c.reference[m]-c.floating[E]+(S&&((C=a.offset)==null?void 0:C[m])||0)+(S?0:x.crossAxis),T=c.reference[m]+c.reference[E]+(S?0:((w=a.offset)==null?void 0:w[m])||0)-(S?x.crossAxis:0);b<R?b=R:b>T&&(b=T)}return{[d]:g,[m]:b}}}},Hp=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...c}=pt(e,t),a=await o.detectOverflow(t,c),l=Ue(n),u=tt(n),f=Ge(n)==="y",{width:h,height:m}=r.floating;let d,g;l==="top"||l==="bottom"?(d=l,g=u===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(g=l,d=u==="end"?"top":"bottom");const b=m-a.top-a.bottom,v=h-a.left-a.right,x=jt(m-a[d],b),C=jt(h-a[g],v),w=t.middlewareData.shift,E=!w;let S=x,R=C;w!=null&&w.enabled.x&&(R=v),w!=null&&w.enabled.y&&(S=b),E&&!u&&(f?R=h-2*st(a.left,a.right):S=m-2*st(a.top,a.bottom)),await i({...t,availableWidth:R,availableHeight:S});const T=await o.getDimensions(s.floating);return h!==T.width||m!==T.height?{reset:{rects:!0}}:{}}}};function vc(e){const t=We(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=je(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Bn(n)!==s||Bn(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function No(e){return ge(e)?e:e.contextElement}function _t(e){const t=No(e);if(!je(t))return it(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=vc(t);let i=(s?Bn(n.width):n.width)/r,c=(s?Bn(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const $p=it(0);function yc(e){const t=Ne(e);return!uo()||!t.visualViewport?$p:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Up(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ne(e)}function Et(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=No(e);let i=it(1);t&&(r?ge(r)&&(i=_t(r)):i=_t(e));const c=Up(s,n,r)?yc(s):it(0);let a=(o.left+c.x)/i.x,l=(o.top+c.y)/i.y,u=o.width/i.x,f=o.height/i.y;if(s&&r){const h=Ne(s),m=ge(r)?Ne(r):r;let d=h,g=kr(d);for(;g&&m!==d;){const b=_t(g),v=g.getBoundingClientRect(),x=We(g),C=v.left+(g.clientLeft+parseFloat(x.paddingLeft))*b.x,w=v.top+(g.clientTop+parseFloat(x.paddingTop))*b.y;a*=b.x,l*=b.y,u*=b.x,f*=b.y,a+=C,l+=w,d=Ne(g),g=kr(d)}}return Hn({width:u,height:f,x:a,y:l})}function rr(e,t){const n=Zn(e).scrollLeft;return t?t.left+n:Et(ct(e)).left+n}function xc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-rr(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Wp(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=ct(r),c=t?Jn(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},l=it(1);const u=it(0),f=je(r);if((f||!s)&&((He(r)!=="body"||Qn(i))&&(a=Zn(r)),f)){const m=Et(r);l=_t(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}const h=i&&!f&&!s?xc(i,a):it(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+u.x+h.x,y:n.y*l.y-a.scrollTop*l.y+u.y+h.y}}function qp(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function zp(e){const t=Zn(e),n=e.ownerDocument.body,r=st(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=st(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+rr(e);const i=-t.scrollTop;return We(n).direction==="rtl"&&(s+=st(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:s,y:i}}const Gp=25;function Kp(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=Ne(e),s=ct(e),i=o.visualViewport;let c=s.clientWidth,a=s.clientHeight,l=0,u=0;if(i){const h=!uo()||t==="fixed";r?h||(l=-i.offsetLeft,u=-i.offsetTop):(c=i.width,a=i.height,h&&(l=i.offsetLeft,u=i.offsetTop))}if(rr(s)<=0){const h=s.ownerDocument,m=h.body,d=getComputedStyle(m),g=h.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,b=Math.abs(s.clientWidth-m.clientWidth-g),v=getComputedStyle(s).scrollbarGutter==="stable both-edges"?b/2:b;v<=Gp&&(c-=v)}return{width:c,height:a,x:l,y:u}}function Yp(e,t){const n=Et(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=_t(e),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,l=r*s.y;return{width:i,height:c,x:a,y:l}}function _s(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Kp(e,n,t);else if(t==="document")r=zp(ct(e));else if(ge(t))r=Yp(t,n);else{const o=yc(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Hn(r)}function Xp(e,t){const n=t.get(e);if(n)return n;let r=Kt(e,[],!1).filter(c=>ge(c)&&He(c)!=="body"),o=null;const s=We(e).position==="fixed";let i=s?ft(e):e;for(;ge(i)&&!lt(i);){const c=We(i),a=lo(i),l=o?o.position:s?"fixed":"";!a&&(l==="fixed"||l==="absolute"&&c.position==="static")?r=r.filter(f=>f!==i):o=c,i=ft(i)}return t.set(e,r),r}function Qp(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Jn(t)?[]:Xp(t,this._c):[].concat(n),r],c=_s(t,i[0],o);let a=c.top,l=c.right,u=c.bottom,f=c.left;for(let h=1;h<i.length;h++){const m=_s(t,i[h],o);a=st(m.top,a),l=jt(m.right,l),u=jt(m.bottom,u),f=st(m.left,f)}return{width:l-f,height:u-a,x:f,y:a}}function Jp(e){const{width:t,height:n}=vc(e);return{width:t,height:n}}function Zp(e,t,n){const r=je(t),o=ct(t),s=n==="fixed",i=Et(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=it(0);if((r||!s)&&((He(t)!=="body"||Qn(o))&&(c=Zn(t)),r)){const h=Et(t,!0,s,t);a.x=h.x+t.clientLeft,a.y=h.y+t.clientTop}!r&&o&&(a.x=rr(o));const l=o&&!r&&!s?xc(o,c):it(0),u=i.left+c.scrollLeft-a.x-l.x,f=i.top+c.scrollTop-a.y-l.y;return{x:u,y:f,width:i.width,height:i.height}}function Cr(e){return We(e).position==="static"}function As(e,t){if(!je(e)||We(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ct(e)===n&&(n=n.ownerDocument.body),n}function wc(e,t){const n=Ne(e);if(Jn(e))return n;if(!je(e)){let o=ft(e);for(;o&&!lt(o);){if(ge(o)&&!Cr(o))return o;o=ft(o)}return n}let r=As(e,t);for(;r&&Tl(r)&&Cr(r);)r=As(r,t);return r&<(r)&&Cr(r)&&!lo(r)?n:r||Pl(e)||n}const eh=async function(e){const t=this.getOffsetParent||wc,n=this.getDimensions,r=await n(e.floating);return{reference:Zp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function th(e){return We(e).direction==="rtl"}const nh={convertOffsetParentRelativeRectToViewportRelativeRect:Wp,getDocumentElement:ct,getClippingRect:Qp,getOffsetParent:wc,getElementRects:eh,getClientRects:qp,getDimensions:Jp,getScale:_t,isElement:ge,isRTL:th};function Cc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function rh(e,t,n){let r=null,o;const s=ct(e);function i(){var u;clearTimeout(o),(u=r)==null||u.disconnect(),r=null}function c(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),i();const h=e.getBoundingClientRect(),{left:m,top:d,width:g,height:b}=h;if(u||t(),!g||!b)return;const v=xn(d),x=xn(s.clientWidth-(m+g)),C=xn(s.clientHeight-(d+b)),w=xn(m),S={rootMargin:-v+"px "+-x+"px "+-C+"px "+-w+"px",threshold:st(0,jt(1,f))||1};let R=!0;function T(P){const k=P[0].intersectionRatio;if(!Cc(h,e.getBoundingClientRect()))return c();if(k!==f){if(!R)return c();k?c(!1,k):o=setTimeout(()=>{c(!1,1e-7)},1e3)}R=!1}try{r=new IntersectionObserver(T,{...S,root:s.ownerDocument})}catch{r=new IntersectionObserver(T,S)}r.observe(e)}const a=Ne(e),l=()=>c(n);return a.addEventListener("resize",l),c(!0),()=>{a.removeEventListener("resize",l),i()}}function Ns(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,l=No(e),u=o||s?[...l?Kt(l):[],...t?Kt(t):[]]:[];u.forEach(v=>{o&&v.addEventListener("scroll",n),s&&v.addEventListener("resize",n)});const f=l&&c?rh(l,n,s):null;let h=-1,m=null;i&&(m=new ResizeObserver(v=>{let[x]=v;x&&x.target===l&&m&&t&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var C;(C=m)==null||C.observe(t)})),n()}),l&&!a&&m.observe(l),t&&m.observe(t));let d,g=a?Et(e):null;a&&b();function b(){const v=Et(e);g&&!Cc(g,v)&&n(),g=v,d=requestAnimationFrame(b)}return n(),()=>{var v;u.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f==null||f(),(v=m)==null||v.disconnect(),m=null,a&&cancelAnimationFrame(d)}}const oh=Lp,sh=Bp,ih=Dp,ch=Hp,ah=Vp,lh=(e,t,n)=>{const r=new Map,o=n??{},s={...nh,...o.platform,_c:r};return jp(e,t,{...o,platform:s})};var uh=typeof document<"u",fh=function(){},_n=uh?O.useLayoutEffect:fh;function zn(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,o;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(!zn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!zn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Sc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ms(e,t){const n=Sc(e);return Math.round(t*n)/n}function Sr(e){const t=y.useRef(e);return _n(()=>{t.current=e}),t}function dh(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:l}=e,[u,f]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=y.useState(r);zn(h,r)||m(r);const[d,g]=y.useState(null),[b,v]=y.useState(null),x=y.useCallback(A=>{A!==S.current&&(S.current=A,g(A))},[]),C=y.useCallback(A=>{A!==R.current&&(R.current=A,v(A))},[]),w=s||d,E=i||b,S=y.useRef(null),R=y.useRef(null),T=y.useRef(u),P=a!=null,k=Sr(a),M=Sr(o),_=Sr(l),D=y.useCallback(()=>{if(!S.current||!R.current)return;const A={placement:t,strategy:n,middleware:h};M.current&&(A.platform=M.current),lh(S.current,R.current,A).then(j=>{const q={...j,isPositioned:_.current!==!1};N.current&&!zn(T.current,q)&&(T.current=q,ht.flushSync(()=>{f(q)}))})},[h,t,n,M,_]);_n(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(A=>({...A,isPositioned:!1})))},[l]);const N=y.useRef(!1);_n(()=>(N.current=!0,()=>{N.current=!1}),[]),_n(()=>{if(w&&(S.current=w),E&&(R.current=E),w&&E){if(k.current)return k.current(w,E,D);D()}},[w,E,D,k,P]);const I=y.useMemo(()=>({reference:S,floating:R,setReference:x,setFloating:C}),[x,C]),F=y.useMemo(()=>({reference:w,floating:E}),[w,E]),U=y.useMemo(()=>{const A={position:n,left:0,top:0};if(!F.floating)return A;const j=Ms(F.floating,u.x),q=Ms(F.floating,u.y);return c?{...A,transform:"translate("+j+"px, "+q+"px)",...Sc(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:j,top:q}},[n,c,F.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:D,refs:I,elements:F,floatingStyles:U}),[u,D,I,F,U])}const ph=(e,t)=>{const n=oh(e);return{name:n.name,fn:n.fn,options:[e,t]}},hh=(e,t)=>{const n=sh(e);return{name:n.name,fn:n.fn,options:[e,t]}},mh=(e,t)=>({fn:ah(e).fn,options:[e,t]}),gh=(e,t)=>{const n=ih(e);return{name:n.name,fn:n.fn,options:[e,t]}},bh=(e,t)=>{const n=ch(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mo=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Mo.displayName="PreviewCardRootContext");function an(e){const t=y.useContext(Mo);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PreviewCardRootContext is missing. PreviewCard parts must be placed within <PreviewCard.Root>.":Rt(50));return t}class vh extends _o{setState(t){}update(t){}set(t,n){}notifyAll(){}}const yh=600,Ec=300,Rc={...Ep,instantType:e=>e.instantType,adaptiveOrigin:e=>e.adaptiveOrigin,closeDelay:e=>e.closeDelay};class xh extends _o{constructor(n,r,o){const s=new dc;super(Tc(n,s,r,o),Ic(s),Rc);ce(this,"setOpen",(n,r)=>{const{inlineRectCoordsRef:o}=this.context;np(this,n,r,{onBeforeDispatch(){var i;const s=r.event;n&&r.reason===Ye&&r.trigger&&"clientX"in s&&"clientY"in s&&((i=o.current)==null?void 0:i.element)!==r.trigger&&fc(o,r.trigger,s.clientX,s.clientY)}})})}}function wh(){const e=new dc;return new vh(Object.freeze(Tc(void 0,e)),Object.freeze(Ic(e)),Rc)}function Tc(e,t,n,r=!1){return{...Cp(t,n,r),instantType:void 0,adaptiveOrigin:void 0,closeDelay:Ec,...e}}function Ic(e){return{popupRef:y.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e,inlineRectCoordsRef:{current:void 0}}}function js(e){const{open:t,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:o,actionsRef:s,handle:i,triggerId:c,defaultTriggerId:a=null,children:l}=e,u=Qd((v,x)=>new xh({open:n,openProp:t,activeTriggerId:a,triggerIdProp:c},v,x));u.useControlledProp("openProp",t),u.useControlledProp("triggerIdProp",c),u.useContextCallback("onOpenChange",r),u.useContextCallback("onOpenChangeComplete",o);const f=u.useState("open"),h=u.useState("activeTriggerId"),m=u.useState("mounted"),d=u.useState("payload");op(u,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:g}=sp(f,u,()=>{u.context.inlineRectCoordsRef.current=void 0});he(()=>{f&&h==null&&u.set("payload",void 0)},[u,h,f]),y.useImperativeHandle(s,()=>({unmount:g,close:()=>u.setOpen(!1,ke(Pr))}),[g,u]);const b=f||m||i!=null;return p.jsxs(Mo.Provider,{value:u,children:[i&&p.jsx(Jd,{handle:i,store:u}),b&&p.jsx(Ch,{store:u}),typeof l=="function"?l({payload:d}):l]})}function Ch({store:e}){const t=e.useState("floatingRootContext"),n=Vd(t);return ip(e,{activeTriggerProps:n.reference,inactiveTriggerProps:n.trigger,popupProps:n.floating}),null}const Oc=Gi(function(t){return an(!0)?p.jsx(js,{...t}):p.jsx(Fd,{children:p.jsx(js,{...t})})});process.env.NODE_ENV!=="production"&&(Oc.displayName="PreviewCardRoot");const jo=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(jo.displayName="PreviewCardPortalContext");function Sh(){const e=y.useContext(jo);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <PreviewCard.Portal> is missing.":Rt(48));return e}const Pc=y.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,style:c,...a}=t,{node:l,subtree:u}=cc({container:o,ref:n,componentProps:t,elementProps:a});return!u&&!l?null:p.jsxs(y.Fragment,{children:[u,l&&ht.createPortal(r,l)]})});process.env.NODE_ENV!=="production"&&(Pc.displayName="FloatingPortalLite");const kc=y.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return an().useState("mounted")||r?p.jsx(jo.Provider,{value:r,children:p.jsx(Pc,{ref:n,...o})}):null});process.env.NODE_ENV!=="production"&&(kc.displayName="PreviewCardPortal");const _c=Pf(function(t,n){const{render:r,className:o,delay:s,closeDelay:i,id:c,payload:a,handle:l,style:u,...f}=t,h=an(!0),d=Rp(l)??h;if(!d)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <PreviewCard.Trigger> must be either used within a <PreviewCard.Root> component or provided with a handle.":Rt(89));const g=yi(c),b=d.useState("isTriggerActive",g),v=d.useState("isOpenedByTrigger",g),x=d.useState("floatingRootContext"),C=d.context.inlineRectCoordsRef,w=y.useRef(null),E=s??yh,S=i??Ec,{registerTrigger:R,isMountedByThisTrigger:T}=rp(g,w,d,{payload:a,closeDelay:S}),P=Pp(x,{mouseOnly:!0,move:!1,handleClose:Ap(),delay:()=>({open:E,close:S}),triggerElementRef:w,isActiveTrigger:b,isClosing:()=>d.select("transitionStatus")==="ending"}),k=Tp(x,{delay:E}),M={open:v},_=d.useState("triggerProps",T),D=qd(C,v);return mt("a",t,{state:M,ref:[n,R,w],props:[P,k.reference,_,D,{id:g},f],stateAttributesMapping:Qf})});process.env.NODE_ENV!=="production"&&(_c.displayName="PreviewCardTrigger");const Do=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Do.displayName="PreviewCardPositionerContext");function Eh(){const e=y.useContext(Do);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PreviewCardPositionerContext is missing. PreviewCardPositioner parts must be placed within <PreviewCard.Positioner>.":Rt(49));return e}function Rh(e){const{nodeId:t,externalTree:n,rootContext:r}=e,o=r.useState("referenceElement"),s=r.useState("floatingElement"),i=r.useState("domReferenceElement"),c=r.useState("open"),a=r.useState("floatingId"),[l,u]=y.useState(null),f=y.useRef(null),h=cn(n),m=y.useMemo(()=>({reference:o,floating:s,domReference:i}),[o,s,i]),d=dh({...e,elements:{...m,...l&&{reference:l}}}),g=y.useCallback(C=>{const w=ge(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;u(w),d.refs.setReference(w)},[d.refs]),b=y.useMemo(()=>({...d.refs,setPositionReference:g,domReference:f}),[d.refs,g]),v=y.useMemo(()=>({...d.elements,domReference:i}),[d.elements,i]),x=y.useMemo(()=>({...d,dataRef:r.context.dataRef,open:c,onOpenChange:r.setOpen,events:r.context.events,floatingId:a,refs:b,elements:v,nodeId:t,rootStore:r}),[d,b,v,t,r,c,a]);return he(()=>{i&&(f.current=i)},[i]),he(()=>{r.context.dataRef.current.floatingContext=x;const C=h==null?void 0:h.nodesRef.current.find(w=>w.id===t);C&&(C.context=x)}),y.useMemo(()=>({...d,context:x,refs:b,elements:v,rootStore:r}),[d,b,v,x,r])}const Ac=y.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ac.displayName="DirectionContext");function Th(){const e=y.useContext(Ac);return(e==null?void 0:e.direction)??"ltr"}const Ih=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:l,padding:u=0}=pt(e,t)||{};if(l==null)return{};const f=ec(u),h={x:n,y:r},m=Eo(o),d=So(m),g=await i.getDimensions(l),b=m==="y",v=b?"top":"left",x=b?"bottom":"right",C=b?"clientHeight":"clientWidth",w=s.reference[d]+s.reference[m]-h[m]-s.floating[d],E=h[m]-s.reference[m],S=c.floating[C]||s.floating[d],R=w/2-E/2,T=S/2-g[d]/2-1,P=Math.min(f[v],T),k=Math.min(f[x],T),M=P,_=S-g[d]-k,D=S/2-g[d]/2+R,N=Zi(M,D,_),I=!a.arrow&&tt(o)!=null&&D!==N&&s.reference[d]/2-(D<M?P:k)-g[d]/2<0,F=I?D<M?D-M:D-_:0;return{[m]:h[m]+F,data:{[m]:N,centerOffset:D-N-F,...I&&{alignmentOffset:F}},reset:I}}}),Oh=(e,t)=>{const{name:n,fn:r}=Ih(e);return{name:n,fn:r,options:[e,t]}},Ph={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0,i=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:i.top-n>=0||i.right-t>=0||i.bottom-n>=0||i.left-t>=0||s}}}},kh={sideX:"left",sideY:"top"},_h="--available-width",Ah="--available-height",Nh="--anchor-width",Mh="--anchor-height",jh="--transform-origin",Ds=_h,Fs=Ah;function Nc(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function Ls(e,t,n){const{rects:r,placement:o}=e;return{side:Nc(t,Ue(o),n),align:tt(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Dh(e){return Fh(e,Rh)}function Fh(e,t){var Vt,un;const{anchor:n,positionMethod:r="absolute",side:o="bottom",sideOffset:s=0,align:i="center",alignOffset:c=0,collisionBoundary:a,collisionPadding:l=5,sticky:u=!1,arrowPadding:f=5,disableAnchorTracking:h=!1,inline:m,keepMounted:d=!1,floatingRootContext:g,mounted:b,collisionAvoidance:v,shift:x,nodeId:C,adaptiveOrigin:w,lazyFlip:E=!1,externalTree:S}=e,R=v.side||"flip",T=v.align||"flip",P=v.fallbackAxisSide||"end",k=(x==null?void 0:x.crossAxis)??!1,M=x==null?void 0:x.rootBoundary,_=typeof n=="function"?n:void 0,D=fe(_),N=_?D:n,I=Xe(n),F=Xe(b),A=Th()==="rtl",[j,q]=y.useState(null);!b&&j!==null&&q(null);const z=E==="placement",ae=j?Ue(j):null,re=j&&z?tt(j)||"center":null,B=ae||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":A?"left":"right","inline-start":A?"right":"left"}[o],G=re||i,V=G==="center"?B:`${B}-${G}`;let H=l;typeof H=="number"?H={top:H,right:H,bottom:H,left:H}:H&&(H={top:H.top||0,right:H.right||0,bottom:H.bottom||0,left:H.left||0});const Z=1,oe=o==="bottom"?Z:0,ee=o==="top"?Z:0,te=o==="right"?Z:0,$=o==="left"?Z:0,ne={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:H},se=y.useRef(null),be=Xe(s),ve=Xe(c),Oe=typeof s!="function"?s:0,Ae=typeof c!="function"?c:0,xe=[];m&&xe.push(m),xe.push(ph(pe=>{const De=Ls(pe,o,A),ze=typeof be.current=="function"?be.current(De):be.current,Be=typeof ve.current=="function"?ve.current(De):ve.current;return{mainAxis:ze,crossAxis:Be,alignmentAxis:Be}},[Oe,Ae,A,o]));const Me=T==="none"&&R!=="shift",Le=!Me&&(u||k||R==="shift"),K=R==="none"?null:gh({...ne,padding:{top:H.top+Z+oe,right:H.right+Z+$,bottom:H.bottom+Z+ee,left:H.left+Z+te},mainAxis:!k&&R==="flip",crossAxis:T==="flip"?"alignment":!1,fallbackAxisSideDirection:P}),J=Me?null:hh({...ne,rootBoundary:M,mainAxis:T!=="none",crossAxis:Le,limiter:u||k?void 0:mh(pe=>{if(!se.current)return{};const{width:De,height:ze}=se.current.getBoundingClientRect(),Be=Ge(Ue(pe.placement)),et=Be==="y"?De:ze,Ke=Be==="y"?H.left+H.right:H.top+H.bottom;return{offset:et/2+Ke/2}})},[ne,u,k,M,H,T]);R==="shift"||T==="shift"||G==="center"?xe.push(J,K):xe.push(K,J),xe.push(bh({...ne,apply({elements:{floating:pe},availableWidth:De,availableHeight:ze,rects:Be}){if(!F.current)return;const et=pe.style;et.setProperty(Ds,`${De}px`),et.setProperty(Fs,`${ze}px`);const Ke=Ne(pe).devicePixelRatio||1,{x:fn,y:Tt,width:dn,height:at}=Be.reference,rt=(Math.round((fn+dn)*Ke)-Math.round(fn*Ke))/Ke,Ht=(Math.round((Tt+at)*Ke)-Math.round(Tt*Ke))/Ke;et.setProperty(Nh,`${rt}px`),et.setProperty(Mh,`${Ht}px`)}}),Oh(pe=>({element:se.current||Je(pe.elements.floating).createElement("div"),padding:se.current?f:0}),[f]),{name:"transformOrigin",fn(pe){var Vo,Ho,$o,Uo,Wo,qo;const{elements:{floating:De},middlewareData:ze,placement:Be,platform:et,rects:Ke,y:fn}=pe,Tt=Ue(Be),dn=tt(Be),at=Ge(Tt)==="y",rt=se.current,Ht=typeof s=="function"?s(Ls(pe,o,A)):s;let pn;if(!rt&&dn&&Math.abs(at?((Vo=ze.shift)==null?void 0:Vo.x)||0:((Ho=ze.shift)==null?void 0:Ho.y)||0)<=1)pn=dn==="start"===(at&&(($o=et.isRTL)==null?void 0:$o.call(et,De))===!0)?"100%":"0%";else{const Wc=at?((Uo=ze.arrow)==null?void 0:Uo.x)||0:((Wo=ze.arrow)==null?void 0:Wo.y)||0,qc=at?(rt==null?void 0:rt.clientWidth)||0:(rt==null?void 0:rt.clientHeight)||0;pn=`${Wc+qc/2}px`}let or=Tt==="top"||Tt==="left"?`calc(100% + ${Ht}px)`:`${-Ht}px`;return Le&&at&&Math.abs(((qo=ze.shift)==null?void 0:qo.y)||0)>Ht&&(or=`${Ke.reference.y+Ke.reference.height/2-fn}px`),De.style.setProperty(jh,at?`${pn} ${or}`:`${or} ${pn}`),{}}},Ph,w),he(()=>{!b&&g&&g.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[b,g]);const ue=y.useMemo(()=>({ancestorScroll:!h,elementResize:!h&&typeof ResizeObserver<"u",layoutShift:!h&&typeof IntersectionObserver<"u"}),[h]),{refs:L,elements:Y,x:Ee,y:me,middlewareData:Re,update:W,placement:Q,context:X,isPositioned:ie,floatingStyles:Se}=t({rootContext:g,open:d?b:void 0,placement:V,middleware:xe,strategy:r,whileElementsMounted:d?void 0:(...pe)=>Ns(...pe,ue),nodeId:C,externalTree:S}),{sideX:de,sideY:_e}=Re.adaptiveOrigin||kh,Te=ie?r:"fixed",qe=y.useMemo(()=>{let pe;return ie?w?pe={position:Te,[de]:Ee,[_e]:me}:pe={...Se,position:Te}:pe={position:Te,top:0,left:0},pe[Ds]="100vw",pe[Fs]="100vh",ie||(pe.opacity=0),pe},[w,Te,de,Ee,_e,me,Se,ie]),$e=y.useRef(null);he(()=>{if(!b)return;const pe=I.current,De=typeof pe=="function"?pe():pe,Be=(Bs(De)?De.current:De)||null||null;Be!==$e.current&&(L.setPositionReference(Be),$e.current=Be)},[b,L,N,I]),y.useEffect(()=>{if(!b)return;const pe=I.current;typeof pe!="function"&&Bs(pe)&&pe.current!==$e.current&&(L.setPositionReference(pe.current),$e.current=pe.current)},[b,L,N,I]),y.useEffect(()=>{if(d&&b&&Y.reference&&Y.floating)return Ns(Y.reference,Y.floating,W,ue)},[d,b,Y,W,ue]);const nt=Ue(Q),gt=Nc(o,nt,A),bt=tt(Q)||"center",Lt=!!((Vt=Re.hide)!=null&&Vt.referenceHidden);he(()=>{E&&b&&ie&&(nt!==B||z&&bt!==G)&&q(Q)},[E,z,b,ie,Q,nt,bt,B,G]);const ln=y.useMemo(()=>{var pe,De;return{position:"absolute",top:(pe=Re.arrow)==null?void 0:pe.y,left:(De=Re.arrow)==null?void 0:De.x}},[Re.arrow]),Bt=((un=Re.arrow)==null?void 0:un.centerOffset)!==0;return y.useMemo(()=>({positionerStyles:qe,arrowStyles:ln,arrowRef:se,arrowUncentered:Bt,side:gt,align:bt,physicalSide:nt,anchorHidden:Lt,refs:L,context:X,isPositioned:ie,update:W}),[qe,ln,se,Bt,gt,bt,nt,Lt,L,X,ie,W])}function Bs(e){return e!=null&&"current"in e}function Mc(e){return e==="starting"?Od:Ve}function Lh(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:c=!1}){const a={...n};return c&&(a.pointerEvents="none"),mt("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:a},Mc(r),o],stateAttributesMapping:Qi})}const jc=y.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:c="bottom",align:a="center",sideOffset:l=0,alignOffset:u=0,collisionBoundary:f="clipping-ancestors",collisionPadding:h=5,arrowPadding:m=5,sticky:d=!1,disableAnchorTracking:g=!1,collisionAvoidance:b=Pd,style:v,...x}=t,C=an(),w=Sh(),E=jd(),S=C.useState("open"),R=C.useState("mounted"),T=C.useState("floatingRootContext"),P=C.useState("instantType"),k=C.useState("transitionStatus"),M=C.useState("adaptiveOrigin"),_=C.context.inlineRectCoordsRef,D=Dh({anchor:s,floatingRootContext:T,positionMethod:i,mounted:R,side:c,sideOffset:l,align:a,alignOffset:u,arrowPadding:m,collisionBoundary:f,collisionPadding:h,sticky:d,disableAnchorTracking:g,keepMounted:w,nodeId:E,collisionAvoidance:b,adaptiveOrigin:M,inline:zd(_)}),N=D.update;he(()=>{S&&R&&N()},[S,R,N]);const I={open:S,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:P},F=Lh(t,I,{styles:D.positionerStyles,transitionStatus:k,props:x,refs:[n,C.useStateSetter("positionerElement")],hidden:!R,inert:!S});return p.jsx(Do.Provider,{value:D,children:p.jsx(Dd,{id:E,children:F})})});process.env.NODE_ENV!=="production"&&(jc.displayName="PreviewCardPositioner");const Dc=y.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,c=an(),{side:a,align:l}=Eh(),u=c.useState("open"),f=c.useState("instantType"),h=c.useState("transitionStatus"),m=c.useState("popupProps"),d=c.useState("floatingRootContext"),g=c.useState("closeDelay");return fo({open:u,ref:c.context.popupRef,onComplete(){var x,C;u&&((C=(x=c.context).onOpenChangeComplete)==null||C.call(x,!0))}}),Ip(d,{closeDelay:g}),mt("div",t,{state:{open:u,side:a,align:l,instant:f,transitionStatus:h},ref:[n,c.context.popupRef,c.useStateSetter("popupElement")],props:[Xd,m,Mc(h),i],stateAttributesMapping:Jf})});process.env.NODE_ENV!=="production"&&(Dc.displayName="PreviewCardPopup");class Bh extends Gd{constructor(){super(wh(),"PreviewCard")}open(t){this.openByTrigger(t)}close(){this.closePopup()}get isOpen(){var t;return((t=this.attachedStore)==null?void 0:t.select("open"))??!1}}function Vh(){return new Bh}const Hh=Vh;function $h(e){return p.jsx(Oc,{...e})}function Uh(e){return p.jsx(_c,{"data-slot":"hover-card-trigger",...e})}function Wh({className:e,side:t="bottom",sideOffset:n=6,align:r="center",alignOffset:o=0,...s}){return p.jsx(kc,{children:p.jsx(jc,{align:r,alignOffset:o,side:t,sideOffset:n,className:"vps-hover-card-positioner",children:p.jsx(Dc,{"data-slot":"hover-card-content",...s,className:i=>le("vps-hover-card",typeof e=="function"?e(i):e)})})})}function qh({className:e,...t}){return p.jsx("span",{className:le("inline-citation",e),...t})}const Fo=O.createContext(null);function Fc(e){!e.popup||!e.focusRequested||!e.handle.isOpen||(e.focusRequested=!1,e.popup.focus())}function zh({handle:e,onOpenChange:t,openDelay:n=80,closeDelay:r=180,...o}){const[s]=O.useState(()=>Hh()),i=e??s,c=O.useMemo(()=>({handle:i,openDelay:n,closeDelay:r,trigger:null,popup:null,focusRequested:!1}),[i,n,r]);return p.jsx(Fo.Provider,{value:c,children:p.jsx($h,{...o,handle:i,onOpenChange:(a,l)=>{var u,f;t==null||t(a,l),!a&&l.reason==="escape-key"&&((u=c.popup)!=null&&u.contains(document.activeElement))&&((f=c.trigger)==null||f.focus())}})})}function zr(e){try{return new URL(e).hostname||e}catch{return e}}function Gh({sources:e,delay:t,closeDelay:n,id:r,children:o,onClick:s,...i}){const c=O.useContext(Fo),a=O.useId(),l=r??a,u=e[0],f=u?zr(u):"Source";return p.jsx(Uh,{id:l,handle:c==null?void 0:c.handle,delay:t??(c==null?void 0:c.openDelay)??80,closeDelay:n??(c==null?void 0:c.closeDelay)??180,render:p.jsx(ho,{variant:"secondary",size:"xs","aria-haspopup":"dialog",...i,onClick:h=>{s==null||s(h),!(!c||h.defaultPrevented)&&(c.trigger=h.currentTarget,c.focusRequested=!0,c.handle.open(l),Fc(c))}}),children:o??(e.length>1?`${f} +${e.length-1}`:f)})}function Kh({ref:e,onBlur:t,...n}){const r=O.useContext(Fo);return p.jsx(Wh,{tabIndex:-1,role:"dialog","aria-label":"Source preview",...n,ref:o=>{typeof e=="function"?e(o):e&&(e.current=o),r&&(r.popup=o,o&&Fc(r))},onBlur:o=>{t==null||t(o),!(!r||o.defaultPrevented)&&o.relatedTarget!==r.trigger&&!o.currentTarget.contains(o.relatedTarget)&&r.handle.close()}})}const Lc=O.createContext(null);function Lo(){const e=O.useContext(Lc);if(!e)throw new Error("Citation carousel parts must be rendered inside InlineCitationCarousel.");return e}function Yh({opts:e,plugins:t,orientation:n="horizontal",setApi:r,className:o,...s}){const[i,c]=wo({...e,axis:n==="vertical"?"y":"x"},t),[{selected:a,count:l},u]=O.useState({selected:0,count:0});return O.useEffect(()=>{if(!c)return;r==null||r(c);const f=()=>u({selected:c.selectedScrollSnap(),count:c.scrollSnapList().length});return f(),c.on("select",f).on("reInit",f),()=>{c.off("select",f).off("reInit",f)}},[c,r]),p.jsx(Lc.Provider,{value:{viewportRef:i,api:c,selected:a,count:l},children:p.jsx("div",{role:"region","aria-roledescription":"carousel",...s,className:le("inline-citation-carousel",o),"data-orientation":n})})}function Xh({className:e,...t}){const{viewportRef:n}=Lo();return p.jsx("div",{ref:n,className:"inline-citation-viewport",children:p.jsx("div",{className:le("inline-citation-track",e),...t})})}function Qh({className:e,...t}){return p.jsx("div",{role:"group","aria-roledescription":"slide",className:le("inline-citation-slide",e),...t})}function Jh({className:e,...t}){return p.jsx("div",{className:le("inline-citation-carousel-header",e),...t})}function Zh({children:e,...t}){const{selected:n,count:r}=Lo();return p.jsx("div",{"aria-live":"polite",...t,children:e??(r?`${n+1}/${r}`:"")})}function Bc({next:e,children:t,disabled:n,onClick:r,...o}){const{api:s}=Lo(),i=e?s==null?void 0:s.canScrollNext():s==null?void 0:s.canScrollPrev();return p.jsx(ho,{variant:"ghost",size:"icon-xs","aria-label":e?"Next source":"Previous source",...o,disabled:n||!i,onClick:c=>{r==null||r(c),!c.defaultPrevented&&(e?s==null||s.scrollNext():s==null||s.scrollPrev())},children:t??(e?p.jsx(ti,{size:14,"aria-hidden":"true"}):p.jsx(ya,{size:14,"aria-hidden":"true"}))})}function em(e){return p.jsx(Bc,{...e,next:!1})}function tm(e){return p.jsx(Bc,{...e,next:!0})}function nm({title:e,url:t,description:n,className:r,children:o,...s}){const i=t?go(t):void 0;return p.jsxs("div",{className:le("inline-citation-source",r),...s,children:[p.jsx("div",{className:"inline-citation-title",children:e||(i?zr(i):"Source")}),i&&p.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:[zr(i),p.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}),n&&p.jsx("p",{children:n}),o]})}function rm({className:e,...t}){return p.jsx("blockquote",{className:le("inline-citation-quote",e),...t})}const om={"fuel-defect-reporting":{label:"Fuel Defect Reporting",path:"/dashboard/fuel-Defect-Reporting"},"bunker-master":{label:"Bunker Master",path:"/dashboard/bunker-master"},"fsc-fsq-e-forms":{label:"Pre-Registration & E-Forms",path:"/dashboard/pre-registration"},"pre-registration-ship":{label:"Pre-Registration",path:"/dashboard/pre-registration"},"reports-fuel":{label:"Fuel Reports",path:"/dashboard/reports"},"sample-fuel":{label:"Sample Status",path:"/dashboard/sample-status"}};function Vc(e){const n=(e.split(/[/\\]/).pop()||"").replace(/\.md$/i,"").toLowerCase();for(const[r,o]of Object.entries(om))if(n.includes(r))return o;return null}function Gr(e){return e.title?e.title:(e.source.split(/[/\\]/).pop()||e.source).replace(/\.md$/i,"").replace(/[-_]/g," ").replace(/\b\w/g,n=>n.toUpperCase())}const sm=({sources:e,hideInspectSources:t=!1,showInspectSources:n=!0,defaultExpanded:r=!1,maxSources:o=5})=>{const s=t||n===!1,[i,c]=O.useState(r&&!s),[a,l]=O.useState(null);if(!e||!e.length)return null;const u=e.slice(0,o),f=u.length===1?"source":"sources",h=p.jsxs(Nt,{children:[p.jsx(Ct,{children:p.jsx(Ea,{size:14})}),p.jsx(Mt,{children:`${u.length} retrieved VPS ${f}`}),!s&&p.jsx(Yt,{children:i?"Hide Details":"Inspect Sources"})]}),m=p.jsx(yt,{className:"grounded-source-rows",children:u.map((d,g)=>{const b=a===g,v=p.jsxs(Nt,{children:[p.jsx(Ct,{children:p.jsx(ba,{size:13})}),p.jsxs(Mt,{children:["[S",g+1,"] ",Gr(d)]}),p.jsxs(Yt,{title:"Ranking score, not a probability of correctness",children:["Score ",d.score.toFixed(2)]})]});return s?p.jsx("div",{children:v},`${d.chunkId}-${g}`):p.jsx("button",{type:"button",className:`trace-trigger${i&&b?" grounded-source-selected":""}`,"aria-pressed":i&&b,onClick:()=>{c(!0),l(b?null:g)},title:d.source,children:v},`${d.chunkId}-${g}`)})});return s?p.jsxs(yt,{className:"grounded-sources-card",children:[h,m]}):p.jsx(yt,{className:"grounded-sources-card",children:p.jsxs(_i,{open:i,onOpenChange:c,children:[p.jsx(Ai,{children:h}),m,p.jsx(Ni,{children:p.jsx("div",{className:"grounded-sources-details-list",children:u.map((d,g)=>{const b=Gr(d),v=Vc(d.source),x=a===g;return p.jsxs("div",{className:`grounded-detail-item${x?" grounded-detail-item--highlighted":""}`,children:[p.jsxs("div",{className:"grounded-detail-top",children:[p.jsxs("div",{className:"grounded-detail-title-group",children:[p.jsxs("span",{className:"grounded-detail-index",children:["[",g+1,"]"]}),p.jsx("span",{className:"grounded-detail-title",children:b})]}),p.jsxs("div",{className:"grounded-detail-meta",children:[p.jsxs("span",{className:"grounded-detail-score",children:["Rank score ",d.score.toFixed(2)]}),v&&p.jsxs("a",{href:v.path,onClick:C=>{C.preventDefault(),window.location.href=v.path},className:"grounded-route-link",title:`Navigate to ${v.label}`,children:[p.jsx("span",{children:v.label}),p.jsx(Ca,{size:10,"aria-hidden":"true"})]})]})]}),p.jsx("div",{className:"grounded-detail-path",children:p.jsx("code",{children:d.source})}),d.snippet&&p.jsxs("p",{className:"grounded-detail-snippet",children:['"',d.snippet,'"']})]},`detail-${d.chunkId}-${g}`)})})})]})})};function im({label:e,sources:t}){const n=t.map(r=>{var i;const o=Gr(r),s=go(r.url||r.source)??((i=Vc(r.source))==null?void 0:i.path);return{key:r.chunkId,label:s||o,content:p.jsxs(p.Fragment,{children:[p.jsx(nm,{title:o,url:s}),r.snippet&&p.jsx(rm,{children:r.snippet})]})}});return p.jsx(qh,{children:p.jsxs(zh,{children:[p.jsx(Gh,{sources:n.map(r=>r.label),"aria-label":"View sources "+e,children:e}),p.jsx(Kh,{children:n.length===1?n[0].content:p.jsxs(Yh,{"aria-label":"Sources",children:[p.jsxs(Jh,{children:[p.jsx(Zh,{}),p.jsx(em,{}),p.jsx(tm,{})]}),p.jsx(Xh,{children:n.map((r,o)=>p.jsx(Qh,{"aria-label":"Source "+(o+1),children:r.content},r.key+"-"+o))})]})})]})})}function cm(e,t){if(!e)return[];const n=/(\[[^\]]+\]\([^)]+\)|\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|https?:\/\/[^\s]+|\[S\d+(?:\s*,\s*S\d+)*\])/g;return e.split(n).map((o,s)=>{if(!o)return null;if(t!=null&&t.length&&/^\[S\d+(?:\s*,\s*S\d+)*\]$/.test(o)){const c=[...new Set(o.match(/\d+/g))].map(a=>t[Number(a)-1]);if(c.every(a=>a!==void 0))return p.jsx(im,{label:o,sources:c},s)}const i=o.match(/^\[([^\]]+)\]\(([^)]+)\)$/);if(i){const c=i[1],a=i[2],l=go(a);if(!l)return p.jsx(O.Fragment,{children:c},s);const u=/^https?:\/\//i.test(a);return p.jsx("a",{href:l,target:u?"_blank":void 0,rel:u?"noopener noreferrer":void 0,className:"md-link",children:c},s)}return o.startsWith("**")&&o.endsWith("**")&&o.length>=4?p.jsx("strong",{children:o.slice(2,-2)},s):o.startsWith("*")&&o.endsWith("*")&&o.length>=2?p.jsx("em",{children:o.slice(1,-1)},s):o.startsWith("`")&&o.endsWith("`")&&o.length>=2?p.jsx("code",{className:"md-code",children:o.slice(1,-1)},s):/^https?:\/\//i.test(o)?p.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"md-link",children:o},s):p.jsx(O.Fragment,{children:o},s)})}function am(e){const t=e.replace(/\r\n/g,`
|
|
212
212
|
`).split(`
|
|
213
213
|
`),n=[];let r=0;for(;r<t.length;){const s=t[r].trim();if(!s){r++;continue}if(s.startsWith("```")){const a=s.slice(3).trim(),l=[];for(r++;r<t.length&&!t[r].trim().startsWith("```");)l.push(t[r]),r++;r<t.length&&t[r].trim().startsWith("```")&&r++,n.push({type:"code",lang:a,code:l.join(`
|
|
214
|
-
`)});continue}if(/^(---|___|\*\*\*)$/.test(s)){n.push({type:"hr"}),r++;continue}const i=s.match(/^(#{1,4})\s+(.*)$/);if(i){n.push({type:"h",level:i[1].length,content:i[2]}),r++;continue}if(s.startsWith(">")){const a=[];for(;r<t.length&&t[r].trim().startsWith(">");)a.push(t[r].trim().replace(/^>\s?/,"")),r++;n.push({type:"quote",lines:a});continue}if(/^[-*]\s+/.test(s)){const a=[];for(;r<t.length&&/^[-*]\s+/.test(t[r].trim());)a.push(t[r].trim().replace(/^[-*]\s+/,"")),r++;n.push({type:"ul",items:a});continue}if(/^\d+\.\s+/.test(s)){const a=[];for(;r<t.length&&/^\d+\.\s+/.test(t[r].trim());)a.push(t[r].trim().replace(/^\d+\.\s+/,"")),r++;n.push({type:"ol",items:a});continue}if(s.startsWith("|")&&s.endsWith("|")){const a=[];for(;r<t.length&&t[r].trim().startsWith("|")&&t[r].trim().endsWith("|");)a.push(t[r].trim()),r++;if(a.length>=2){const l=
|
|
215
|
-
`).map((s,i)=>p.jsxs("span",{className:"md-code-line",children:[p.jsx("span",{className:"md-code-number","aria-hidden":"true",children:i+1}),p.jsx("span",{children:s||" "})]},i))})})]})}const Ls=I.memo(function({text:t,streaming:n=!1,sources:r}){if(!t)return null;const o=og(t),s=i=>rg(i,r);return p.jsx("div",{className:"md-content",children:o.map((i,c)=>{switch(i.type){case"h":return i.level===1?p.jsx("h2",{className:"md-h1",children:s(i.content)},c):i.level===2?p.jsx("h3",{className:"md-h2",children:s(i.content)},c):i.level===3?p.jsx("h4",{className:"md-h3",children:s(i.content)},c):p.jsx("h5",{className:"md-h4",children:s(i.content)},c);case"ul":return p.jsx("ul",{className:"md-ul",children:i.items.map((a,l)=>p.jsx("li",{className:"md-li",children:s(a)},l))},c);case"ol":return p.jsx("ol",{className:"md-ol",children:i.items.map((a,l)=>p.jsx("li",{className:"md-li",children:s(a)},l))},c);case"code":return p.jsx(sg,{code:i.code,lang:i.lang,streaming:n},c);case"quote":return p.jsx("blockquote",{className:"md-quote",children:i.lines.map((a,l)=>p.jsx("p",{children:s(a)},l))},c);case"hr":return p.jsx("hr",{className:"md-hr"},c);case"table":return p.jsx("div",{className:"md-table-wrap",children:p.jsxs("table",{className:"md-table",children:[p.jsx("thead",{children:p.jsx("tr",{children:i.headers.map((a,l)=>p.jsx("th",{children:s(a)},l))})}),p.jsx("tbody",{children:i.rows.map((a,l)=>p.jsx("tr",{children:a.map((f,u)=>p.jsx("td",{children:s(f)},u))},l))})]})},c);case"p":default:return p.jsx("p",{className:"md-p",children:i.lines.map((a,l)=>p.jsxs(I.Fragment,{children:[s(a),l<i.lines.length-1&&p.jsx("br",{})]},l))},c)}})})}),ig=I.lazy(async()=>({default:(await import("streamdown")).Streamdown})),Bc=I.createContext(null);function Vc(){const e=I.useContext(Bc);if(!e)throw new Error("Reasoning parts must be rendered inside Reasoning.");return e}function cg({isStreaming:e=!1,open:t,defaultOpen:n,onOpenChange:r,duration:o,className:s,...i}){const[c,a]=I.useState(n),[l,f]=I.useState(),u=I.useRef(null),h=t??c??e;I.useEffect(()=>{e?u.current=performance.now():u.current!==null&&(f(Math.round((performance.now()-u.current)/1e3)),u.current=null)},[e]);function g(d){t===void 0&&a(d),r==null||r(d)}return p.jsx(Bc.Provider,{value:{isStreaming:e,isOpen:h,setIsOpen:g,duration:o??l},children:p.jsx(bt,{className:s,children:p.jsx(Ii,{...i,open:h,onOpenChange:g})})})}function ag({getThinkingMessage:e,children:t,icon:n,description:r,...o}){const{isStreaming:s,duration:i}=Vc(),c=s?"Thinking":i===void 0?"Thought":`Thought for ${i}s`;return p.jsx(_i,{...o,children:p.jsxs(Nt,{status:s?"running":void 0,children:[p.jsx(xt,{children:n??(s?p.jsx(ti,{size:14,className:"trace-spinner"}):p.jsx(Qs,{size:14}))}),p.jsx(jt,{children:t??(e==null?void 0:e(s,i))??c}),r&&p.jsx(Kt,{"aria-hidden":s||void 0,children:r})]})})}function lg({children:e,className:t,...n}){const{isStreaming:r}=Vc();return p.jsx(ki,{className:ue("reasoning-content",t),...n,children:typeof e=="string"?p.jsx(I.Suspense,{fallback:p.jsx("div",{className:"md-content reasoning-text",children:e}),children:p.jsx(ig,{className:"md-content",isAnimating:r,mode:r?"streaming":"static",children:e})}):e})}function ug(e){return e==="create_ticket"?"Support ticket processed":e==="get_customer"?"Account verified":e==="get_ticket"?"Ticket status loaded":"Information retrieved"}const fg=({status:e="complete",progressText:t,progressSteps:n=[],durationMs:r,toolCalls:o=[]})=>{const s=e==="pending",i=e==="stopped",[c,a]=I.useState(0);I.useEffect(()=>{if(!s)return;const u=Date.now(),h=setInterval(()=>{a(Number(((Date.now()-u)/1e3).toFixed(1)))},250);return()=>clearInterval(h)},[s]);const l=n.length>0||o.length>0,f=r===void 0?void 0:Number((r/1e3).toFixed(1));return l?p.jsxs(cg,{className:"chat-response-trace",isStreaming:s,duration:f,children:[p.jsx(ag,{getThinkingMessage:i?()=>"Response stopped":void 0,icon:i?p.jsx(ri,{size:12}):void 0,description:s?`${c.toFixed(1)}s`:void 0}),p.jsx(lg,{children:p.jsxs(bt,{children:[n.map((u,h)=>p.jsxs(Ks,{children:[p.jsx(ca,{children:p.jsx("span",{className:"chat-progress-dot"})}),p.jsx(Ys,{children:u})]},`${u}-${h}`)),o.map((u,h)=>p.jsxs(Nt,{children:[p.jsx(xt,{children:p.jsx(_a,{size:13})}),p.jsx(jt,{children:ug(u.toolName)})]},`${u.toolName}-${h}`))]})})]}):p.jsx(bt,{className:"chat-response-trace",children:p.jsxs(Nt,{status:s?"running":void 0,children:[p.jsx(xt,{children:s?p.jsx(ti,{size:14,className:"trace-spinner"}):p.jsx(Qs,{size:14})}),p.jsx(jt,{children:s?t||"Thinking":i?"Response stopped":"Thought"}),s?p.jsxs(Kt,{"aria-hidden":"true",children:[c.toFixed(1),"s"]}):!i&&f!==void 0&&p.jsxs(Kt,{children:[f,"s"]})]})})},dg=({message:e,onEdit:t})=>{var g,d,m,b;const n=qn(),r=(n==null?void 0:n.hideInspectSources)??!1,o=(n==null?void 0:n.showGroundedSources)??!1,s=e.role==="user",i=e.status==="error",c=e.status==="pending",a=e.status==="stopped",l=e.id.startsWith("welcome"),f=e.role==="assistant"&&!l&&!i,u=f&&(c||a||e.durationMs!==void 0||!!((g=e.progressSteps)!=null&&g.length||(d=e.sources)!=null&&d.length||(m=e.toolCalls)!=null&&m.length||e.usage)),h=f&&!c&&!a&&e.content.trim().length>0;return p.jsxs(Jr,{align:s?"end":"start",children:[e.role==="assistant"&&p.jsx(oi,{className:"avatar-circle","aria-hidden":"true",children:p.jsx(Js,{size:15})}),p.jsxs(Zr,{children:[u&&p.jsx(Aa,{children:p.jsx(fg,{status:c?"pending":a?"stopped":"complete",progressText:e.progressText,progressSteps:e.progressSteps,durationMs:e.durationMs,toolCalls:e.toolCalls})}),s?p.jsx(Ar,{align:"end",children:p.jsx(Nr,{className:"msg-user-pre",children:e.content})}):l||i?p.jsx(Ar,{variant:i?"destructive":"muted",children:p.jsx(Nr,{children:p.jsx(Ls,{text:e.content})})}):e.content&&p.jsxs("div",{className:"chat-message-body",children:[p.jsx(Ls,{text:e.content,streaming:c,sources:f&&!c&&!a&&!r?e.sources:void 0}),f&&!c&&!a&&o&&((b=e.sources)!=null&&b.length)?p.jsx(tg,{sources:e.sources,hideInspectSources:r}):null]}),h&&n&&p.jsx(Cr,{children:p.jsx($u,{message:e,onFeedback:n.toggleMessageFeedback})}),s&&!i&&p.jsxs(Cr,{children:[t&&p.jsx("button",{type:"button",className:"chat-message-action","aria-label":"Edit message",title:"Edit message",disabled:(n==null?void 0:n.status)==="awaiting"||(n==null?void 0:n.status)==="connecting"||!!(n!=null&&n.pendingTicket),onClick:()=>t(e.content),children:p.jsx(wa,{size:14,"aria-hidden":"true"})}),p.jsx(Xr,{size:13,className:"msg-tick","aria-hidden":"true"})]})]})]})},pg=({onEdit:e})=>{const{messages:t,status:n,suggestions:r,showSuggestions:o,sendMessage:s}=en(),i=n==="awaiting"||n==="connecting",c=t.filter(a=>a.status!=="error");return p.jsx(Mu,{autoScroll:!0,defaultScrollPosition:"last-anchor",scrollPreviousItemPeek:64,children:p.jsxs(Du,{children:[p.jsx(Fu,{"aria-label":"Chat messages",children:p.jsxs(Lu,{"aria-busy":i,children:[c.length===0&&p.jsx(cs,{messageId:"welcome",children:p.jsx(Vu,{})}),c.map(a=>p.jsx(cs,{messageId:a.streamId??a.id,"data-role":a.role,scrollAnchor:a.role==="user",children:p.jsx(dg,{message:a,onEdit:e})},a.streamId??a.id))]})}),p.jsx(Bu,{})]})})},hg=()=>{const{pendingTicket:e,ticketBusy:t,userContext:n,confirmTicket:r,cancelTicket:o}=en(),s=!n.customerId&&!n.email,[i,c]=I.useState("");return e?p.jsxs("div",{className:"ticket-card",role:"region","aria-label":"Create support ticket",children:[p.jsx("h3",{className:"ticket-card-title",children:"Create support ticket?"}),p.jsx("p",{className:"ticket-card-desc",children:"I can open a support request for you. Nothing is created until you confirm."}),p.jsx("p",{className:"ticket-card-body",children:e.description}),s&&p.jsxs("label",{className:"ticket-id-label",children:["Customer ID or email",p.jsx("input",{value:i,onChange:a=>c(a.target.value),className:"ticket-id-input",placeholder:"CUST-1001 or you@company.com",autoComplete:"email"})]}),p.jsxs("div",{className:"ticket-actions",children:[p.jsx("button",{type:"button",onClick:o,disabled:t,className:"ticket-cancel-btn",children:"Cancel"}),p.jsx("button",{type:"button",onClick:()=>void r(i),disabled:t||s&&!i.trim(),className:"ticket-confirm-btn",children:t?"Creating…":"Create ticket"})]})]}):null},Fo=({className:e,onClose:t,showMinimize:n,title:r,subtitle:o,envStage:s,envPulse:i=!0})=>{const{messages:c,sendMessage:a,stopResponse:l,status:f,error:u,resetConversation:h,retryLast:g,pendingTicket:d,soundEnabled:m,toggleSound:b}=en(),v=I.useRef(null),x=f==="awaiting"||f==="connecting",S=c[c.length-1],E=x?S==null?void 0:S.progressText:(S==null?void 0:S.status)==="stopped"?"Response stopped":void 0;return p.jsxs("section",{className:`chat-panel${e?` ${e}`:""}`,"aria-label":"VPS AI Assistant",children:[p.jsx($l,{title:r,subtitle:o,onClose:t,onReset:()=>void h(),showMinimize:n,soundEnabled:m,onToggleSound:b,envStage:s,envPulse:i}),p.jsx("div",{className:"chat-panel-body",children:p.jsx(pg,{onEdit:C=>{var w;return(w=v.current)==null?void 0:w.edit(C)}})}),p.jsx(Ks,{className:"sr-only",role:"status",children:p.jsx(Ys,{children:E})}),u&&f==="error"&&p.jsx(Fl,{message:u,onRetry:()=>void g()}),p.jsx(hg,{}),p.jsx(Zl,{ref:v,onSend:C=>void a(C),onStop:x?l:void 0,disabled:x||!!d})]})},gg=({open:e,onClose:t,envStage:n,envPulse:r=!0})=>e?p.jsx("div",{id:"vps-chatbot-widget-panel",className:"widget-panel",children:p.jsx(Fo,{onClose:t,showMinimize:!0,title:"VPS AI Assistant",envStage:n,envPulse:r})}):null,mg=({open:e,onToggle:t})=>p.jsx("button",{type:"button",onClick:t,"aria-expanded":e,"aria-controls":"vps-chatbot-widget-panel","aria-label":e?"Close assistant":"Open assistant",className:"widget-trigger-btn",children:e?p.jsx(ka,{size:22}):p.jsx(ni,{size:24})}),Bs=({defaultOpen:e=!1,open:t,onOpenChange:n,envStage:r,envPulse:o=!0})=>{const[s,i]=I.useState(e),c=t??s,a=l=>{n==null||n(l),t===void 0&&i(l)};return p.jsxs(p.Fragment,{children:[p.jsx(gg,{open:c,onClose:()=>a(!1),envStage:r,envPulse:o}),p.jsx(mg,{open:c,onToggle:()=>a(!c)})]})},bg=({apiBaseUrl:e,apiUrl:t,proxyUrl:n,userContext:r,role:o,roleId:s,client:i,welcomeMessage:c,suggestions:a,disableSuggestions:l,initialMessage:f,hideInspectSources:u,showGroundedSources:h,modelId:g,...d})=>{const m=qn(),b=e??t??n;return!!m&&(!b||yt(b)===yt(m==null?void 0:m.apiBaseUrl))&&!r&&o===void 0&&s===void 0&&i===void 0&&c===void 0&&!a&&l===void 0&&!f&&u===void 0&&h===void 0&&g===void 0?p.jsx(Bs,{...d}):p.jsx(Yr,{apiBaseUrl:b,userContext:r,role:o,roleId:s,client:i,welcomeMessage:c,suggestions:a,disableSuggestions:l,initialMessage:f,hideInspectSources:u,showGroundedSources:h,modelId:g,children:p.jsx(Bs,{...d})})},vg=({open:e,onClose:t,subtitle:n,title:r,envStage:o,envPulse:s=!0})=>p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`embedded-overlay ${e?"embedded-overlay--open":"embedded-overlay--closed"}`,hidden:!e,onClick:t,"aria-hidden":"true"}),p.jsx("aside",{id:"vps-embedded-chat-panel",className:`embedded-panel ${e?"embedded-panel--open":"embedded-panel--closed"}`,"aria-hidden":!e,children:e&&p.jsx(Fo,{onClose:t,title:r||"VPS AI Assistant",subtitle:n,envStage:o,envPulse:s})})]}),yg=5,wr=8,$c="vps-embedded-assistant-top",Vs=16;function xg(e,t,n){return Math.min(n,Math.max(t,e))}function $s(e,t){const n=Math.max(wr,window.innerHeight-t-wr);return xg(e,wr,n)}function Eg(){try{const e=window.localStorage.getItem($c);if(!e)return null;const t=Number(e);return Number.isFinite(t)?t:null}catch{return null}}function Sg(e){try{window.localStorage.setItem($c,String(e))}catch{}}const wg=({onOpen:e})=>{const t=I.useRef(null),n=I.useRef({pointerId:null,startY:0,startTop:0,moved:!1}),[r,o]=I.useState(()=>typeof window>"u"?null:Eg()),s=I.useRef(r),i=I.useRef(!1),[c,a]=I.useState(!1),[l,f]=I.useState(!1);I.useEffect(()=>{s.current=r},[r]),I.useEffect(()=>{const d=t.current;if(!d)return;const m=()=>{o(b=>{const x=$s(b??Vs,d.offsetHeight);return s.current=x,x})};return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]);const u=d=>{if(d.button!==0)return;const m=d.currentTarget,b=m.getBoundingClientRect();n.current={pointerId:d.pointerId,startY:d.clientY,startTop:b.top,moved:!1};try{m.setPointerCapture(d.pointerId)}catch{}},h=d=>{if(n.current.pointerId!==d.pointerId)return;const m=d.clientY-n.current.startY;if(!n.current.moved&&Math.abs(m)<yg)return;n.current.moved=!0,a(!0);const b=$s(n.current.startTop+m,d.currentTarget.offsetHeight);s.current=b,o(b)},g=d=>{var b,v;if(n.current.pointerId!==d.pointerId)return;try{(v=(b=d.currentTarget).hasPointerCapture)!=null&&v.call(b,d.pointerId)&&d.currentTarget.releasePointerCapture(d.pointerId)}catch{}const m=n.current.moved;n.current.pointerId=null,n.current.moved=!1,a(!1),m&&(i.current=!0,s.current!=null&&Sg(s.current))};return p.jsxs("button",{ref:t,type:"button",onPointerDown:u,onPointerMove:h,onPointerUp:g,onPointerCancel:g,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),onClick:()=>{if(i.current){i.current=!1;return}e()},"aria-expanded":!1,"aria-controls":"vps-embedded-chat-panel","aria-label":"Assistant",className:`embedded-trigger-btn ${c?"embedded-trigger-btn--grabbing":"embedded-trigger-btn--grab"}${l?" embedded-trigger-btn--expanded":" embedded-trigger-btn--collapsed"}`,style:{top:r??Vs,transform:void 0},children:[p.jsx(ni,{size:18}),p.jsx("span",{className:"embedded-trigger-label",children:"Assistant"})]})},Hs=({defaultOpen:e=!1,open:t,onOpenChange:n,showTrigger:r=!0,envStage:o,envPulse:s=!0})=>{const[i,c]=I.useState(e),a=t??i,l=f=>{n==null||n(f),t===void 0&&c(f)};return p.jsxs(p.Fragment,{children:[r&&!a&&p.jsx(wg,{onOpen:()=>l(!0)}),p.jsx(vg,{open:a,onClose:()=>l(!1),envStage:o,envPulse:s})]})},Cg=({apiBaseUrl:e,apiUrl:t,proxyUrl:n,userContext:r,role:o,roleId:s,client:i,welcomeMessage:c,suggestions:a,disableSuggestions:l,initialMessage:f,hideInspectSources:u,showGroundedSources:h,modelId:g,...d})=>{const m=qn(),b=e??t??n;return!!m&&(!b||yt(b)===yt(m==null?void 0:m.apiBaseUrl))&&!r&&o===void 0&&s===void 0&&i===void 0&&c===void 0&&!a&&l===void 0&&!f&&u===void 0&&h===void 0&&g===void 0?p.jsx(Hs,{...d}):p.jsx(Yr,{apiBaseUrl:b,userContext:r,role:o,roleId:s,client:i,welcomeMessage:c,suggestions:a,disableSuggestions:l,initialMessage:f,hideInspectSources:u,showGroundedSources:h,modelId:g,children:p.jsx(Hs,{...d})})},Rg={Colors:{VPS_White:"#fff",VPS_Dark_Blue:"#1A1A31",VPS_Light_Blue:"#353552",VPS_Light_Grey:"#D1D1D6",VPS_Orange:"#FF4717",Dark_Blue_50:"#F1F5FC",Dark_Blue_100:"#E5EBFA",Dark_Blue_200:"#D1DAF4",Dark_Blue_300:"#B4C2ED",Dark_Blue_400:"#96A2E3",Dark_Blue_500:"#7C84D8",Dark_Blue_600:"#6262C9",Dark_Blue_700:"#5351B1",Dark_Blue_800:"#44448F",Dark_Blue_900:"#3C3D73",Dark_Blue_950:"#1A1A31",Light_Blue_50:"#F4F6FA",Light_Blue_100:"#E6E9F3",Light_Blue_200:"#D3D8EA",Light_Blue_300:"#B4BEDC",Light_Blue_400:"#909DCA",Light_Blue_500:"#7580BC",Light_Blue_600:"#6369AD",Light_Blue_700:"#575A9E",Light_Blue_800:"#4B4B82",Light_Blue_900:"#404168",Light_Blue_950:"#353552",Grey_50:"#F6F6F7",Grey_100:"#EFEFF0",Grey_200:"#E2E1E4",Grey_300:"#D1D1D6",Grey_400:"#B9B9C0",Grey_500:"#A7A6AE",Grey_600:"#93919A",Grey_700:"#7E7D85",Grey_800:"#67666D",Grey_900:"#56555A",Grey_950:"#323234",Orange_50:"#FFF3ED",Orange_100:"#FFE4D4",Orange_200:"#FFC5A8",Orange_300:"#FF9D70",Orange_400:"#FF6837",Orange_500:"#FF4717",Orange_600:"#F02706",Orange_700:"#C71807",Orange_800:"#9E150E",Orange_900:"#7F150F",Orange_950:"#450605",Success_50:"#F1FCF5",Success_100:"#DEFAEA",Success_200:"#BEF4D4",Success_300:"#8BEAB3",Success_400:"#52D689",Success_500:"#2ECC71",Success_600:"#1D9C53",Success_700:"#1B7A43",Success_800:"#1A6139",Success_900:"#175031",Success_950:"#072C18",Warning_50:"#FFFEEA",Warning_100:"#FFF9C5",Warning_200:"#FFF485",Warning_300:"#FFE846",Warning_400:"#FFD81B",Warning_500:"#FFB800",Warning_600:"#E28D00",Warning_700:"#BB6302",Warning_800:"#984C08",Warning_900:"#7C3F0B",Warning_950:"#482000",Error_50:"#FFF1F1",Error_100:"#FFDFDF",Error_200:"#FFC5C5",Error_300:"#FF9D9D",Error_400:"#FF6464",Error_500:"#FF2E2E",Error_600:"#ED1515",Error_700:"#C80D0D",Error_800:"#A50F0F",Error_900:"#881414",Error_950:"#4B0404",Netural_25:"#FDFDFD",Netural_50:"#FAFAFA",Netural_100:"#F5F5F5",Netural_200:"#E9EAEC",Netural_300:"#D6D7DB",Netural_400:"#A4A7AE",Netural_500:"#727681",Netural_600:"#545863",Netural_700:"#424651",Netural_800:"#252B37",Netural_900:"#191D28",Netural_950:"#0A0D12",Tint_Dark_Blue_100:"#1A1A31",Tint_Dark_Blue_90:"#313146",Tint_Dark_Blue_80:"#48485A",Tint_Dark_Blue_70:"#5F5F6F",Tint_Dark_Blue_60:"#767683",Tint_Dark_Blue_50:"#8C8C98",Tint_Dark_Blue_40:"#A3A3AD",Tint_Dark_Blue_30:"#BABAC1",Tint_Dark_Blue_20:"#D1D1D6",Tint_Dark_Blue_10:"#E8E8EA",Tint_Dark_Blue_5:"#F4F4F5",Tint_Light_Blue_100:"#353552",Tint_Light_Blue_90:"#494963",Tint_Light_Blue_80:"#5D5D75",Tint_Light_Blue_70:"#727286",Tint_Light_Blue_60:"#868697",Tint_Light_Blue_50:"#9A9AA8",Tint_Light_Blue_40:"#AEAEBA",Tint_Light_Blue_30:"#C2C2CB",Tint_Light_Blue_20:"#D7D7DC",Tint_Light_Blue_10:"#EBEBEE",Tint_Light_Blue_5:"#F5F5F6",Tint_Grey_100:"#D1D1D6",Tint_Grey_90:"#D6D6DA",Tint_Grey_80:"#DADADE",Tint_Grey_70:"#DFDFE2",Tint_Grey_60:"#E3E3E6",Tint_Grey_50:"#E8E8EB",Tint_Grey_40:"#EDEDEF",Tint_Grey_30:"#F1F1F3",Tint_Grey_20:"#F6F6F7",Tint_Grey_10:"#FAFAFB",Tint_Grey_5:"#FDFDFD",Tint_Solus_100:"#FF4717",Tint_Solus_90:"#FF592E",Tint_Solus_80:"#FF6C45",Tint_Solus_70:"#FF7E5D",Tint_Solus_60:"#FF9174",Tint_Solus_50:"#FFA38B",Tint_Solus_40:"#FFB5A2",Tint_Solus_30:"#FFC8B9",Tint_Solus_20:"#FFDAD1",Tint_Solus_10:"#FFEDE8",Tint_Solus_5:"#FFF6F3",Other_Color:"#00ABC9"},StatusColor:{tested:"#3E4784",received:"#EE46BC",InTransit:"#6938EF",registered:"#1570EF",reported:"#2ECC71",noStatus:"#727681",Action:"#FF2E2E",Caution:"#FFB800",Pass:"#2ECC71",No_Rating:"#FF6837",Received:"#EE46BC",Tested:"#3E4784",Reported:"#2ECC71",No_Status:"#6938EF",Overdue:"#FF2E2E",Duesoon:"#FFB800",Scheduled:"#1570EF",Good:"#2ECC71",NotApplicable:"#353552"}};exports.ChatPanel=Fo;exports.ChatProvider=Yr;exports.ChatbotWidget=bg;exports.ColorPalette=Rg;exports.EmbeddedChatbot=Cg;exports.buildApiUrl=Rn;exports.chatApi=na;exports.createChatApi=Gr;exports.resolveApiBaseUrl=yt;exports.useChatContext=Ws;exports.useChatbot=en;exports.useOptionalChatContext=qn;
|
|
214
|
+
`)});continue}if(/^(---|___|\*\*\*)$/.test(s)){n.push({type:"hr"}),r++;continue}const i=s.match(/^(#{1,4})\s+(.*)$/);if(i){n.push({type:"h",level:i[1].length,content:i[2]}),r++;continue}if(s.startsWith(">")){const a=[];for(;r<t.length&&t[r].trim().startsWith(">");)a.push(t[r].trim().replace(/^>\s?/,"")),r++;n.push({type:"quote",lines:a});continue}if(/^[-*]\s+/.test(s)){const a=[];for(;r<t.length&&/^[-*]\s+/.test(t[r].trim());)a.push(t[r].trim().replace(/^[-*]\s+/,"")),r++;n.push({type:"ul",items:a});continue}if(/^\d+\.\s+/.test(s)){const a=[];for(;r<t.length&&/^\d+\.\s+/.test(t[r].trim());)a.push(t[r].trim().replace(/^\d+\.\s+/,"")),r++;n.push({type:"ol",items:a});continue}if(s.startsWith("|")&&s.endsWith("|")){const a=[];for(;r<t.length&&t[r].trim().startsWith("|")&&t[r].trim().endsWith("|");)a.push(t[r].trim()),r++;if(a.length>=2){const l=m=>m.slice(1,-1).split("|").map(d=>d.trim()),u=l(a[0]),f=a[1].includes("-")?2:1,h=a.slice(f).map(l);n.push({type:"table",headers:u,rows:h});continue}}const c=[];for(;r<t.length&&t[r].trim()&&!t[r].trim().startsWith("```")&&!/^(#{1,4})\s+/.test(t[r].trim())&&!/^[-*]\s+/.test(t[r].trim())&&!/^\d+\.\s+/.test(t[r].trim())&&!t[r].trim().startsWith(">")&&!/^(---|___|\*\*\*)$/.test(t[r].trim());)c.push(t[r].trim()),r++;c.length>0&&n.push({type:"p",lines:c})}return n}function lm({code:e,lang:t,streaming:n}){const{status:r,copy:o}=Ui();return p.jsxs("div",{className:"md-code-block",children:[p.jsxs("div",{className:"md-code-header",children:[p.jsx("span",{children:t||"Code"}),!n&&p.jsxs(p.Fragment,{children:[p.jsxs("span",{className:"md-code-status",role:"status",children:[r==="copied"&&"Copied",r==="failed"&&"Couldn’t copy"]}),p.jsx("button",{type:"button",className:"chat-message-action","aria-label":"Copy code",title:"Copy code",disabled:r==="copying",onClick:()=>void o(e),children:r==="copied"?p.jsx(Qr,{size:15,"aria-hidden":"true"}):p.jsx(ri,{size:15,"aria-hidden":"true"})})]})]}),p.jsx("pre",{className:"md-pre",children:p.jsx("code",{children:e.split(`
|
|
215
|
+
`).map((s,i)=>p.jsxs("span",{className:"md-code-line",children:[p.jsx("span",{className:"md-code-number","aria-hidden":"true",children:i+1}),p.jsx("span",{children:s||" "})]},i))})})]})}const Vs=O.memo(function({text:t,streaming:n=!1,sources:r}){if(!t)return null;const o=am(t),s=i=>cm(i,r);return p.jsx("div",{className:"md-content",children:o.map((i,c)=>{switch(i.type){case"h":return i.level===1?p.jsx("h2",{className:"md-h1",children:s(i.content)},c):i.level===2?p.jsx("h3",{className:"md-h2",children:s(i.content)},c):i.level===3?p.jsx("h4",{className:"md-h3",children:s(i.content)},c):p.jsx("h5",{className:"md-h4",children:s(i.content)},c);case"ul":return p.jsx("ul",{className:"md-ul",children:i.items.map((a,l)=>p.jsx("li",{className:"md-li",children:s(a)},l))},c);case"ol":return p.jsx("ol",{className:"md-ol",children:i.items.map((a,l)=>p.jsx("li",{className:"md-li",children:s(a)},l))},c);case"code":return p.jsx(lm,{code:i.code,lang:i.lang,streaming:n},c);case"quote":return p.jsx("blockquote",{className:"md-quote",children:i.lines.map((a,l)=>p.jsx("p",{children:s(a)},l))},c);case"hr":return p.jsx("hr",{className:"md-hr"},c);case"table":return p.jsx("div",{className:"md-table-wrap",children:p.jsxs("table",{className:"md-table",children:[p.jsx("thead",{children:p.jsx("tr",{children:i.headers.map((a,l)=>p.jsx("th",{children:s(a)},l))})}),p.jsx("tbody",{children:i.rows.map((a,l)=>p.jsx("tr",{children:a.map((u,f)=>p.jsx("td",{children:s(u)},f))},l))})]})},c);case"p":default:return p.jsx("p",{className:"md-p",children:i.lines.map((a,l)=>p.jsxs(O.Fragment,{children:[s(a),l<i.lines.length-1&&p.jsx("br",{})]},l))},c)}})})}),um=O.lazy(async()=>({default:(await import("streamdown")).Streamdown})),Hc=O.createContext(null);function $c(){const e=O.useContext(Hc);if(!e)throw new Error("Reasoning parts must be rendered inside Reasoning.");return e}function fm({isStreaming:e=!1,open:t,defaultOpen:n,onOpenChange:r,duration:o,className:s,...i}){const[c,a]=O.useState(n),[l,u]=O.useState(),f=O.useRef(null),h=t??c??e;O.useEffect(()=>{e?f.current=performance.now():f.current!==null&&(u(Math.round((performance.now()-f.current)/1e3)),f.current=null)},[e]);function m(d){t===void 0&&a(d),r==null||r(d)}return p.jsx(Hc.Provider,{value:{isStreaming:e,isOpen:h,setIsOpen:m,duration:o??l},children:p.jsx(yt,{className:s,children:p.jsx(_i,{...i,open:h,onOpenChange:m})})})}function dm({getThinkingMessage:e,children:t,icon:n,description:r,...o}){const{isStreaming:s,duration:i}=$c(),c=s?"Thinking":i===void 0?"Thought":`Thought for ${i}s`;return p.jsx(Ai,{...o,children:p.jsxs(Nt,{status:s?"running":void 0,children:[p.jsx(Ct,{children:n??(s?p.jsx(oi,{size:14,className:"trace-spinner"}):p.jsx(ni,{size:14}))}),p.jsx(Mt,{children:t??(e==null?void 0:e(s,i))??c}),r&&p.jsx(Yt,{"aria-hidden":s||void 0,children:r})]})})}function pm({children:e,className:t,...n}){const{isStreaming:r}=$c();return p.jsx(Ni,{className:le("reasoning-content",t),...n,children:typeof e=="string"?p.jsx(O.Suspense,{fallback:p.jsx("div",{className:"md-content reasoning-text",children:e}),children:p.jsx(um,{className:"md-content",isAnimating:r,mode:r?"streaming":"static",children:e})}):e})}function hm(e){return e==="create_ticket"?"Support ticket processed":e==="get_customer"?"Account verified":e==="get_ticket"?"Ticket status loaded":"Information retrieved"}const mm=({status:e="complete",progressText:t,progressSteps:n=[],durationMs:r,toolCalls:o=[]})=>{const s=e==="pending",i=e==="stopped",[c,a]=O.useState(0);O.useEffect(()=>{if(!s)return;const f=Date.now(),h=setInterval(()=>{a(Number(((Date.now()-f)/1e3).toFixed(1)))},250);return()=>clearInterval(h)},[s]);const l=n.length>0||o.length>0,u=r===void 0?void 0:Number((r/1e3).toFixed(1));return l?p.jsxs(fm,{className:"chat-response-trace",isStreaming:s,duration:u,children:[p.jsx(dm,{getThinkingMessage:i?()=>"Response stopped":void 0,icon:i?p.jsx(si,{size:12}):void 0,description:s?`${c.toFixed(1)}s`:void 0}),p.jsx(pm,{children:p.jsxs(yt,{children:[n.map((f,h)=>p.jsxs(Js,{children:[p.jsx(ua,{children:p.jsx("span",{className:"chat-progress-dot"})}),p.jsx(Zs,{children:f})]},`${f}-${h}`)),o.map((f,h)=>p.jsxs(Nt,{children:[p.jsx(Ct,{children:p.jsx(ja,{size:13})}),p.jsx(Mt,{children:hm(f.toolName)})]},`${f.toolName}-${h}`))]})})]}):p.jsx(yt,{className:"chat-response-trace",children:p.jsxs(Nt,{status:s?"running":void 0,children:[p.jsx(Ct,{children:s?p.jsx(oi,{size:14,className:"trace-spinner"}):p.jsx(ni,{size:14})}),p.jsx(Mt,{children:s?t||"Thinking":i?"Response stopped":"Thought"}),s?p.jsxs(Yt,{"aria-hidden":"true",children:[c.toFixed(1),"s"]}):!i&&u!==void 0&&p.jsxs(Yt,{children:[u,"s"]})]})})},gm=({message:e,onEdit:t})=>{var m,d,g,b;const n=Gn(),r=(n==null?void 0:n.hideInspectSources)??!1,o=(n==null?void 0:n.showGroundedSources)??!1,s=e.role==="user",i=e.status==="error",c=e.status==="pending",a=e.status==="stopped",l=e.id.startsWith("welcome"),u=e.role==="assistant"&&!l&&!i,f=u&&(c||a||e.durationMs!==void 0||!!((m=e.progressSteps)!=null&&m.length||(d=e.sources)!=null&&d.length||(g=e.toolCalls)!=null&&g.length||e.usage)),h=u&&!c&&!a&&e.content.trim().length>0;return p.jsxs(Jr,{align:s?"end":"start",children:[e.role==="assistant"&&p.jsx(ii,{className:"avatar-circle","aria-hidden":"true",children:p.jsx("img",{src:po,alt:"VPS Logo",style:{width:"16px",height:"16px"}})}),p.jsxs(Zr,{children:[f&&p.jsx(Fa,{children:p.jsx(mm,{status:c?"pending":a?"stopped":"complete",progressText:e.progressText,progressSteps:e.progressSteps,durationMs:e.durationMs,toolCalls:e.toolCalls})}),s?p.jsx(Nr,{align:"end",children:p.jsx(Mr,{className:"msg-user-pre",children:e.content})}):l||i?p.jsx(Nr,{variant:i?"destructive":"muted",children:p.jsx(Mr,{children:p.jsx(Vs,{text:e.content})})}):e.content&&p.jsxs("div",{className:"chat-message-body",children:[p.jsx(Vs,{text:e.content,streaming:c,sources:u&&!c&&!a&&!r?e.sources:void 0}),u&&!c&&!a&&o&&((b=e.sources)!=null&&b.length)?p.jsx(sm,{sources:e.sources,hideInspectSources:r}):null]}),h&&n&&p.jsx(Rr,{children:p.jsx(qu,{message:e,onFeedback:n.toggleMessageFeedback})}),s&&!i&&p.jsxs(Rr,{children:[t&&p.jsx("button",{type:"button",className:"chat-message-action","aria-label":"Edit message",title:"Edit message",disabled:(n==null?void 0:n.status)==="awaiting"||(n==null?void 0:n.status)==="connecting"||!!(n!=null&&n.pendingTicket),onClick:()=>t(e.content),children:p.jsx(Oa,{size:14,"aria-hidden":"true"})}),p.jsx(Qr,{size:13,className:"msg-tick","aria-hidden":"true"})]})]})]})},bm=({onEdit:e})=>{const{messages:t,status:n,suggestions:r,showSuggestions:o,sendMessage:s}=tn(),i=n==="awaiting"||n==="connecting",c=t.filter(a=>a.status!=="error");return p.jsx(Bu,{autoScroll:!0,defaultScrollPosition:"last-anchor",scrollPreviousItemPeek:64,children:p.jsxs(Vu,{children:[p.jsx(Hu,{"aria-label":"Chat messages",children:p.jsxs($u,{"aria-busy":i,children:[c.length===0&&p.jsx(ls,{messageId:"welcome",children:p.jsx(Wu,{})}),c.map(a=>p.jsx(ls,{messageId:a.streamId??a.id,"data-role":a.role,scrollAnchor:a.role==="user",children:p.jsx(gm,{message:a,onEdit:e})},a.streamId??a.id))]})}),p.jsx(Uu,{})]})})},vm=()=>{const{pendingTicket:e,ticketBusy:t,userContext:n,confirmTicket:r,cancelTicket:o}=tn(),s=!n.customerId&&!n.email,[i,c]=O.useState("");return e?p.jsxs("div",{className:"ticket-card",role:"region","aria-label":"Create support ticket",children:[p.jsx("h3",{className:"ticket-card-title",children:"Create support ticket?"}),p.jsx("p",{className:"ticket-card-desc",children:"I can open a support request for you. Nothing is created until you confirm."}),p.jsx("p",{className:"ticket-card-body",children:e.description}),s&&p.jsxs("label",{className:"ticket-id-label",children:["Customer ID or email",p.jsx("input",{value:i,onChange:a=>c(a.target.value),className:"ticket-id-input",placeholder:"CUST-1001 or you@company.com",autoComplete:"email"})]}),p.jsxs("div",{className:"ticket-actions",children:[p.jsx("button",{type:"button",onClick:o,disabled:t,className:"ticket-cancel-btn",children:"Cancel"}),p.jsx("button",{type:"button",onClick:()=>void r(i),disabled:t||s&&!i.trim(),className:"ticket-confirm-btn",children:t?"Creating…":"Create ticket"})]})]}):null},Bo=({className:e,onClose:t,showMinimize:n,title:r,subtitle:o,envStage:s,envPulse:i=!0})=>{const{messages:c,sendMessage:a,stopResponse:l,status:u,error:f,resetConversation:h,retryLast:m,pendingTicket:d,soundEnabled:g,toggleSound:b}=tn(),v=O.useRef(null),x=u==="awaiting"||u==="connecting",C=c[c.length-1],w=x?C==null?void 0:C.progressText:(C==null?void 0:C.status)==="stopped"?"Response stopped":void 0;return p.jsxs("section",{className:`chat-panel${e?` ${e}`:""}`,"aria-label":"VPS AI Assistant",children:[p.jsx(ql,{title:r,subtitle:o,onClose:t,onReset:()=>void h(),showMinimize:n,soundEnabled:g,onToggleSound:b,envStage:s,envPulse:i}),p.jsx("div",{className:"chat-panel-body",children:p.jsx(bm,{onEdit:E=>{var S;return(S=v.current)==null?void 0:S.edit(E)}})}),p.jsx(Js,{className:"sr-only",role:"status",children:p.jsx(Zs,{children:w})}),f&&u==="error"&&p.jsx($l,{message:f,onRetry:()=>void m()}),p.jsx(vm,{}),p.jsx(nu,{ref:v,onSend:E=>void a(E),onStop:x?l:void 0,disabled:x||!!d})]})},ym=({open:e,onClose:t,envStage:n,envPulse:r=!0})=>e?p.jsx("div",{id:"vps-chatbot-widget-panel",className:"widget-panel",children:p.jsx(Bo,{onClose:t,showMinimize:!0,title:"VPS AI Assistant",envStage:n,envPulse:r})}):null,xm=({open:e,onToggle:t})=>p.jsx("button",{type:"button",onClick:t,"aria-expanded":e,"aria-controls":"vps-chatbot-widget-panel","aria-label":e?"Close assistant":"Open assistant",className:"widget-trigger-btn",children:e?p.jsx(Da,{size:22}):p.jsx(Ra,{size:24})}),Hs=({defaultOpen:e=!1,open:t,onOpenChange:n,envStage:r,envPulse:o=!0})=>{const[s,i]=O.useState(e),c=t??s,a=l=>{n==null||n(l),t===void 0&&i(l)};return p.jsxs(p.Fragment,{children:[p.jsx(ym,{open:c,onClose:()=>a(!1),envStage:r,envPulse:o}),p.jsx(xm,{open:c,onToggle:()=>a(!c)})]})},wm=({apiBaseUrl:e,apiUrl:t,proxyUrl:n,userContext:r,role:o,roleId:s,client:i,service:c,welcomeMessage:a,suggestions:l,disableSuggestions:u,initialMessage:f,hideInspectSources:h,showGroundedSources:m,modelId:d,...g})=>{const b=Gn(),v=e??t??n;return!!b&&(!v||wt(v)===wt(b==null?void 0:b.apiBaseUrl))&&!r&&o===void 0&&s===void 0&&i===void 0&&c===void 0&&a===void 0&&!l&&u===void 0&&!f&&h===void 0&&m===void 0&&d===void 0?p.jsx(Hs,{...g}):p.jsx(Xr,{apiBaseUrl:v,userContext:r,role:o,roleId:s,client:i,service:c,welcomeMessage:a,suggestions:l,disableSuggestions:u,initialMessage:f,hideInspectSources:h,showGroundedSources:m,modelId:d,children:p.jsx(Hs,{...g})})},Cm=({open:e,onClose:t,subtitle:n,title:r,envStage:o,envPulse:s=!0})=>p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`embedded-overlay ${e?"embedded-overlay--open":"embedded-overlay--closed"}`,hidden:!e,onClick:t,"aria-hidden":"true"}),p.jsx("aside",{id:"vps-embedded-chat-panel",className:`embedded-panel ${e?"embedded-panel--open":"embedded-panel--closed"}`,"aria-hidden":!e,children:e&&p.jsx(Bo,{onClose:t,title:r||"VPS AI Assistant",subtitle:n,envStage:o,envPulse:s})})]}),Sm=5,Er=8,Uc="vps-embedded-assistant-top",$s=16;function Em(e,t,n){return Math.min(n,Math.max(t,e))}function Us(e,t){const n=Math.max(Er,window.innerHeight-t-Er);return Em(e,Er,n)}function Rm(){try{const e=window.localStorage.getItem(Uc);if(!e)return null;const t=Number(e);return Number.isFinite(t)?t:null}catch{return null}}function Tm(e){try{window.localStorage.setItem(Uc,String(e))}catch{}}const Im=({onOpen:e})=>{const t=O.useRef(null),n=O.useRef({pointerId:null,startY:0,startTop:0,moved:!1}),[r,o]=O.useState(()=>typeof window>"u"?null:Rm()),s=O.useRef(r),i=O.useRef(!1),[c,a]=O.useState(!1),[l,u]=O.useState(!1);O.useEffect(()=>{s.current=r},[r]),O.useEffect(()=>{const d=t.current;if(!d)return;const g=()=>{o(b=>{const x=Us(b??$s,d.offsetHeight);return s.current=x,x})};return g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[]);const f=d=>{if(d.button!==0)return;const g=d.currentTarget,b=g.getBoundingClientRect();n.current={pointerId:d.pointerId,startY:d.clientY,startTop:b.top,moved:!1};try{g.setPointerCapture(d.pointerId)}catch{}},h=d=>{if(n.current.pointerId!==d.pointerId)return;const g=d.clientY-n.current.startY;if(!n.current.moved&&Math.abs(g)<Sm)return;n.current.moved=!0,a(!0);const b=Us(n.current.startTop+g,d.currentTarget.offsetHeight);s.current=b,o(b)},m=d=>{var b,v;if(n.current.pointerId!==d.pointerId)return;try{(v=(b=d.currentTarget).hasPointerCapture)!=null&&v.call(b,d.pointerId)&&d.currentTarget.releasePointerCapture(d.pointerId)}catch{}const g=n.current.moved;n.current.pointerId=null,n.current.moved=!1,a(!1),g&&(i.current=!0,s.current!=null&&Tm(s.current))};return p.jsxs("button",{ref:t,type:"button",onPointerDown:f,onPointerMove:h,onPointerUp:m,onPointerCancel:m,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onClick:()=>{if(i.current){i.current=!1;return}e()},"aria-expanded":!1,"aria-controls":"vps-embedded-chat-panel","aria-label":"Assistant",className:`embedded-trigger-btn ${c?"embedded-trigger-btn--grabbing":"embedded-trigger-btn--grab"}${l?" embedded-trigger-btn--expanded":" embedded-trigger-btn--collapsed"}`,style:{top:r??$s,transform:void 0},children:[p.jsx("img",{src:po,alt:"",className:"embedded-trigger-icon","aria-hidden":"true"}),p.jsx("span",{className:"embedded-trigger-label",children:"Assistant"})]})},Ws=({defaultOpen:e=!1,open:t,onOpenChange:n,showTrigger:r=!0,envStage:o,envPulse:s=!0})=>{const[i,c]=O.useState(e),a=t??i,l=u=>{n==null||n(u),t===void 0&&c(u)};return O.useEffect(()=>{if(a){window.history.pushState({vpsChatOpen:!0},"");const u=()=>{l(!1)};return window.addEventListener("popstate",u),()=>{window.removeEventListener("popstate",u)}}},[a]),p.jsxs(p.Fragment,{children:[r&&!a&&p.jsx(Im,{onOpen:()=>l(!0)}),p.jsx(Cm,{open:a,onClose:()=>l(!1),envStage:o,envPulse:s})]})},Om=({apiBaseUrl:e,apiUrl:t,proxyUrl:n,userContext:r,role:o,roleId:s,client:i,service:c,welcomeMessage:a,suggestions:l,disableSuggestions:u,initialMessage:f,hideInspectSources:h,showGroundedSources:m,modelId:d,...g})=>{const b=Gn(),v=e??t??n;return!!b&&(!v||wt(v)===wt(b==null?void 0:b.apiBaseUrl))&&!r&&o===void 0&&s===void 0&&i===void 0&&c===void 0&&a===void 0&&!l&&u===void 0&&!f&&h===void 0&&m===void 0&&d===void 0?p.jsx(Ws,{...g}):p.jsx(Xr,{apiBaseUrl:v,userContext:r,role:o,roleId:s,client:i,service:c,welcomeMessage:a,suggestions:l,disableSuggestions:u,initialMessage:f,hideInspectSources:h,showGroundedSources:m,modelId:d,children:p.jsx(Ws,{...g})})},Pm={Colors:{VPS_White:"#fff",VPS_Dark_Blue:"#1A1A31",VPS_Light_Blue:"#353552",VPS_Light_Grey:"#D1D1D6",VPS_Orange:"#FF4717",Dark_Blue_50:"#F1F5FC",Dark_Blue_100:"#E5EBFA",Dark_Blue_200:"#D1DAF4",Dark_Blue_300:"#B4C2ED",Dark_Blue_400:"#96A2E3",Dark_Blue_500:"#7C84D8",Dark_Blue_600:"#6262C9",Dark_Blue_700:"#5351B1",Dark_Blue_800:"#44448F",Dark_Blue_900:"#3C3D73",Dark_Blue_950:"#1A1A31",Light_Blue_50:"#F4F6FA",Light_Blue_100:"#E6E9F3",Light_Blue_200:"#D3D8EA",Light_Blue_300:"#B4BEDC",Light_Blue_400:"#909DCA",Light_Blue_500:"#7580BC",Light_Blue_600:"#6369AD",Light_Blue_700:"#575A9E",Light_Blue_800:"#4B4B82",Light_Blue_900:"#404168",Light_Blue_950:"#353552",Grey_50:"#F6F6F7",Grey_100:"#EFEFF0",Grey_200:"#E2E1E4",Grey_300:"#D1D1D6",Grey_400:"#B9B9C0",Grey_500:"#A7A6AE",Grey_600:"#93919A",Grey_700:"#7E7D85",Grey_800:"#67666D",Grey_900:"#56555A",Grey_950:"#323234",Orange_50:"#FFF3ED",Orange_100:"#FFE4D4",Orange_200:"#FFC5A8",Orange_300:"#FF9D70",Orange_400:"#FF6837",Orange_500:"#FF4717",Orange_600:"#F02706",Orange_700:"#C71807",Orange_800:"#9E150E",Orange_900:"#7F150F",Orange_950:"#450605",Success_50:"#F1FCF5",Success_100:"#DEFAEA",Success_200:"#BEF4D4",Success_300:"#8BEAB3",Success_400:"#52D689",Success_500:"#2ECC71",Success_600:"#1D9C53",Success_700:"#1B7A43",Success_800:"#1A6139",Success_900:"#175031",Success_950:"#072C18",Warning_50:"#FFFEEA",Warning_100:"#FFF9C5",Warning_200:"#FFF485",Warning_300:"#FFE846",Warning_400:"#FFD81B",Warning_500:"#FFB800",Warning_600:"#E28D00",Warning_700:"#BB6302",Warning_800:"#984C08",Warning_900:"#7C3F0B",Warning_950:"#482000",Error_50:"#FFF1F1",Error_100:"#FFDFDF",Error_200:"#FFC5C5",Error_300:"#FF9D9D",Error_400:"#FF6464",Error_500:"#FF2E2E",Error_600:"#ED1515",Error_700:"#C80D0D",Error_800:"#A50F0F",Error_900:"#881414",Error_950:"#4B0404",Netural_25:"#FDFDFD",Netural_50:"#FAFAFA",Netural_100:"#F5F5F5",Netural_200:"#E9EAEC",Netural_300:"#D6D7DB",Netural_400:"#A4A7AE",Netural_500:"#727681",Netural_600:"#545863",Netural_700:"#424651",Netural_800:"#252B37",Netural_900:"#191D28",Netural_950:"#0A0D12",Tint_Dark_Blue_100:"#1A1A31",Tint_Dark_Blue_90:"#313146",Tint_Dark_Blue_80:"#48485A",Tint_Dark_Blue_70:"#5F5F6F",Tint_Dark_Blue_60:"#767683",Tint_Dark_Blue_50:"#8C8C98",Tint_Dark_Blue_40:"#A3A3AD",Tint_Dark_Blue_30:"#BABAC1",Tint_Dark_Blue_20:"#D1D1D6",Tint_Dark_Blue_10:"#E8E8EA",Tint_Dark_Blue_5:"#F4F4F5",Tint_Light_Blue_100:"#353552",Tint_Light_Blue_90:"#494963",Tint_Light_Blue_80:"#5D5D75",Tint_Light_Blue_70:"#727286",Tint_Light_Blue_60:"#868697",Tint_Light_Blue_50:"#9A9AA8",Tint_Light_Blue_40:"#AEAEBA",Tint_Light_Blue_30:"#C2C2CB",Tint_Light_Blue_20:"#D7D7DC",Tint_Light_Blue_10:"#EBEBEE",Tint_Light_Blue_5:"#F5F5F6",Tint_Grey_100:"#D1D1D6",Tint_Grey_90:"#D6D6DA",Tint_Grey_80:"#DADADE",Tint_Grey_70:"#DFDFE2",Tint_Grey_60:"#E3E3E6",Tint_Grey_50:"#E8E8EB",Tint_Grey_40:"#EDEDEF",Tint_Grey_30:"#F1F1F3",Tint_Grey_20:"#F6F6F7",Tint_Grey_10:"#FAFAFB",Tint_Grey_5:"#FDFDFD",Tint_Solus_100:"#FF4717",Tint_Solus_90:"#FF592E",Tint_Solus_80:"#FF6C45",Tint_Solus_70:"#FF7E5D",Tint_Solus_60:"#FF9174",Tint_Solus_50:"#FFA38B",Tint_Solus_40:"#FFB5A2",Tint_Solus_30:"#FFC8B9",Tint_Solus_20:"#FFDAD1",Tint_Solus_10:"#FFEDE8",Tint_Solus_5:"#FFF6F3",Other_Color:"#00ABC9"},StatusColor:{tested:"#3E4784",received:"#EE46BC",InTransit:"#6938EF",registered:"#1570EF",reported:"#2ECC71",noStatus:"#727681",Action:"#FF2E2E",Caution:"#FFB800",Pass:"#2ECC71",No_Rating:"#FF6837",Received:"#EE46BC",Tested:"#3E4784",Reported:"#2ECC71",No_Status:"#6938EF",Overdue:"#FF2E2E",Duesoon:"#FFB800",Scheduled:"#1570EF",Good:"#2ECC71",NotApplicable:"#353552"}};exports.CUSTOMER_PORTAL_ROLES=Gs;exports.ChatPanel=Bo;exports.ChatProvider=Xr;exports.ChatbotWidget=wm;exports.ColorPalette=Pm;exports.EmbeddedChatbot=Om;exports.buildApiUrl=Tn;exports.chatApi=oa;exports.createChatApi=Kr;exports.resolveApiBaseUrl=wt;exports.useChatContext=Ys;exports.useChatbot=tn;exports.useOptionalChatContext=Gn;
|