ordify-chat-widget 1.0.47 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var jn=Object.defineProperty;var In=(e,t,r)=>t in e?jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ht=(e,t,r)=>In(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react");function An(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Dt=An(k);var zr={exports:{}},Xe={};/**
1
+ "use strict";var Mn=Object.defineProperty;var _n=(e,t,r)=>t in e?Mn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var mt=(e,t,r)=>_n(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react");function Rn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const zt=Rn(x);var Nr={exports:{}},et={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,54 +6,109 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var En=k,Tn=Symbol.for("react.element"),Rn=Symbol.for("react.fragment"),Mn=Object.prototype.hasOwnProperty,_n=En.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,On={key:!0,ref:!0,__self:!0,__source:!0};function Dr(e,t,r){var n,a={},c=null,u=null;r!==void 0&&(c=""+r),t.key!==void 0&&(c=""+t.key),t.ref!==void 0&&(u=t.ref);for(n in t)Mn.call(t,n)&&!On.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)a[n]===void 0&&(a[n]=t[n]);return{$$typeof:Tn,type:e,key:c,ref:u,props:a,_owner:_n.current}}Xe.Fragment=Rn;Xe.jsx=Dr;Xe.jsxs=Dr;zr.exports=Xe;var l=zr.exports;function Me(){return Math.random().toString(36).substr(2,9)}function zn(e){return new Intl.DateTimeFormat("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}).format(e)}function Dn(e,t){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>e(...n),t)}}function Nn(e,t){let r;return(...n)=>{r||(e(...n),r=!0,setTimeout(()=>r=!1,t))}}function Bn(e){return{id:e.id,name:e.name,url:e.url,content_type:e.content_type,type:e.type,size:e.size??null,preview:null,oauth_token:null}}class Nr{constructor(t){ht(this,"config");ht(this,"warnedLegacyApiKey",!1);if(this.config=t,!this.config.publishableKey&&!this.config.apiKey)throw new Error("Either publishableKey or apiKey is required.");this.config.publishableKey&&this.config.apiKey&&console.warn("[Ordify] Both publishableKey and apiKey provided. publishableKey will be used.")}usePublishableKey(){return!!this.config.publishableKey}maybeWarnLegacyApiKey(){this.usePublishableKey()||this.warnedLegacyApiKey||(this.warnedLegacyApiKey=!0,console.warn("[Ordify] Using legacy apiKey in browser. For production embeds, use publishableKey from user settings."))}getAuthHeaders(t=!1){return this.usePublishableKey()?{...t?{"Content-Type":"application/json"}:{},"x-ordify-publishable-key":this.config.publishableKey,accept:"application/json"}:(this.maybeWarnLegacyApiKey(),{...t?{"Content-Type":"application/json"}:{},"api-key":this.config.apiKey,accept:"application/json"})}async sendMessage(t,r,n,a){const c=this.usePublishableKey()?`/widget/chat/${this.config.agentId}`:`/chat/agents/${this.config.agentId}`,u=`${this.config.apiBaseUrl}${c}`,d=a!=null&&a.length?a.map(Bn):void 0,h={message:t,sessionId:r,context:n};d!=null&&d.length&&(h.attachments=d,h.use_document_understanding=d.some(b=>b.type==="document"||!b.type&&!String(b.content_type||"").startsWith("image/")));const g=await fetch(u,{method:"POST",headers:this.getAuthHeaders(!0),body:JSON.stringify(h)});if(!g.ok){const b=await g.json();throw new Error(`API Error: ${b.detail}`)}if(!g.body)throw new Error("No response body");return g.body}async uploadAttachment(t){if(!this.usePublishableKey())throw new Error("[Ordify] uploadAttachment requires publishableKey.");const r=`${this.config.apiBaseUrl}/widget/attachments`,n=new FormData;n.append("file",t);const a=await fetch(r,{method:"POST",headers:this.getAuthHeaders(!1),body:n});if(!a.ok){let u=`HTTP ${a.status}`;try{u=(await a.json()).detail||u}catch{}throw new Error(`API Error: ${u}`)}const c=await a.json();if(!(c!=null&&c.url)||!(c!=null&&c.content_type)||!(c!=null&&c.name))throw new Error("Invalid attachment response from server");return{id:c.id,name:c.name,type:c.type==="image"?"image":"document",url:c.url,content_type:c.content_type,size:c.size,preview:c.preview}}async createSession(){const t=this.usePublishableKey()?"/widget/sessions":"/sessions",r=`${this.config.apiBaseUrl}${t}`,n=await fetch(r,{method:"POST",headers:this.getAuthHeaders(!0),body:JSON.stringify({name:"Chat Session",agentConfig:{type:"chat",settings:null}})});if(!n.ok){const a=await n.json();throw new Error(`API Error: ${a.detail}`)}return n.json()}async getSessionWithMessages(t){const r=this.usePublishableKey()?`/widget/sessions/${t}/with-messages`:`/sessions/${t}/with-messages`,n=`${this.config.apiBaseUrl}${r}`,a=await fetch(n,{method:"GET",headers:this.getAuthHeaders()});if(!a.ok){const c=await a.json();throw new Error(`API Error: ${c.detail}`)}return a.json()}async getAgents(){if(!this.config.apiKey)throw new Error("[Ordify] getAgents() requires apiKey and is not supported with publishableKey.");const t=`${this.config.apiBaseUrl}/chat/agents`,r=await fetch(t,{method:"GET",headers:{"api-key":this.config.apiKey,accept:"application/json"}});if(!r.ok){const a=await r.json();throw new Error(`API Error: ${a.detail}`)}return(await r.json()).agents||[]}async getSessions(){if(!this.config.apiKey)throw new Error("[Ordify] getSessions() requires apiKey and is not supported with publishableKey.");const t=`${this.config.apiBaseUrl}/sessions`,r=await fetch(t,{method:"GET",headers:{"api-key":this.config.apiKey,accept:"application/json"}});if(!r.ok){const n=await r.json();throw new Error(`API Error: ${n.detail}`)}return r.json()}}function Br(e){try{if(e.startsWith("data: ")){const t=e.slice(6).trim();if(t==="[DONE]"||t==="")return{text:"",sessionId:"",type:"done"};const r=JSON.parse(t);return r.done?{text:"",sessionId:r.sessionId||"",type:"done"}:r}}catch(t){console.warn("Failed to parse streaming response:",t)}return null}function tr(e){const t=(e.attachments||[]).map(r=>r.id).join("|");return`${e.role}:${e.content.trim()}:${t}`}function Pn(e){const t=e.attachments;if(!t||!Array.isArray(t)||t.length===0)return;const r=[];for(const n of t){const a=n.url||"";a&&r.push({id:n.id||Me(),name:String(n.name||"attachment"),type:n.type==="image"?"image":"document",url:a,content_type:String(n.content_type||n.contentType||"application/octet-stream"),size:n.size,preview:n.preview})}return r.length?r:void 0}function Pr(e){const[t,r]=k.useState([]),[n,a]=k.useState(!1),[c,u]=k.useState(null),[d,h]=k.useState(e.sessionId||null),[g,b]=k.useState(!1),[p,v]=k.useState(!1),[w,S]=k.useState(!1),[I,C]=k.useState(!1),[o,i]=k.useState(!1),s=k.useRef(null),f=k.useRef(""),m=k.useRef(!1),x=k.useRef(!1),y=k.useRef(!1),E=`${e.publishableKey??""}|${e.apiKey??""}|${e.apiBaseUrl??""}|${e.agentId}`;f.current!==E&&(s.current=null,f.current=E),s.current||(s.current=new Nr({publishableKey:e.publishableKey,apiKey:e.apiKey,apiBaseUrl:e.apiBaseUrl||"https://api.ordify.ai",agentId:e.agentId}));const M=k.useRef(null),j=k.useRef(new Set);k.useEffect(()=>{if(e.sessionId&&e.sessionId!==d){const A=j.current.has(e.sessionId);h(e.sessionId),x.current=!1,M.current=null,S(!1),A||r([])}},[e.sessionId]),k.useEffect(()=>{(async()=>{const D=d||e.sessionId;if(y.current||n)return;if(!D){x.current=!0,M.current=null,S(!1);return}if(M.current===D)return;if(j.current.has(D)&&t.length>0&&!x.current){x.current=!0,M.current=D,C(!1);return}M.current=D,C(!0);try{const $=await s.current.getSessionWithMessages(D);if($.messages&&$.messages.length>0){const N=$.messages.map(O=>({id:O.id||Me(),content:O.content||"",role:O.role==="assistant"?"assistant":"user",timestamp:O.timestamp?new Date(O.timestamp):new Date,sessionId:D,attachments:Pn(O)}));r(O=>{if(O.length>0){const W=new Map,B=new Map;return O.forEach(z=>{W.set(z.id,z);const U=tr(z);B.has(U)||B.set(U,z)}),N.forEach(z=>{const U=tr(z);!W.has(z.id)&&!B.has(U)?(W.set(z.id,z),B.set(U,z)):W.has(z.id)&&W.set(z.id,z)}),Array.from(W.values()).sort((z,U)=>z.timestamp.getTime()-U.timestamp.getTime())}return N}),S(!0),i(!0)}else S(!1)}catch($){console.warn("Failed to load session history:",$),S(!1),$ instanceof Error&&$.message.includes("404")&&(h(null),M.current=null)}finally{C(!1),x.current=!0}})()},[d,e.sessionId]);const R=k.useCallback(()=>{u(null)},[]),K=k.useCallback(async A=>{if(!s.current)throw new Error("API client not initialized");return s.current.uploadAttachment(A)},[]),L=k.useCallback(async(A,D,H)=>{const $=A.trim(),N=!!(H&&H.length>0);if(!(!$&&!N||n)){a(!0),u(null);try{const O=H!=null&&H.length?H.map(V=>({...V})):void 0,W={id:Me(),content:$,role:"user",timestamp:new Date,sessionId:d||void 0,attachments:O};r(V=>[...V,W]),i(!0);let B=d||e.sessionId||null;B?B!==d&&h(B):(B=(await s.current.createSession()).id,j.current.add(B),e.onSessionCreated&&e.onSessionCreated(B)),y.current=!0;const z=(await s.current.sendMessage($||"(see attachments)",B,D,O)).getReader(),U=new TextDecoder;let Q={id:Me(),content:"",role:"assistant",timestamp:new Date,sessionId:B};for(r(V=>[...V,Q]);;){const{done:V,value:oe}=await z.read();if(V)break;const ae=U.decode(oe,{stream:!0}).split(`
10
- `);for(const be of ae){if(!be.trim())continue;const te=Br(be);if(te){if(te.type==="stream"&&te.text)Q.content+=te.text,r(J=>J.find(Ee=>Ee.id===Q.id)?J.map(Ee=>Ee.id===Q.id?{...Ee,content:Q.content}:Ee):[...J,{...Q,content:Q.content}]);else if(te.type==="done")break}}}B&&B!==d&&h(B),e.onMessage&&e.onMessage(Q)}catch(O){const W=O instanceof Error?O.message:"Failed to send message";u(W),e.onError&&e.onError(O instanceof Error?O:new Error(W))}finally{y.current=!1,a(!1)}}},[e.onSessionCreated,e.onMessage,e.onError,e.sessionId,n,d]);return k.useEffect(()=>{const D=!(d||e.sessionId)||!w,H=e.quickQuestions&&e.quickQuestions.length>0;if((e.initialMessage||e.initialContext)&&D&&!p&&!n&&!I&&!m.current&&x.current&&!H){v(!0),m.current=!0;let $,N;if(e.initialMessage&&e.initialContext)$=e.initialMessage,N=e.initialContext;else if(e.initialMessage)$=e.initialMessage,N=void 0;else if(e.initialContext)$="Hi",N=e.initialContext;else return;setTimeout(()=>{L($,N)},0)}},[e.initialMessage,e.initialContext,p,n,I,w,d,e.sessionId,L]),{messages:t,sendMessage:L,uploadAttachment:K,isLoading:n,error:c,clearError:R,sessionId:d,isOpen:g,setIsOpen:b,hasSessionStarted:o}}function Ne(e){if(typeof process>"u"||!process.env)return;const t=process.env[e];return typeof t=="string"&&t.length>0?t:void 0}function Lr(e){return k.useMemo(()=>{const t=e.agentId||Ne("ORDIFY_AGENT_ID"),r=e.publishableKey||Ne("ORDIFY_PUBLISHABLE_KEY"),n=e.apiKey||Ne("ORDIFY_API_KEY"),a=e.apiBaseUrl||Ne("ORDIFY_API_BASE_URL")||"https://r.ordify.ai";if(!t)throw new Error("Ordify agent ID is required. Provide agentId prop or set ORDIFY_AGENT_ID environment variable.");if(!r&&!n)throw new Error("Ordify credentials are required. Provide publishableKey (recommended) or apiKey.");return{agentId:t,publishableKey:r,apiKey:n,apiBaseUrl:a,mode:e.mode||"floating",position:e.position||"bottom-right",theme:e.theme||"auto",placeholder:e.placeholder||"Type a message...",height:e.height||"500px",className:e.className||"",buttonStyle:e.buttonStyle||{},chatWindowStyle:e.chatWindowStyle||{},showHeader:e.showHeader!==!1,buttonText:e.buttonText,chatName:e.chatName,primaryColor:e.primaryColor,agentImage:e.agentImage,onMessage:e.onMessage,onError:e.onError,onClose:e.onClose,onSessionCreated:e.onSessionCreated,initialMessage:e.initialMessage,initialContext:e.initialContext,sessionId:e.sessionId,quickQuestions:e.quickQuestions,welcomeMessage:e.welcomeMessage,welcomeImage:e.welcomeImage,enableAttachments:e.enableAttachments,maxAttachmentSizeMB:e.maxAttachmentSizeMB,maxAttachments:e.maxAttachments,allowedAttachmentTypes:e.allowedAttachmentTypes}},[e])}/**
9
+ */var On=x,Pn=Symbol.for("react.element"),Dn=Symbol.for("react.fragment"),zn=Object.prototype.hasOwnProperty,Nn=On.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Bn={key:!0,ref:!0,__self:!0,__source:!0};function Br(e,t,r){var n,a={},c=null,u=null;r!==void 0&&(c=""+r),t.key!==void 0&&(c=""+t.key),t.ref!==void 0&&(u=t.ref);for(n in t)zn.call(t,n)&&!Bn.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)a[n]===void 0&&(a[n]=t[n]);return{$$typeof:Pn,type:e,key:c,ref:u,props:a,_owner:Nn.current}}et.Fragment=Dn;et.jsx=Br;et.jsxs=Br;Nr.exports=et;var l=Nr.exports;function Re(){return Math.random().toString(36).substr(2,9)}function Ln(e){return new Intl.DateTimeFormat("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}).format(e)}function Fn(e,t){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>e(...n),t)}}function Wn(e,t){let r;return(...n)=>{r||(e(...n),r=!0,setTimeout(()=>r=!1,t))}}function rr(e){let t=e.replace(/\r\n/g,`
10
+ `);return t=t.replace(/\n\nUsing [^\n]+\.{3}(?:\s*\n)+/g,`
11
+
12
+ `),t=t.replace(/\n\nAction completed(?:\s*\n)+/g,`
13
+
14
+ `),t=t.replace(/^Using [^\n]+\.{3}(?:\s*\n)+/m,""),t=t.replace(/^Action completed(?:\s*\n)+/m,""),t=t.replace(/\n{3,}/g,`
15
+
16
+ `),t}function Kn(e){const t=e.type;return t==="adk_tool"||t==="ADK_TOOL"}function Un(e){return{id:e.id,name:e.name,url:e.url,content_type:e.content_type,type:e.type,size:e.size??null,preview:null,oauth_token:null}}class Lr{constructor(t){mt(this,"config");mt(this,"warnedLegacyApiKey",!1);if(this.config=t,!this.config.publishableKey&&!this.config.apiKey)throw new Error("Either publishableKey or apiKey is required.");this.config.publishableKey&&this.config.apiKey&&console.warn("[Ordify] Both publishableKey and apiKey provided. publishableKey will be used.")}usePublishableKey(){return!!this.config.publishableKey}maybeWarnLegacyApiKey(){this.usePublishableKey()||this.warnedLegacyApiKey||(this.warnedLegacyApiKey=!0,console.warn("[Ordify] Using legacy apiKey in browser. For production embeds, use publishableKey from user settings."))}getAuthHeaders(t=!1){return this.usePublishableKey()?{...t?{"Content-Type":"application/json"}:{},"x-ordify-publishable-key":this.config.publishableKey,accept:"application/json"}:(this.maybeWarnLegacyApiKey(),{...t?{"Content-Type":"application/json"}:{},"api-key":this.config.apiKey,accept:"application/json"})}getAuthHeadersForPdfExport(){return this.usePublishableKey()?{"Content-Type":"application/json","x-ordify-publishable-key":this.config.publishableKey,accept:"application/pdf"}:(this.maybeWarnLegacyApiKey(),{"Content-Type":"application/json","api-key":this.config.apiKey,accept:"application/pdf"})}async exportMessagePdf(t,r){const n=`${this.config.apiBaseUrl}/document-conversion/pdf`,a=await fetch(n,{method:"POST",headers:this.getAuthHeadersForPdfExport(),body:JSON.stringify({content:t,filename:r??void 0,format:"A4",margin_top:"1cm",margin_bottom:"1cm",margin_left:"1cm",margin_right:"1cm",print_background:!0,display_header_footer:!1})});if(!a.ok){let p=`HTTP ${a.status}`;try{const v=await a.json();p=typeof v.detail=="string"?v.detail:p}catch{try{const v=await a.text();v&&(p=v.slice(0,500))}catch{}}throw new Error(`PDF export failed: ${p}`)}const c=await a.blob(),u=a.headers.get("Content-Disposition");let d=r!=null&&r.endsWith(".pdf")?r:`${r??"document"}.pdf`;const h=/filename\*?=(?:UTF-8''|")?([^";\n]+)/i.exec(u??"");if(h!=null&&h[1])try{d=decodeURIComponent(h[1].replace(/^"|"$/g,"").trim())}catch{d=h[1].replace(/^"|"$/g,"").trim()}d.endsWith(".pdf")||(d+=".pdf");const b=URL.createObjectURL(c),g=document.createElement("a");g.href=b,g.download=d,g.rel="noopener noreferrer",document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL(b)}async sendMessage(t,r,n,a){const c=this.usePublishableKey()?`/widget/chat/${this.config.agentId}`:`/chat/agents/${this.config.agentId}`,u=`${this.config.apiBaseUrl}${c}`,d=a!=null&&a.length?a.map(Un):void 0,h={message:t,sessionId:r,context:n};d!=null&&d.length&&(h.attachments=d,h.use_document_understanding=d.some(g=>g.type==="document"||!g.type&&!String(g.content_type||"").startsWith("image/")));const b=await fetch(u,{method:"POST",headers:this.getAuthHeaders(!0),body:JSON.stringify(h)});if(!b.ok){const g=await b.json();throw new Error(`API Error: ${g.detail}`)}if(!b.body)throw new Error("No response body");return b.body}async uploadAttachment(t){if(!this.usePublishableKey())throw new Error("[Ordify] uploadAttachment requires publishableKey.");const r=`${this.config.apiBaseUrl}/widget/attachments`,n=new FormData;n.append("file",t);const a=await fetch(r,{method:"POST",headers:this.getAuthHeaders(!1),body:n});if(!a.ok){let u=`HTTP ${a.status}`;try{u=(await a.json()).detail||u}catch{}throw new Error(`API Error: ${u}`)}const c=await a.json();if(!(c!=null&&c.url)||!(c!=null&&c.content_type)||!(c!=null&&c.name))throw new Error("Invalid attachment response from server");return{id:c.id,name:c.name,type:c.type==="image"?"image":"document",url:c.url,content_type:c.content_type,size:c.size,preview:c.preview}}async createSession(){const t=this.usePublishableKey()?"/widget/sessions":"/sessions",r=`${this.config.apiBaseUrl}${t}`,n=await fetch(r,{method:"POST",headers:this.getAuthHeaders(!0),body:JSON.stringify({name:"Chat Session",agentConfig:{type:"chat",settings:null}})});if(!n.ok){const a=await n.json();throw new Error(`API Error: ${a.detail}`)}return n.json()}async getSessionWithMessages(t){const r=this.usePublishableKey()?`/widget/sessions/${t}/with-messages`:`/sessions/${t}/with-messages`,n=`${this.config.apiBaseUrl}${r}`,a=await fetch(n,{method:"GET",headers:this.getAuthHeaders()});if(!a.ok){const c=await a.json();throw new Error(`API Error: ${c.detail}`)}return a.json()}async getAgents(){if(!this.config.apiKey)throw new Error("[Ordify] getAgents() requires apiKey and is not supported with publishableKey.");const t=`${this.config.apiBaseUrl}/chat/agents`,r=await fetch(t,{method:"GET",headers:{"api-key":this.config.apiKey,accept:"application/json"}});if(!r.ok){const a=await r.json();throw new Error(`API Error: ${a.detail}`)}return(await r.json()).agents||[]}async getSessions(){if(!this.config.apiKey)throw new Error("[Ordify] getSessions() requires apiKey and is not supported with publishableKey.");const t=`${this.config.apiBaseUrl}/sessions`,r=await fetch(t,{method:"GET",headers:{"api-key":this.config.apiKey,accept:"application/json"}});if(!r.ok){const n=await r.json();throw new Error(`API Error: ${n.detail}`)}return r.json()}}function Fr(e){try{if(e.startsWith("data: ")){const t=e.slice(6).trim();if(t==="[DONE]"||t==="")return{text:"",sessionId:"",type:"done"};const r=JSON.parse(t);return r.done?{text:"",sessionId:r.sessionId||"",type:"done"}:r.type==="adk_tool"||r.type==="turn_complete"||r.type==="image"?null:r}}catch(t){console.warn("Failed to parse streaming response:",t)}return null}function nr(e){const t=(e.attachments||[]).map(r=>r.id).join("|");return`${e.role}:${e.content.trim()}:${t}`}function Hn(e){const t=e.attachments;if(!t||!Array.isArray(t)||t.length===0)return;const r=[];for(const n of t){const a=n.url||"";a&&r.push({id:n.id||Re(),name:String(n.name||"attachment"),type:n.type==="image"?"image":"document",url:a,content_type:String(n.content_type||n.contentType||"application/octet-stream"),size:n.size,preview:n.preview})}return r.length?r:void 0}function Wr(e){const[t,r]=x.useState([]),[n,a]=x.useState(!1),[c,u]=x.useState(null),[d,h]=x.useState(e.sessionId||null),[b,g]=x.useState(!1),[p,v]=x.useState(!1),[w,C]=x.useState(!1),[j,$]=x.useState(!1),[o,i]=x.useState(!1),s=x.useRef(null),f=x.useRef(""),m=x.useRef(!1),k=x.useRef(!1),y=x.useRef(!1),T=`${e.publishableKey??""}|${e.apiKey??""}|${e.apiBaseUrl??""}|${e.agentId}`;f.current!==T&&(s.current=null,f.current=T),s.current||(s.current=new Lr({publishableKey:e.publishableKey,apiKey:e.apiKey,apiBaseUrl:e.apiBaseUrl||"https://api.ordify.ai",agentId:e.agentId}));const R=x.useRef(null),I=x.useRef(new Set);x.useEffect(()=>{if(e.sessionId&&e.sessionId!==d){const A=I.current.has(e.sessionId);h(e.sessionId),k.current=!1,R.current=null,C(!1),A||r([])}},[e.sessionId]),x.useEffect(()=>{(async()=>{const D=d||e.sessionId;if(y.current||n)return;if(!D){k.current=!0,R.current=null,C(!1);return}if(R.current===D)return;if(I.current.has(D)&&t.length>0&&!k.current){k.current=!0,R.current=D,$(!1);return}R.current=D,$(!0);try{const S=await s.current.getSessionWithMessages(D);if(S.messages&&S.messages.length>0){const P=S.messages.filter(z=>!Kn(z)).map(z=>{const L=z.role==="assistant"?"assistant":"user",O=String(z.content||"");return{id:z.id||Re(),content:L==="assistant"?rr(O):O,role:L,timestamp:z.timestamp?new Date(z.timestamp):new Date,sessionId:D,attachments:Hn(z)}});r(z=>{if(z.length>0){const L=new Map,O=new Map;return z.forEach(N=>{L.set(N.id,N);const H=nr(N);O.has(H)||O.set(H,N)}),P.forEach(N=>{const H=nr(N);!L.has(N.id)&&!O.has(H)?(L.set(N.id,N),O.set(H,N)):L.has(N.id)&&L.set(N.id,N)}),Array.from(L.values()).sort((N,H)=>N.timestamp.getTime()-H.timestamp.getTime())}return P}),C(!0),i(!0)}else C(!1)}catch(S){console.warn("Failed to load session history:",S),C(!1),S instanceof Error&&S.message.includes("404")&&(h(null),R.current=null)}finally{$(!1),k.current=!0}})()},[d,e.sessionId]);const M=x.useCallback(()=>{u(null)},[]),K=x.useCallback(async A=>{if(!s.current)throw new Error("API client not initialized");return s.current.uploadAttachment(A)},[]),F=x.useCallback(async(A,D)=>{if(!s.current)throw new Error("API client not initialized");await s.current.exportMessagePdf(A,D)},[]),V=x.useCallback(async(A,D,U)=>{const S=A.trim(),P=!!(U&&U.length>0);if(!(!S&&!P||n)){a(!0),u(null);try{const z=U!=null&&U.length?U.map(Z=>({...Z})):void 0,L={id:Re(),content:S,role:"user",timestamp:new Date,sessionId:d||void 0,attachments:z};r(Z=>[...Z,L]),i(!0);let O=d||e.sessionId||null;O?O!==d&&h(O):(O=(await s.current.createSession()).id,I.current.add(O),e.onSessionCreated&&e.onSessionCreated(O)),y.current=!0;const N=(await s.current.sendMessage(S||"(see attachments)",O,D,z)).getReader(),H=new TextDecoder;let Q={id:Re(),content:"",role:"assistant",timestamp:new Date,sessionId:O};for(r(Z=>[...Z,Q]);;){const{done:Z,value:se}=await N.read();if(Z)break;const Te=H.decode(se,{stream:!0}).split(`
17
+ `);for(const pe of Te){if(!pe.trim())continue;const J=Fr(pe);if(J){if(J.type==="stream"&&J.text)Q.content=rr(Q.content+J.text),r(ht=>ht.find(Ee=>Ee.id===Q.id)?ht.map(Ee=>Ee.id===Q.id?{...Ee,content:Q.content}:Ee):[...ht,{...Q,content:Q.content}]);else if(J.type==="done")break}}}O&&O!==d&&h(O),e.onMessage&&e.onMessage(Q)}catch(z){const L=z instanceof Error?z.message:"Failed to send message";u(L),e.onError&&e.onError(z instanceof Error?z:new Error(L))}finally{y.current=!1,a(!1)}}},[e.onSessionCreated,e.onMessage,e.onError,e.sessionId,n,d]);return x.useEffect(()=>{const D=!(d||e.sessionId)||!w,U=e.quickQuestions&&e.quickQuestions.length>0;if((e.initialMessage||e.initialContext)&&D&&!p&&!n&&!j&&!m.current&&k.current&&!U){v(!0),m.current=!0;let S,P;if(e.initialMessage&&e.initialContext)S=e.initialMessage,P=e.initialContext;else if(e.initialMessage)S=e.initialMessage,P=void 0;else if(e.initialContext)S="Hi",P=e.initialContext;else return;setTimeout(()=>{V(S,P)},0)}},[e.initialMessage,e.initialContext,p,n,j,w,d,e.sessionId,V]),{messages:t,sendMessage:V,uploadAttachment:K,exportMessagePdf:F,isLoading:n,error:c,clearError:M,sessionId:d,isOpen:b,setIsOpen:g,hasSessionStarted:o}}function Ne(e){if(typeof process>"u"||!process.env)return;const t=process.env[e];return typeof t=="string"&&t.length>0?t:void 0}function Kr(e){return x.useMemo(()=>{const t=e.agentId||Ne("ORDIFY_AGENT_ID"),r=e.publishableKey||Ne("ORDIFY_PUBLISHABLE_KEY"),n=e.apiKey||Ne("ORDIFY_API_KEY"),a=e.apiBaseUrl||Ne("ORDIFY_API_BASE_URL")||"https://r.ordify.ai";if(!t)throw new Error("Ordify agent ID is required. Provide agentId prop or set ORDIFY_AGENT_ID environment variable.");if(!r&&!n)throw new Error("Ordify credentials are required. Provide publishableKey (recommended) or apiKey.");return{agentId:t,publishableKey:r,apiKey:n,apiBaseUrl:a,mode:e.mode||"floating",position:e.position||"bottom-right",theme:e.theme||"auto",placeholder:e.placeholder||"Type a message...",height:e.height||"500px",className:e.className||"",buttonStyle:e.buttonStyle||{},chatWindowStyle:e.chatWindowStyle||{},showHeader:e.showHeader!==!1,buttonText:e.buttonText,chatName:e.chatName,primaryColor:e.primaryColor,agentImage:e.agentImage,onMessage:e.onMessage,onError:e.onError,onClose:e.onClose,onSessionCreated:e.onSessionCreated,initialMessage:e.initialMessage,initialContext:e.initialContext,sessionId:e.sessionId,quickQuestions:e.quickQuestions,welcomeMessage:e.welcomeMessage,welcomeImage:e.welcomeImage,enableAttachments:e.enableAttachments,maxAttachmentSizeMB:e.maxAttachmentSizeMB,maxAttachments:e.maxAttachments,allowedAttachmentTypes:e.allowedAttachmentTypes}},[e])}async function qn(e){var r;if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))try{await navigator.clipboard.writeText(e);return}catch{}const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select();try{document.execCommand("copy")}finally{document.body.removeChild(t)}}/**
18
+ * @license lucide-react v0.544.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */const Gn=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Yn=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),or=e=>{const t=Yn(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ur=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),Qn=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
11
23
  * @license lucide-react v0.544.0 - ISC
12
24
  *
13
25
  * This source code is licensed under the ISC license.
14
26
  * See the LICENSE file in the root directory of this source tree.
15
- */const Ln=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Fn=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),rr=e=>{const t=Fn(e);return t.charAt(0).toUpperCase()+t.slice(1)},Fr=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),Kn=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
27
+ */var Vn={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"};/**
16
28
  * @license lucide-react v0.544.0 - ISC
17
29
  *
18
30
  * This source code is licensed under the ISC license.
19
31
  * See the LICENSE file in the root directory of this source tree.
20
- */var Wn={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"};/**
32
+ */const Zn=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:c,iconNode:u,...d},h)=>x.createElement("svg",{ref:h,...Vn,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Ur("lucide",a),...!c&&!Qn(d)&&{"aria-hidden":"true"},...d},[...u.map(([b,g])=>x.createElement(b,g)),...Array.isArray(c)?c:[c]]));/**
21
33
  * @license lucide-react v0.544.0 - ISC
22
34
  *
23
35
  * This source code is licensed under the ISC license.
24
36
  * See the LICENSE file in the root directory of this source tree.
25
- */const Un=k.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:c,iconNode:u,...d},h)=>k.createElement("svg",{ref:h,...Wn,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Fr("lucide",a),...!c&&!Kn(d)&&{"aria-hidden":"true"},...d},[...u.map(([g,b])=>k.createElement(g,b)),...Array.isArray(c)?c:[c]]));/**
37
+ */const Ie=(e,t)=>{const r=x.forwardRef(({className:n,...a},c)=>x.createElement(Zn,{ref:c,iconNode:t,className:Ur(`lucide-${Gn(or(e))}`,`lucide-${e}`,n),...a}));return r.displayName=or(e),r};/**
26
38
  * @license lucide-react v0.544.0 - ISC
27
39
  *
28
40
  * This source code is licensed under the ISC license.
29
41
  * See the LICENSE file in the root directory of this source tree.
30
- */const et=(e,t)=>{const r=k.forwardRef(({className:n,...a},c)=>k.createElement(Un,{ref:c,iconNode:t,className:Fr(`lucide-${Ln(rr(e))}`,`lucide-${e}`,n),...a}));return r.displayName=rr(e),r};/**
42
+ */const Jn=[["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"}]],Xn=Ie("copy",Jn);/**
31
43
  * @license lucide-react v0.544.0 - ISC
32
44
  *
33
45
  * This source code is licensed under the ISC license.
34
46
  * See the LICENSE file in the root directory of this source tree.
35
- */const Hn=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],qn=et("file-text",Hn);/**
47
+ */const eo=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],to=Ie("file-down",eo);/**
36
48
  * @license lucide-react v0.544.0 - ISC
37
49
  *
38
50
  * This source code is licensed under the ISC license.
39
51
  * See the LICENSE file in the root directory of this source tree.
40
- */const Gn=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Yn=et("image",Gn);/**
52
+ */const ro=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],no=Ie("file-text",ro);/**
41
53
  * @license lucide-react v0.544.0 - ISC
42
54
  *
43
55
  * This source code is licensed under the ISC license.
44
56
  * See the LICENSE file in the root directory of this source tree.
45
- */const Qn=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Vn=et("paperclip",Qn);/**
57
+ */const oo=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],ao=Ie("image",oo);/**
46
58
  * @license lucide-react v0.544.0 - ISC
47
59
  *
48
60
  * This source code is licensed under the ISC license.
49
61
  * See the LICENSE file in the root directory of this source tree.
50
- */const Zn=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Jn=et("x",Zn);var Z=function(){return Z=Object.assign||function(t){for(var r,n=1,a=arguments.length;n<a;n++){r=arguments[n];for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(t[c]=r[c])}return t},Z.apply(this,arguments)};function Ye(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,c;n<a;n++)(c||!(n in t))&&(c||(c=Array.prototype.slice.call(t,0,n)),c[n]=t[n]);return e.concat(c||Array.prototype.slice.call(t))}var F="-ms-",_e="-moz-",P="-webkit-",Kr="comm",tt="rule",Nt="decl",Xn="@import",Wr="@keyframes",eo="@layer",Ur=Math.abs,Bt=String.fromCharCode,At=Object.assign;function to(e,t){return Y(e,0)^45?(((t<<2^Y(e,0))<<2^Y(e,1))<<2^Y(e,2))<<2^Y(e,3):0}function Hr(e){return e.trim()}function ie(e,t){return(e=t.exec(e))?e[0]:e}function _(e,t,r){return e.replace(t,r)}function Fe(e,t,r){return e.indexOf(t,r)}function Y(e,t){return e.charCodeAt(t)|0}function ke(e,t,r){return e.slice(t,r)}function ne(e){return e.length}function qr(e){return e.length}function Re(e,t){return t.push(e),e}function ro(e,t){return e.map(t).join("")}function nr(e,t){return e.filter(function(r){return!ie(r,t)})}var rt=1,we=1,Gr=0,X=0,G=0,Ae="";function nt(e,t,r,n,a,c,u,d){return{value:e,root:t,parent:r,type:n,props:a,children:c,line:rt,column:we,length:u,return:"",siblings:d}}function de(e,t){return At(nt("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function ye(e){for(;e.root;)e=de(e.root,{children:[e]});Re(e,e.siblings)}function no(){return G}function oo(){return G=X>0?Y(Ae,--X):0,we--,G===10&&(we=1,rt--),G}function ee(){return G=X<Gr?Y(Ae,X++):0,we++,G===10&&(we=1,rt++),G}function fe(){return Y(Ae,X)}function Ke(){return X}function ot(e,t){return ke(Ae,e,t)}function Et(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function ao(e){return rt=we=1,Gr=ne(Ae=e),X=0,[]}function so(e){return Ae="",e}function mt(e){return Hr(ot(X-1,Tt(e===91?e+2:e===40?e+1:e)))}function io(e){for(;(G=fe())&&G<33;)ee();return Et(e)>2||Et(G)>3?"":" "}function co(e,t){for(;--t&&ee()&&!(G<48||G>102||G>57&&G<65||G>70&&G<97););return ot(e,Ke()+(t<6&&fe()==32&&ee()==32))}function Tt(e){for(;ee();)switch(G){case e:return X;case 34:case 39:e!==34&&e!==39&&Tt(G);break;case 40:e===41&&Tt(e);break;case 92:ee();break}return X}function lo(e,t){for(;ee()&&e+G!==57;)if(e+G===84&&fe()===47)break;return"/*"+ot(t,X-1)+"*"+Bt(e===47?e:ee())}function uo(e){for(;!Et(fe());)ee();return ot(e,X)}function po(e){return so(We("",null,null,null,[""],e=ao(e),0,[0],e))}function We(e,t,r,n,a,c,u,d,h){for(var g=0,b=0,p=u,v=0,w=0,S=0,I=1,C=1,o=1,i=0,s="",f=a,m=c,x=n,y=s;C;)switch(S=i,i=ee()){case 40:if(S!=108&&Y(y,p-1)==58){Fe(y+=_(mt(i),"&","&\f"),"&\f",Ur(g?d[g-1]:0))!=-1&&(o=-1);break}case 34:case 39:case 91:y+=mt(i);break;case 9:case 10:case 13:case 32:y+=io(S);break;case 92:y+=co(Ke()-1,7);continue;case 47:switch(fe()){case 42:case 47:Re(fo(lo(ee(),Ke()),t,r,h),h);break;default:y+="/"}break;case 123*I:d[g++]=ne(y)*o;case 125*I:case 59:case 0:switch(i){case 0:case 125:C=0;case 59+b:o==-1&&(y=_(y,/\f/g,"")),w>0&&ne(y)-p&&Re(w>32?ar(y+";",n,r,p-1,h):ar(_(y," ","")+";",n,r,p-2,h),h);break;case 59:y+=";";default:if(Re(x=or(y,t,r,g,b,a,d,s,f=[],m=[],p,c),c),i===123)if(b===0)We(y,t,x,x,f,c,p,d,m);else switch(v===99&&Y(y,3)===110?100:v){case 100:case 108:case 109:case 115:We(e,x,x,n&&Re(or(e,x,x,0,0,a,d,s,a,f=[],p,m),m),a,m,p,d,n?f:m);break;default:We(y,x,x,x,[""],m,0,d,m)}}g=b=w=0,I=o=1,s=y="",p=u;break;case 58:p=1+ne(y),w=S;default:if(I<1){if(i==123)--I;else if(i==125&&I++==0&&oo()==125)continue}switch(y+=Bt(i),i*I){case 38:o=b>0?1:(y+="\f",-1);break;case 44:d[g++]=(ne(y)-1)*o,o=1;break;case 64:fe()===45&&(y+=mt(ee())),v=fe(),b=p=ne(s=y+=uo(Ke())),i++;break;case 45:S===45&&ne(y)==2&&(I=0)}}return c}function or(e,t,r,n,a,c,u,d,h,g,b,p){for(var v=a-1,w=a===0?c:[""],S=qr(w),I=0,C=0,o=0;I<n;++I)for(var i=0,s=ke(e,v+1,v=Ur(C=u[I])),f=e;i<S;++i)(f=Hr(C>0?w[i]+" "+s:_(s,/&\f/g,w[i])))&&(h[o++]=f);return nt(e,t,r,a===0?tt:d,h,g,b,p)}function fo(e,t,r,n){return nt(e,t,r,Kr,Bt(no()),ke(e,2,-2),0,n)}function ar(e,t,r,n,a){return nt(e,t,r,Nt,ke(e,0,n),ke(e,n+1,-1),n,a)}function Yr(e,t,r){switch(to(e,t)){case 5103:return P+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return P+e+e;case 4789:return _e+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return P+e+_e+e+F+e+e;case 5936:switch(Y(e,t+11)){case 114:return P+e+F+_(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return P+e+F+_(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return P+e+F+_(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return P+e+F+e+e;case 6165:return P+e+F+"flex-"+e+e;case 5187:return P+e+_(e,/(\w+).+(:[^]+)/,P+"box-$1$2"+F+"flex-$1$2")+e;case 5443:return P+e+F+"flex-item-"+_(e,/flex-|-self/g,"")+(ie(e,/flex-|baseline/)?"":F+"grid-row-"+_(e,/flex-|-self/g,""))+e;case 4675:return P+e+F+"flex-line-pack"+_(e,/align-content|flex-|-self/g,"")+e;case 5548:return P+e+F+_(e,"shrink","negative")+e;case 5292:return P+e+F+_(e,"basis","preferred-size")+e;case 6060:return P+"box-"+_(e,"-grow","")+P+e+F+_(e,"grow","positive")+e;case 4554:return P+_(e,/([^-])(transform)/g,"$1"+P+"$2")+e;case 6187:return _(_(_(e,/(zoom-|grab)/,P+"$1"),/(image-set)/,P+"$1"),e,"")+e;case 5495:case 3959:return _(e,/(image-set\([^]*)/,P+"$1$`$1");case 4968:return _(_(e,/(.+:)(flex-)?(.*)/,P+"box-pack:$3"+F+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+P+e+e;case 4200:if(!ie(e,/flex-|baseline/))return F+"grid-column-align"+ke(e,t)+e;break;case 2592:case 3360:return F+_(e,"template-","")+e;case 4384:case 3616:return r&&r.some(function(n,a){return t=a,ie(n.props,/grid-\w+-end/)})?~Fe(e+(r=r[t].value),"span",0)?e:F+_(e,"-start","")+e+F+"grid-row-span:"+(~Fe(r,"span",0)?ie(r,/\d+/):+ie(r,/\d+/)-+ie(e,/\d+/))+";":F+_(e,"-start","")+e;case 4896:case 4128:return r&&r.some(function(n){return ie(n.props,/grid-\w+-start/)})?e:F+_(_(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return _(e,/(.+)-inline(.+)/,P+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ne(e)-1-t>6)switch(Y(e,t+1)){case 109:if(Y(e,t+4)!==45)break;case 102:return _(e,/(.+:)(.+)-([^]+)/,"$1"+P+"$2-$3$1"+_e+(Y(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Fe(e,"stretch",0)?Yr(_(e,"stretch","fill-available"),t,r)+e:e}break;case 5152:case 5920:return _(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(n,a,c,u,d,h,g){return F+a+":"+c+g+(u?F+a+"-span:"+(d?h:+h-+c)+g:"")+e});case 4949:if(Y(e,t+6)===121)return _(e,":",":"+P)+e;break;case 6444:switch(Y(e,Y(e,14)===45?18:11)){case 120:return _(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+P+(Y(e,14)===45?"inline-":"")+"box$3$1"+P+"$2$3$1"+F+"$2box$3")+e;case 100:return _(e,":",":"+F)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return _(e,"scroll-","scroll-snap-")+e}return e}function Qe(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function ho(e,t,r,n){switch(e.type){case eo:if(e.children.length)break;case Xn:case Nt:return e.return=e.return||e.value;case Kr:return"";case Wr:return e.return=e.value+"{"+Qe(e.children,n)+"}";case tt:if(!ne(e.value=e.props.join(",")))return""}return ne(r=Qe(e.children,n))?e.return=e.value+"{"+r+"}":""}function mo(e){var t=qr(e);return function(r,n,a,c){for(var u="",d=0;d<t;d++)u+=e[d](r,n,a,c)||"";return u}}function go(e){return function(t){t.root||(t=t.return)&&e(t)}}function bo(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case Nt:e.return=Yr(e.value,e.length,r);return;case Wr:return Qe([de(e,{value:_(e.value,"@","@"+P)})],n);case tt:if(e.length)return ro(r=e.props,function(a){switch(ie(a,n=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":ye(de(e,{props:[_(a,/:(read-\w+)/,":"+_e+"$1")]})),ye(de(e,{props:[a]})),At(e,{props:nr(r,n)});break;case"::placeholder":ye(de(e,{props:[_(a,/:(plac\w+)/,":"+P+"input-$1")]})),ye(de(e,{props:[_(a,/:(plac\w+)/,":"+_e+"$1")]})),ye(de(e,{props:[_(a,/:(plac\w+)/,F+"input-$1")]})),ye(de(e,{props:[a]})),At(e,{props:nr(r,n)});break}return""})}}var yo={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},ve=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",Qr="active",Vr="data-styled-version",at="6.1.19",Pt=`/*!sc*/
51
- `,Ve=typeof window<"u"&&typeof document<"u",xo=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==""?process.env.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&process.env.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.SC_DISABLE_SPEEDY!==void 0&&process.env.SC_DISABLE_SPEEDY!==""&&process.env.SC_DISABLE_SPEEDY!=="false"&&process.env.SC_DISABLE_SPEEDY),st=Object.freeze([]),$e=Object.freeze({});function ko(e,t,r){return r===void 0&&(r=$e),e.theme!==r.theme&&e.theme||t||r.theme}var Zr=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),wo=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,vo=/(^-|-$)/g;function sr(e){return e.replace(wo,"-").replace(vo,"")}var $o=/(a)(d)/gi,Be=52,ir=function(e){return String.fromCharCode(e+(e>25?39:97))};function Rt(e){var t,r="";for(t=Math.abs(e);t>Be;t=t/Be|0)r=ir(t%Be)+r;return(ir(t%Be)+r).replace($o,"$1-$2")}var gt,Jr=5381,xe=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},Xr=function(e){return xe(Jr,e)};function So(e){return Rt(Xr(e)>>>0)}function Co(e){return e.displayName||e.name||"Component"}function bt(e){return typeof e=="string"&&!0}var en=typeof Symbol=="function"&&Symbol.for,tn=en?Symbol.for("react.memo"):60115,jo=en?Symbol.for("react.forward_ref"):60112,Io={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Ao={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},rn={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Eo=((gt={})[jo]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},gt[tn]=rn,gt);function cr(e){return("type"in(t=e)&&t.type.$$typeof)===tn?rn:"$$typeof"in e?Eo[e.$$typeof]:Io;var t}var To=Object.defineProperty,Ro=Object.getOwnPropertyNames,lr=Object.getOwnPropertySymbols,Mo=Object.getOwnPropertyDescriptor,_o=Object.getPrototypeOf,dr=Object.prototype;function nn(e,t,r){if(typeof t!="string"){if(dr){var n=_o(t);n&&n!==dr&&nn(e,n,r)}var a=Ro(t);lr&&(a=a.concat(lr(t)));for(var c=cr(e),u=cr(t),d=0;d<a.length;++d){var h=a[d];if(!(h in Ao||r&&r[h]||u&&h in u||c&&h in c)){var g=Mo(t,h);try{To(e,h,g)}catch{}}}}return e}function Se(e){return typeof e=="function"}function Lt(e){return typeof e=="object"&&"styledComponentId"in e}function pe(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function ur(e,t){if(e.length===0)return"";for(var r=e[0],n=1;n<e.length;n++)r+=e[n];return r}function ze(e){return e!==null&&typeof e=="object"&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function Mt(e,t,r){if(r===void 0&&(r=!1),!r&&!ze(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var n=0;n<t.length;n++)e[n]=Mt(e[n],t[n]);else if(ze(t))for(var n in t)e[n]=Mt(e[n],t[n]);return e}function Ft(e,t){Object.defineProperty(e,"toString",{value:t})}function De(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):""))}var Oo=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var r=0,n=0;n<t;n++)r+=this.groupSizes[n];return r},e.prototype.insertRules=function(t,r){if(t>=this.groupSizes.length){for(var n=this.groupSizes,a=n.length,c=a;t>=c;)if((c<<=1)<0)throw De(16,"".concat(t));this.groupSizes=new Uint32Array(c),this.groupSizes.set(n),this.length=c;for(var u=a;u<c;u++)this.groupSizes[u]=0}for(var d=this.indexOfGroup(t+1),h=(u=0,r.length);u<h;u++)this.tag.insertRule(d,r[u])&&(this.groupSizes[t]++,d++)},e.prototype.clearGroup=function(t){if(t<this.length){var r=this.groupSizes[t],n=this.indexOfGroup(t),a=n+r;this.groupSizes[t]=0;for(var c=n;c<a;c++)this.tag.deleteRule(n)}},e.prototype.getGroup=function(t){var r="";if(t>=this.length||this.groupSizes[t]===0)return r;for(var n=this.groupSizes[t],a=this.indexOfGroup(t),c=a+n,u=a;u<c;u++)r+="".concat(this.tag.getRule(u)).concat(Pt);return r},e}(),Ue=new Map,Ze=new Map,He=1,Pe=function(e){if(Ue.has(e))return Ue.get(e);for(;Ze.has(He);)He++;var t=He++;return Ue.set(e,t),Ze.set(t,e),t},zo=function(e,t){He=t+1,Ue.set(e,t),Ze.set(t,e)},Do="style[".concat(ve,"][").concat(Vr,'="').concat(at,'"]'),No=new RegExp("^".concat(ve,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Bo=function(e,t,r){for(var n,a=r.split(","),c=0,u=a.length;c<u;c++)(n=a[c])&&e.registerName(t,n)},Po=function(e,t){for(var r,n=((r=t.textContent)!==null&&r!==void 0?r:"").split(Pt),a=[],c=0,u=n.length;c<u;c++){var d=n[c].trim();if(d){var h=d.match(No);if(h){var g=0|parseInt(h[1],10),b=h[2];g!==0&&(zo(b,g),Bo(e,b,h[3]),e.getTag().insertRules(g,a)),a.length=0}else a.push(d)}}},pr=function(e){for(var t=document.querySelectorAll(Do),r=0,n=t.length;r<n;r++){var a=t[r];a&&a.getAttribute(ve)!==Qr&&(Po(e,a),a.parentNode&&a.parentNode.removeChild(a))}};function Lo(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var on=function(e){var t=document.head,r=e||t,n=document.createElement("style"),a=function(d){var h=Array.from(d.querySelectorAll("style[".concat(ve,"]")));return h[h.length-1]}(r),c=a!==void 0?a.nextSibling:null;n.setAttribute(ve,Qr),n.setAttribute(Vr,at);var u=Lo();return u&&n.setAttribute("nonce",u),r.insertBefore(n,c),n},Fo=function(){function e(t){this.element=on(t),this.element.appendChild(document.createTextNode("")),this.sheet=function(r){if(r.sheet)return r.sheet;for(var n=document.styleSheets,a=0,c=n.length;a<c;a++){var u=n[a];if(u.ownerNode===r)return u}throw De(17)}(this.element),this.length=0}return e.prototype.insertRule=function(t,r){try{return this.sheet.insertRule(r,t),this.length++,!0}catch{return!1}},e.prototype.deleteRule=function(t){this.sheet.deleteRule(t),this.length--},e.prototype.getRule=function(t){var r=this.sheet.cssRules[t];return r&&r.cssText?r.cssText:""},e}(),Ko=function(){function e(t){this.element=on(t),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(t,r){if(t<=this.length&&t>=0){var n=document.createTextNode(r);return this.element.insertBefore(n,this.nodes[t]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.prototype.getRule=function(t){return t<this.length?this.nodes[t].textContent:""},e}(),Wo=function(){function e(t){this.rules=[],this.length=0}return e.prototype.insertRule=function(t,r){return t<=this.length&&(this.rules.splice(t,0,r),this.length++,!0)},e.prototype.deleteRule=function(t){this.rules.splice(t,1),this.length--},e.prototype.getRule=function(t){return t<this.length?this.rules[t]:""},e}(),fr=Ve,Uo={isServer:!Ve,useCSSOMInjection:!xo},an=function(){function e(t,r,n){t===void 0&&(t=$e),r===void 0&&(r={});var a=this;this.options=Z(Z({},Uo),t),this.gs=r,this.names=new Map(n),this.server=!!t.isServer,!this.server&&Ve&&fr&&(fr=!1,pr(this)),Ft(this,function(){return function(c){for(var u=c.getTag(),d=u.length,h="",g=function(p){var v=function(o){return Ze.get(o)}(p);if(v===void 0)return"continue";var w=c.names.get(v),S=u.getGroup(p);if(w===void 0||!w.size||S.length===0)return"continue";var I="".concat(ve,".g").concat(p,'[id="').concat(v,'"]'),C="";w!==void 0&&w.forEach(function(o){o.length>0&&(C+="".concat(o,","))}),h+="".concat(S).concat(I,'{content:"').concat(C,'"}').concat(Pt)},b=0;b<d;b++)g(b);return h}(a)})}return e.registerId=function(t){return Pe(t)},e.prototype.rehydrate=function(){!this.server&&Ve&&pr(this)},e.prototype.reconstructWithOptions=function(t,r){return r===void 0&&(r=!0),new e(Z(Z({},this.options),t),this.gs,r&&this.names||void 0)},e.prototype.allocateGSInstance=function(t){return this.gs[t]=(this.gs[t]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(t=function(r){var n=r.useCSSOMInjection,a=r.target;return r.isServer?new Wo(a):n?new Fo(a):new Ko(a)}(this.options),new Oo(t)));var t},e.prototype.hasNameForId=function(t,r){return this.names.has(t)&&this.names.get(t).has(r)},e.prototype.registerName=function(t,r){if(Pe(t),this.names.has(t))this.names.get(t).add(r);else{var n=new Set;n.add(r),this.names.set(t,n)}},e.prototype.insertRules=function(t,r,n){this.registerName(t,r),this.getTag().insertRules(Pe(t),n)},e.prototype.clearNames=function(t){this.names.has(t)&&this.names.get(t).clear()},e.prototype.clearRules=function(t){this.getTag().clearGroup(Pe(t)),this.clearNames(t)},e.prototype.clearTag=function(){this.tag=void 0},e}(),Ho=/&/g,qo=/^\s*\/\/.*$/gm;function sn(e,t){return e.map(function(r){return r.type==="rule"&&(r.value="".concat(t," ").concat(r.value),r.value=r.value.replaceAll(",",",".concat(t," ")),r.props=r.props.map(function(n){return"".concat(t," ").concat(n)})),Array.isArray(r.children)&&r.type!=="@keyframes"&&(r.children=sn(r.children,t)),r})}function Go(e){var t,r,n,a=$e,c=a.options,u=c===void 0?$e:c,d=a.plugins,h=d===void 0?st:d,g=function(v,w,S){return S.startsWith(r)&&S.endsWith(r)&&S.replaceAll(r,"").length>0?".".concat(t):v},b=h.slice();b.push(function(v){v.type===tt&&v.value.includes("&")&&(v.props[0]=v.props[0].replace(Ho,r).replace(n,g))}),u.prefix&&b.push(bo),b.push(ho);var p=function(v,w,S,I){w===void 0&&(w=""),S===void 0&&(S=""),I===void 0&&(I="&"),t=I,r=w,n=new RegExp("\\".concat(r,"\\b"),"g");var C=v.replace(qo,""),o=po(S||w?"".concat(S," ").concat(w," { ").concat(C," }"):C);u.namespace&&(o=sn(o,u.namespace));var i=[];return Qe(o,mo(b.concat(go(function(s){return i.push(s)})))),i};return p.hash=h.length?h.reduce(function(v,w){return w.name||De(15),xe(v,w.name)},Jr).toString():"",p}var Yo=new an,_t=Go(),cn=k.createContext({shouldForwardProp:void 0,styleSheet:Yo,stylis:_t});cn.Consumer;k.createContext(void 0);function hr(){return k.useContext(cn)}var Qo=function(){function e(t,r){var n=this;this.inject=function(a,c){c===void 0&&(c=_t);var u=n.name+c.hash;a.hasNameForId(n.id,u)||a.insertRules(n.id,u,c(n.rules,u,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=r,Ft(this,function(){throw De(12,String(n.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=_t),this.name+t.hash},e}(),Vo=function(e){return e>="A"&&e<="Z"};function mr(e){for(var t="",r=0;r<e.length;r++){var n=e[r];if(r===1&&n==="-"&&e[0]==="-")return e;Vo(n)?t+="-"+n.toLowerCase():t+=n}return t.startsWith("ms-")?"-"+t:t}var ln=function(e){return e==null||e===!1||e===""},dn=function(e){var t,r,n=[];for(var a in e){var c=e[a];e.hasOwnProperty(a)&&!ln(c)&&(Array.isArray(c)&&c.isCss||Se(c)?n.push("".concat(mr(a),":"),c,";"):ze(c)?n.push.apply(n,Ye(Ye(["".concat(a," {")],dn(c),!1),["}"],!1)):n.push("".concat(mr(a),": ").concat((t=a,(r=c)==null||typeof r=="boolean"||r===""?"":typeof r!="number"||r===0||t in yo||t.startsWith("--")?String(r).trim():"".concat(r,"px")),";")))}return n};function he(e,t,r,n){if(ln(e))return[];if(Lt(e))return[".".concat(e.styledComponentId)];if(Se(e)){if(!Se(c=e)||c.prototype&&c.prototype.isReactComponent||!t)return[e];var a=e(t);return he(a,t,r,n)}var c;return e instanceof Qo?r?(e.inject(r,n),[e.getName(n)]):[e]:ze(e)?dn(e):Array.isArray(e)?Array.prototype.concat.apply(st,e.map(function(u){return he(u,t,r,n)})):[e.toString()]}function Zo(e){for(var t=0;t<e.length;t+=1){var r=e[t];if(Se(r)&&!Lt(r))return!1}return!0}var Jo=Xr(at),Xo=function(){function e(t,r,n){this.rules=t,this.staticRulesId="",this.isStatic=(n===void 0||n.isStatic)&&Zo(t),this.componentId=r,this.baseHash=xe(Jo,r),this.baseStyle=n,an.registerId(r)}return e.prototype.generateAndInjectStyles=function(t,r,n){var a=this.baseStyle?this.baseStyle.generateAndInjectStyles(t,r,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&r.hasNameForId(this.componentId,this.staticRulesId))a=pe(a,this.staticRulesId);else{var c=ur(he(this.rules,t,r,n)),u=Rt(xe(this.baseHash,c)>>>0);if(!r.hasNameForId(this.componentId,u)){var d=n(c,".".concat(u),void 0,this.componentId);r.insertRules(this.componentId,u,d)}a=pe(a,u),this.staticRulesId=u}else{for(var h=xe(this.baseHash,n.hash),g="",b=0;b<this.rules.length;b++){var p=this.rules[b];if(typeof p=="string")g+=p;else if(p){var v=ur(he(p,t,r,n));h=xe(h,v+b),g+=v}}if(g){var w=Rt(h>>>0);r.hasNameForId(this.componentId,w)||r.insertRules(this.componentId,w,n(g,".".concat(w),void 0,this.componentId)),a=pe(a,w)}}return a},e}(),un=k.createContext(void 0);un.Consumer;var yt={};function ea(e,t,r){var n=Lt(e),a=e,c=!bt(e),u=t.attrs,d=u===void 0?st:u,h=t.componentId,g=h===void 0?function(f,m){var x=typeof f!="string"?"sc":sr(f);yt[x]=(yt[x]||0)+1;var y="".concat(x,"-").concat(So(at+x+yt[x]));return m?"".concat(m,"-").concat(y):y}(t.displayName,t.parentComponentId):h,b=t.displayName,p=b===void 0?function(f){return bt(f)?"styled.".concat(f):"Styled(".concat(Co(f),")")}(e):b,v=t.displayName&&t.componentId?"".concat(sr(t.displayName),"-").concat(t.componentId):t.componentId||g,w=n&&a.attrs?a.attrs.concat(d).filter(Boolean):d,S=t.shouldForwardProp;if(n&&a.shouldForwardProp){var I=a.shouldForwardProp;if(t.shouldForwardProp){var C=t.shouldForwardProp;S=function(f,m){return I(f,m)&&C(f,m)}}else S=I}var o=new Xo(r,v,n?a.componentStyle:void 0);function i(f,m){return function(x,y,E){var M=x.attrs,j=x.componentStyle,R=x.defaultProps,K=x.foldedComponentIds,L=x.styledComponentId,A=x.target,D=k.useContext(un),H=hr(),$=x.shouldForwardProp||H.shouldForwardProp,N=ko(y,D,R)||$e,O=function(Q,V,oe){for(var ge,ae=Z(Z({},V),{className:void 0,theme:oe}),be=0;be<Q.length;be+=1){var te=Se(ge=Q[be])?ge(ae):ge;for(var J in te)ae[J]=J==="className"?pe(ae[J],te[J]):J==="style"?Z(Z({},ae[J]),te[J]):te[J]}return V.className&&(ae.className=pe(ae.className,V.className)),ae}(M,y,N),W=O.as||A,B={};for(var q in O)O[q]===void 0||q[0]==="$"||q==="as"||q==="theme"&&O.theme===N||(q==="forwardedAs"?B.as=O.forwardedAs:$&&!$(q,W)||(B[q]=O[q]));var z=function(Q,V){var oe=hr(),ge=Q.generateAndInjectStyles(V,oe.styleSheet,oe.stylis);return ge}(j,O),U=pe(K,L);return z&&(U+=" "+z),O.className&&(U+=" "+O.className),B[bt(W)&&!Zr.has(W)?"class":"className"]=U,E&&(B.ref=E),k.createElement(W,B)}(s,f,m)}i.displayName=p;var s=k.forwardRef(i);return s.attrs=w,s.componentStyle=o,s.displayName=p,s.shouldForwardProp=S,s.foldedComponentIds=n?pe(a.foldedComponentIds,a.styledComponentId):"",s.styledComponentId=v,s.target=n?a.target:e,Object.defineProperty(s,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(f){this._foldedDefaultProps=n?function(m){for(var x=[],y=1;y<arguments.length;y++)x[y-1]=arguments[y];for(var E=0,M=x;E<M.length;E++)Mt(m,M[E],!0);return m}({},a.defaultProps,f):f}}),Ft(s,function(){return".".concat(s.styledComponentId)}),c&&nn(s,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),s}function gr(e,t){for(var r=[e[0]],n=0,a=t.length;n<a;n+=1)r.push(t[n],e[n+1]);return r}var br=function(e){return Object.assign(e,{isCss:!0})};function ta(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(Se(e)||ze(e))return br(he(gr(st,Ye([e],t,!0))));var n=e;return t.length===0&&n.length===1&&typeof n[0]=="string"?he(n):br(he(gr(n,t)))}function Ot(e,t,r){if(r===void 0&&(r=$e),!t)throw De(1,t);var n=function(a){for(var c=[],u=1;u<arguments.length;u++)c[u-1]=arguments[u];return e(t,r,ta.apply(void 0,Ye([a],c,!1)))};return n.attrs=function(a){return Ot(e,t,Z(Z({},r),{attrs:Array.prototype.concat(r.attrs,a).filter(Boolean)}))},n.withConfig=function(a){return Ot(e,t,Z(Z({},r),a))},n}var pn=function(e){return Ot(ea,e)},T=pn;Zr.forEach(function(e){T[e]=pn(e)});const ra=T.div`
62
+ */const so=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],io=Ie("paperclip",so);/**
63
+ * @license lucide-react v0.544.0 - ISC
64
+ *
65
+ * This source code is licensed under the ISC license.
66
+ * See the LICENSE file in the root directory of this source tree.
67
+ */const co=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],lo=Ie("x",co);var X=function(){return X=Object.assign||function(t){for(var r,n=1,a=arguments.length;n<a;n++){r=arguments[n];for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(t[c]=r[c])}return t},X.apply(this,arguments)};function Qe(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,c;n<a;n++)(c||!(n in t))&&(c||(c=Array.prototype.slice.call(t,0,n)),c[n]=t[n]);return e.concat(c||Array.prototype.slice.call(t))}var W="-ms-",Oe="-moz-",B="-webkit-",Hr="comm",tt="rule",Nt="decl",uo="@import",qr="@keyframes",po="@layer",Gr=Math.abs,Bt=String.fromCharCode,Tt=Object.assign;function fo(e,t){return G(e,0)^45?(((t<<2^G(e,0))<<2^G(e,1))<<2^G(e,2))<<2^G(e,3):0}function Yr(e){return e.trim()}function ae(e,t){return(e=t.exec(e))?e[0]:e}function _(e,t,r){return e.replace(t,r)}function We(e,t,r){return e.indexOf(t,r)}function G(e,t){return e.charCodeAt(t)|0}function ke(e,t,r){return e.slice(t,r)}function ne(e){return e.length}function Qr(e){return e.length}function _e(e,t){return t.push(e),e}function ho(e,t){return e.map(t).join("")}function ar(e,t){return e.filter(function(r){return!ae(r,t)})}var rt=1,we=1,Vr=0,ee=0,q=0,Ae="";function nt(e,t,r,n,a,c,u,d){return{value:e,root:t,parent:r,type:n,props:a,children:c,line:rt,column:we,length:u,return:"",siblings:d}}function de(e,t){return Tt(nt("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function ye(e){for(;e.root;)e=de(e.root,{children:[e]});_e(e,e.siblings)}function mo(){return q}function go(){return q=ee>0?G(Ae,--ee):0,we--,q===10&&(we=1,rt--),q}function te(){return q=ee<Vr?G(Ae,ee++):0,we++,q===10&&(we=1,rt++),q}function me(){return G(Ae,ee)}function Ke(){return ee}function ot(e,t){return ke(Ae,e,t)}function Et(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function bo(e){return rt=we=1,Vr=ne(Ae=e),ee=0,[]}function yo(e){return Ae="",e}function gt(e){return Yr(ot(ee-1,Mt(e===91?e+2:e===40?e+1:e)))}function xo(e){for(;(q=me())&&q<33;)te();return Et(e)>2||Et(q)>3?"":" "}function ko(e,t){for(;--t&&te()&&!(q<48||q>102||q>57&&q<65||q>70&&q<97););return ot(e,Ke()+(t<6&&me()==32&&te()==32))}function Mt(e){for(;te();)switch(q){case e:return ee;case 34:case 39:e!==34&&e!==39&&Mt(q);break;case 40:e===41&&Mt(e);break;case 92:te();break}return ee}function wo(e,t){for(;te()&&e+q!==57;)if(e+q===84&&me()===47)break;return"/*"+ot(t,ee-1)+"*"+Bt(e===47?e:te())}function vo(e){for(;!Et(me());)te();return ot(e,ee)}function $o(e){return yo(Ue("",null,null,null,[""],e=bo(e),0,[0],e))}function Ue(e,t,r,n,a,c,u,d,h){for(var b=0,g=0,p=u,v=0,w=0,C=0,j=1,$=1,o=1,i=0,s="",f=a,m=c,k=n,y=s;$;)switch(C=i,i=te()){case 40:if(C!=108&&G(y,p-1)==58){We(y+=_(gt(i),"&","&\f"),"&\f",Gr(b?d[b-1]:0))!=-1&&(o=-1);break}case 34:case 39:case 91:y+=gt(i);break;case 9:case 10:case 13:case 32:y+=xo(C);break;case 92:y+=ko(Ke()-1,7);continue;case 47:switch(me()){case 42:case 47:_e(So(wo(te(),Ke()),t,r,h),h);break;default:y+="/"}break;case 123*j:d[b++]=ne(y)*o;case 125*j:case 59:case 0:switch(i){case 0:case 125:$=0;case 59+g:o==-1&&(y=_(y,/\f/g,"")),w>0&&ne(y)-p&&_e(w>32?ir(y+";",n,r,p-1,h):ir(_(y," ","")+";",n,r,p-2,h),h);break;case 59:y+=";";default:if(_e(k=sr(y,t,r,b,g,a,d,s,f=[],m=[],p,c),c),i===123)if(g===0)Ue(y,t,k,k,f,c,p,d,m);else switch(v===99&&G(y,3)===110?100:v){case 100:case 108:case 109:case 115:Ue(e,k,k,n&&_e(sr(e,k,k,0,0,a,d,s,a,f=[],p,m),m),a,m,p,d,n?f:m);break;default:Ue(y,k,k,k,[""],m,0,d,m)}}b=g=w=0,j=o=1,s=y="",p=u;break;case 58:p=1+ne(y),w=C;default:if(j<1){if(i==123)--j;else if(i==125&&j++==0&&go()==125)continue}switch(y+=Bt(i),i*j){case 38:o=g>0?1:(y+="\f",-1);break;case 44:d[b++]=(ne(y)-1)*o,o=1;break;case 64:me()===45&&(y+=gt(te())),v=me(),g=p=ne(s=y+=vo(Ke())),i++;break;case 45:C===45&&ne(y)==2&&(j=0)}}return c}function sr(e,t,r,n,a,c,u,d,h,b,g,p){for(var v=a-1,w=a===0?c:[""],C=Qr(w),j=0,$=0,o=0;j<n;++j)for(var i=0,s=ke(e,v+1,v=Gr($=u[j])),f=e;i<C;++i)(f=Yr($>0?w[i]+" "+s:_(s,/&\f/g,w[i])))&&(h[o++]=f);return nt(e,t,r,a===0?tt:d,h,b,g,p)}function So(e,t,r,n){return nt(e,t,r,Hr,Bt(mo()),ke(e,2,-2),0,n)}function ir(e,t,r,n,a){return nt(e,t,r,Nt,ke(e,0,n),ke(e,n+1,-1),n,a)}function Zr(e,t,r){switch(fo(e,t)){case 5103:return B+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return B+e+e;case 4789:return Oe+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return B+e+Oe+e+W+e+e;case 5936:switch(G(e,t+11)){case 114:return B+e+W+_(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return B+e+W+_(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return B+e+W+_(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return B+e+W+e+e;case 6165:return B+e+W+"flex-"+e+e;case 5187:return B+e+_(e,/(\w+).+(:[^]+)/,B+"box-$1$2"+W+"flex-$1$2")+e;case 5443:return B+e+W+"flex-item-"+_(e,/flex-|-self/g,"")+(ae(e,/flex-|baseline/)?"":W+"grid-row-"+_(e,/flex-|-self/g,""))+e;case 4675:return B+e+W+"flex-line-pack"+_(e,/align-content|flex-|-self/g,"")+e;case 5548:return B+e+W+_(e,"shrink","negative")+e;case 5292:return B+e+W+_(e,"basis","preferred-size")+e;case 6060:return B+"box-"+_(e,"-grow","")+B+e+W+_(e,"grow","positive")+e;case 4554:return B+_(e,/([^-])(transform)/g,"$1"+B+"$2")+e;case 6187:return _(_(_(e,/(zoom-|grab)/,B+"$1"),/(image-set)/,B+"$1"),e,"")+e;case 5495:case 3959:return _(e,/(image-set\([^]*)/,B+"$1$`$1");case 4968:return _(_(e,/(.+:)(flex-)?(.*)/,B+"box-pack:$3"+W+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+B+e+e;case 4200:if(!ae(e,/flex-|baseline/))return W+"grid-column-align"+ke(e,t)+e;break;case 2592:case 3360:return W+_(e,"template-","")+e;case 4384:case 3616:return r&&r.some(function(n,a){return t=a,ae(n.props,/grid-\w+-end/)})?~We(e+(r=r[t].value),"span",0)?e:W+_(e,"-start","")+e+W+"grid-row-span:"+(~We(r,"span",0)?ae(r,/\d+/):+ae(r,/\d+/)-+ae(e,/\d+/))+";":W+_(e,"-start","")+e;case 4896:case 4128:return r&&r.some(function(n){return ae(n.props,/grid-\w+-start/)})?e:W+_(_(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return _(e,/(.+)-inline(.+)/,B+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ne(e)-1-t>6)switch(G(e,t+1)){case 109:if(G(e,t+4)!==45)break;case 102:return _(e,/(.+:)(.+)-([^]+)/,"$1"+B+"$2-$3$1"+Oe+(G(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~We(e,"stretch",0)?Zr(_(e,"stretch","fill-available"),t,r)+e:e}break;case 5152:case 5920:return _(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(n,a,c,u,d,h,b){return W+a+":"+c+b+(u?W+a+"-span:"+(d?h:+h-+c)+b:"")+e});case 4949:if(G(e,t+6)===121)return _(e,":",":"+B)+e;break;case 6444:switch(G(e,G(e,14)===45?18:11)){case 120:return _(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+B+(G(e,14)===45?"inline-":"")+"box$3$1"+B+"$2$3$1"+W+"$2box$3")+e;case 100:return _(e,":",":"+W)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return _(e,"scroll-","scroll-snap-")+e}return e}function Ve(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function Co(e,t,r,n){switch(e.type){case po:if(e.children.length)break;case uo:case Nt:return e.return=e.return||e.value;case Hr:return"";case qr:return e.return=e.value+"{"+Ve(e.children,n)+"}";case tt:if(!ne(e.value=e.props.join(",")))return""}return ne(r=Ve(e.children,n))?e.return=e.value+"{"+r+"}":""}function jo(e){var t=Qr(e);return function(r,n,a,c){for(var u="",d=0;d<t;d++)u+=e[d](r,n,a,c)||"";return u}}function Io(e){return function(t){t.root||(t=t.return)&&e(t)}}function Ao(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case Nt:e.return=Zr(e.value,e.length,r);return;case qr:return Ve([de(e,{value:_(e.value,"@","@"+B)})],n);case tt:if(e.length)return ho(r=e.props,function(a){switch(ae(a,n=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":ye(de(e,{props:[_(a,/:(read-\w+)/,":"+Oe+"$1")]})),ye(de(e,{props:[a]})),Tt(e,{props:ar(r,n)});break;case"::placeholder":ye(de(e,{props:[_(a,/:(plac\w+)/,":"+B+"input-$1")]})),ye(de(e,{props:[_(a,/:(plac\w+)/,":"+Oe+"$1")]})),ye(de(e,{props:[_(a,/:(plac\w+)/,W+"input-$1")]})),ye(de(e,{props:[a]})),Tt(e,{props:ar(r,n)});break}return""})}}var To={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},ve=typeof process<"u"&&process.env!==void 0&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",Jr="active",Xr="data-styled-version",at="6.1.19",Lt=`/*!sc*/
68
+ `,Ze=typeof window<"u"&&typeof document<"u",Eo=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&process.env.REACT_APP_SC_DISABLE_SPEEDY!==""?process.env.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&process.env.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&process.env!==void 0&&process.env.SC_DISABLE_SPEEDY!==void 0&&process.env.SC_DISABLE_SPEEDY!==""&&process.env.SC_DISABLE_SPEEDY!=="false"&&process.env.SC_DISABLE_SPEEDY),st=Object.freeze([]),$e=Object.freeze({});function Mo(e,t,r){return r===void 0&&(r=$e),e.theme!==r.theme&&e.theme||t||r.theme}var en=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),_o=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Ro=/(^-|-$)/g;function cr(e){return e.replace(_o,"-").replace(Ro,"")}var Oo=/(a)(d)/gi,Be=52,lr=function(e){return String.fromCharCode(e+(e>25?39:97))};function _t(e){var t,r="";for(t=Math.abs(e);t>Be;t=t/Be|0)r=lr(t%Be)+r;return(lr(t%Be)+r).replace(Oo,"$1-$2")}var bt,tn=5381,xe=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},rn=function(e){return xe(tn,e)};function Po(e){return _t(rn(e)>>>0)}function Do(e){return e.displayName||e.name||"Component"}function yt(e){return typeof e=="string"&&!0}var nn=typeof Symbol=="function"&&Symbol.for,on=nn?Symbol.for("react.memo"):60115,zo=nn?Symbol.for("react.forward_ref"):60112,No={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Bo={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},an={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Lo=((bt={})[zo]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},bt[on]=an,bt);function dr(e){return("type"in(t=e)&&t.type.$$typeof)===on?an:"$$typeof"in e?Lo[e.$$typeof]:No;var t}var Fo=Object.defineProperty,Wo=Object.getOwnPropertyNames,ur=Object.getOwnPropertySymbols,Ko=Object.getOwnPropertyDescriptor,Uo=Object.getPrototypeOf,pr=Object.prototype;function sn(e,t,r){if(typeof t!="string"){if(pr){var n=Uo(t);n&&n!==pr&&sn(e,n,r)}var a=Wo(t);ur&&(a=a.concat(ur(t)));for(var c=dr(e),u=dr(t),d=0;d<a.length;++d){var h=a[d];if(!(h in Bo||r&&r[h]||u&&h in u||c&&h in c)){var b=Ko(t,h);try{Fo(e,h,b)}catch{}}}}return e}function Se(e){return typeof e=="function"}function Ft(e){return typeof e=="object"&&"styledComponentId"in e}function he(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function fr(e,t){if(e.length===0)return"";for(var r=e[0],n=1;n<e.length;n++)r+=e[n];return r}function De(e){return e!==null&&typeof e=="object"&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function Rt(e,t,r){if(r===void 0&&(r=!1),!r&&!De(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var n=0;n<t.length;n++)e[n]=Rt(e[n],t[n]);else if(De(t))for(var n in t)e[n]=Rt(e[n],t[n]);return e}function Wt(e,t){Object.defineProperty(e,"toString",{value:t})}function ze(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):""))}var Ho=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var r=0,n=0;n<t;n++)r+=this.groupSizes[n];return r},e.prototype.insertRules=function(t,r){if(t>=this.groupSizes.length){for(var n=this.groupSizes,a=n.length,c=a;t>=c;)if((c<<=1)<0)throw ze(16,"".concat(t));this.groupSizes=new Uint32Array(c),this.groupSizes.set(n),this.length=c;for(var u=a;u<c;u++)this.groupSizes[u]=0}for(var d=this.indexOfGroup(t+1),h=(u=0,r.length);u<h;u++)this.tag.insertRule(d,r[u])&&(this.groupSizes[t]++,d++)},e.prototype.clearGroup=function(t){if(t<this.length){var r=this.groupSizes[t],n=this.indexOfGroup(t),a=n+r;this.groupSizes[t]=0;for(var c=n;c<a;c++)this.tag.deleteRule(n)}},e.prototype.getGroup=function(t){var r="";if(t>=this.length||this.groupSizes[t]===0)return r;for(var n=this.groupSizes[t],a=this.indexOfGroup(t),c=a+n,u=a;u<c;u++)r+="".concat(this.tag.getRule(u)).concat(Lt);return r},e}(),He=new Map,Je=new Map,qe=1,Le=function(e){if(He.has(e))return He.get(e);for(;Je.has(qe);)qe++;var t=qe++;return He.set(e,t),Je.set(t,e),t},qo=function(e,t){qe=t+1,He.set(e,t),Je.set(t,e)},Go="style[".concat(ve,"][").concat(Xr,'="').concat(at,'"]'),Yo=new RegExp("^".concat(ve,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Qo=function(e,t,r){for(var n,a=r.split(","),c=0,u=a.length;c<u;c++)(n=a[c])&&e.registerName(t,n)},Vo=function(e,t){for(var r,n=((r=t.textContent)!==null&&r!==void 0?r:"").split(Lt),a=[],c=0,u=n.length;c<u;c++){var d=n[c].trim();if(d){var h=d.match(Yo);if(h){var b=0|parseInt(h[1],10),g=h[2];b!==0&&(qo(g,b),Qo(e,g,h[3]),e.getTag().insertRules(b,a)),a.length=0}else a.push(d)}}},hr=function(e){for(var t=document.querySelectorAll(Go),r=0,n=t.length;r<n;r++){var a=t[r];a&&a.getAttribute(ve)!==Jr&&(Vo(e,a),a.parentNode&&a.parentNode.removeChild(a))}};function Zo(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var cn=function(e){var t=document.head,r=e||t,n=document.createElement("style"),a=function(d){var h=Array.from(d.querySelectorAll("style[".concat(ve,"]")));return h[h.length-1]}(r),c=a!==void 0?a.nextSibling:null;n.setAttribute(ve,Jr),n.setAttribute(Xr,at);var u=Zo();return u&&n.setAttribute("nonce",u),r.insertBefore(n,c),n},Jo=function(){function e(t){this.element=cn(t),this.element.appendChild(document.createTextNode("")),this.sheet=function(r){if(r.sheet)return r.sheet;for(var n=document.styleSheets,a=0,c=n.length;a<c;a++){var u=n[a];if(u.ownerNode===r)return u}throw ze(17)}(this.element),this.length=0}return e.prototype.insertRule=function(t,r){try{return this.sheet.insertRule(r,t),this.length++,!0}catch{return!1}},e.prototype.deleteRule=function(t){this.sheet.deleteRule(t),this.length--},e.prototype.getRule=function(t){var r=this.sheet.cssRules[t];return r&&r.cssText?r.cssText:""},e}(),Xo=function(){function e(t){this.element=cn(t),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(t,r){if(t<=this.length&&t>=0){var n=document.createTextNode(r);return this.element.insertBefore(n,this.nodes[t]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.prototype.getRule=function(t){return t<this.length?this.nodes[t].textContent:""},e}(),ea=function(){function e(t){this.rules=[],this.length=0}return e.prototype.insertRule=function(t,r){return t<=this.length&&(this.rules.splice(t,0,r),this.length++,!0)},e.prototype.deleteRule=function(t){this.rules.splice(t,1),this.length--},e.prototype.getRule=function(t){return t<this.length?this.rules[t]:""},e}(),mr=Ze,ta={isServer:!Ze,useCSSOMInjection:!Eo},ln=function(){function e(t,r,n){t===void 0&&(t=$e),r===void 0&&(r={});var a=this;this.options=X(X({},ta),t),this.gs=r,this.names=new Map(n),this.server=!!t.isServer,!this.server&&Ze&&mr&&(mr=!1,hr(this)),Wt(this,function(){return function(c){for(var u=c.getTag(),d=u.length,h="",b=function(p){var v=function(o){return Je.get(o)}(p);if(v===void 0)return"continue";var w=c.names.get(v),C=u.getGroup(p);if(w===void 0||!w.size||C.length===0)return"continue";var j="".concat(ve,".g").concat(p,'[id="').concat(v,'"]'),$="";w!==void 0&&w.forEach(function(o){o.length>0&&($+="".concat(o,","))}),h+="".concat(C).concat(j,'{content:"').concat($,'"}').concat(Lt)},g=0;g<d;g++)b(g);return h}(a)})}return e.registerId=function(t){return Le(t)},e.prototype.rehydrate=function(){!this.server&&Ze&&hr(this)},e.prototype.reconstructWithOptions=function(t,r){return r===void 0&&(r=!0),new e(X(X({},this.options),t),this.gs,r&&this.names||void 0)},e.prototype.allocateGSInstance=function(t){return this.gs[t]=(this.gs[t]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(t=function(r){var n=r.useCSSOMInjection,a=r.target;return r.isServer?new ea(a):n?new Jo(a):new Xo(a)}(this.options),new Ho(t)));var t},e.prototype.hasNameForId=function(t,r){return this.names.has(t)&&this.names.get(t).has(r)},e.prototype.registerName=function(t,r){if(Le(t),this.names.has(t))this.names.get(t).add(r);else{var n=new Set;n.add(r),this.names.set(t,n)}},e.prototype.insertRules=function(t,r,n){this.registerName(t,r),this.getTag().insertRules(Le(t),n)},e.prototype.clearNames=function(t){this.names.has(t)&&this.names.get(t).clear()},e.prototype.clearRules=function(t){this.getTag().clearGroup(Le(t)),this.clearNames(t)},e.prototype.clearTag=function(){this.tag=void 0},e}(),ra=/&/g,na=/^\s*\/\/.*$/gm;function dn(e,t){return e.map(function(r){return r.type==="rule"&&(r.value="".concat(t," ").concat(r.value),r.value=r.value.replaceAll(",",",".concat(t," ")),r.props=r.props.map(function(n){return"".concat(t," ").concat(n)})),Array.isArray(r.children)&&r.type!=="@keyframes"&&(r.children=dn(r.children,t)),r})}function oa(e){var t,r,n,a=$e,c=a.options,u=c===void 0?$e:c,d=a.plugins,h=d===void 0?st:d,b=function(v,w,C){return C.startsWith(r)&&C.endsWith(r)&&C.replaceAll(r,"").length>0?".".concat(t):v},g=h.slice();g.push(function(v){v.type===tt&&v.value.includes("&")&&(v.props[0]=v.props[0].replace(ra,r).replace(n,b))}),u.prefix&&g.push(Ao),g.push(Co);var p=function(v,w,C,j){w===void 0&&(w=""),C===void 0&&(C=""),j===void 0&&(j="&"),t=j,r=w,n=new RegExp("\\".concat(r,"\\b"),"g");var $=v.replace(na,""),o=$o(C||w?"".concat(C," ").concat(w," { ").concat($," }"):$);u.namespace&&(o=dn(o,u.namespace));var i=[];return Ve(o,jo(g.concat(Io(function(s){return i.push(s)})))),i};return p.hash=h.length?h.reduce(function(v,w){return w.name||ze(15),xe(v,w.name)},tn).toString():"",p}var aa=new ln,Ot=oa(),un=x.createContext({shouldForwardProp:void 0,styleSheet:aa,stylis:Ot});un.Consumer;x.createContext(void 0);function gr(){return x.useContext(un)}var sa=function(){function e(t,r){var n=this;this.inject=function(a,c){c===void 0&&(c=Ot);var u=n.name+c.hash;a.hasNameForId(n.id,u)||a.insertRules(n.id,u,c(n.rules,u,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=r,Wt(this,function(){throw ze(12,String(n.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=Ot),this.name+t.hash},e}(),ia=function(e){return e>="A"&&e<="Z"};function br(e){for(var t="",r=0;r<e.length;r++){var n=e[r];if(r===1&&n==="-"&&e[0]==="-")return e;ia(n)?t+="-"+n.toLowerCase():t+=n}return t.startsWith("ms-")?"-"+t:t}var pn=function(e){return e==null||e===!1||e===""},fn=function(e){var t,r,n=[];for(var a in e){var c=e[a];e.hasOwnProperty(a)&&!pn(c)&&(Array.isArray(c)&&c.isCss||Se(c)?n.push("".concat(br(a),":"),c,";"):De(c)?n.push.apply(n,Qe(Qe(["".concat(a," {")],fn(c),!1),["}"],!1)):n.push("".concat(br(a),": ").concat((t=a,(r=c)==null||typeof r=="boolean"||r===""?"":typeof r!="number"||r===0||t in To||t.startsWith("--")?String(r).trim():"".concat(r,"px")),";")))}return n};function ge(e,t,r,n){if(pn(e))return[];if(Ft(e))return[".".concat(e.styledComponentId)];if(Se(e)){if(!Se(c=e)||c.prototype&&c.prototype.isReactComponent||!t)return[e];var a=e(t);return ge(a,t,r,n)}var c;return e instanceof sa?r?(e.inject(r,n),[e.getName(n)]):[e]:De(e)?fn(e):Array.isArray(e)?Array.prototype.concat.apply(st,e.map(function(u){return ge(u,t,r,n)})):[e.toString()]}function ca(e){for(var t=0;t<e.length;t+=1){var r=e[t];if(Se(r)&&!Ft(r))return!1}return!0}var la=rn(at),da=function(){function e(t,r,n){this.rules=t,this.staticRulesId="",this.isStatic=(n===void 0||n.isStatic)&&ca(t),this.componentId=r,this.baseHash=xe(la,r),this.baseStyle=n,ln.registerId(r)}return e.prototype.generateAndInjectStyles=function(t,r,n){var a=this.baseStyle?this.baseStyle.generateAndInjectStyles(t,r,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&r.hasNameForId(this.componentId,this.staticRulesId))a=he(a,this.staticRulesId);else{var c=fr(ge(this.rules,t,r,n)),u=_t(xe(this.baseHash,c)>>>0);if(!r.hasNameForId(this.componentId,u)){var d=n(c,".".concat(u),void 0,this.componentId);r.insertRules(this.componentId,u,d)}a=he(a,u),this.staticRulesId=u}else{for(var h=xe(this.baseHash,n.hash),b="",g=0;g<this.rules.length;g++){var p=this.rules[g];if(typeof p=="string")b+=p;else if(p){var v=fr(ge(p,t,r,n));h=xe(h,v+g),b+=v}}if(b){var w=_t(h>>>0);r.hasNameForId(this.componentId,w)||r.insertRules(this.componentId,w,n(b,".".concat(w),void 0,this.componentId)),a=he(a,w)}}return a},e}(),hn=x.createContext(void 0);hn.Consumer;var xt={};function ua(e,t,r){var n=Ft(e),a=e,c=!yt(e),u=t.attrs,d=u===void 0?st:u,h=t.componentId,b=h===void 0?function(f,m){var k=typeof f!="string"?"sc":cr(f);xt[k]=(xt[k]||0)+1;var y="".concat(k,"-").concat(Po(at+k+xt[k]));return m?"".concat(m,"-").concat(y):y}(t.displayName,t.parentComponentId):h,g=t.displayName,p=g===void 0?function(f){return yt(f)?"styled.".concat(f):"Styled(".concat(Do(f),")")}(e):g,v=t.displayName&&t.componentId?"".concat(cr(t.displayName),"-").concat(t.componentId):t.componentId||b,w=n&&a.attrs?a.attrs.concat(d).filter(Boolean):d,C=t.shouldForwardProp;if(n&&a.shouldForwardProp){var j=a.shouldForwardProp;if(t.shouldForwardProp){var $=t.shouldForwardProp;C=function(f,m){return j(f,m)&&$(f,m)}}else C=j}var o=new da(r,v,n?a.componentStyle:void 0);function i(f,m){return function(k,y,T){var R=k.attrs,I=k.componentStyle,M=k.defaultProps,K=k.foldedComponentIds,F=k.styledComponentId,V=k.target,A=x.useContext(hn),D=gr(),U=k.shouldForwardProp||D.shouldForwardProp,S=Mo(y,A,M)||$e,P=function(H,Q,Z){for(var se,ie=X(X({},Q),{className:void 0,theme:Z}),Te=0;Te<H.length;Te+=1){var pe=Se(se=H[Te])?se(ie):se;for(var J in pe)ie[J]=J==="className"?he(ie[J],pe[J]):J==="style"?X(X({},ie[J]),pe[J]):pe[J]}return Q.className&&(ie.className=he(ie.className,Q.className)),ie}(R,y,S),z=P.as||V,L={};for(var O in P)P[O]===void 0||O[0]==="$"||O==="as"||O==="theme"&&P.theme===S||(O==="forwardedAs"?L.as=P.forwardedAs:U&&!U(O,z)||(L[O]=P[O]));var Y=function(H,Q){var Z=gr(),se=H.generateAndInjectStyles(Q,Z.styleSheet,Z.stylis);return se}(I,P),N=he(K,F);return Y&&(N+=" "+Y),P.className&&(N+=" "+P.className),L[yt(z)&&!en.has(z)?"class":"className"]=N,T&&(L.ref=T),x.createElement(z,L)}(s,f,m)}i.displayName=p;var s=x.forwardRef(i);return s.attrs=w,s.componentStyle=o,s.displayName=p,s.shouldForwardProp=C,s.foldedComponentIds=n?he(a.foldedComponentIds,a.styledComponentId):"",s.styledComponentId=v,s.target=n?a.target:e,Object.defineProperty(s,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(f){this._foldedDefaultProps=n?function(m){for(var k=[],y=1;y<arguments.length;y++)k[y-1]=arguments[y];for(var T=0,R=k;T<R.length;T++)Rt(m,R[T],!0);return m}({},a.defaultProps,f):f}}),Wt(s,function(){return".".concat(s.styledComponentId)}),c&&sn(s,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),s}function yr(e,t){for(var r=[e[0]],n=0,a=t.length;n<a;n+=1)r.push(t[n],e[n+1]);return r}var xr=function(e){return Object.assign(e,{isCss:!0})};function pa(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(Se(e)||De(e))return xr(ge(yr(st,Qe([e],t,!0))));var n=e;return t.length===0&&n.length===1&&typeof n[0]=="string"?ge(n):xr(ge(yr(n,t)))}function Pt(e,t,r){if(r===void 0&&(r=$e),!t)throw ze(1,t);var n=function(a){for(var c=[],u=1;u<arguments.length;u++)c[u-1]=arguments[u];return e(t,r,pa.apply(void 0,Qe([a],c,!1)))};return n.attrs=function(a){return Pt(e,t,X(X({},r),{attrs:Array.prototype.concat(r.attrs,a).filter(Boolean)}))},n.withConfig=function(a){return Pt(e,t,X(X({},r),a))},n}var mn=function(e){return Pt(ua,e)},E=mn;en.forEach(function(e){E[e]=mn(e)});const fa=E.div`
69
+ display: flex;
70
+ align-items: center;
71
+ gap: 4px;
72
+ margin-top: 6px;
73
+ padding-left: 2px;
74
+ `,kr=E.button`
75
+ cursor: pointer;
76
+ display: inline-flex;
77
+ align-items: center;
78
+ justify-content: center;
79
+ padding: 6px;
80
+ border-radius: 8px;
81
+ border: none;
82
+ background: transparent;
83
+ color: #6b7280;
84
+ transition:
85
+ background-color 0.2s ease,
86
+ color 0.2s ease;
87
+
88
+ &:hover:not(:disabled) {
89
+ background: #f3f4f6;
90
+ color: #111827;
91
+ }
92
+
93
+ &:disabled {
94
+ opacity: 0.5;
95
+ cursor: not-allowed;
96
+ }
97
+
98
+ [data-theme='dark'] & {
99
+ color: #9ca3af;
100
+
101
+ &:hover:not(:disabled) {
102
+ background: #3f3f46;
103
+ color: #f9fafb;
104
+ }
105
+ }
106
+ `;function gn({content:e,disabled:t,onExportPdf:r}){const[n,a]=x.useState(!1),c=()=>{qn(e)},u=async()=>{a(!0);try{await r(e)}finally{a(!1)}};return l.jsxs(fa,{children:[l.jsx(kr,{type:"button",onClick:c,disabled:t,"aria-label":"Copy message",title:"Copy",children:l.jsx(Xn,{size:16,strokeWidth:1.75})}),l.jsx(kr,{type:"button",onClick:()=>void u(),disabled:t||n,"aria-label":"Download PDF",title:"Download PDF",children:l.jsx(to,{size:16,strokeWidth:1.75})})]})}const ha=E.div`
52
107
  display: flex;
53
108
  flex-wrap: wrap;
54
109
  gap: 6px;
55
110
  margin-bottom: 6px;
56
- `,na=T.div`
111
+ `,ma=E.div`
57
112
  display: inline-flex;
58
113
  align-items: center;
59
114
  gap: 6px;
@@ -70,18 +125,18 @@
70
125
  border-color: #4b5563;
71
126
  background: ${e=>e.$isImage?"rgba(59, 130, 246, 0.2)":"rgba(107, 114, 128, 0.25)"};
72
127
  }
73
- `,oa=T.img`
128
+ `,ga=E.img`
74
129
  width: 28px;
75
130
  height: 28px;
76
131
  object-fit: cover;
77
132
  border-radius: 4px;
78
- `,aa=T.span`
133
+ `,ba=E.span`
79
134
  overflow: hidden;
80
135
  text-overflow: ellipsis;
81
136
  white-space: nowrap;
82
137
  flex: 1;
83
138
  min-width: 0;
84
- `,sa=T.button`
139
+ `,ya=E.button`
85
140
  display: flex;
86
141
  align-items: center;
87
142
  justify-content: center;
@@ -96,7 +151,7 @@
96
151
  color: #ef4444;
97
152
  background: rgba(239, 68, 68, 0.1);
98
153
  }
99
- `;function Ce({attachments:e,onRemove:t,readOnly:r}){return e.length?l.jsx(ra,{children:e.map(n=>{const a=n.type==="image",c=a&&(n.preview||n.url);return l.jsxs(na,{$isImage:a,title:n.name,children:[c?l.jsx(oa,{src:n.preview||n.url,alt:"",loading:"lazy",decoding:"async"}):a?l.jsx(Yn,{size:16,"aria-hidden":!0}):l.jsx(qn,{size:16,"aria-hidden":!0}),l.jsx(aa,{children:n.name}),!r&&t&&l.jsx(sa,{type:"button",onClick:()=>t(n.id),"aria-label":`Remove ${n.name}`,children:l.jsx(Jn,{size:14})})]},n.id)})}):null}const fn=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","text/csv","text/plain","text/markdown","application/json","image/png","image/jpeg","image/webp","image/gif"],ia={".pdf":"application/pdf",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xls":"application/vnd.ms-excel",".csv":"text/csv",".txt":"text/plain",".md":"text/markdown",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".gif":"image/gif"};function ca(e){const t=e.lastIndexOf(".");if(!(t<0))return ia[e.slice(t).toLowerCase()]}async function Kt(e){var r;if(!e)return[];const t=[];if((r=e.files)!=null&&r.length)for(let n=0;n<e.files.length;n++)t.push(e.files[n]);return t}function hn(e,t,r){if(e.size>t)return`File too large (max ${Math.floor(t/(1024*1024))}MB)`;if(r.includes(e.type))return null;const n=ca(e.name);return n&&r.includes(n)?null:"File type not allowed for attachments"}const la=T.button`
154
+ `;function Ce({attachments:e,onRemove:t,readOnly:r}){return e.length?l.jsx(ha,{children:e.map(n=>{const a=n.type==="image",c=a&&(n.preview||n.url);return l.jsxs(ma,{$isImage:a,title:n.name,children:[c?l.jsx(ga,{src:n.preview||n.url,alt:"",loading:"lazy",decoding:"async"}):a?l.jsx(ao,{size:16,"aria-hidden":!0}):l.jsx(no,{size:16,"aria-hidden":!0}),l.jsx(ba,{children:n.name}),!r&&t&&l.jsx(ya,{type:"button",onClick:()=>t(n.id),"aria-label":`Remove ${n.name}`,children:l.jsx(lo,{size:14})})]},n.id)})}):null}const bn=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","text/csv","text/plain","text/markdown","application/json","image/png","image/jpeg","image/webp","image/gif"],xa={".pdf":"application/pdf",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xls":"application/vnd.ms-excel",".csv":"text/csv",".txt":"text/plain",".md":"text/markdown",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".webp":"image/webp",".gif":"image/gif"};function ka(e){const t=e.lastIndexOf(".");if(!(t<0))return xa[e.slice(t).toLowerCase()]}async function Kt(e){var r;if(!e)return[];const t=[];if((r=e.files)!=null&&r.length)for(let n=0;n<e.files.length;n++)t.push(e.files[n]);return t}function yn(e,t,r){if(e.size>t)return`File too large (max ${Math.floor(t/(1024*1024))}MB)`;if(r.includes(e.type))return null;const n=ka(e.name);return n&&r.includes(n)?null:"File type not allowed for attachments"}const wa=E.button`
100
155
  display: flex;
101
156
  align-items: center;
102
157
  justify-content: center;
@@ -127,7 +182,7 @@
127
182
  border-color: #4b5563;
128
183
  color: #e5e7eb;
129
184
  }
130
- `,da=T.button`
185
+ `,va=E.button`
131
186
  display: flex;
132
187
  align-items: center;
133
188
  justify-content: center;
@@ -170,23 +225,23 @@
170
225
  color: #e2e8f0;
171
226
  }
172
227
  }
173
- `;function Wt({disabled:e,integrated:t=!1,maxFileBytes:r,maxFiles:n,allowedMime:a=fn,currentCount:c,uploadAttachment:u,onUploaded:d,onError:h}){const g=k.useRef(null),[b,p]=k.useState(!1),v=k.useMemo(()=>[".pdf,.docx,.xlsx,.xls,.csv,.txt,.md,.json","image/png,image/jpeg,image/webp,image/gif"].join(","),[]),w=k.useCallback(async i=>{const s=Array.from(i);if(!s.length)return;let f=0;for(const m of s){if(c+f>=n){h==null||h(`You can attach at most ${n} files per message.`);break}const x=hn(m,r,a);if(x){h==null||h(`${m.name}: ${x}`);continue}try{p(!0);const y=await u(m);d(y),f+=1}catch(y){const E=y instanceof Error?y.message:"Upload failed";h==null||h(E)}finally{p(!1)}}},[a,c,r,n,h,d,u]),S=i=>{const s=i.target.files;s!=null&&s.length&&w(s),i.target.value=""},I=c>=n,C=!!(e||b||I),o=t?da:la;return l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:g,type:"file",multiple:!0,accept:v,style:{display:"none"},onChange:S}),l.jsx(o,{type:"button",disabled:C,"aria-label":"Attach file",title:"Attach file",onClick:()=>{var i;return(i=g.current)==null?void 0:i.click()},children:l.jsx(Vn,{size:16,strokeWidth:2})})]})}function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ue.apply(this,arguments)}const ua=["children","options"],yr=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{class:"className",for:"htmlFor"}),xr={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},pa=["style","script","pre"],fa=["src","href","data","formAction","srcDoc","action"],ha=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,ma=/mailto:/i,ga=/\n{2,}$/,kr=/^(\s*>[\s\S]*?)(?=\n\n|$)/,ba=/^ *> ?/gm,ya=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,xa=/^ {2,}\n/,ka=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,wr=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,vr=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,wa=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,va=/^(?:\n *)*\n/,$a=/\r\n?/g,Sa=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,Ca=/^\[\^([^\]]+)]/,ja=/\f/g,Ia=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,Aa=/^\s*?\[(x|\s)\]/,$r=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,Sr=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,Cr=/^([^\n]+)\n *(=|-){3,} *\n/,xt=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,Ea=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,jr=/^<!--[\s\S]*?(?:-->)/,Ta=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,kt=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,Ra=/^\{.*\}$/,Ma=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,_a=/^<([^ >]+@[^ >]+)>/,Oa=/^<([^ >]+:\/[^ >]+)>/,za=/-([a-z])?/gi,Ir=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,Da=/^[^\n]+(?: \n|\n{2,})/,Na=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,Ba=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,Pa=/^\[([^\]]*)\] ?\[([^\]]*)\]/,La=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,Fa=/\t/g,Ka=/(^ *\||\| *$)/g,Wa=/^ *:-+: *$/,Ua=/^ *:-+ *$/,Ha=/^ *-+: *$/,it=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,ct="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",qa=RegExp(`^([*_])\\1${it(1)}${ct}\\1\\1(?!\\1)`),Ga=RegExp(`^([*_])${it(0)}${ct}\\1(?!\\1)`),Ya=RegExp(`^(==)${it(0)}${ct}\\1`),Qa=RegExp(`^(~~)${it(0)}${ct}\\1`),Va=/^(:[a-zA-Z0-9-_]+:)/,Za=/^\\([^0-9A-Za-z\s])/,Ja=/\\([^0-9A-Za-z\s])/g,Xa=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,es=/^\n+/,ts=/^([ \t]*)/,rs=/(?:^|\n)( *)$/,Ut="(?:\\d+\\.)",Ht="(?:[*+-])";function mn(e){return"( *)("+(e===1?Ut:Ht)+") +"}const gn=mn(1),bn=mn(2);function yn(e){return RegExp("^"+(e===1?gn:bn))}const ns=yn(1),os=yn(2);function xn(e){return RegExp("^"+(e===1?gn:bn)+"[^\\n]*(?:\\n(?!\\1"+(e===1?Ut:Ht)+" )[^\\n]*)*(\\n|$)","gm")}const as=xn(1),ss=xn(2);function kn(e){const t=e===1?Ut:Ht;return RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const wn=kn(1),vn=kn(2);function Ar(e,t){const r=t===1,n=r?wn:vn,a=r?as:ss,c=r?ns:os;return{t:u=>c.test(u),o:je(function(u,d){const h=rs.exec(d.prevCapture);return h&&(d.list||!d.inline&&!d.simple)?n.exec(u=h[1]+u):null}),i:1,u(u,d,h){const g=r?+u[2]:void 0,b=u[0].replace(ga,`
174
- `).match(a);let p=!1;return{items:b.map(function(v,w){const S=c.exec(v)[0].length,I=RegExp("^ {1,"+S+"}","gm"),C=v.replace(I,"").replace(c,""),o=w===b.length-1,i=C.indexOf(`
228
+ `;function Ut({disabled:e,integrated:t=!1,maxFileBytes:r,maxFiles:n,allowedMime:a=bn,currentCount:c,uploadAttachment:u,onUploaded:d,onError:h}){const b=x.useRef(null),[g,p]=x.useState(!1),v=x.useMemo(()=>[".pdf,.docx,.xlsx,.xls,.csv,.txt,.md,.json","image/png,image/jpeg,image/webp,image/gif"].join(","),[]),w=x.useCallback(async i=>{const s=Array.from(i);if(!s.length)return;let f=0;for(const m of s){if(c+f>=n){h==null||h(`You can attach at most ${n} files per message.`);break}const k=yn(m,r,a);if(k){h==null||h(`${m.name}: ${k}`);continue}try{p(!0);const y=await u(m);d(y),f+=1}catch(y){const T=y instanceof Error?y.message:"Upload failed";h==null||h(T)}finally{p(!1)}}},[a,c,r,n,h,d,u]),C=i=>{const s=i.target.files;s!=null&&s.length&&w(s),i.target.value=""},j=c>=n,$=!!(e||g||j),o=t?va:wa;return l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:b,type:"file",multiple:!0,accept:v,style:{display:"none"},onChange:C}),l.jsx(o,{type:"button",disabled:$,"aria-label":"Attach file",title:"Attach file",onClick:()=>{var i;return(i=b.current)==null?void 0:i.click()},children:l.jsx(io,{size:16,strokeWidth:2})})]})}function fe(){return fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fe.apply(this,arguments)}const $a=["children","options"],wr=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{class:"className",for:"htmlFor"}),vr={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},Sa=["style","script","pre"],Ca=["src","href","data","formAction","srcDoc","action"],ja=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,Ia=/mailto:/i,Aa=/\n{2,}$/,$r=/^(\s*>[\s\S]*?)(?=\n\n|$)/,Ta=/^ *> ?/gm,Ea=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,Ma=/^ {2,}\n/,_a=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,Sr=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,Cr=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,Ra=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,Oa=/^(?:\n *)*\n/,Pa=/\r\n?/g,Da=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,za=/^\[\^([^\]]+)]/,Na=/\f/g,Ba=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,La=/^\s*?\[(x|\s)\]/,jr=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,Ir=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,Ar=/^([^\n]+)\n *(=|-){3,} *\n/,kt=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,Fa=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,Tr=/^<!--[\s\S]*?(?:-->)/,Wa=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,wt=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,Ka=/^\{.*\}$/,Ua=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,Ha=/^<([^ >]+@[^ >]+)>/,qa=/^<([^ >]+:\/[^ >]+)>/,Ga=/-([a-z])?/gi,Er=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,Ya=/^[^\n]+(?: \n|\n{2,})/,Qa=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,Va=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,Za=/^\[([^\]]*)\] ?\[([^\]]*)\]/,Ja=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,Xa=/\t/g,es=/(^ *\||\| *$)/g,ts=/^ *:-+: *$/,rs=/^ *:-+ *$/,ns=/^ *-+: *$/,it=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,ct="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",os=RegExp(`^([*_])\\1${it(1)}${ct}\\1\\1(?!\\1)`),as=RegExp(`^([*_])${it(0)}${ct}\\1(?!\\1)`),ss=RegExp(`^(==)${it(0)}${ct}\\1`),is=RegExp(`^(~~)${it(0)}${ct}\\1`),cs=/^(:[a-zA-Z0-9-_]+:)/,ls=/^\\([^0-9A-Za-z\s])/,ds=/\\([^0-9A-Za-z\s])/g,us=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,ps=/^\n+/,fs=/^([ \t]*)/,hs=/(?:^|\n)( *)$/,Ht="(?:\\d+\\.)",qt="(?:[*+-])";function xn(e){return"( *)("+(e===1?Ht:qt)+") +"}const kn=xn(1),wn=xn(2);function vn(e){return RegExp("^"+(e===1?kn:wn))}const ms=vn(1),gs=vn(2);function $n(e){return RegExp("^"+(e===1?kn:wn)+"[^\\n]*(?:\\n(?!\\1"+(e===1?Ht:qt)+" )[^\\n]*)*(\\n|$)","gm")}const bs=$n(1),ys=$n(2);function Sn(e){const t=e===1?Ht:qt;return RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const Cn=Sn(1),jn=Sn(2);function Mr(e,t){const r=t===1,n=r?Cn:jn,a=r?bs:ys,c=r?ms:gs;return{t:u=>c.test(u),o:je(function(u,d){const h=hs.exec(d.prevCapture);return h&&(d.list||!d.inline&&!d.simple)?n.exec(u=h[1]+u):null}),i:1,u(u,d,h){const b=r?+u[2]:void 0,g=u[0].replace(Aa,`
229
+ `).match(a);let p=!1;return{items:g.map(function(v,w){const C=c.exec(v)[0].length,j=RegExp("^ {1,"+C+"}","gm"),$=v.replace(j,"").replace(c,""),o=w===g.length-1,i=$.indexOf(`
175
230
 
176
- `)!==-1||o&&p;p=i;const s=h.inline,f=h.list;let m;h.list=!0,i?(h.inline=!1,m=Oe(C)+`
231
+ `)!==-1||o&&p;p=i;const s=h.inline,f=h.list;let m;h.list=!0,i?(h.inline=!1,m=Pe($)+`
177
232
 
178
- `):(h.inline=!0,m=Oe(C));const x=d(m,h);return h.inline=s,h.list=f,x}),ordered:r,start:g}},l:(u,d,h)=>e(u.ordered?"ol":"ul",{key:h.key,start:u.type==="20"?u.start:void 0},u.items.map(function(g,b){return e("li",{key:b},d(g,h))}))}}const is=RegExp(`^\\[((?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\][^\\[\\]]*)*\\]|[^\\[\\]])*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['"]([\\s\\S]*?)['"])?\\s*\\)`),cs=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/;function Oe(e){let t=e.length;for(;t>0&&e[t-1]<=" ";)t--;return e.slice(0,t)}function qe(e,t){return e.startsWith(t)}function ls(e,t,r){if(Array.isArray(r)){for(let n=0;n<r.length;n++)if(qe(e,r[n]))return!0;return!1}return r(e,t)}function Te(e){return e.replace(/[ÀÁÂÃÄÅàáâãä忯]/g,"a").replace(/[çÇ]/g,"c").replace(/[ðÐ]/g,"d").replace(/[ÈÉÊËéèêë]/g,"e").replace(/[ÏïÎîÍíÌì]/g,"i").replace(/[Ññ]/g,"n").replace(/[øØœŒÕõÔôÓóÒò]/g,"o").replace(/[ÜüÛûÚúÙù]/g,"u").replace(/[ŸÿÝý]/g,"y").replace(/[^a-z0-9- ]/gi,"").replace(/ /gi,"-").toLowerCase()}function ds(e){return Ha.test(e)?"right":Wa.test(e)?"center":Ua.test(e)?"left":null}function Er(e,t,r,n){const a=r.inTable;r.inTable=!0;let c=[[]],u="";function d(){if(!u)return;const h=c[c.length-1];h.push.apply(h,t(u,r)),u=""}return e.trim().split(/(`[^`]*`|\\\||\|)/).filter(Boolean).forEach((h,g,b)=>{h.trim()==="|"&&(d(),n)?g!==0&&g!==b.length-1&&c.push([]):u+=h}),d(),r.inTable=a,c}function us(e,t,r){r.inline=!0;const n=e[2]?e[2].replace(Ka,"").split("|").map(ds):[],a=e[3]?function(u,d,h){return u.trim().split(`
179
- `).map(function(g){return Er(g,d,h,!0)})}(e[3],t,r):[],c=Er(e[1],t,r,!!a.length);return r.inline=!1,a.length?{align:n,cells:a,header:c,type:"25"}:{children:c,type:"21"}}function Tr(e,t){return e.align[t]==null?{}:{textAlign:e.align[t]}}function je(e){return e.inline=1,e}function ce(e){return je(function(t,r){return r.inline?e.exec(t):null})}function le(e){return je(function(t,r){return r.inline||r.simple?e.exec(t):null})}function se(e){return function(t,r){return r.inline||r.simple?null:e.exec(t)}}function Le(e){return je(function(t){return e.exec(t)})}const ps=/(javascript|vbscript|data(?!:image)):/i;function fs(e){try{const t=decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"");if(ps.test(t))return null}catch{return null}return e}function re(e){return e&&e.replace(Ja,"$1")}function Ge(e,t,r){const n=r.inline||!1,a=r.simple||!1;r.inline=!0,r.simple=!0;const c=e(t,r);return r.inline=n,r.simple=a,c}function hs(e,t,r){const n=r.inline||!1,a=r.simple||!1;r.inline=!1,r.simple=!0;const c=e(t,r);return r.inline=n,r.simple=a,c}function ms(e,t,r){const n=r.inline||!1;r.inline=!1;const a=e(t,r);return r.inline=n,a}const wt=(e,t,r)=>({children:Ge(t,e[2],r)});function vt(){return{}}function $t(){return null}function gs(...e){return e.filter(Boolean).join(" ")}function St(e,t,r){let n=e;const a=t.split(".");for(;a.length&&(n=n[a[0]],n!==void 0);)a.shift();return n||r}function bs(e="",t={}){t.overrides=t.overrides||{},t.namedCodesToUnicode=t.namedCodesToUnicode?ue({},xr,t.namedCodesToUnicode):xr;const r=t.slugify||Te,n=t.sanitizer||fs,a=t.createElement||Dt.createElement,c=[kr,wr,vr,t.enforceAtxHeadings?Sr:$r,Cr,Ir,wn,vn],u=[...c,Da,xt,jr,kt];function d(o,i,...s){const f=St(t.overrides,o+".props",{});return a(function(m,x){const y=St(x,m);return y?typeof y=="function"||typeof y=="object"&&"render"in y?y:St(x,m+".component",m):m}(o,t.overrides),ue({},i,f,{className:gs(i==null?void 0:i.className,f.className)||void 0}),...s)}function h(o){o=o.replace(Ia,"");let i=!1;t.forceInline?i=!0:t.forceBlock||(i=La.test(o)===!1);const s=S(w(i?o:Oe(o).replace(es,"")+`
233
+ `):(h.inline=!0,m=Pe($));const k=d(m,h);return h.inline=s,h.list=f,k}),ordered:r,start:b}},l:(u,d,h)=>e(u.ordered?"ol":"ul",{key:h.key,start:u.type==="20"?u.start:void 0},u.items.map(function(b,g){return e("li",{key:g},d(b,h))}))}}const xs=RegExp(`^\\[((?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\][^\\[\\]]*)*\\]|[^\\[\\]])*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['"]([\\s\\S]*?)['"])?\\s*\\)`),ks=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/;function Pe(e){let t=e.length;for(;t>0&&e[t-1]<=" ";)t--;return e.slice(0,t)}function Ge(e,t){return e.startsWith(t)}function ws(e,t,r){if(Array.isArray(r)){for(let n=0;n<r.length;n++)if(Ge(e,r[n]))return!0;return!1}return r(e,t)}function Me(e){return e.replace(/[ÀÁÂÃÄÅàáâãä忯]/g,"a").replace(/[çÇ]/g,"c").replace(/[ðÐ]/g,"d").replace(/[ÈÉÊËéèêë]/g,"e").replace(/[ÏïÎîÍíÌì]/g,"i").replace(/[Ññ]/g,"n").replace(/[øØœŒÕõÔôÓóÒò]/g,"o").replace(/[ÜüÛûÚúÙù]/g,"u").replace(/[ŸÿÝý]/g,"y").replace(/[^a-z0-9- ]/gi,"").replace(/ /gi,"-").toLowerCase()}function vs(e){return ns.test(e)?"right":ts.test(e)?"center":rs.test(e)?"left":null}function _r(e,t,r,n){const a=r.inTable;r.inTable=!0;let c=[[]],u="";function d(){if(!u)return;const h=c[c.length-1];h.push.apply(h,t(u,r)),u=""}return e.trim().split(/(`[^`]*`|\\\||\|)/).filter(Boolean).forEach((h,b,g)=>{h.trim()==="|"&&(d(),n)?b!==0&&b!==g.length-1&&c.push([]):u+=h}),d(),r.inTable=a,c}function $s(e,t,r){r.inline=!0;const n=e[2]?e[2].replace(es,"").split("|").map(vs):[],a=e[3]?function(u,d,h){return u.trim().split(`
234
+ `).map(function(b){return _r(b,d,h,!0)})}(e[3],t,r):[],c=_r(e[1],t,r,!!a.length);return r.inline=!1,a.length?{align:n,cells:a,header:c,type:"25"}:{children:c,type:"21"}}function Rr(e,t){return e.align[t]==null?{}:{textAlign:e.align[t]}}function je(e){return e.inline=1,e}function ce(e){return je(function(t,r){return r.inline?e.exec(t):null})}function le(e){return je(function(t,r){return r.inline||r.simple?e.exec(t):null})}function oe(e){return function(t,r){return r.inline||r.simple?null:e.exec(t)}}function Fe(e){return je(function(t){return e.exec(t)})}const Ss=/(javascript|vbscript|data(?!:image)):/i;function Cs(e){try{const t=decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"");if(Ss.test(t))return null}catch{return null}return e}function re(e){return e&&e.replace(ds,"$1")}function Ye(e,t,r){const n=r.inline||!1,a=r.simple||!1;r.inline=!0,r.simple=!0;const c=e(t,r);return r.inline=n,r.simple=a,c}function js(e,t,r){const n=r.inline||!1,a=r.simple||!1;r.inline=!1,r.simple=!0;const c=e(t,r);return r.inline=n,r.simple=a,c}function Is(e,t,r){const n=r.inline||!1;r.inline=!1;const a=e(t,r);return r.inline=n,a}const vt=(e,t,r)=>({children:Ye(t,e[2],r)});function $t(){return{}}function St(){return null}function As(...e){return e.filter(Boolean).join(" ")}function Ct(e,t,r){let n=e;const a=t.split(".");for(;a.length&&(n=n[a[0]],n!==void 0);)a.shift();return n||r}function Ts(e="",t={}){t.overrides=t.overrides||{},t.namedCodesToUnicode=t.namedCodesToUnicode?fe({},vr,t.namedCodesToUnicode):vr;const r=t.slugify||Me,n=t.sanitizer||Cs,a=t.createElement||zt.createElement,c=[$r,Sr,Cr,t.enforceAtxHeadings?Ir:jr,Ar,Er,Cn,jn],u=[...c,Ya,kt,Tr,wt];function d(o,i,...s){const f=Ct(t.overrides,o+".props",{});return a(function(m,k){const y=Ct(k,m);return y?typeof y=="function"||typeof y=="object"&&"render"in y?y:Ct(k,m+".component",m):m}(o,t.overrides),fe({},i,f,{className:As(i==null?void 0:i.className,f.className)||void 0}),...s)}function h(o){o=o.replace(Ba,"");let i=!1;t.forceInline?i=!0:t.forceBlock||(i=Ja.test(o)===!1);const s=C(w(i?o:Pe(o).replace(ps,"")+`
180
235
 
181
- `,{inline:i}));for(;typeof s[s.length-1]=="string"&&!s[s.length-1].trim();)s.pop();if(t.wrapper===null)return s;const f=t.wrapper||(i?"span":"div");let m;if(s.length>1||t.forceWrapper)m=s;else{if(s.length===1)return m=s[0],typeof m=="string"?d("span",{key:"outer"},m):m;m=null}return a(f,{key:"outer"},m)}function g(o,i){if(!i||!i.trim())return null;const s=i.match(ha);return s?s.reduce(function(f,m){const x=m.indexOf("=");if(x!==-1){const y=function(R){return R.indexOf("-")!==-1&&R.match(Ta)===null&&(R=R.replace(za,function(K,L){return L.toUpperCase()})),R}(m.slice(0,x)).trim(),E=function(R){const K=R[0];return(K==='"'||K==="'")&&R.length>=2&&R[R.length-1]===K?R.slice(1,-1):R}(m.slice(x+1).trim()),M=yr[y]||y;if(M==="ref")return f;const j=f[M]=function(R,K,L,A){return K==="style"?function(D){const H=[];let $="",N=!1,O=!1,W="";if(!D)return H;for(let q=0;q<D.length;q++){const z=D[q];if(z!=='"'&&z!=="'"||N||(O?z===W&&(O=!1,W=""):(O=!0,W=z)),z==="("&&$.endsWith("url")?N=!0:z===")"&&N&&(N=!1),z!==";"||O||N)$+=z;else{const U=$.trim();if(U){const Q=U.indexOf(":");if(Q>0){const V=U.slice(0,Q).trim(),oe=U.slice(Q+1).trim();H.push([V,oe])}}$=""}}const B=$.trim();if(B){const q=B.indexOf(":");if(q>0){const z=B.slice(0,q).trim(),U=B.slice(q+1).trim();H.push([z,U])}}return H}(L).reduce(function(D,[H,$]){return D[H.replace(/(-[a-z])/g,N=>N[1].toUpperCase())]=A($,R,H),D},{}):fa.indexOf(K)!==-1?A(re(L),R,K):(L.match(Ra)&&(L=re(L.slice(1,L.length-1))),L==="true"||L!=="false"&&L)}(o,y,E,n);typeof j=="string"&&(xt.test(j)||kt.test(j))&&(f[M]=h(j.trim()))}else m!=="style"&&(f[yr[m]||m]=!0);return f},{}):null}const b=[],p={},v={0:{t:[">"],o:se(kr),i:1,u(o,i,s){const[,f,m]=o[0].replace(ba,"").match(ya);return{alert:f,children:i(m,s)}},l(o,i,s){const f={key:s.key};return o.alert&&(f.className="markdown-alert-"+r(o.alert.toLowerCase(),Te),o.children.unshift({attrs:{},children:[{type:"27",text:o.alert}],noInnerParse:!0,type:"11",tag:"header"})),d("blockquote",f,i(o.children,s))}},1:{o:Le(xa),i:1,u:vt,l:(o,i,s)=>d("br",{key:s.key})},2:{t:o=>{const i=o[0];return i==="-"||i==="*"||i==="_"},o:se(ka),i:1,u:vt,l:(o,i,s)=>d("hr",{key:s.key})},3:{t:[" "],o:se(vr),i:0,u:o=>({lang:void 0,text:re(Oe(o[0].replace(/^ {4}/gm,"")))}),l:(o,i,s)=>d("pre",{key:s.key},d("code",ue({},o.attrs,{className:o.lang?"lang-"+o.lang:""}),o.text))},4:{t:["```","~~~"],o:se(wr),i:0,u:o=>({attrs:g("code",o[3]||""),lang:o[2]||void 0,text:o[4],type:"3"})},5:{t:["`"],o:le(wa),i:3,u:o=>({text:re(o[2])}),l:(o,i,s)=>d("code",{key:s.key},o.text)},6:{t:["[^"],o:se(Sa),i:0,u:o=>(b.push({footnote:o[2],identifier:o[1]}),{}),l:$t},7:{t:["[^"],o:ce(Ca),i:1,u:o=>({target:"#"+r(o[1],Te),text:o[1]}),l:(o,i,s)=>d("a",{key:s.key,href:n(o.target,"a","href")},d("sup",{key:s.key},o.text))},8:{t:["[ ]","[x]"],o:ce(Aa),i:1,u:o=>({completed:o[1].toLowerCase()==="x"}),l:(o,i,s)=>d("input",{checked:o.completed,key:s.key,readOnly:!0,type:"checkbox"})},9:{t:["#"],o:se(t.enforceAtxHeadings?Sr:$r),i:1,u:(o,i,s)=>({children:Ge(i,o[2],s),id:r(o[2],Te),level:o[1].length}),l:(o,i,s)=>d("h"+o.level,{id:o.id,key:s.key},i(o.children,s))},10:{o:se(Cr),i:0,u:(o,i,s)=>({children:Ge(i,o[1],s),level:o[2]==="="?1:2,type:"9"})},11:{t:["<"],o:Le(xt),i:1,u(o,i,s){const[,f]=o[3].match(ts),m=RegExp("^"+f,"gm"),x=o[3].replace(m,""),y=(E=x,u.some(L=>L.test(E))?ms:Ge);var E;const M=o[1].toLowerCase(),j=pa.indexOf(M)!==-1,R=(j?M:o[1]).trim(),K={attrs:g(R,o[2]),noInnerParse:j,tag:R};if(s.inAnchor=s.inAnchor||M==="a",j)K.text=o[3];else{const L=s.inHTML;s.inHTML=!0,K.children=y(i,x,s),s.inHTML=L}return s.inAnchor=!1,K},l:(o,i,s)=>d(o.tag,ue({key:s.key},o.attrs),o.text||(o.children?i(o.children,s):""))},13:{t:["<"],o:Le(kt),i:1,u(o){const i=o[1].trim();return{attrs:g(i,o[2]||""),tag:i}},l:(o,i,s)=>d(o.tag,ue({},o.attrs,{key:s.key}))},12:{t:["<!--"],o:Le(jr),i:1,u:()=>({}),l:$t},14:{t:["!["],o:le(cs),i:1,u:o=>({alt:re(o[1]),target:re(o[2]),title:re(o[3])}),l:(o,i,s)=>d("img",{key:s.key,alt:o.alt||void 0,title:o.title||void 0,src:n(o.target,"img","src")})},15:{t:["["],o:ce(is),i:3,u:(o,i,s)=>({children:hs(i,o[1],s),target:re(o[2]),title:re(o[3])}),l:(o,i,s)=>d("a",{key:s.key,href:n(o.target,"a","href"),title:o.title},i(o.children,s))},16:{t:["<"],o:ce(Oa),i:0,u:o=>({children:[{text:o[1],type:"27"}],target:o[1],type:"15"})},17:{t:(o,i)=>!i.inAnchor&&!t.disableAutoLink&&(qe(o,"http://")||qe(o,"https://")),o:ce(Ma),i:0,u:o=>({children:[{text:o[1],type:"27"}],target:o[1],title:void 0,type:"15"})},18:{t:["<"],o:ce(_a),i:0,u(o){let i=o[1],s=o[1];return ma.test(s)||(s="mailto:"+s),{children:[{text:i.replace("mailto:",""),type:"27"}],target:s,type:"15"}}},20:Ar(d,1),33:Ar(d,2),19:{o:se(va),i:3,u:vt,l:()=>`
236
+ `,{inline:i}));for(;typeof s[s.length-1]=="string"&&!s[s.length-1].trim();)s.pop();if(t.wrapper===null)return s;const f=t.wrapper||(i?"span":"div");let m;if(s.length>1||t.forceWrapper)m=s;else{if(s.length===1)return m=s[0],typeof m=="string"?d("span",{key:"outer"},m):m;m=null}return a(f,{key:"outer"},m)}function b(o,i){if(!i||!i.trim())return null;const s=i.match(ja);return s?s.reduce(function(f,m){const k=m.indexOf("=");if(k!==-1){const y=function(M){return M.indexOf("-")!==-1&&M.match(Wa)===null&&(M=M.replace(Ga,function(K,F){return F.toUpperCase()})),M}(m.slice(0,k)).trim(),T=function(M){const K=M[0];return(K==='"'||K==="'")&&M.length>=2&&M[M.length-1]===K?M.slice(1,-1):M}(m.slice(k+1).trim()),R=wr[y]||y;if(R==="ref")return f;const I=f[R]=function(M,K,F,V){return K==="style"?function(A){const D=[];let U="",S=!1,P=!1,z="";if(!A)return D;for(let O=0;O<A.length;O++){const Y=A[O];if(Y!=='"'&&Y!=="'"||S||(P?Y===z&&(P=!1,z=""):(P=!0,z=Y)),Y==="("&&U.endsWith("url")?S=!0:Y===")"&&S&&(S=!1),Y!==";"||P||S)U+=Y;else{const N=U.trim();if(N){const H=N.indexOf(":");if(H>0){const Q=N.slice(0,H).trim(),Z=N.slice(H+1).trim();D.push([Q,Z])}}U=""}}const L=U.trim();if(L){const O=L.indexOf(":");if(O>0){const Y=L.slice(0,O).trim(),N=L.slice(O+1).trim();D.push([Y,N])}}return D}(F).reduce(function(A,[D,U]){return A[D.replace(/(-[a-z])/g,S=>S[1].toUpperCase())]=V(U,M,D),A},{}):Ca.indexOf(K)!==-1?V(re(F),M,K):(F.match(Ka)&&(F=re(F.slice(1,F.length-1))),F==="true"||F!=="false"&&F)}(o,y,T,n);typeof I=="string"&&(kt.test(I)||wt.test(I))&&(f[R]=h(I.trim()))}else m!=="style"&&(f[wr[m]||m]=!0);return f},{}):null}const g=[],p={},v={0:{t:[">"],o:oe($r),i:1,u(o,i,s){const[,f,m]=o[0].replace(Ta,"").match(Ea);return{alert:f,children:i(m,s)}},l(o,i,s){const f={key:s.key};return o.alert&&(f.className="markdown-alert-"+r(o.alert.toLowerCase(),Me),o.children.unshift({attrs:{},children:[{type:"27",text:o.alert}],noInnerParse:!0,type:"11",tag:"header"})),d("blockquote",f,i(o.children,s))}},1:{o:Fe(Ma),i:1,u:$t,l:(o,i,s)=>d("br",{key:s.key})},2:{t:o=>{const i=o[0];return i==="-"||i==="*"||i==="_"},o:oe(_a),i:1,u:$t,l:(o,i,s)=>d("hr",{key:s.key})},3:{t:[" "],o:oe(Cr),i:0,u:o=>({lang:void 0,text:re(Pe(o[0].replace(/^ {4}/gm,"")))}),l:(o,i,s)=>d("pre",{key:s.key},d("code",fe({},o.attrs,{className:o.lang?"lang-"+o.lang:""}),o.text))},4:{t:["```","~~~"],o:oe(Sr),i:0,u:o=>({attrs:b("code",o[3]||""),lang:o[2]||void 0,text:o[4],type:"3"})},5:{t:["`"],o:le(Ra),i:3,u:o=>({text:re(o[2])}),l:(o,i,s)=>d("code",{key:s.key},o.text)},6:{t:["[^"],o:oe(Da),i:0,u:o=>(g.push({footnote:o[2],identifier:o[1]}),{}),l:St},7:{t:["[^"],o:ce(za),i:1,u:o=>({target:"#"+r(o[1],Me),text:o[1]}),l:(o,i,s)=>d("a",{key:s.key,href:n(o.target,"a","href")},d("sup",{key:s.key},o.text))},8:{t:["[ ]","[x]"],o:ce(La),i:1,u:o=>({completed:o[1].toLowerCase()==="x"}),l:(o,i,s)=>d("input",{checked:o.completed,key:s.key,readOnly:!0,type:"checkbox"})},9:{t:["#"],o:oe(t.enforceAtxHeadings?Ir:jr),i:1,u:(o,i,s)=>({children:Ye(i,o[2],s),id:r(o[2],Me),level:o[1].length}),l:(o,i,s)=>d("h"+o.level,{id:o.id,key:s.key},i(o.children,s))},10:{o:oe(Ar),i:0,u:(o,i,s)=>({children:Ye(i,o[1],s),level:o[2]==="="?1:2,type:"9"})},11:{t:["<"],o:Fe(kt),i:1,u(o,i,s){const[,f]=o[3].match(fs),m=RegExp("^"+f,"gm"),k=o[3].replace(m,""),y=(T=k,u.some(F=>F.test(T))?Is:Ye);var T;const R=o[1].toLowerCase(),I=Sa.indexOf(R)!==-1,M=(I?R:o[1]).trim(),K={attrs:b(M,o[2]),noInnerParse:I,tag:M};if(s.inAnchor=s.inAnchor||R==="a",I)K.text=o[3];else{const F=s.inHTML;s.inHTML=!0,K.children=y(i,k,s),s.inHTML=F}return s.inAnchor=!1,K},l:(o,i,s)=>d(o.tag,fe({key:s.key},o.attrs),o.text||(o.children?i(o.children,s):""))},13:{t:["<"],o:Fe(wt),i:1,u(o){const i=o[1].trim();return{attrs:b(i,o[2]||""),tag:i}},l:(o,i,s)=>d(o.tag,fe({},o.attrs,{key:s.key}))},12:{t:["<!--"],o:Fe(Tr),i:1,u:()=>({}),l:St},14:{t:["!["],o:le(ks),i:1,u:o=>({alt:re(o[1]),target:re(o[2]),title:re(o[3])}),l:(o,i,s)=>d("img",{key:s.key,alt:o.alt||void 0,title:o.title||void 0,src:n(o.target,"img","src")})},15:{t:["["],o:ce(xs),i:3,u:(o,i,s)=>({children:js(i,o[1],s),target:re(o[2]),title:re(o[3])}),l:(o,i,s)=>d("a",{key:s.key,href:n(o.target,"a","href"),title:o.title},i(o.children,s))},16:{t:["<"],o:ce(qa),i:0,u:o=>({children:[{text:o[1],type:"27"}],target:o[1],type:"15"})},17:{t:(o,i)=>!i.inAnchor&&!t.disableAutoLink&&(Ge(o,"http://")||Ge(o,"https://")),o:ce(Ua),i:0,u:o=>({children:[{text:o[1],type:"27"}],target:o[1],title:void 0,type:"15"})},18:{t:["<"],o:ce(Ha),i:0,u(o){let i=o[1],s=o[1];return Ia.test(s)||(s="mailto:"+s),{children:[{text:i.replace("mailto:",""),type:"27"}],target:s,type:"15"}}},20:Mr(d,1),33:Mr(d,2),19:{o:oe(Oa),i:3,u:$t,l:()=>`
182
237
  `},21:{o:je(function(o,i){if(i.inline||i.simple||i.inHTML&&o.indexOf(`
183
238
 
184
239
  `)===-1&&i.prevCapture.indexOf(`
185
240
 
186
241
  `)===-1)return null;let s="";o.split(`
187
242
  `).every(m=>(m+=`
188
- `,!c.some(x=>x.test(m))&&(s+=m,!!m.trim())));const f=Oe(s);return f===""?null:[s,,f]}),i:3,u:wt,l:(o,i,s)=>d("p",{key:s.key},i(o.children,s))},22:{t:["["],o:ce(Na),i:0,u:o=>(p[o[1]]={target:o[2],title:o[4]},{}),l:$t},23:{t:["!["],o:le(Ba),i:0,u:o=>({alt:o[1]?re(o[1]):void 0,ref:o[2]}),l:(o,i,s)=>p[o.ref]?d("img",{key:s.key,alt:o.alt,src:n(p[o.ref].target,"img","src"),title:p[o.ref].title}):null},24:{t:o=>o[0]==="["&&o.indexOf("](")===-1,o:ce(Pa),i:0,u:(o,i,s)=>({children:i(o[1],s),fallbackChildren:o[0],ref:o[2]}),l:(o,i,s)=>p[o.ref]?d("a",{key:s.key,href:n(p[o.ref].target,"a","href"),title:p[o.ref].title},i(o.children,s)):d("span",{key:s.key},o.fallbackChildren)},25:{t:["|"],o:se(Ir),i:1,u:us,l(o,i,s){const f=o;return d("table",{key:s.key},d("thead",null,d("tr",null,f.header.map(function(m,x){return d("th",{key:x,style:Tr(f,x)},i(m,s))}))),d("tbody",null,f.cells.map(function(m,x){return d("tr",{key:x},m.map(function(y,E){return d("td",{key:E,style:Tr(f,E)},i(y,s))}))})))}},27:{o:je(function(o,i){let s;return qe(o,":")&&(s=Va.exec(o)),s||Xa.exec(o)}),i:4,u(o){const i=o[0];return{text:i.indexOf("&")===-1?i:i.replace(Ea,(s,f)=>t.namedCodesToUnicode[f]||s)}},l:o=>o.text},28:{t:["**","__"],o:le(qa),i:2,u:(o,i,s)=>({children:i(o[2],s)}),l:(o,i,s)=>d("strong",{key:s.key},i(o.children,s))},29:{t:o=>{const i=o[0];return(i==="*"||i==="_")&&o[1]!==i},o:le(Ga),i:3,u:(o,i,s)=>({children:i(o[2],s)}),l:(o,i,s)=>d("em",{key:s.key},i(o.children,s))},30:{t:["\\"],o:le(Za),i:1,u:o=>({text:o[1],type:"27"})},31:{t:["=="],o:le(Ya),i:3,u:wt,l:(o,i,s)=>d("mark",{key:s.key},i(o.children,s))},32:{t:["~~"],o:le(Qa),i:3,u:wt,l:(o,i,s)=>d("del",{key:s.key},i(o.children,s))}};t.disableParsingRawHTML===!0&&(delete v[11],delete v[13]);const w=function(o){var i=Object.keys(o);function s(f,m){var x=[];if(m.prevCapture=m.prevCapture||"",f.trim())for(;f;)for(var y=0;y<i.length;){var E=i[y],M=o[E];if(!M.t||ls(f,m,M.t)){var j=M.o(f,m);if(j&&j[0]){f=f.substring(j[0].length);var R=M.u(j,s,m);m.prevCapture+=j[0],R.type||(R.type=E),x.push(R);break}y++}else y++}return m.prevCapture="",x}return i.sort(function(f,m){return o[f].i-o[m].i||(f<m?-1:1)}),function(f,m){return s(function(x){return x.replace($a,`
189
- `).replace(ja,"").replace(Fa," ")}(f),m)}}(v),S=(I=function(o,i){return function(s,f,m){const x=o[s.type].l;return i?i(()=>x(s,f,m),s,f,m):x(s,f,m)}}(v,t.renderRule),function o(i,s={}){if(Array.isArray(i)){const f=s.key,m=[];let x=!1;for(let y=0;y<i.length;y++){s.key=y;const E=o(i[y],s),M=typeof E=="string";M&&x?m[m.length-1]+=E:E!==null&&m.push(E),x=M}return s.key=f,m}return I(i,o,s)});var I;const C=h(e);return b.length?d("div",null,C,d("footer",{key:"footer"},b.map(function(o){return d("div",{id:r(o.identifier,Te),key:o.identifier},o.identifier,S(w(o.footnote,{inline:!0})))}))):C}const ys=e=>{let{children:t="",options:r}=e,n=function(a,c){if(a==null)return{};var u,d,h={},g=Object.keys(a);for(d=0;d<g.length;d++)c.indexOf(u=g[d])>=0||(h[u]=a[u]);return h}(e,ua);return Dt.cloneElement(bs(t,r),n)},xs=T.div`
243
+ `,!c.some(k=>k.test(m))&&(s+=m,!!m.trim())));const f=Pe(s);return f===""?null:[s,,f]}),i:3,u:vt,l:(o,i,s)=>d("p",{key:s.key},i(o.children,s))},22:{t:["["],o:ce(Qa),i:0,u:o=>(p[o[1]]={target:o[2],title:o[4]},{}),l:St},23:{t:["!["],o:le(Va),i:0,u:o=>({alt:o[1]?re(o[1]):void 0,ref:o[2]}),l:(o,i,s)=>p[o.ref]?d("img",{key:s.key,alt:o.alt,src:n(p[o.ref].target,"img","src"),title:p[o.ref].title}):null},24:{t:o=>o[0]==="["&&o.indexOf("](")===-1,o:ce(Za),i:0,u:(o,i,s)=>({children:i(o[1],s),fallbackChildren:o[0],ref:o[2]}),l:(o,i,s)=>p[o.ref]?d("a",{key:s.key,href:n(p[o.ref].target,"a","href"),title:p[o.ref].title},i(o.children,s)):d("span",{key:s.key},o.fallbackChildren)},25:{t:["|"],o:oe(Er),i:1,u:$s,l(o,i,s){const f=o;return d("table",{key:s.key},d("thead",null,d("tr",null,f.header.map(function(m,k){return d("th",{key:k,style:Rr(f,k)},i(m,s))}))),d("tbody",null,f.cells.map(function(m,k){return d("tr",{key:k},m.map(function(y,T){return d("td",{key:T,style:Rr(f,T)},i(y,s))}))})))}},27:{o:je(function(o,i){let s;return Ge(o,":")&&(s=cs.exec(o)),s||us.exec(o)}),i:4,u(o){const i=o[0];return{text:i.indexOf("&")===-1?i:i.replace(Fa,(s,f)=>t.namedCodesToUnicode[f]||s)}},l:o=>o.text},28:{t:["**","__"],o:le(os),i:2,u:(o,i,s)=>({children:i(o[2],s)}),l:(o,i,s)=>d("strong",{key:s.key},i(o.children,s))},29:{t:o=>{const i=o[0];return(i==="*"||i==="_")&&o[1]!==i},o:le(as),i:3,u:(o,i,s)=>({children:i(o[2],s)}),l:(o,i,s)=>d("em",{key:s.key},i(o.children,s))},30:{t:["\\"],o:le(ls),i:1,u:o=>({text:o[1],type:"27"})},31:{t:["=="],o:le(ss),i:3,u:vt,l:(o,i,s)=>d("mark",{key:s.key},i(o.children,s))},32:{t:["~~"],o:le(is),i:3,u:vt,l:(o,i,s)=>d("del",{key:s.key},i(o.children,s))}};t.disableParsingRawHTML===!0&&(delete v[11],delete v[13]);const w=function(o){var i=Object.keys(o);function s(f,m){var k=[];if(m.prevCapture=m.prevCapture||"",f.trim())for(;f;)for(var y=0;y<i.length;){var T=i[y],R=o[T];if(!R.t||ws(f,m,R.t)){var I=R.o(f,m);if(I&&I[0]){f=f.substring(I[0].length);var M=R.u(I,s,m);m.prevCapture+=I[0],M.type||(M.type=T),k.push(M);break}y++}else y++}return m.prevCapture="",k}return i.sort(function(f,m){return o[f].i-o[m].i||(f<m?-1:1)}),function(f,m){return s(function(k){return k.replace(Pa,`
244
+ `).replace(Na,"").replace(Xa," ")}(f),m)}}(v),C=(j=function(o,i){return function(s,f,m){const k=o[s.type].l;return i?i(()=>k(s,f,m),s,f,m):k(s,f,m)}}(v,t.renderRule),function o(i,s={}){if(Array.isArray(i)){const f=s.key,m=[];let k=!1;for(let y=0;y<i.length;y++){s.key=y;const T=o(i[y],s),R=typeof T=="string";R&&k?m[m.length-1]+=T:T!==null&&m.push(T),k=R}return s.key=f,m}return j(i,o,s)});var j;const $=h(e);return g.length?d("div",null,$,d("footer",{key:"footer"},g.map(function(o){return d("div",{id:r(o.identifier,Me),key:o.identifier},o.identifier,C(w(o.footnote,{inline:!0})))}))):$}const Es=e=>{let{children:t="",options:r}=e,n=function(a,c){if(a==null)return{};var u,d,h={},b=Object.keys(a);for(d=0;d<b.length;d++)c.indexOf(u=b[d])>=0||(h[u]=a[u]);return h}(e,$a);return zt.cloneElement(Ts(t,r),n)},Ms=E.div`
190
245
  code {
191
246
  @media (prefers-color-scheme: dark) {
192
247
  background-color: #374151 !important;
@@ -224,7 +279,7 @@
224
279
  color: #e5e7eb !important;
225
280
  }
226
281
  }
227
- `;function lt({content:e,className:t}){return l.jsx(xs,{className:t,children:l.jsx(ys,{options:{overrides:{p:{props:{style:{marginBottom:"12px",lineHeight:"1.5",color:"inherit"}}},strong:{props:{style:{fontWeight:700,color:"inherit"}}},em:{props:{style:{fontStyle:"italic",color:"inherit"}}},code:{props:{style:{backgroundColor:"#f3f4f6",padding:"2px 6px",borderRadius:"4px",fontSize:"14px",fontFamily:"monospace",color:"#111827"}}},pre:{props:{style:{backgroundColor:"#f3f4f6",padding:"12px",borderRadius:"6px",fontSize:"14px",fontFamily:"monospace",color:"#111827",overflowX:"auto",marginBottom:"12px"}}},ul:{props:{className:"list-disc list-inside mb-3 space-y-1 ml-2"}},ol:{props:{className:"list-decimal list-inside mb-3 space-y-1 ml-2"}},li:{props:{className:"leading-relaxed"}},blockquote:{props:{style:{borderLeft:"4px solid #93c5fd",paddingLeft:"16px",padding:"8px",fontStyle:"italic",marginBottom:"12px",backgroundColor:"#eff6ff",borderRadius:"4px",color:"inherit"}}},h1:{props:{style:{fontSize:"20px",fontWeight:700,marginBottom:"12px",color:"inherit"}}},h2:{props:{style:{fontSize:"18px",fontWeight:700,marginBottom:"8px",color:"inherit"}}},h3:{props:{style:{fontSize:"16px",fontWeight:700,marginBottom:"8px",color:"inherit"}}},h4:{props:{style:{fontSize:"14px",fontWeight:700,marginBottom:"8px",color:"inherit"}}},h5:{props:{style:{fontSize:"14px",fontWeight:700,marginBottom:"8px",color:"inherit"}}},h6:{props:{style:{fontSize:"14px",fontWeight:700,marginBottom:"8px",color:"inherit"}}},hr:{props:{style:{margin:"16px 0",borderColor:"#e5e7eb",borderWidth:"1px",borderStyle:"solid"}}},a:{props:{style:{color:"#2563eb",textDecoration:"underline"},target:"_blank",rel:"noopener noreferrer"}}}},children:e})})}const $n=T.div`
282
+ `;function lt({content:e,className:t}){return l.jsx(Ms,{className:t,children:l.jsx(Es,{options:{overrides:{p:{props:{style:{marginBottom:"12px",lineHeight:"1.5",color:"inherit"}}},strong:{props:{style:{fontWeight:700,color:"inherit"}}},em:{props:{style:{fontStyle:"italic",color:"inherit"}}},code:{props:{style:{backgroundColor:"#f3f4f6",padding:"2px 6px",borderRadius:"4px",fontSize:"14px",fontFamily:"monospace",color:"#111827"}}},pre:{props:{style:{backgroundColor:"#f3f4f6",padding:"12px",borderRadius:"6px",fontSize:"14px",fontFamily:"monospace",color:"#111827",overflowX:"auto",marginBottom:"12px"}}},ul:{props:{className:"list-disc list-inside mb-3 space-y-1 ml-2"}},ol:{props:{className:"list-decimal list-inside mb-3 space-y-1 ml-2"}},li:{props:{className:"leading-relaxed"}},blockquote:{props:{style:{borderLeft:"4px solid #93c5fd",paddingLeft:"16px",padding:"8px",fontStyle:"italic",marginBottom:"12px",backgroundColor:"#eff6ff",borderRadius:"4px",color:"inherit"}}},h1:{props:{style:{fontSize:"20px",fontWeight:700,marginBottom:"12px",color:"inherit"}}},h2:{props:{style:{fontSize:"18px",fontWeight:700,marginBottom:"8px",color:"inherit"}}},h3:{props:{style:{fontSize:"16px",fontWeight:700,marginBottom:"8px",color:"inherit"}}},h4:{props:{style:{fontSize:"14px",fontWeight:700,marginBottom:"8px",color:"inherit"}}},h5:{props:{style:{fontSize:"14px",fontWeight:700,marginBottom:"8px",color:"inherit"}}},h6:{props:{style:{fontSize:"14px",fontWeight:700,marginBottom:"8px",color:"inherit"}}},hr:{props:{style:{margin:"16px 0",borderColor:"#e5e7eb",borderWidth:"1px",borderStyle:"solid"}}},a:{props:{style:{color:"#2563eb",textDecoration:"underline"},target:"_blank",rel:"noopener noreferrer"}}}},children:e})})}const In=E.div`
228
283
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
229
284
  background-color: white;
230
285
  border: 1px solid #e5e7eb;
@@ -261,7 +316,7 @@
261
316
  background-color: #1f2937;
262
317
  border-color: #374151;
263
318
  }
264
- `,Ie=T.div`
319
+ `,ue=E.div`
265
320
  max-width: 80%;
266
321
  padding: 12px;
267
322
  border-radius: 8px;
@@ -302,7 +357,7 @@
302
357
  font-weight: 700;
303
358
  }
304
359
  }
305
- `,qt=T.div`
360
+ `,Gt=E.div`
306
361
  display: flex;
307
362
  flex-direction: column;
308
363
  flex: 1;
@@ -335,7 +390,7 @@
335
390
  border-color: rgba(255, 255, 255, 0.3);
336
391
  }
337
392
  }
338
- `,Gt=T.div`
393
+ `,Yt=E.div`
339
394
  display: flex;
340
395
  align-items: center;
341
396
  justify-content: space-between;
@@ -354,7 +409,7 @@
354
409
  border-top-color: #52525b;
355
410
  background-color: #3f3f46;
356
411
  }
357
- `,ks=T.textarea`
412
+ `,_s=E.textarea`
358
413
  display: block;
359
414
  width: 100%;
360
415
  min-width: 0;
@@ -398,7 +453,7 @@
398
453
  color: #9ca3af;
399
454
  }
400
455
  }
401
- `,Yt=T.div`
456
+ `,Qt=E.div`
402
457
  display: flex;
403
458
  align-items: center;
404
459
  gap: 8px;
@@ -415,7 +470,7 @@
415
470
  background-color: #1f2937;
416
471
  border-top-color: #374151;
417
472
  }
418
- `,ws=T.textarea`
473
+ `,Rs=E.textarea`
419
474
  flex: 1;
420
475
  width: 100%;
421
476
  min-height: 40px;
@@ -474,7 +529,7 @@
474
529
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
475
530
  }
476
531
  }
477
- `,vs=T.button`
532
+ `,Os=E.button`
478
533
  width: 32px;
479
534
  height: 32px;
480
535
  min-width: 32px;
@@ -547,7 +602,7 @@
547
602
  color: #6b7280;
548
603
  }
549
604
  }
550
- `,Qt=T.button`
605
+ `,Vt=E.button`
551
606
  width: 26px;
552
607
  height: 26px;
553
608
  min-width: 26px;
@@ -642,14 +697,14 @@
642
697
  color: #6b7280;
643
698
  }
644
699
  }
645
- `,Ct=(e,t=.15)=>{if(e&&e.startsWith("#")){const r=e.replace("#",""),n=parseInt(r,16);if(isNaN(n))return e;const a=Math.max(0,Math.min(255,n>>16&255)*(1-t)),c=Math.max(0,Math.min(255,n>>8&255)*(1-t)),u=Math.max(0,Math.min(255,n&255)*(1-t));return`#${Math.floor(a).toString(16).padStart(2,"0")}${Math.floor(c).toString(16).padStart(2,"0")}${Math.floor(u).toString(16).padStart(2,"0")}`}return e||"#2563eb"},$s=T.button`
700
+ `,jt=(e,t=.15)=>{if(e&&e.startsWith("#")){const r=e.replace("#",""),n=parseInt(r,16);if(isNaN(n))return e;const a=Math.max(0,Math.min(255,n>>16&255)*(1-t)),c=Math.max(0,Math.min(255,n>>8&255)*(1-t)),u=Math.max(0,Math.min(255,n&255)*(1-t));return`#${Math.floor(a).toString(16).padStart(2,"0")}${Math.floor(c).toString(16).padStart(2,"0")}${Math.floor(u).toString(16).padStart(2,"0")}`}return e||"#2563eb"},Ps=E.button`
646
701
  position: fixed;
647
702
  z-index: 50;
648
703
  height: 48px;
649
704
  padding: 0 16px;
650
705
  box-sizing: border-box;
651
706
  line-height: normal;
652
- background: ${e=>{if(e.$primaryColor){const t=Ct(e.$primaryColor,.1);return`linear-gradient(135deg, ${e.$primaryColor} 0%, ${t} 100%)`}return"linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%)"}};
707
+ background: ${e=>{if(e.$primaryColor){const t=jt(e.$primaryColor,.1);return`linear-gradient(135deg, ${e.$primaryColor} 0%, ${t} 100%)`}return"linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%)"}};
653
708
  color: white;
654
709
  border: none;
655
710
  border-radius: 24px;
@@ -666,7 +721,7 @@
666
721
  ${e=>{switch(e.$position){case"bottom-left":return"bottom: 24px; left: 24px;";case"top-right":return"top: 24px; right: 24px;";case"top-left":return"top: 24px; left: 24px;";default:return"bottom: 24px; right: 24px;"}}}
667
722
 
668
723
  &:hover {
669
- background: ${e=>{if(e.$primaryColor){const t=Ct(e.$primaryColor,.2),r=Ct(e.$primaryColor,.3);return`linear-gradient(135deg, ${t} 0%, ${r} 100%)`}return"linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%)"}};
724
+ background: ${e=>{if(e.$primaryColor){const t=jt(e.$primaryColor,.2),r=jt(e.$primaryColor,.3);return`linear-gradient(135deg, ${t} 0%, ${r} 100%)`}return"linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%)"}};
670
725
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
671
726
  }
672
727
 
@@ -679,7 +734,7 @@
679
734
  align-items: center;
680
735
  justify-content: center;
681
736
  }
682
- `,Ss=T.div`
737
+ `,Ds=E.div`
683
738
  position: fixed;
684
739
  z-index: 50;
685
740
  width: 320px;
@@ -706,7 +761,7 @@
706
761
  @media (min-width: 640px) {
707
762
  width: 384px;
708
763
  }
709
- `;T.div`
764
+ `;E.div`
710
765
  padding: 12px 16px;
711
766
  background: ${e=>e.primaryColor||"#3b82f6"};
712
767
  color: white;
@@ -727,7 +782,7 @@
727
782
  align-items: center;
728
783
  gap: 4px;
729
784
  }
730
- `;T.button`
785
+ `;E.button`
731
786
  width: 24px;
732
787
  height: 24px;
733
788
  padding: 0;
@@ -751,7 +806,7 @@
751
806
  width: 16px;
752
807
  height: 16px;
753
808
  }
754
- `;T.div`
809
+ `;E.div`
755
810
  flex: 1;
756
811
  overflow-y: auto;
757
812
  padding: 16px;
@@ -804,7 +859,7 @@
804
859
  background: #9ca3af;
805
860
  }
806
861
  }
807
- `;const Vt=T.div`
862
+ `;const Zt=E.div`
808
863
  display: flex;
809
864
  gap: 4px;
810
865
  align-items: center;
@@ -835,7 +890,7 @@
835
890
  background: #9ca3af;
836
891
  }
837
892
  }
838
- `;T.div`
893
+ `;E.div`
839
894
  font-size: 12px;
840
895
  margin-top: 4px;
841
896
  color: ${e=>e.$isUser?"rgba(255, 255, 255, 0.8)":"#6b7280"};
@@ -847,7 +902,7 @@
847
902
  [data-theme="dark"] & {
848
903
  color: ${e=>e.$isUser?"rgba(255, 255, 255, 0.8)":"#d1d5db"};
849
904
  }
850
- `;const Zt=T.div`
905
+ `;const Jt=E.div`
851
906
  font-size: 14px;
852
907
  color: #dc2626;
853
908
  text-align: center;
@@ -857,7 +912,7 @@
857
912
  @media (prefers-color-scheme: dark) {
858
913
  color: #f87171;
859
914
  }
860
- `,Cs=T.div`
915
+ `,zs=E.div`
861
916
  position: absolute;
862
917
  ${e=>e.$position==="top"?"top: 0;":"bottom: 0;"}
863
918
  left: 0;
@@ -881,7 +936,7 @@
881
936
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 50%, #3b82f6 100%);
882
937
  }
883
938
  }
884
- `,me=T.img`
939
+ `,be=E.img`
885
940
  width: ${e=>e.$size||"32px"};
886
941
  height: ${e=>e.$size||"32px"};
887
942
  border-radius: 50%;
@@ -889,7 +944,7 @@
889
944
  flex-shrink: 0;
890
945
  border: 2px solid rgba(255, 255, 255, 0.2);
891
946
  background-color: rgba(255, 255, 255, 0.1);
892
- `,js=T.div`
947
+ `,Ns=E.div`
893
948
  display: flex;
894
949
  flex-direction: column;
895
950
  align-items: center;
@@ -911,7 +966,7 @@
911
966
  [data-theme="dark"] & {
912
967
  background: ${e=>e.$primaryColor?`linear-gradient(to bottom, ${e.$primaryColor} 0%, ${e.$primaryColor} 20%, rgba(31, 41, 55, 0.3) 45%, rgba(31, 41, 55, 0.7) 65%, rgba(31, 41, 55, 1) 100%)`:"transparent"};
913
968
  }
914
- `,Is=T.div`
969
+ `,Bs=E.div`
915
970
  font-size: 18px;
916
971
  font-weight: 600;
917
972
  text-align: center;
@@ -925,7 +980,7 @@
925
980
  [data-theme="dark"] & {
926
981
  color: #f9fafb;
927
982
  }
928
- `,As=T.img`
983
+ `,Ls=E.img`
929
984
  max-width: 120px;
930
985
  max-height: 120px;
931
986
  width: auto;
@@ -933,14 +988,14 @@
933
988
  object-fit: contain;
934
989
  margin-bottom: 8px;
935
990
  border-radius: 8px;
936
- `,Es=T.div`
991
+ `,Fs=E.div`
937
992
  display: flex;
938
993
  flex-direction: column;
939
994
  gap: 12px;
940
995
  width: 100%;
941
996
  max-width: 100%;
942
997
  margin-bottom: 16px;
943
- `,Ts=T.button`
998
+ `,Ws=E.button`
944
999
  width: 100%;
945
1000
  padding: 12px 16px;
946
1001
  box-sizing: border-box;
@@ -992,7 +1047,7 @@
992
1047
  border-color: ${e=>e.$primaryColor||"#6b7280"};
993
1048
  }
994
1049
  }
995
- `,Rs=T.div`
1050
+ `,Ks=E.div`
996
1051
  display: flex;
997
1052
  align-items: center;
998
1053
  gap: 8px;
@@ -1008,10 +1063,10 @@
1008
1063
  [data-theme="dark"] & {
1009
1064
  border-top-color: #374151;
1010
1065
  }
1011
- `,dt=k.forwardRef(function({value:t,onChange:r,onKeyDown:n,placeholder:a="Type a message...",disabled:c=!1,className:u,maxLength:d=2e3,variant:h="default"},g){const b=w=>{r(w.target.value)},p=w=>{w.key==="Enter"&&!w.shiftKey&&w.preventDefault(),n(w)},v=h==="composer"?ks:ws;return l.jsx(v,{ref:g,value:t,onChange:b,onKeyDown:p,placeholder:a,disabled:c,maxLength:d,className:u,onInput:w=>{const S=w.target;S.style.height="auto";const I=h==="composer"?96:120;S.style.height=`${Math.min(S.scrollHeight,I)}px`}})});function ut({size:e=16}){return l.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M22 2L11 13"}),l.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})}function Jt({config:e,onQuestionClick:t,onSendMessage:r,isLoading:n}){const[a,c]=k.useState(""),u=k.useRef(null),d=async()=>{!a.trim()||n||(await r(a.trim()),c(""))},h=b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),d())},g=e.welcomeMessage||"Hi there 👋 How can we help?";return l.jsxs(js,{$primaryColor:e.primaryColor,children:[e.welcomeImage&&l.jsx(As,{src:e.welcomeImage,alt:"Welcome"}),l.jsx(Is,{children:g}),e.quickQuestions&&e.quickQuestions.length>0&&l.jsx(Es,{children:e.quickQuestions.map((b,p)=>l.jsx(Ts,{onClick:()=>t(b),disabled:n,$primaryColor:e.primaryColor,children:b},p))}),l.jsxs(Rs,{children:[l.jsx(dt,{ref:u,value:a,onChange:c,onKeyDown:h,placeholder:e.placeholder||"Type a message...",disabled:n}),l.jsx(vs,{onClick:d,disabled:n||!a.trim(),children:l.jsx(ut,{size:16})})]})]})}function pt(e,t){var I;const r=(e.maxAttachmentSizeMB??10)*1024*1024,n=e.maxAttachments??3,a=(I=e.allowedAttachmentTypes)!=null&&I.length?e.allowedAttachmentTypes:fn,c=!!(e.enableAttachments&&e.publishableKey),[u,d]=k.useState([]),[h,g]=k.useState(null),b=k.useRef([]);k.useEffect(()=>{b.current=u},[u]);const p=k.useCallback(async C=>{if(c){g(null);for(const o of C){if(b.current.length>=n){g(`At most ${n} attachments per message.`);break}const i=hn(o,r,a);if(i){g(`${o.name}: ${i}`);continue}try{const s=await t(o);d(f=>{if(f.length>=n)return f;const m=[...f,s];return b.current=m,m})}catch(s){g(s instanceof Error?s.message:"Upload failed")}}}},[a,c,r,n,t]),v=k.useCallback(C=>{d(o=>{const i=o.filter(s=>s.id!==C);return b.current=i,i})},[]),w=k.useCallback(()=>{d([]),b.current=[],g(null)},[]),S=k.useCallback(C=>{g(null),d(o=>{if(o.length>=n)return o;const i=[...o,C];return b.current=i,i})},[n]);return{enabled:c,staged:u,attachmentError:h,setAttachmentError:g,addFiles:p,appendStaged:S,removeStaged:v,clearStaged:w,maxFiles:n,maxBytes:r,allowed:a}}function Ms({size:e=16}){return l.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function _s({size:e=16}){return l.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M18 6 6 18"}),l.jsx("path",{d:"m6 6 12 12"})]})}/*!---------------------------------------------------------------------------------------------
1066
+ `,dt=x.forwardRef(function({value:t,onChange:r,onKeyDown:n,placeholder:a="Type a message...",disabled:c=!1,className:u,maxLength:d=2e3,variant:h="default"},b){const g=w=>{r(w.target.value)},p=w=>{w.key==="Enter"&&!w.shiftKey&&w.preventDefault(),n(w)},v=h==="composer"?_s:Rs;return l.jsx(v,{ref:b,value:t,onChange:g,onKeyDown:p,placeholder:a,disabled:c,maxLength:d,className:u,onInput:w=>{const C=w.target;C.style.height="auto";const j=h==="composer"?96:120;C.style.height=`${Math.min(C.scrollHeight,j)}px`}})});function ut({size:e=16}){return l.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M22 2L11 13"}),l.jsx("path",{d:"M22 2L15 22L11 13L2 9L22 2Z"})]})}function Xt({config:e,onQuestionClick:t,onSendMessage:r,isLoading:n}){const[a,c]=x.useState(""),u=x.useRef(null),d=async()=>{!a.trim()||n||(await r(a.trim()),c(""))},h=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),d())},b=e.welcomeMessage||"Hi there 👋 How can we help?";return l.jsxs(Ns,{$primaryColor:e.primaryColor,children:[e.welcomeImage&&l.jsx(Ls,{src:e.welcomeImage,alt:"Welcome"}),l.jsx(Bs,{children:b}),e.quickQuestions&&e.quickQuestions.length>0&&l.jsx(Fs,{children:e.quickQuestions.map((g,p)=>l.jsx(Ws,{onClick:()=>t(g),disabled:n,$primaryColor:e.primaryColor,children:g},p))}),l.jsxs(Ks,{children:[l.jsx(dt,{ref:u,value:a,onChange:c,onKeyDown:h,placeholder:e.placeholder||"Type a message...",disabled:n}),l.jsx(Os,{onClick:d,disabled:n||!a.trim(),children:l.jsx(ut,{size:16})})]})]})}function pt(e,t){var j;const r=(e.maxAttachmentSizeMB??10)*1024*1024,n=e.maxAttachments??3,a=(j=e.allowedAttachmentTypes)!=null&&j.length?e.allowedAttachmentTypes:bn,c=!!(e.enableAttachments&&e.publishableKey),[u,d]=x.useState([]),[h,b]=x.useState(null),g=x.useRef([]);x.useEffect(()=>{g.current=u},[u]);const p=x.useCallback(async $=>{if(c){b(null);for(const o of $){if(g.current.length>=n){b(`At most ${n} attachments per message.`);break}const i=yn(o,r,a);if(i){b(`${o.name}: ${i}`);continue}try{const s=await t(o);d(f=>{if(f.length>=n)return f;const m=[...f,s];return g.current=m,m})}catch(s){b(s instanceof Error?s.message:"Upload failed")}}}},[a,c,r,n,t]),v=x.useCallback($=>{d(o=>{const i=o.filter(s=>s.id!==$);return g.current=i,i})},[]),w=x.useCallback(()=>{d([]),g.current=[],b(null)},[]),C=x.useCallback($=>{b(null),d(o=>{if(o.length>=n)return o;const i=[...o,$];return g.current=i,i})},[n]);return{enabled:c,staged:u,attachmentError:h,setAttachmentError:b,addFiles:p,appendStaged:C,removeStaged:v,clearStaged:w,maxFiles:n,maxBytes:r,allowed:a}}function An(e,t,r){if(e.role!=="assistant"||!e.content.trim())return!1;const n=t[t.length-1];return n?!(r&&n.role==="assistant"&&n.id===e.id):!0}function Us({size:e=16}){return l.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function Hs({size:e=16}){return l.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M18 6 6 18"}),l.jsx("path",{d:"m6 6 12 12"})]})}/*!---------------------------------------------------------------------------------------------
1012
1067
  * Copyright (c) StackBlitz. All rights reserved.
1013
1068
  * Licensed under the MIT License. See License.txt in the project root for license information.
1014
- *--------------------------------------------------------------------------------------------*/const Os={damping:.7,stiffness:.05,mass:1.25},zs=70,Ds=1e3/60,Ns=350;let ft=!1;var Mr;(Mr=globalThis.document)==null||Mr.addEventListener("mousedown",()=>{ft=!0});var _r;(_r=globalThis.document)==null||_r.addEventListener("mouseup",()=>{ft=!1});var Or;(Or=globalThis.document)==null||Or.addEventListener("click",()=>{ft=!1});const Bs=(e={})=>{const[t,r]=k.useState(!1),[n,a]=k.useState(e.initial!==!1),[c,u]=k.useState(!1),d=k.useRef(null);d.current=e;const h=k.useCallback(()=>{var f;if(!ft)return!1;const i=window.getSelection();if(!i||!i.rangeCount)return!1;const s=i.getRangeAt(0);return s.commonAncestorContainer.contains(C.current)||((f=C.current)==null?void 0:f.contains(s.commonAncestorContainer))},[]),g=k.useCallback(i=>{p.isAtBottom=i,a(i)},[]),b=k.useCallback(i=>{p.escapedFromLock=i,r(i)},[]),p=k.useMemo(()=>{let i;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var s;return((s=C.current)==null?void 0:s.scrollTop)??0},set scrollTop(s){C.current&&(C.current.scrollTop=s,p.ignoreScrollToTop=C.current.scrollTop)},get targetScrollTop(){return!C.current||!o.current?0:C.current.scrollHeight-1-C.current.clientHeight},get calculatedTargetScrollTop(){if(!C.current||!o.current)return 0;const{targetScrollTop:s}=this;if(!e.targetScrollTop)return s;if((i==null?void 0:i.targetScrollTop)===s)return i.calculatedScrollTop;const f=Math.max(Math.min(e.targetScrollTop(s,{scrollElement:C.current,contentElement:o.current}),s),0);return i={targetScrollTop:s,calculatedScrollTop:f},requestAnimationFrame(()=>{i=void 0}),f},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=zs}}},[]),v=k.useCallback((i={})=>{var M;typeof i=="string"&&(i={animation:i}),i.preserveScrollPosition||g(!0);const s=Date.now()+(Number(i.wait)||0),f=It(d.current,i.animation),{ignoreEscapes:m=!1}=i;let x,y=p.calculatedTargetScrollTop;i.duration instanceof Promise?i.duration.finally(()=>{x=Date.now()}):x=s+(i.duration??0);const E=async()=>{const j=new Promise(requestAnimationFrame).then(()=>{var A;if(!p.isAtBottom)return p.animation=void 0,!1;const{scrollTop:R}=p,K=performance.now(),L=(K-(p.lastTick??K))/Ds;if(p.animation||(p.animation={behavior:f,promise:j,ignoreEscapes:m}),p.animation.behavior===f&&(p.lastTick=K),h()||s>Date.now())return E();if(R<Math.min(y,p.calculatedTargetScrollTop)){if(((A=p.animation)==null?void 0:A.behavior)===f){if(f==="instant")return p.scrollTop=p.calculatedTargetScrollTop,E();p.velocity=(f.damping*p.velocity+f.stiffness*p.scrollDifference)/f.mass,p.accumulated+=p.velocity*L,p.scrollTop+=p.accumulated,p.scrollTop!==R&&(p.accumulated=0)}return E()}return x>Date.now()?(y=p.calculatedTargetScrollTop,E()):(p.animation=void 0,p.scrollTop<p.calculatedTargetScrollTop?v({animation:It(d.current,d.current.resize),ignoreEscapes:m,duration:Math.max(0,x-Date.now())||void 0}):p.isAtBottom)});return j.then(R=>(requestAnimationFrame(()=>{p.animation||(p.lastTick=void 0,p.velocity=0)}),R))};return i.wait!==!0&&(p.animation=void 0),((M=p.animation)==null?void 0:M.behavior)===f?p.animation.promise:E()},[g,h,p]),w=k.useCallback(()=>{b(!0),g(!1)},[b,g]),S=k.useCallback(({target:i})=>{if(i!==C.current)return;const{scrollTop:s,ignoreScrollToTop:f}=p;let{lastScrollTop:m=s}=p;p.lastScrollTop=s,p.ignoreScrollToTop=void 0,f&&f>s&&(m=f),u(p.isNearBottom),setTimeout(()=>{var E;if(p.resizeDifference||s===f)return;if(h()){b(!0),g(!1);return}const x=s>m,y=s<m;if((E=p.animation)!=null&&E.ignoreEscapes){p.scrollTop=m;return}y&&(b(!0),g(!1)),x&&b(!1),!p.escapedFromLock&&p.isNearBottom&&g(!0)},1)},[b,g,h,p]),I=k.useCallback(({target:i,deltaY:s})=>{var m;let f=i;for(;!["scroll","auto"].includes(getComputedStyle(f).overflow);){if(!f.parentElement)return;f=f.parentElement}f===C.current&&s<0&&C.current.scrollHeight>C.current.clientHeight&&!((m=p.animation)!=null&&m.ignoreEscapes)&&(b(!0),g(!1))},[b,g,p]),C=Rr(i=>{var s,f;(s=C.current)==null||s.removeEventListener("scroll",S),(f=C.current)==null||f.removeEventListener("wheel",I),i==null||i.addEventListener("scroll",S,{passive:!0}),i==null||i.addEventListener("wheel",I,{passive:!0})},[]),o=Rr(i=>{var f,m;if((f=p.resizeObserver)==null||f.disconnect(),!i)return;let s;p.resizeObserver=new ResizeObserver(([x])=>{const{height:y}=x.contentRect,E=y-(s??y);if(p.resizeDifference=E,p.scrollTop>p.targetScrollTop&&(p.scrollTop=p.targetScrollTop),u(p.isNearBottom),E>=0){const M=It(d.current,s?d.current.resize:d.current.initial);v({animation:M,wait:!0,preserveScrollPosition:!0,duration:M==="instant"?void 0:Ns})}else p.isNearBottom&&(b(!1),g(!0));s=y,requestAnimationFrame(()=>{setTimeout(()=>{p.resizeDifference===E&&(p.resizeDifference=0)},1)})}),(m=p.resizeObserver)==null||m.observe(i)},[]);return{contentRef:o,scrollRef:C,scrollToBottom:v,stopScroll:w,isAtBottom:n||c,isNearBottom:c,escapedFromLock:t,state:p}};function Rr(e,t){const r=k.useCallback(n=>(r.current=n,e(n)),t);return r}const jt=new Map;function It(...e){const t={...Os};let r=!1;for(const a of e){if(a==="instant"){r=!0;continue}typeof a=="object"&&(r=!1,t.damping=a.damping??t.damping,t.stiffness=a.stiffness??t.stiffness,t.mass=a.mass??t.mass)}const n=JSON.stringify(t);return jt.has(n)||jt.set(n,Object.freeze(t)),r?"instant":jt.get(n)}const Sn=k.createContext(null),Ps=typeof window<"u"?k.useLayoutEffect:k.useEffect;function Je({instance:e,children:t,resize:r,initial:n,mass:a,damping:c,stiffness:u,targetScrollTop:d,contextRef:h,...g}){const b=k.useRef(null),p=Dt.useCallback((m,x)=>{const y=(f==null?void 0:f.targetScrollTop)??d;return(y==null?void 0:y(m,x))??m},[d]),v=Bs({mass:a,damping:c,stiffness:u,resize:r,initial:n,targetScrollTop:p}),{scrollRef:w,contentRef:S,scrollToBottom:I,stopScroll:C,isAtBottom:o,escapedFromLock:i,state:s}=e??v,f=k.useMemo(()=>({scrollToBottom:I,stopScroll:C,scrollRef:w,isAtBottom:o,escapedFromLock:i,contentRef:S,state:s,get targetScrollTop(){return b.current},set targetScrollTop(m){b.current=m}}),[I,o,S,w,C,i,s]);return k.useImperativeHandle(h,()=>f,[f]),Ps(()=>{w.current&&getComputedStyle(w.current).overflow==="visible"&&(w.current.style.overflow="auto")},[]),l.jsx(Sn.Provider,{value:f,children:l.jsx("div",{...g,children:typeof t=="function"?t(f):t})})}(function(e){function t({children:r,...n}){const a=Ls();return l.jsx("div",{ref:a.scrollRef,style:{height:"100%",width:"100%"},children:l.jsx("div",{...n,ref:a.contentRef,children:typeof r=="function"?r(a):r})})}e.Content=t})(Je||(Je={}));function Ls(){const e=k.useContext(Sn);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const Fs=T(Je)`
1069
+ *--------------------------------------------------------------------------------------------*/const qs={damping:.7,stiffness:.05,mass:1.25},Gs=70,Ys=1e3/60,Qs=350;let ft=!1;var Pr;(Pr=globalThis.document)==null||Pr.addEventListener("mousedown",()=>{ft=!0});var Dr;(Dr=globalThis.document)==null||Dr.addEventListener("mouseup",()=>{ft=!1});var zr;(zr=globalThis.document)==null||zr.addEventListener("click",()=>{ft=!1});const Vs=(e={})=>{const[t,r]=x.useState(!1),[n,a]=x.useState(e.initial!==!1),[c,u]=x.useState(!1),d=x.useRef(null);d.current=e;const h=x.useCallback(()=>{var f;if(!ft)return!1;const i=window.getSelection();if(!i||!i.rangeCount)return!1;const s=i.getRangeAt(0);return s.commonAncestorContainer.contains($.current)||((f=$.current)==null?void 0:f.contains(s.commonAncestorContainer))},[]),b=x.useCallback(i=>{p.isAtBottom=i,a(i)},[]),g=x.useCallback(i=>{p.escapedFromLock=i,r(i)},[]),p=x.useMemo(()=>{let i;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var s;return((s=$.current)==null?void 0:s.scrollTop)??0},set scrollTop(s){$.current&&($.current.scrollTop=s,p.ignoreScrollToTop=$.current.scrollTop)},get targetScrollTop(){return!$.current||!o.current?0:$.current.scrollHeight-1-$.current.clientHeight},get calculatedTargetScrollTop(){if(!$.current||!o.current)return 0;const{targetScrollTop:s}=this;if(!e.targetScrollTop)return s;if((i==null?void 0:i.targetScrollTop)===s)return i.calculatedScrollTop;const f=Math.max(Math.min(e.targetScrollTop(s,{scrollElement:$.current,contentElement:o.current}),s),0);return i={targetScrollTop:s,calculatedScrollTop:f},requestAnimationFrame(()=>{i=void 0}),f},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Gs}}},[]),v=x.useCallback((i={})=>{var R;typeof i=="string"&&(i={animation:i}),i.preserveScrollPosition||b(!0);const s=Date.now()+(Number(i.wait)||0),f=At(d.current,i.animation),{ignoreEscapes:m=!1}=i;let k,y=p.calculatedTargetScrollTop;i.duration instanceof Promise?i.duration.finally(()=>{k=Date.now()}):k=s+(i.duration??0);const T=async()=>{const I=new Promise(requestAnimationFrame).then(()=>{var V;if(!p.isAtBottom)return p.animation=void 0,!1;const{scrollTop:M}=p,K=performance.now(),F=(K-(p.lastTick??K))/Ys;if(p.animation||(p.animation={behavior:f,promise:I,ignoreEscapes:m}),p.animation.behavior===f&&(p.lastTick=K),h()||s>Date.now())return T();if(M<Math.min(y,p.calculatedTargetScrollTop)){if(((V=p.animation)==null?void 0:V.behavior)===f){if(f==="instant")return p.scrollTop=p.calculatedTargetScrollTop,T();p.velocity=(f.damping*p.velocity+f.stiffness*p.scrollDifference)/f.mass,p.accumulated+=p.velocity*F,p.scrollTop+=p.accumulated,p.scrollTop!==M&&(p.accumulated=0)}return T()}return k>Date.now()?(y=p.calculatedTargetScrollTop,T()):(p.animation=void 0,p.scrollTop<p.calculatedTargetScrollTop?v({animation:At(d.current,d.current.resize),ignoreEscapes:m,duration:Math.max(0,k-Date.now())||void 0}):p.isAtBottom)});return I.then(M=>(requestAnimationFrame(()=>{p.animation||(p.lastTick=void 0,p.velocity=0)}),M))};return i.wait!==!0&&(p.animation=void 0),((R=p.animation)==null?void 0:R.behavior)===f?p.animation.promise:T()},[b,h,p]),w=x.useCallback(()=>{g(!0),b(!1)},[g,b]),C=x.useCallback(({target:i})=>{if(i!==$.current)return;const{scrollTop:s,ignoreScrollToTop:f}=p;let{lastScrollTop:m=s}=p;p.lastScrollTop=s,p.ignoreScrollToTop=void 0,f&&f>s&&(m=f),u(p.isNearBottom),setTimeout(()=>{var T;if(p.resizeDifference||s===f)return;if(h()){g(!0),b(!1);return}const k=s>m,y=s<m;if((T=p.animation)!=null&&T.ignoreEscapes){p.scrollTop=m;return}y&&(g(!0),b(!1)),k&&g(!1),!p.escapedFromLock&&p.isNearBottom&&b(!0)},1)},[g,b,h,p]),j=x.useCallback(({target:i,deltaY:s})=>{var m;let f=i;for(;!["scroll","auto"].includes(getComputedStyle(f).overflow);){if(!f.parentElement)return;f=f.parentElement}f===$.current&&s<0&&$.current.scrollHeight>$.current.clientHeight&&!((m=p.animation)!=null&&m.ignoreEscapes)&&(g(!0),b(!1))},[g,b,p]),$=Or(i=>{var s,f;(s=$.current)==null||s.removeEventListener("scroll",C),(f=$.current)==null||f.removeEventListener("wheel",j),i==null||i.addEventListener("scroll",C,{passive:!0}),i==null||i.addEventListener("wheel",j,{passive:!0})},[]),o=Or(i=>{var f,m;if((f=p.resizeObserver)==null||f.disconnect(),!i)return;let s;p.resizeObserver=new ResizeObserver(([k])=>{const{height:y}=k.contentRect,T=y-(s??y);if(p.resizeDifference=T,p.scrollTop>p.targetScrollTop&&(p.scrollTop=p.targetScrollTop),u(p.isNearBottom),T>=0){const R=At(d.current,s?d.current.resize:d.current.initial);v({animation:R,wait:!0,preserveScrollPosition:!0,duration:R==="instant"?void 0:Qs})}else p.isNearBottom&&(g(!1),b(!0));s=y,requestAnimationFrame(()=>{setTimeout(()=>{p.resizeDifference===T&&(p.resizeDifference=0)},1)})}),(m=p.resizeObserver)==null||m.observe(i)},[]);return{contentRef:o,scrollRef:$,scrollToBottom:v,stopScroll:w,isAtBottom:n||c,isNearBottom:c,escapedFromLock:t,state:p}};function Or(e,t){const r=x.useCallback(n=>(r.current=n,e(n)),t);return r}const It=new Map;function At(...e){const t={...qs};let r=!1;for(const a of e){if(a==="instant"){r=!0;continue}typeof a=="object"&&(r=!1,t.damping=a.damping??t.damping,t.stiffness=a.stiffness??t.stiffness,t.mass=a.mass??t.mass)}const n=JSON.stringify(t);return It.has(n)||It.set(n,Object.freeze(t)),r?"instant":It.get(n)}const Tn=x.createContext(null),Zs=typeof window<"u"?x.useLayoutEffect:x.useEffect;function Xe({instance:e,children:t,resize:r,initial:n,mass:a,damping:c,stiffness:u,targetScrollTop:d,contextRef:h,...b}){const g=x.useRef(null),p=zt.useCallback((m,k)=>{const y=(f==null?void 0:f.targetScrollTop)??d;return(y==null?void 0:y(m,k))??m},[d]),v=Vs({mass:a,damping:c,stiffness:u,resize:r,initial:n,targetScrollTop:p}),{scrollRef:w,contentRef:C,scrollToBottom:j,stopScroll:$,isAtBottom:o,escapedFromLock:i,state:s}=e??v,f=x.useMemo(()=>({scrollToBottom:j,stopScroll:$,scrollRef:w,isAtBottom:o,escapedFromLock:i,contentRef:C,state:s,get targetScrollTop(){return g.current},set targetScrollTop(m){g.current=m}}),[j,o,C,w,$,i,s]);return x.useImperativeHandle(h,()=>f,[f]),Zs(()=>{w.current&&getComputedStyle(w.current).overflow==="visible"&&(w.current.style.overflow="auto")},[]),l.jsx(Tn.Provider,{value:f,children:l.jsx("div",{...b,children:typeof t=="function"?t(f):t})})}(function(e){function t({children:r,...n}){const a=Js();return l.jsx("div",{ref:a.scrollRef,style:{height:"100%",width:"100%"},children:l.jsx("div",{...n,ref:a.contentRef,children:typeof r=="function"?r(a):r})})}e.Content=t})(Xe||(Xe={}));function Js(){const e=x.useContext(Tn);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const Xs=E(Xe)`
1015
1070
  position: relative;
1016
1071
  flex: 1;
1017
1072
  overflow-y: auto;
@@ -1061,9 +1116,9 @@
1061
1116
  background-color: rgba(100, 116, 139, 0.75);
1062
1117
  }
1063
1118
  }
1064
- `,Ks=T(Je.Content)`
1119
+ `,ei=E(Xe.Content)`
1065
1120
  padding: 16px;
1066
- `;T.button`
1121
+ `;E.button`
1067
1122
  position: absolute;
1068
1123
  bottom: 16px;
1069
1124
  left: 50%;
@@ -1103,7 +1158,7 @@
1103
1158
  color: #d1d5db;
1104
1159
  }
1105
1160
  }
1106
- `;function Xt({className:e,children:t,style:r,onDragOver:n,onDragLeave:a,onDrop:c}){return l.jsx(Fs,{className:e,style:r,initial:"smooth",resize:"smooth",role:"log",onDragOver:n,onDragLeave:a,onDrop:c,children:t})}function er({className:e,children:t}){return l.jsx(Ks,{className:e,children:t})}function Cn({config:e,chat:t}){const{messages:r,sendMessage:n,uploadAttachment:a,isLoading:c,error:u,hasSessionStarted:d}=t,[h,g]=k.useState(""),[b,p]=k.useState(!1),v=k.useRef(null),{enabled:w,staged:S,attachmentError:I,setAttachmentError:C,addFiles:o,appendStaged:i,removeStaged:s,clearStaged:f,maxFiles:m,maxBytes:x,allowed:y}=pt(e,a),E=()=>e.theme==="dark"?"dark":e.theme==="light"?"light":b?"dark":"light";k.useEffect(()=>{if(e.theme==="auto"||!e.theme){const A=()=>{p(window.matchMedia("(prefers-color-scheme: dark)").matches)};A();const D=window.matchMedia("(prefers-color-scheme: dark)");return D.addEventListener("change",A),()=>D.removeEventListener("change",A)}else p(e.theme==="dark")},[e.theme]);const M=async()=>{const A=h.trim();!A&&S.length===0||c||(await n(A,void 0,S.length?S:void 0),g(""),f(),setTimeout(()=>{var D;(D=v.current)==null||D.focus()},100))},j=A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),M())},R=k.useMemo(()=>e.height==="100%"||e.height==="100vh"?{height:"100%",minHeight:0,display:"flex",flexDirection:"column",borderRadius:"8px"}:{height:e.height,display:"flex",flexDirection:"column",borderRadius:"8px"},[e.height]),K=A=>{w&&(A.preventDefault(),A.dataTransfer.dropEffect="copy")},L=async A=>{if(!w)return;A.preventDefault();const D=await Kt(A.dataTransfer);D.length&&await o(D)};return l.jsx($n,{"data-theme":E(),style:R,children:e.quickQuestions&&e.quickQuestions.length>0&&!d?l.jsx(Jt,{config:e,onQuestionClick:async A=>{await n(A)},onSendMessage:n,isLoading:c}):l.jsxs(l.Fragment,{children:[l.jsx(Xt,{style:{flex:1},onDragOver:K,onDrop:L,children:l.jsxs(er,{children:[r.map(A=>l.jsxs("div",{style:{display:"flex",marginBottom:"16px",justifyContent:A.role==="user"?"flex-end":"flex-start",alignItems:"flex-start",gap:"8px"},children:[A.role==="assistant"&&e.agentImage&&l.jsx(me,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(Ie,{$isUser:A.role==="user",children:A.role==="assistant"?l.jsx(lt,{content:A.content}):l.jsxs(l.Fragment,{children:[A.attachments&&A.attachments.length>0&&l.jsx(Ce,{attachments:A.attachments,readOnly:!0}),A.content?A.content:null]})})]},A.id)),c&&l.jsxs("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"flex-start",gap:"8px",marginBottom:"16px"},children:[e.agentImage&&l.jsx(me,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(Ie,{$isUser:!1,children:l.jsxs(Vt,{children:[l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"})]})})]}),u&&l.jsx(Zt,{children:u})]})}),l.jsxs(Yt,{style:{flexDirection:"column",alignItems:"stretch",gap:0},children:[(I||w&&S.length>0)&&l.jsxs("div",{style:{paddingBottom:8},children:[I&&l.jsx("div",{style:{fontSize:12,color:"#dc2626",marginBottom:4},children:I}),w&&S.length>0&&l.jsx(Ce,{attachments:S,onRemove:s})]}),l.jsx("div",{style:{width:"100%"},children:l.jsxs(qt,{children:[l.jsx(dt,{ref:v,variant:"composer",value:h,onChange:g,onKeyDown:j,placeholder:e.placeholder,disabled:c}),l.jsxs(Gt,{children:[l.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:w&&l.jsx(Wt,{integrated:!0,disabled:c,maxFileBytes:x,maxFiles:m,allowedMime:y,currentCount:S.length,uploadAttachment:a,onUploaded:i,onError:C})}),l.jsx(Qt,{type:"button",onClick:M,disabled:c||!h.trim()&&S.length===0,"aria-label":"Send message",children:l.jsx(ut,{size:13})})]})]})})]})]})})}const Ws=T.div`
1161
+ `;function er({className:e,children:t,style:r,onDragOver:n,onDragLeave:a,onDrop:c}){return l.jsx(Xs,{className:e,style:r,initial:"smooth",resize:"smooth",role:"log",onDragOver:n,onDragLeave:a,onDrop:c,children:t})}function tr({className:e,children:t}){return l.jsx(ei,{className:e,children:t})}function En({config:e,chat:t}){const{messages:r,sendMessage:n,uploadAttachment:a,exportMessagePdf:c,isLoading:u,error:d,hasSessionStarted:h}=t,[b,g]=x.useState(""),[p,v]=x.useState(!1),w=x.useRef(null),{enabled:C,staged:j,attachmentError:$,setAttachmentError:o,addFiles:i,appendStaged:s,removeStaged:f,clearStaged:m,maxFiles:k,maxBytes:y,allowed:T}=pt(e,a),R=()=>e.theme==="dark"?"dark":e.theme==="light"?"light":p?"dark":"light";x.useEffect(()=>{if(e.theme==="auto"||!e.theme){const A=()=>{v(window.matchMedia("(prefers-color-scheme: dark)").matches)};A();const D=window.matchMedia("(prefers-color-scheme: dark)");return D.addEventListener("change",A),()=>D.removeEventListener("change",A)}else v(e.theme==="dark")},[e.theme]);const I=async()=>{const A=b.trim();!A&&j.length===0||u||(await n(A,void 0,j.length?j:void 0),g(""),m(),setTimeout(()=>{var D;(D=w.current)==null||D.focus()},100))},M=A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),I())},K=x.useMemo(()=>e.height==="100%"||e.height==="100vh"?{height:"100%",minHeight:0,display:"flex",flexDirection:"column",borderRadius:"8px"}:{height:e.height,display:"flex",flexDirection:"column",borderRadius:"8px"},[e.height]),F=A=>{C&&(A.preventDefault(),A.dataTransfer.dropEffect="copy")},V=async A=>{if(!C)return;A.preventDefault();const D=await Kt(A.dataTransfer);D.length&&await i(D)};return l.jsx(In,{"data-theme":R(),style:K,children:e.quickQuestions&&e.quickQuestions.length>0&&!h?l.jsx(Xt,{config:e,onQuestionClick:async A=>{await n(A)},onSendMessage:n,isLoading:u}):l.jsxs(l.Fragment,{children:[l.jsx(er,{style:{flex:1},onDragOver:F,onDrop:V,children:l.jsxs(tr,{children:[r.map(A=>l.jsxs("div",{style:{display:"flex",marginBottom:"16px",justifyContent:A.role==="user"?"flex-end":"flex-start",alignItems:"flex-start",gap:"8px"},children:[A.role==="assistant"&&e.agentImage&&l.jsx(be,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),A.role==="assistant"?l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",maxWidth:"80%"},children:[l.jsx(ue,{$isUser:!1,children:l.jsx(lt,{content:A.content})}),An(A,r,u)&&l.jsx(gn,{content:A.content,disabled:u,onExportPdf:D=>c(D)})]}):l.jsx(ue,{$isUser:!0,children:l.jsxs(l.Fragment,{children:[A.attachments&&A.attachments.length>0&&l.jsx(Ce,{attachments:A.attachments,readOnly:!0}),A.content?A.content:null]})})]},A.id)),u&&l.jsxs("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"flex-start",gap:"8px",marginBottom:"16px"},children:[e.agentImage&&l.jsx(be,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(ue,{$isUser:!1,children:l.jsxs(Zt,{children:[l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"})]})})]}),d&&l.jsx(Jt,{children:d})]})}),l.jsxs(Qt,{style:{flexDirection:"column",alignItems:"stretch",gap:0},children:[($||C&&j.length>0)&&l.jsxs("div",{style:{paddingBottom:8},children:[$&&l.jsx("div",{style:{fontSize:12,color:"#dc2626",marginBottom:4},children:$}),C&&j.length>0&&l.jsx(Ce,{attachments:j,onRemove:f})]}),l.jsx("div",{style:{width:"100%"},children:l.jsxs(Gt,{children:[l.jsx(dt,{ref:w,variant:"composer",value:b,onChange:g,onKeyDown:M,placeholder:e.placeholder,disabled:u}),l.jsxs(Yt,{children:[l.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:C&&l.jsx(Ut,{integrated:!0,disabled:u,maxFileBytes:y,maxFiles:k,allowedMime:T,currentCount:j.length,uploadAttachment:a,onUploaded:s,onError:o})}),l.jsx(Vt,{type:"button",onClick:I,disabled:u||!b.trim()&&j.length===0,"aria-label":"Send message",children:l.jsx(ut,{size:13})})]})]})})]})]})})}const ti=E.div`
1107
1162
  display: flex;
1108
1163
  align-items: center;
1109
1164
  justify-content: space-between;
@@ -1129,15 +1184,15 @@
1129
1184
  background: ${e=>e.$showWelcomeScreen&&e.$primaryColor?e.$primaryColor:"#ffffff"};
1130
1185
  color: ${e=>e.$showWelcomeScreen&&e.$primaryColor?"white":"#111827"};
1131
1186
  }
1132
- `,Us=T.div`
1187
+ `,ri=E.div`
1133
1188
  display: flex;
1134
1189
  align-items: center;
1135
1190
  gap: 12px;
1136
- `,Hs=T.div`
1191
+ `,ni=E.div`
1137
1192
  display: flex;
1138
1193
  align-items: center;
1139
1194
  gap: 8px;
1140
- `,qs=T.div`
1195
+ `,oi=E.div`
1141
1196
  width: 8px;
1142
1197
  height: 8px;
1143
1198
  background: #10b981;
@@ -1152,14 +1207,14 @@
1152
1207
  opacity: 0.5;
1153
1208
  }
1154
1209
  }
1155
- `,Gs=T.span`
1210
+ `,ai=E.span`
1156
1211
  font-weight: 500;
1157
1212
  font-size: 14px;
1158
- `,Ys=T.div`
1213
+ `,si=E.div`
1159
1214
  display: flex;
1160
1215
  align-items: center;
1161
1216
  gap: 4px;
1162
- `,Qs=T.button`
1217
+ `,ii=E.button`
1163
1218
  padding: 4px;
1164
1219
  background: transparent;
1165
1220
  border: none;
@@ -1179,4 +1234,4 @@
1179
1234
  width: 16px;
1180
1235
  height: 16px;
1181
1236
  }
1182
- `;function Vs({chatName:e="Chat Assistant",showCloseButton:t=!0,onClose:r,agentImage:n,className:a,primaryColor:c,showWelcomeScreen:u=!1}){return l.jsxs(Ws,{className:a,$primaryColor:c,$showWelcomeScreen:u,children:[l.jsxs(Us,{children:[n&&l.jsx(me,{src:n,alt:e||"Agent",$size:"32px"}),l.jsxs(Hs,{children:[l.jsx(qs,{}),l.jsx(Gs,{children:e})]})]}),l.jsx(Ys,{children:t&&l.jsx(Qs,{onClick:r,"aria-label":"Close",children:l.jsx(_s,{size:16})})})]})}function zt({config:e,chat:t}){const{messages:r,sendMessage:n,uploadAttachment:a,isLoading:c,error:u,isOpen:d,setIsOpen:h,hasSessionStarted:g}=t,[b,p]=k.useState(""),[v,w]=k.useState(e.height||600),[S,I]=k.useState(!1),C=k.useRef(null),{enabled:o,staged:i,attachmentError:s,setAttachmentError:f,addFiles:m,appendStaged:x,removeStaged:y,clearStaged:E,maxFiles:M,maxBytes:j,allowed:R}=pt(e,a),K=()=>e.theme==="dark"?"dark":e.theme==="light"?"light":S?"dark":"light";k.useEffect(()=>{if(e.theme==="auto"||!e.theme){const $=()=>{I(window.matchMedia("(prefers-color-scheme: dark)").matches)};$();const N=window.matchMedia("(prefers-color-scheme: dark)");return N.addEventListener("change",$),()=>N.removeEventListener("change",$)}else I(e.theme==="dark")},[e.theme]);const L=async()=>{const $=b.trim();!$&&i.length===0||c||(await n($,void 0,i.length?i:void 0),p(""),E(),setTimeout(()=>{var N;(N=C.current)==null||N.focus()},100))},A=$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),L())},D=$=>{o&&($.preventDefault(),$.dataTransfer.dropEffect="copy")},H=async $=>{if(!o)return;$.preventDefault();const N=await Kt($.dataTransfer);N.length&&await m(N)};return d?l.jsxs(Ss,{$position:e.position||"bottom-right","data-theme":K(),style:{height:v,...e.chatWindowStyle},children:[e.resizable!==!1&&l.jsx(Cs,{$position:"top",onMouseDown:$=>{$.preventDefault();const N=$.clientY,O=typeof v=="number"?v:600,W=q=>{const z=q.clientY-N,U=O-z;w(Math.max(200,Math.min(600,U)))},B=()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",B)};document.addEventListener("mousemove",W),document.addEventListener("mouseup",B)}}),e.showHeader!==!1&&l.jsx(Vs,{agentImage:e.agentImage,chatName:e.chatName,onClose:()=>h(!1),primaryColor:e.primaryColor,showWelcomeScreen:e.quickQuestions&&e.quickQuestions.length>0&&!g}),e.quickQuestions&&e.quickQuestions.length>0&&!g?l.jsx(Jt,{config:e,onQuestionClick:async $=>{await n($)},onSendMessage:n,isLoading:c}):l.jsxs(l.Fragment,{children:[l.jsx(Xt,{onDragOver:D,onDrop:H,children:l.jsxs(er,{children:[r.map($=>l.jsxs("div",{style:{display:"flex",marginBottom:"16px",justifyContent:$.role==="user"?"flex-end":"flex-start",alignItems:"flex-start",gap:"8px"},children:[$.role==="assistant"&&e.agentImage&&l.jsx(me,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(Ie,{$isUser:$.role==="user",children:$.role==="assistant"?l.jsx(lt,{content:$.content}):l.jsxs(l.Fragment,{children:[$.attachments&&$.attachments.length>0&&l.jsx(Ce,{attachments:$.attachments,readOnly:!0}),$.content?$.content:null]})})]},$.id)),c&&l.jsxs("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"flex-start",gap:"8px",marginBottom:"16px"},children:[e.agentImage&&l.jsx(me,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(Ie,{$isUser:!1,children:l.jsxs(Vt,{children:[l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"})]})})]}),u&&l.jsx(Zt,{children:u})]})}),l.jsxs(Yt,{style:{flexDirection:"column",alignItems:"stretch",gap:0},children:[(s||o&&i.length>0)&&l.jsxs("div",{style:{paddingBottom:8},children:[s&&l.jsx("div",{style:{fontSize:12,color:"#dc2626",marginBottom:4},children:s}),o&&i.length>0&&l.jsx(Ce,{attachments:i,onRemove:y})]}),l.jsx("div",{style:{width:"100%"},children:l.jsxs(qt,{children:[l.jsx(dt,{ref:C,variant:"composer",value:b,onChange:p,onKeyDown:A,placeholder:e.placeholder,disabled:c}),l.jsxs(Gt,{children:[l.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:o&&l.jsx(Wt,{integrated:!0,disabled:c,maxFileBytes:j,maxFiles:M,allowedMime:R,currentCount:i.length,uploadAttachment:a,onUploaded:x,onError:f})}),l.jsx(Qt,{type:"button",onClick:L,disabled:c||!b.trim()&&i.length===0,"aria-label":"Send message",children:l.jsx(ut,{size:13})})]})]})})]})]})]}):l.jsxs($s,{onClick:()=>h(!0),style:e.buttonStyle,$position:e.position||"bottom-right",$primaryColor:e.primaryColor,"aria-label":"Open chat",children:[l.jsx("div",{className:"icon-container",children:l.jsx(Ms,{size:16})}),l.jsx("span",{children:e.buttonText||e.chatName||"AI Chat"})]})}function Zs(e){const t=Lr(e),r=Pr(t);switch(t.mode){case"floating":return l.jsx(zt,{config:t,chat:r});case"embedded":return l.jsx(Cn,{config:t,chat:r});default:return l.jsx(zt,{config:t,chat:r})}}function Js({config:e,chat:t}){const{messages:r,sendMessage:n,uploadAttachment:a,isLoading:c,error:u,hasSessionStarted:d}=t,[h,g]=k.useState(""),b=k.useRef(null),{enabled:p,staged:v,attachmentError:w,setAttachmentError:S,addFiles:I,appendStaged:C,removeStaged:o,clearStaged:i,maxFiles:s,maxBytes:f,allowed:m}=pt(e,a),x=async()=>{const j=h.trim();!j&&v.length===0||c||(await n(j,void 0,v.length?v:void 0),g(""),i(),setTimeout(()=>{var R;(R=b.current)==null||R.focus()},100))},y=j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),x())},E=j=>{p&&(j.preventDefault(),j.dataTransfer.dropEffect="copy")},M=async j=>{if(!p)return;j.preventDefault();const R=await Kt(j.dataTransfer);R.length&&await I(R)};return l.jsx($n,{style:{height:e.height,display:"flex",flexDirection:"column",backgroundColor:"white",border:"1px solid #e5e7eb",borderRadius:"8px"},children:e.quickQuestions&&e.quickQuestions.length>0&&!d?l.jsx(Jt,{config:e,onQuestionClick:async j=>{await n(j)},onSendMessage:n,isLoading:c}):l.jsxs(l.Fragment,{children:[l.jsx(Xt,{style:{flex:1},onDragOver:E,onDrop:M,children:l.jsxs(er,{children:[r.map(j=>l.jsxs("div",{style:{display:"flex",marginBottom:"12px",justifyContent:j.role==="user"?"flex-end":"flex-start",alignItems:"flex-start",gap:"8px"},children:[j.role==="assistant"&&e.agentImage&&l.jsx(me,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(Ie,{$isUser:j.role==="user",children:j.role==="assistant"?l.jsx(lt,{content:j.content}):l.jsxs(l.Fragment,{children:[j.attachments&&j.attachments.length>0&&l.jsx(Ce,{attachments:j.attachments,readOnly:!0}),j.content?j.content:null]})})]},j.id)),c&&l.jsxs("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"flex-start",gap:"8px",marginBottom:"12px"},children:[e.agentImage&&l.jsx(me,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(Ie,{$isUser:!1,children:l.jsxs(Vt,{children:[l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"})]})})]}),u&&l.jsx(Zt,{children:u})]})}),l.jsxs(Yt,{style:{flexDirection:"column",alignItems:"stretch",gap:0},children:[(w||p&&v.length>0)&&l.jsxs("div",{style:{paddingBottom:8},children:[w&&l.jsx("div",{style:{fontSize:12,color:"#dc2626",marginBottom:4},children:w}),p&&v.length>0&&l.jsx(Ce,{attachments:v,onRemove:o})]}),l.jsx("div",{style:{width:"100%"},children:l.jsxs(qt,{children:[l.jsx(dt,{ref:b,variant:"composer",value:h,onChange:g,onKeyDown:y,placeholder:e.placeholder,disabled:c}),l.jsxs(Gt,{children:[l.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:p&&l.jsx(Wt,{integrated:!0,disabled:c,maxFileBytes:f,maxFiles:s,allowedMime:m,currentCount:v.length,uploadAttachment:a,onUploaded:C,onError:S})}),l.jsx(Qt,{type:"button",onClick:x,disabled:c||!h.trim()&&v.length===0,"aria-label":"Send message",children:l.jsx(ut,{size:13})})]})]})})]})]})})}exports.EmbeddedChat=Cn;exports.FloatingChat=zt;exports.InlineChat=Js;exports.MarkdownRenderer=lt;exports.OrdifyApiClient=Nr;exports.OrdifyChat=Zs;exports.debounce=Dn;exports.formatTime=zn;exports.generateId=Me;exports.parseStreamingResponse=Br;exports.throttle=Nn;exports.useOrdifyChat=Pr;exports.useOrdifyConfig=Lr;exports.useWidgetAttachmentStaging=pt;
1237
+ `;function ci({chatName:e="Chat Assistant",showCloseButton:t=!0,onClose:r,agentImage:n,className:a,primaryColor:c,showWelcomeScreen:u=!1}){return l.jsxs(ti,{className:a,$primaryColor:c,$showWelcomeScreen:u,children:[l.jsxs(ri,{children:[n&&l.jsx(be,{src:n,alt:e||"Agent",$size:"32px"}),l.jsxs(ni,{children:[l.jsx(oi,{}),l.jsx(ai,{children:e})]})]}),l.jsx(si,{children:t&&l.jsx(ii,{onClick:r,"aria-label":"Close",children:l.jsx(Hs,{size:16})})})]})}function Dt({config:e,chat:t}){const{messages:r,sendMessage:n,uploadAttachment:a,exportMessagePdf:c,isLoading:u,error:d,isOpen:h,setIsOpen:b,hasSessionStarted:g}=t,[p,v]=x.useState(""),[w,C]=x.useState(e.height||600),[j,$]=x.useState(!1),o=x.useRef(null),{enabled:i,staged:s,attachmentError:f,setAttachmentError:m,addFiles:k,appendStaged:y,removeStaged:T,clearStaged:R,maxFiles:I,maxBytes:M,allowed:K}=pt(e,a),F=()=>e.theme==="dark"?"dark":e.theme==="light"?"light":j?"dark":"light";x.useEffect(()=>{if(e.theme==="auto"||!e.theme){const S=()=>{$(window.matchMedia("(prefers-color-scheme: dark)").matches)};S();const P=window.matchMedia("(prefers-color-scheme: dark)");return P.addEventListener("change",S),()=>P.removeEventListener("change",S)}else $(e.theme==="dark")},[e.theme]);const V=async()=>{const S=p.trim();!S&&s.length===0||u||(await n(S,void 0,s.length?s:void 0),v(""),R(),setTimeout(()=>{var P;(P=o.current)==null||P.focus()},100))},A=S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),V())},D=S=>{i&&(S.preventDefault(),S.dataTransfer.dropEffect="copy")},U=async S=>{if(!i)return;S.preventDefault();const P=await Kt(S.dataTransfer);P.length&&await k(P)};return h?l.jsxs(Ds,{$position:e.position||"bottom-right","data-theme":F(),style:{height:w,...e.chatWindowStyle},children:[e.resizable!==!1&&l.jsx(zs,{$position:"top",onMouseDown:S=>{S.preventDefault();const P=S.clientY,z=typeof w=="number"?w:600,L=Y=>{const N=Y.clientY-P,H=z-N;C(Math.max(200,Math.min(600,H)))},O=()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",O)};document.addEventListener("mousemove",L),document.addEventListener("mouseup",O)}}),e.showHeader!==!1&&l.jsx(ci,{agentImage:e.agentImage,chatName:e.chatName,onClose:()=>b(!1),primaryColor:e.primaryColor,showWelcomeScreen:e.quickQuestions&&e.quickQuestions.length>0&&!g}),e.quickQuestions&&e.quickQuestions.length>0&&!g?l.jsx(Xt,{config:e,onQuestionClick:async S=>{await n(S)},onSendMessage:n,isLoading:u}):l.jsxs(l.Fragment,{children:[l.jsx(er,{onDragOver:D,onDrop:U,children:l.jsxs(tr,{children:[r.map(S=>l.jsxs("div",{style:{display:"flex",marginBottom:"16px",justifyContent:S.role==="user"?"flex-end":"flex-start",alignItems:"flex-start",gap:"8px"},children:[S.role==="assistant"&&e.agentImage&&l.jsx(be,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),S.role==="assistant"?l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",maxWidth:"80%"},children:[l.jsx(ue,{$isUser:!1,children:l.jsx(lt,{content:S.content})}),An(S,r,u)&&l.jsx(gn,{content:S.content,disabled:u,onExportPdf:P=>c(P)})]}):l.jsx(ue,{$isUser:!0,children:l.jsxs(l.Fragment,{children:[S.attachments&&S.attachments.length>0&&l.jsx(Ce,{attachments:S.attachments,readOnly:!0}),S.content?S.content:null]})})]},S.id)),u&&l.jsxs("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"flex-start",gap:"8px",marginBottom:"16px"},children:[e.agentImage&&l.jsx(be,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(ue,{$isUser:!1,children:l.jsxs(Zt,{children:[l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"})]})})]}),d&&l.jsx(Jt,{children:d})]})}),l.jsxs(Qt,{style:{flexDirection:"column",alignItems:"stretch",gap:0},children:[(f||i&&s.length>0)&&l.jsxs("div",{style:{paddingBottom:8},children:[f&&l.jsx("div",{style:{fontSize:12,color:"#dc2626",marginBottom:4},children:f}),i&&s.length>0&&l.jsx(Ce,{attachments:s,onRemove:T})]}),l.jsx("div",{style:{width:"100%"},children:l.jsxs(Gt,{children:[l.jsx(dt,{ref:o,variant:"composer",value:p,onChange:v,onKeyDown:A,placeholder:e.placeholder,disabled:u}),l.jsxs(Yt,{children:[l.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:i&&l.jsx(Ut,{integrated:!0,disabled:u,maxFileBytes:M,maxFiles:I,allowedMime:K,currentCount:s.length,uploadAttachment:a,onUploaded:y,onError:m})}),l.jsx(Vt,{type:"button",onClick:V,disabled:u||!p.trim()&&s.length===0,"aria-label":"Send message",children:l.jsx(ut,{size:13})})]})]})})]})]})]}):l.jsxs(Ps,{onClick:()=>b(!0),style:e.buttonStyle,$position:e.position||"bottom-right",$primaryColor:e.primaryColor,"aria-label":"Open chat",children:[l.jsx("div",{className:"icon-container",children:l.jsx(Us,{size:16})}),l.jsx("span",{children:e.buttonText||e.chatName||"AI Chat"})]})}function li(e){const t=Kr(e),r=Wr(t);switch(t.mode){case"floating":return l.jsx(Dt,{config:t,chat:r});case"embedded":return l.jsx(En,{config:t,chat:r});default:return l.jsx(Dt,{config:t,chat:r})}}function di({config:e,chat:t}){const{messages:r,sendMessage:n,uploadAttachment:a,isLoading:c,error:u,hasSessionStarted:d}=t,[h,b]=x.useState(""),g=x.useRef(null),{enabled:p,staged:v,attachmentError:w,setAttachmentError:C,addFiles:j,appendStaged:$,removeStaged:o,clearStaged:i,maxFiles:s,maxBytes:f,allowed:m}=pt(e,a),k=async()=>{const I=h.trim();!I&&v.length===0||c||(await n(I,void 0,v.length?v:void 0),b(""),i(),setTimeout(()=>{var M;(M=g.current)==null||M.focus()},100))},y=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),k())},T=I=>{p&&(I.preventDefault(),I.dataTransfer.dropEffect="copy")},R=async I=>{if(!p)return;I.preventDefault();const M=await Kt(I.dataTransfer);M.length&&await j(M)};return l.jsx(In,{style:{height:e.height,display:"flex",flexDirection:"column",backgroundColor:"white",border:"1px solid #e5e7eb",borderRadius:"8px"},children:e.quickQuestions&&e.quickQuestions.length>0&&!d?l.jsx(Xt,{config:e,onQuestionClick:async I=>{await n(I)},onSendMessage:n,isLoading:c}):l.jsxs(l.Fragment,{children:[l.jsx(er,{style:{flex:1},onDragOver:T,onDrop:R,children:l.jsxs(tr,{children:[r.map(I=>l.jsxs("div",{style:{display:"flex",marginBottom:"12px",justifyContent:I.role==="user"?"flex-end":"flex-start",alignItems:"flex-start",gap:"8px"},children:[I.role==="assistant"&&e.agentImage&&l.jsx(be,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(ue,{$isUser:I.role==="user",children:I.role==="assistant"?l.jsx(lt,{content:I.content}):l.jsxs(l.Fragment,{children:[I.attachments&&I.attachments.length>0&&l.jsx(Ce,{attachments:I.attachments,readOnly:!0}),I.content?I.content:null]})})]},I.id)),c&&l.jsxs("div",{style:{display:"flex",justifyContent:"flex-start",alignItems:"flex-start",gap:"8px",marginBottom:"12px"},children:[e.agentImage&&l.jsx(be,{src:e.agentImage,alt:e.chatName||"Agent",$size:"28px"}),l.jsx(ue,{$isUser:!1,children:l.jsxs(Zt,{children:[l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"}),l.jsx("div",{className:"dot"})]})})]}),u&&l.jsx(Jt,{children:u})]})}),l.jsxs(Qt,{style:{flexDirection:"column",alignItems:"stretch",gap:0},children:[(w||p&&v.length>0)&&l.jsxs("div",{style:{paddingBottom:8},children:[w&&l.jsx("div",{style:{fontSize:12,color:"#dc2626",marginBottom:4},children:w}),p&&v.length>0&&l.jsx(Ce,{attachments:v,onRemove:o})]}),l.jsx("div",{style:{width:"100%"},children:l.jsxs(Gt,{children:[l.jsx(dt,{ref:g,variant:"composer",value:h,onChange:b,onKeyDown:y,placeholder:e.placeholder,disabled:c}),l.jsxs(Yt,{children:[l.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,minWidth:0},children:p&&l.jsx(Ut,{integrated:!0,disabled:c,maxFileBytes:f,maxFiles:s,allowedMime:m,currentCount:v.length,uploadAttachment:a,onUploaded:$,onError:C})}),l.jsx(Vt,{type:"button",onClick:k,disabled:c||!h.trim()&&v.length===0,"aria-label":"Send message",children:l.jsx(ut,{size:13})})]})]})})]})]})})}exports.EmbeddedChat=En;exports.FloatingChat=Dt;exports.InlineChat=di;exports.MarkdownRenderer=lt;exports.OrdifyApiClient=Lr;exports.OrdifyChat=li;exports.debounce=Fn;exports.formatTime=Ln;exports.generateId=Re;exports.parseStreamingResponse=Fr;exports.throttle=Wn;exports.useOrdifyChat=Wr;exports.useOrdifyConfig=Kr;exports.useWidgetAttachmentStaging=pt;