@accurix/centrinfo-widget 1.1.0 → 4.0.0
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/cdn/centrinfo-widget.js +303 -61
- package/dist/cdn/manifest.json +6 -6
- package/dist/{config-CHvO9tW1.mjs → config-CkU4urQY.mjs} +7 -7
- package/dist/{config-BfVMFkZ4.cjs → config-DsNMbdKp.cjs} +7 -7
- package/dist/index.cjs +284 -42
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +284 -42
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.cts +36 -7
- package/dist/runtime.d.mts +36 -7
- package/dist/runtime.mjs +1 -1
- package/dist/{types-BwixZ4yh.d.mts → types-1ZJJY7Da.d.mts} +280 -8
- package/dist/{types-CiW6Ilds.d.cts → types-B0r4SXaT.d.cts} +280 -8
- package/package.json +4 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n&&e(r,Symbol.toStringTag,{value:`Module`}),r};let n=require(`preact`),r=require(`preact/hooks`),i=require(`preact/jsx-runtime`);var a=class extends Error{constructor(e,t){super(t),this.status=e,this.name=`ApiError`}};const o=()=>({agentName:`Accurix`,greeting:`Hi! 👋 How can I help you today?`,widgetModule:`chat`,assistantMediaKind:`image`,soundEnabled:!0,voiceOutputEnabled:!1,talkbackMode:`text`,allowVoiceInput:!1,memoryEnabled:!0,memoryRetentionDays:30,memoryMessageCap:50,availableActions:[]}),s=`Sara is an AI assistant; answers may be imperfect.`,c=`Accurix is an AI assistant; answers may be imperfect.`,l=e=>{typeof console>`u`||console.warn(`[centrinfo-widget] Could not load saved widget configuration from the API (${e}). Showing default widget chrome. Check data-token, data-api-base, CORS, and backend availability.`)},u=(e,t={})=>{let n=(e.disclaimerText?.trim())?.toLowerCase(),r=t.agentName?.trim()||e.agentName?.trim()||`Accurix`,i=t.agentAvatarUrl?.trim()||e.agentAvatarUrl?.trim();return{...e,agentName:r,agentAvatarUrl:i||void 0,disclaimerText:n===`sara is an ai assistant; answers may be imperfect.`||n?.includes(`sara is an ai assistant`)?`Accurix is an AI assistant; answers may be imperfect.`:e.disclaimerText}};var d=class{constructor(e,t,n,r,i={},a,o,s=`floating`){this.baseUrl=e,this.token=t,this.gifApiKey=n,this.analyticsContextToken=r,this.bootstrapOverrides=i,this.identityToken=a,this.identityTokenProvider=o,this.chatSurface=s}async currentIdentityToken(){return this.identityTokenProvider&&(this.identityToken=(await this.identityTokenProvider())?.trim()||void 0),this.identityToken}headers(e=!0){let t={Authorization:`Bearer ${this.token}`};return e&&(t[`Content-Type`]=`application/json`),t}async json(e){let t;try{t=await e.json()}catch{t=void 0}if(!e.ok){let n=p(t)??`request failed (${e.status})`;throw new a(e.status,n)}return t?.data??t}async bootstrap(){try{let e=await fetch(`${this.baseUrl}/public-chat/bootstrap`,{headers:this.headers(!1)});if(!e.ok)return l(`bootstrap request failed with ${e.status}`),u(o(),this.bootstrapOverrides);let t=await this.json(e);return u({...o(),...t},this.bootstrapOverrides)}catch(e){return l(e instanceof Error?e.message:`bootstrap request failed`),u(o(),this.bootstrapOverrides)}}async history(){let e=await this.currentIdentityToken();if(!e)return{conversations:[]};let t=await fetch(`${this.baseUrl}/public-chat/history`,{method:`POST`,headers:this.headers(),body:JSON.stringify({identityToken:e,surface:this.chatSurface})}),n=await this.json(t);return{activeSessionId:n.activeSessionId,conversations:Array.isArray(n.conversations)?n.conversations:[]}}async stream(e,t,n){let r=await this.currentIdentityToken(),i=await fetch(`${this.baseUrl}/public-chat/stream`,{method:`POST`,headers:this.headers(),body:JSON.stringify({question:e,sessionId:t,voicePlaybackRequested:!!n.voicePlaybackRequested,analyticsContextToken:this.analyticsContextToken,identityToken:r,surface:this.chatSurface}),signal:n.signal});return!i.ok||!i.body?this.send(e,t,n):m(i.body,n)}async liveEvents(e,t){let n=`sessionId=${encodeURIComponent(e)}&after=${encodeURIComponent(t)}`,r=await fetch(`${this.baseUrl}/public-chat/live-events?${n}`,{headers:this.headers(!1)}),i=await this.json(r);return{mode:i.mode??`ai`,assignedAgentName:i.assignedAgentName,agentTyping:!!i.agentTyping,agentTypingName:i.agentTypingName,conversationEnded:!!i.conversationEnded,events:i.events??[]}}async typing(e,t){try{let n=await fetch(`${this.baseUrl}/public-chat/typing`,{method:`POST`,headers:this.headers(),body:JSON.stringify({sessionId:e,isTyping:t})});if(!n.ok)try{await n.text()}catch{}}catch{}}async send(e,t,n){let r=await this.currentIdentityToken(),i=await fetch(`${this.baseUrl}/public-chat`,{method:`POST`,headers:this.headers(),body:JSON.stringify({question:e,sessionId:t,voicePlaybackRequested:!!n.voicePlaybackRequested,analyticsContextToken:this.analyticsContextToken,identityToken:r,surface:this.chatSurface}),signal:n.signal}),a=await this.json(i);return n.onChunk(a.answer??``),{answer:a.answer??``,sources:a.sources??[],suggestedReplies:a.suggestedReplies??[],availableActions:a.availableActions??[],handoffOffered:a.handoffOffered??!1,requestedContactFields:g(a.requestedContactFields),conversationEnded:a.conversationEnded??!1,liveMode:a.liveMode,assignedAgentName:a.assignedAgentName,audioBase64:a.audioBase64,mimeType:a.mimeType,visualization:a.visualization}}async action(e,t){let n=await fetch(`${this.baseUrl}/public-chat/${
|
|
1
|
+
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n&&e(r,Symbol.toStringTag,{value:`Module`}),r};let n=require(`preact`),r=require(`preact/hooks`),i=require(`preact/jsx-runtime`);var a=class extends Error{constructor(e,t){super(t),this.status=e,this.name=`ApiError`}};const o=()=>({agentName:`Accurix`,greeting:`Hi! 👋 How can I help you today?`,widgetModule:`chat`,assistantMediaKind:`image`,soundEnabled:!0,voiceOutputEnabled:!1,talkbackMode:`text`,allowVoiceInput:!1,memoryEnabled:!0,memoryRetentionDays:30,memoryMessageCap:50,availableActions:[]}),s=`Sara is an AI assistant; answers may be imperfect.`,c=`Accurix is an AI assistant; answers may be imperfect.`,l=e=>{typeof console>`u`||console.warn(`[centrinfo-widget] Could not load saved widget configuration from the API (${e}). Showing default widget chrome. Check data-token, data-api-base, CORS, and backend availability.`)},u=(e,t={})=>{let n=(e.disclaimerText?.trim())?.toLowerCase(),r=t.agentName?.trim()||e.agentName?.trim()||`Accurix`,i=t.agentAvatarUrl?.trim()||e.agentAvatarUrl?.trim();return{...e,agentName:r,agentAvatarUrl:i||void 0,disclaimerText:n===`sara is an ai assistant; answers may be imperfect.`||n?.includes(`sara is an ai assistant`)?`Accurix is an AI assistant; answers may be imperfect.`:e.disclaimerText}};var d=class{constructor(e,t,n,r,i={},a,o,s=`floating`){this.baseUrl=e,this.token=t,this.gifApiKey=n,this.analyticsContextToken=r,this.bootstrapOverrides=i,this.identityToken=a,this.identityTokenProvider=o,this.chatSurface=s}async currentIdentityToken(){return this.identityTokenProvider&&(this.identityToken=(await this.identityTokenProvider())?.trim()||void 0),this.identityToken}headers(e=!0){let t={Authorization:`Bearer ${this.token}`};return e&&(t[`Content-Type`]=`application/json`),t}async json(e){let t;try{t=await e.json()}catch{t=void 0}if(!e.ok){let n=p(t)??`request failed (${e.status})`;throw new a(e.status,n)}return t?.data??t}async bootstrap(){try{let e=await fetch(`${this.baseUrl}/public-chat/bootstrap`,{headers:this.headers(!1)});if(!e.ok)return l(`bootstrap request failed with ${e.status}`),u(o(),this.bootstrapOverrides);let t=await this.json(e);return u({...o(),...t},this.bootstrapOverrides)}catch(e){return l(e instanceof Error?e.message:`bootstrap request failed`),u(o(),this.bootstrapOverrides)}}async history(){let e=await this.currentIdentityToken();if(!e)return{conversations:[]};let t=await fetch(`${this.baseUrl}/public-chat/history`,{method:`POST`,headers:this.headers(),body:JSON.stringify({identityToken:e,surface:this.chatSurface})}),n=await this.json(t);return{activeSessionId:n.activeSessionId,conversations:Array.isArray(n.conversations)?n.conversations:[]}}async stream(e,t,n){let r=await this.currentIdentityToken(),i=await fetch(`${this.baseUrl}/public-chat/stream`,{method:`POST`,headers:this.headers(),body:JSON.stringify({question:e,sessionId:t,voicePlaybackRequested:!!n.voicePlaybackRequested,analyticsContextToken:this.analyticsContextToken,identityToken:r,surface:this.chatSurface}),signal:n.signal});return!i.ok||!i.body?this.send(e,t,n):m(i.body,n)}async liveEvents(e,t){let n=`sessionId=${encodeURIComponent(e)}&after=${encodeURIComponent(t)}`,r=await fetch(`${this.baseUrl}/public-chat/live-events?${n}`,{headers:this.headers(!1)}),i=await this.json(r);return{mode:i.mode??`ai`,assignedAgentName:i.assignedAgentName,agentTyping:!!i.agentTyping,agentTypingName:i.agentTypingName,conversationEnded:!!i.conversationEnded,events:i.events??[]}}async typing(e,t){try{let n=await fetch(`${this.baseUrl}/public-chat/typing`,{method:`POST`,headers:this.headers(),body:JSON.stringify({sessionId:e,isTyping:t})});if(!n.ok)try{await n.text()}catch{}}catch{}}async send(e,t,n){let r=await this.currentIdentityToken(),i=await fetch(`${this.baseUrl}/public-chat`,{method:`POST`,headers:this.headers(),body:JSON.stringify({question:e,sessionId:t,voicePlaybackRequested:!!n.voicePlaybackRequested,analyticsContextToken:this.analyticsContextToken,identityToken:r,surface:this.chatSurface}),signal:n.signal}),a=await this.json(i);return n.onChunk(a.answer??``),{answer:a.answer??``,sources:a.sources??[],suggestedReplies:a.suggestedReplies??[],availableActions:a.availableActions??[],actions:a.actions??[],selectedAction:a.selectedAction,handoffOffered:a.handoffOffered??!1,requestedContactFields:g(a.requestedContactFields),conversationEnded:a.conversationEnded??!1,liveMode:a.liveMode,assignedAgentName:a.assignedAgentName,audioBase64:a.audioBase64,mimeType:a.mimeType,visualization:a.visualization,artifacts:a.artifacts}}async action(e,t,n){let r=n?.trim()||(e===`contact-support`?`inquiry`:e),i=await fetch(`${this.baseUrl}/public-chat/${r}`,{method:`POST`,headers:this.headers(),body:JSON.stringify(t)}),a=await this.json(i);return{ok:!0,note:a?.note,booking:a?.booking}}async speak(e){let t=await fetch(`${this.baseUrl}/public-chat/speak`,{method:`POST`,headers:this.headers(),body:JSON.stringify({text:e})}),n=await this.json(t);return{providerReady:!!n.providerReady,message:n.message,audioBase64:n.audioBase64,mimeType:n.mimeType}}async identify(e,t){if(!(!e||!t))try{let n=await fetch(`${this.baseUrl}/public-chat/identify`,{method:`POST`,headers:this.headers(),body:JSON.stringify(f(e,t))});if(!n.ok)try{await n.text()}catch{}}catch{}}async transcribe(e,t,n,r){let i=await fetch(`${this.baseUrl}/public-chat/transcribe`,{method:`POST`,headers:this.headers(),body:JSON.stringify({audioBase64:e,mimeType:t,languageHint:n,durationSeconds:r})});return(await this.json(i)).text??``}async transcribeAudio(e,t,n,r){let i=new FormData;i.append(`audio`,e,`voice-recording`),i.append(`mimeType`,t||e.type||`audio/webm`),n&&i.append(`languageHint`,n),r!==void 0&&Number.isFinite(r)&&i.append(`durationSeconds`,String(r));let a=await fetch(`${this.baseUrl}/public-chat/transcribe`,{method:`POST`,headers:this.headers(!1),body:i});return(await this.json(a)).text??``}async endConversation(e){try{let t=await fetch(`${this.baseUrl}/public-chat/end`,{method:`POST`,headers:this.headers(),body:JSON.stringify({sessionId:e})});if(!t.ok)try{await t.text()}catch{}}catch{}}async sendFeedback(e){try{let t=await fetch(`${this.baseUrl}/public-chat/feedback`,{method:`POST`,headers:this.headers(),body:JSON.stringify(e)});if(!t.ok)try{await t.text()}catch{}}catch{}}async extract(e,t,n){let r=await fetch(`${this.baseUrl}/public-chat/extract`,{method:`POST`,headers:this.headers(),body:JSON.stringify({fileBase64:e,mimeType:t,filename:n})});return(await this.json(r)).text??``}async demoSlots(e,t){let n=`from=${encodeURIComponent(e)}&to=${encodeURIComponent(t)}`,r=await fetch(`${this.baseUrl}/public-chat/demo-slots?${n}`,{headers:this.headers(!1)});if(!r.ok){let e=Error(`Calendar availability is temporarily unavailable.`);throw e.status=r.status,e}let i=await this.json(r);return{status:i?.status,reason:i?.reason,timezone:i?.timezone,slotDurationMinutes:i?.slotDurationMinutes,available:i?.available,taken:i?.taken??[],busy:i?.busy??[]}}async searchGifs(e){if(!this.gifApiKey)return[];let t=`https://tenor.googleapis.com/v2/search?q=${encodeURIComponent(e.trim()||`trending`)}&key=${this.gifApiKey}&limit=24&media_filter=tinygif,gif&contentfilter=high`;try{let e=await fetch(t);return e.ok?((await e.json()).results??[]).map(e=>({id:e.id,url:e.media_formats?.gif?.url??e.media_formats?.tinygif?.url??``,preview:e.media_formats?.tinygif?.url??e.media_formats?.gif?.url??``,alt:e.content_description||`GIF`})).filter(e=>e.url):[]}catch{return[]}}};const f=(e,t)=>{let n={...t.customAttributes??{},...t.metadata??{}};t.createdAt!==void 0&&(n.createdAt=t.createdAt),t.avatarUrl&&(n.avatarUrl=t.avatarUrl),t.company&&(n.company=t.company);let r={sessionId:e},i=t.externalId??t.userId;return i&&(r.externalId=i),t.email&&(r.email=t.email),t.firstName&&(r.firstName=t.firstName),t.lastName&&(r.lastName=t.lastName),t.name&&(r.name=t.name),t.phone&&(r.phone=t.phone),Object.keys(n).length>0&&(r.metadata=n),r},p=e=>{let t=e?.message;if(Array.isArray(t))return t.join(`, `);if(typeof t==`string`)return t},m=async(e,t)=>{let n=e.getReader(),r=new TextDecoder,i={answer:``,sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1,requestedContactFields:[],conversationEnded:!1},o=``;for(;;){let{done:e,value:s}=await n.read();if(e)break;o+=r.decode(s,{stream:!0});let c;for(;(c=o.indexOf(`
|
|
2
2
|
|
|
3
|
-
`))!==-1;){let e=o.slice(0,c);o=o.slice(c+2);let n=h(e);if(n){if(n.event===`error`)throw new a(502,n.data?.message??`stream error`);if(n.event===`chunk`&&typeof n.data?.text==`string`)i.answer+=n.data.text,t.onChunk(n.data.text);else if(n.event===`final`&&n.data)i.sources=n.data.sources??[],i.suggestedReplies=n.data.suggestedReplies??[],i.availableActions=n.data.availableActions??[],i.handoffOffered=!!n.data.handoffOffered,i.requestedContactFields=g(n.data.requestedContactFields),i.conversationEnded=!!n.data.conversationEnded,i.liveMode=n.data.liveMode,i.assignedAgentName=n.data.assignedAgentName,i.visualization=n.data.visualization,i.audioBase64=n.data.audioBase64,i.mimeType=n.data.mimeType;else if(n.event===`done`)return i}}}return i},h=e=>{let t=`message`,n=[];for(let r of e.split(`
|
|
3
|
+
`))!==-1;){let e=o.slice(0,c);o=o.slice(c+2);let n=h(e);if(n){if(n.event===`error`)throw new a(502,n.data?.message??`stream error`);if(n.event===`chunk`&&typeof n.data?.text==`string`)i.answer+=n.data.text,t.onChunk(n.data.text);else if(n.event===`final`&&n.data)i.sources=n.data.sources??[],i.suggestedReplies=n.data.suggestedReplies??[],i.availableActions=n.data.availableActions??[],i.actions=n.data.actions??[],i.selectedAction=n.data.selectedAction,i.handoffOffered=!!n.data.handoffOffered,i.requestedContactFields=g(n.data.requestedContactFields),i.conversationEnded=!!n.data.conversationEnded,i.liveMode=n.data.liveMode,i.assignedAgentName=n.data.assignedAgentName,i.visualization=n.data.visualization,i.artifacts=n.data.artifacts,i.audioBase64=n.data.audioBase64,i.mimeType=n.data.mimeType;else if(n.event===`done`)return i}}}return i},h=e=>{let t=`message`,n=[];for(let r of e.split(`
|
|
4
4
|
`))r.startsWith(`event:`)?t=r.slice(6).trim():r.startsWith(`data:`)&&n.push(r.slice(5).trim());if(n.length===0)return{event:t};try{return{event:t,data:JSON.parse(n.join(`
|
|
5
|
-
`))}}catch{return{event:t}}},g=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],_=e=>new Promise(t=>setTimeout(t,e)),v={agentName:`Accurix`,agentAvatarUrl:``,widgetModule:`assistant`,assistantMediaUrl:`https://images.unsplash.com/photo-1494790108377-be9c29b29330`,assistantMediaKind:`image`,assistantPrivacyUrl:`https://accurix.tech/privacy`,soundEnabled:!0,voiceOutputEnabled:!1,talkbackMode:`avatar`,avatarProvider:`demo`,avatarId:`accurix-demo`,greeting:`Hi! I'm Accurix, the AI assistant for Accurix. Ask me anything about products, pricing, or documentation — or book a demo.`,allowVoiceInput:!1,memoryEnabled:!0,memoryRetentionDays:30,memoryMessageCap:50,availableActions:[`public_book_demo`,`public_capture_contact`,`public_submit_inquiry`],agentDescription:`I help with Accurix products, pricing, and documentation.`,welcomeSubtitle:`Ask me anything — most answers are instant.`,disclaimerText:`Accurix is an AI assistant; answers may be imperfect.`,starterQuestions:[`What can Accurix help with?`,`How do I get started?`,`What's your pricing?`],featuredLinks:[{label:`Accurix founders`,url:`https://accurix.tech/about`},{label:`Pricing`,url:`https://accurix.tech/pricing`}]},y=[{match:/demo chart|monthly orders|orders by status/i,result:{answer:`Orders moved in different directions by status in the latest month. The chart below shows one line for submitted, approved, and fulfilled orders.`,sources:[],suggestedReplies:[`Show a demo KPI`,`Show a demo table`],handoffOffered:!1,visualization:{version:1,presentation:`chart`,type:`line`,title:`Monthly orders by status`,columns:[`month`,`status`,`order_count`],rows:[{month:`2025-01-01`,status:`Submitted`,order_count:12},{month:`2025-01-01`,status:`Approved`,order_count:16},{month:`2025-01-01`,status:`Fulfilled`,order_count:14},{month:`2025-02-01`,status:`Submitted`,order_count:14},{month:`2025-02-01`,status:`Approved`,order_count:15},{month:`2025-02-01`,status:`Fulfilled`,order_count:15},{month:`2025-03-01`,status:`Submitted`,order_count:13},{month:`2025-03-01`,status:`Approved`,order_count:17},{month:`2025-03-01`,status:`Fulfilled`,order_count:16},{month:`2025-04-01`,status:`Submitted`,order_count:15},{month:`2025-04-01`,status:`Approved`,order_count:16},{month:`2025-04-01`,status:`Fulfilled`,order_count:17},{month:`2025-05-01`,status:`Submitted`,order_count:16},{month:`2025-05-01`,status:`Approved`,order_count:18},{month:`2025-05-01`,status:`Fulfilled`,order_count:17},{month:`2025-06-01`,status:`Submitted`,order_count:17},{month:`2025-06-01`,status:`Approved`,order_count:17},{month:`2025-06-01`,status:`Fulfilled`,order_count:18},{month:`2025-07-01`,status:`Submitted`,order_count:18},{month:`2025-07-01`,status:`Approved`,order_count:19},{month:`2025-07-01`,status:`Fulfilled`,order_count:18},{month:`2025-08-01`,status:`Submitted`,order_count:19},{month:`2025-08-01`,status:`Approved`,order_count:18},{month:`2025-08-01`,status:`Fulfilled`,order_count:19}],rowCount:24,timezone:`UTC`,columnMetadata:[{key:`month`,label:`Order month`,dataType:`date`,semanticRole:`date`},{key:`status`,label:`Status`,dataType:`text`,semanticRole:`dimension`},{key:`order_count`,label:`Distinct order count`,dataType:`number`,semanticRole:`measure`,aggregation:`count_distinct`}],chartRecommendation:{type:`line`,mode:`time_series`,categoryField:`month`,valueFields:[`order_count`],seriesField:`status`},expandable:!0,tableAvailable:!1,explanation:{headline:`The latest results moved in different directions by status.`,summary:`Submitted and fulfilled orders increased, while approved orders decreased.`,evidence:[`Submitted orders increased from 18 in July to 19 in August.`,`Approved orders decreased from 19 in July to 18 in August.`,`Fulfilled orders increased from 18 in July to 19 in August.`],businessMeaning:`Overall order activity is steady, but the small approval decline is worth watching if it continues.`,followUps:[`Which status changed the most?`,`How does this compare with the prior quarter?`],source:`governed_result`}}}},{match:/demo kpi|active accounts/i,result:{answer:`There are 5,632 active accounts in the current demo result.`,sources:[],suggestedReplies:[`Show a demo chart`,`Show a demo table`],handoffOffered:!1,visualization:{version:1,presentation:`kpi`,type:`kpi`,title:`Active accounts`,columns:[`active_accounts`],value:`active_accounts`,rows:[{active_accounts:5632}],rowCount:1,columnMetadata:[{key:`active_accounts`,label:`Active accounts`,dataType:`number`,semanticRole:`measure`,aggregation:`count_distinct`}],explanation:{headline:`Active accounts are 5,632.`,summary:`This is the latest value in the demo result.`,evidence:[`The displayed active-account count is 5,632.`],source:`governed_result`}}}},{match:/demo table|account health/i,result:{answer:`Nine accounts are included in this governed result. The table shows a compact preview and can be expanded to inspect every permitted row.`,sources:[],suggestedReplies:[`Show a demo chart`,`Test the hidden table response`],handoffOffered:!1,visualization:{version:1,presentation:`table`,type:`table`,title:`Account health`,columns:[`account_name`,`region`,`health_score`,`renewal_month`],rows:[{account_name:`Northstar Industries`,region:`West`,health_score:94,renewal_month:`August`},{account_name:`Apex Group`,region:`East`,health_score:91,renewal_month:`September`},{account_name:`Summit Retail`,region:`North`,health_score:88,renewal_month:`August`},{account_name:`Harbor Logistics`,region:`South`,health_score:86,renewal_month:`October`},{account_name:`Brightline Media`,region:`West`,health_score:84,renewal_month:`November`},{account_name:`Redwood Labs`,region:`East`,health_score:82,renewal_month:`September`},{account_name:`Atlas Foods`,region:`North`,health_score:79,renewal_month:`December`},{account_name:`Cedar Health`,region:`South`,health_score:77,renewal_month:`October`},{account_name:`Bluewave Energy`,region:`West`,health_score:74,renewal_month:`December`}],rowCount:9,columnMetadata:[{key:`account_name`,label:`Account`,dataType:`text`,semanticRole:`dimension`},{key:`region`,label:`Region`,dataType:`text`,semanticRole:`geography`},{key:`health_score`,label:`Health score`,dataType:`number`,semanticRole:`measure`},{key:`renewal_month`,label:`Renewal month`,dataType:`text`,semanticRole:`date`}],expandable:!0,tableAvailable:!0,downloadAvailable:!0,explanation:{headline:`Nine accounts are available for review.`,summary:`Health scores range from 74 to 94 across four regions.`,evidence:[`Northstar Industries has the highest health score at 94.`],source:`governed_result`}}}},{match:/hidden table|table response/i,result:{answer:`Three accounts need attention. The public widget explains the result without exposing its underlying rows.`,sources:[],suggestedReplies:[`Show a demo chart`,`Show a demo KPI`],handoffOffered:!1,visualization:{version:1,presentation:`table`,type:`table`,columns:[`account_name`,`risk_score`],rows:[{account_name:`Private account A`,risk_score:91},{account_name:`Private account B`,risk_score:87},{account_name:`Private account C`,risk_score:82}],rowCount:3,tableAvailable:!1,explanation:{headline:`Three accounts need attention.`,summary:`The written result is available without displaying a public data table.`,evidence:[`Three accounts matched the approved attention rule.`],source:`governed_result`}}}},{match:/^\s*(hi+|hey+|hello|yo|sup|howdy|hola|thanks|thank you|thx|good (morning|afternoon|evening))\b/i,result:{answer:`Hello! 👋 How can I help you today?`,sources:[],suggestedReplies:[`How do I track a shipment?`,`How does customs work?`],handoffOffered:!1}},{match:/track|shipment|where|status/i,result:{answer:`Centrinfo can answer from your indexed knowledge base, public website, connected files, and approved organization tools. It keeps answers grounded in your configured sources and can hand a conversation to your team when the AI is not enough.`,sources:[{title:`Centrinfo public widget`,url:`https://accurix.tech/centrinfo`}],suggestedReplies:[`How does the widget work?`,`Can a human take over?`],handoffOffered:!1}},{match:/custom|clear|duty|tariff|import/i,result:{answer:`Accurix connects your organization knowledge, channels, integrations, and public widget in one place. You can configure which sources the AI can use, which tools visitors can trigger, and when your team should take over live chat.`,sources:[{title:`Accurix documentation`,url:`https://accurix.tech/docs`}],suggestedReplies:[`Which tools can I connect?`,`How do permissions work?`],handoffOffered:!1}},{match:/price|cost|pricing|plan|quote/i,result:{answer:`Accurix uses a usage-based pricing model. Organizations keep an active subscription and spend credits as the AI answers, searches, and uses tools. Credit top-ups can extend usage when the subscription grant runs low.`,sources:[{title:`Pricing`,url:`https://accurix.tech/pricing`}],suggestedReplies:[`How do credits work?`,`Can I top up credits?`],handoffOffered:!1}}],b={answer:`That's a great question — I don't have a confident answer from Accurix's published docs yet. Want me to pass it to the team so a human can follow up? You can also book a quick demo.`,sources:[],suggestedReplies:[`What can you help with?`],handoffOffered:!0},x=e=>y.find(t=>t.match.test(e))?.result??b;var S=class{async history(){return{conversations:[]}}async bootstrap(){return await _(180),v}async stream(e,t,n){await _(550);let r=x(e),i=r.answer.split(/(\s+)/);for(let e of i){if(n.signal?.aborted)break;n.onChunk(e),await _(18+Math.min(40,e.length*6))}return{...r,availableActions:v.availableActions}}async liveEvents(){return{mode:`ai`,conversationEnded:!1,events:[]}}async typing(){await _(20)}async action(e,t){return await _(450),{ok:!0,note:{"book-demo":`Demo requested — we'll email you a few times that work. 📅`,contact:`Got it — saved your details. ✅`,inquiry:`Thanks! We'll get back to you shortly. ✉️`,"request-callback":`We'll call you back soon. 📞`,"subscribe-newsletter":`You're subscribed. 🎉`}[e]}}async speak(){return await _(120),{providerReady:!1,message:`Demo voice provider is not connected.`}}async transcribe(e,t,n,r){return await _(700),`How do I track a shipment?`}async extract(e,t,n){return await _(600),`[Attached file${n?`: ${n}`:``}] Invoice #4821 — 3 pallets, Rotterdam → Lagos, ETA 12 days.`}async identify(e,t){await _(50)}async endConversation(e){await _(50)}async sendFeedback(){await _(50)}async demoSlots(e,t){return await _(150),{taken:[[11,0],[15,0]].map(([e,t])=>{let n=new Date;return n.setHours(e,t,0,0),n.toISOString()}),busy:[]}}async searchGifs(e){await _(280);let t=e.trim().toLowerCase(),n=t?E.filter(e=>e.alt.includes(t)||e.tags.some(e=>e.includes(t)||t.includes(e))):E;return(n.length>0?n:E).map(e=>({id:e.id,url:T(e.emoji,e.anim),preview:T(e.emoji,e.anim),alt:e.alt}))}};const C=`<animateTransform attributeName='transform' attributeType='XML' type='translate' values='0 0;0 -16;0 0' dur='0.7s' repeatCount='indefinite'/>`,w=`<animateTransform attributeName='transform' attributeType='XML' type='rotate' values='-14 64 110;14 64 110;-14 64 110' dur='0.9s' repeatCount='indefinite'/>`,T=(e,t)=>{let n=`<svg xmlns='http://www.w3.org/2000/svg' width='128' height='128'><rect width='128' height='128' rx='14' fill='#eef1f4'/><text x='64' y='88' font-size='64' text-anchor='middle'>${e}${t}</text></svg>`;return`data:image/svg+xml,${encodeURIComponent(n)}`},E=[{id:`g1`,emoji:`👍`,alt:`thumbs up`,tags:[`thumbs`,`yes`,`ok`,`great`,`good`],anim:C},{id:`g2`,emoji:`🎉`,alt:`celebrate`,tags:[`party`,`yay`,`congrats`,`celebrate`],anim:w},{id:`g3`,emoji:`👋`,alt:`wave hello`,tags:[`hi`,`hello`,`hey`,`wave`,`bye`],anim:w},{id:`g4`,emoji:`❤️`,alt:`heart`,tags:[`love`,`thanks`,`heart`],anim:C},{id:`g5`,emoji:`🤔`,alt:`thinking`,tags:[`hmm`,`think`,`thinking`],anim:w},{id:`g6`,emoji:`😂`,alt:`laughing`,tags:[`lol`,`funny`,`haha`,`laugh`],anim:C},{id:`g7`,emoji:`🔥`,alt:`fire`,tags:[`fire`,`hot`,`lit`,`awesome`],anim:C},{id:`g8`,emoji:`🚀`,alt:`rocket`,tags:[`rocket`,`launch`,`fast`,`go`],anim:w}],D=e=>new Promise(t=>setTimeout(t,e));var O=class{constructor(e,t){this.real=e,this.strings=t}bootstrap(){return this.real.bootstrap()}async history(){return{conversations:[]}}async stream(e,t,n){await D(300);for(let e of this.strings.previewReply.split(/(\s+)/)){if(n.signal?.aborted)break;n.onChunk(e),await D(16)}return{answer:this.strings.previewReply,sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1}}async liveEvents(){return{mode:`ai`,conversationEnded:!1,events:[]}}async typing(){}async action(){return await D(250),{ok:!0,note:this.strings.previewActionNote}}async speak(){return{providerReady:!1,message:`Preview voice provider is not connected.`}}async identify(){}async endConversation(){}async sendFeedback(){}async transcribe(e,t,n,r){return``}async extract(){return``}async searchGifs(){return[]}async demoSlots(){return{taken:[],busy:[]}}},k=function(e,t){return k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},k(e,t)};function A(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);k(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var j=12,M=`sans-serif`,N=j+`px `+M,P=20,ee=100,te=`007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N`;function ne(e){var t={};if(typeof JSON>`u`)return t;for(var n=0;n<e.length;n++){var r=String.fromCharCode(n+32);t[r]=(e.charCodeAt(n)-P)/ee}return t}var re=ne(te),ie={createCanvas:function(){return typeof document<`u`&&document.createElement(`canvas`)},measureText:(function(){var e,t;return function(n,r){if(!e){var i=ie.createCanvas();e=i&&i.getContext(`2d`)}if(e)return t!==r&&(t=e.font=r||N),e.measureText(n);n=n||``,r=r||N;var a=/((?:\d+)?\.?\d*)px/.exec(r),o=a&&+a[1]||j,s=0;if(r.indexOf(`mono`)>=0)s=o*n.length;else for(var c=0;c<n.length;c++){var l=re[n[c]];s+=l==null?o:l*o}return{width:s}}})(),loadImage:function(e,t,n){var r=new Image;return r.onload=t,r.onerror=n,r.src=e,r}},ae=xe([`Function`,`RegExp`,`Date`,`Error`,`CanvasGradient`,`CanvasPattern`,`Image`,`Canvas`],function(e,t){return e[`[object `+t+`]`]=!0,e},{}),oe=xe([`Int8`,`Uint8`,`Uint8Clamped`,`Int16`,`Uint16`,`Int32`,`Uint32`,`Float32`,`Float64`],function(e,t){return e[`[object `+t+`Array]`]=!0,e},{}),se=Object.prototype.toString,ce=Array.prototype,le=ce.forEach,ue=ce.filter,F=ce.slice,I=ce.map,de=function(){}.constructor,fe=de?de.prototype:null,pe=`__proto__`,me=2311;function he(){return me++}function ge(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];typeof console<`u`&&console.error.apply(console,e)}function L(e){if(typeof e!=`object`||!e)return e;var t=e,n=se.call(e);if(n===`[object Array]`){if(!He(e)){t=[];for(var r=0,i=e.length;r<i;r++)t[r]=L(e[r])}}else if(oe[n]){if(!He(e)){var a=e.constructor;if(a.from)t=a.from(e);else{t=new a(e.length);for(var r=0,i=e.length;r<i;r++)t[r]=e[r]}}}else if(!ae[n]&&!He(e)&&!Ae(e))for(var o in t={},e)e.hasOwnProperty(o)&&o!==pe&&(t[o]=L(e[o]));return t}function R(e,t,n){if(!J(t)||!J(e))return n?L(t):e;for(var r in t)if(t.hasOwnProperty(r)&&r!==pe){var i=e[r],a=t[r];J(a)&&J(i)&&!G(a)&&!G(i)&&!Ae(a)&&!Ae(i)&&!Oe(a)&&!Oe(i)&&!He(a)&&!He(i)?R(i,a,n):(n||!(r in e))&&(e[r]=L(t[r]))}return e}function z(e,t){if(Object.assign)Object.assign(e,t);else for(var n in t)t.hasOwnProperty(n)&&n!==pe&&(e[n]=t[n]);return e}function B(e,t,n){for(var r=Ce(t),i=0,a=r.length;i<a;i++){var o=r[i];(n?t[o]!=null:e[o]==null)&&(e[o]=t[o])}return e}var _e=ie.createCanvas;function V(e,t){if(e){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n}return-1}function ve(e,t){var n=e.prototype;function r(){}for(var i in r.prototype=t.prototype,e.prototype=new r,n)n.hasOwnProperty(i)&&(e.prototype[i]=n[i]);e.prototype.constructor=e,e.superClass=t}function ye(e,t,n){if(e=`prototype`in e?e.prototype:e,t=`prototype`in t?t.prototype:t,Object.getOwnPropertyNames)for(var r=Object.getOwnPropertyNames(t),i=0;i<r.length;i++){var a=r[i];a!==`constructor`&&(n?t[a]!=null:e[a]==null)&&(e[a]=t[a])}else B(e,t,n)}function be(e){return!e||typeof e==`string`?!1:typeof e.length==`number`}function H(e,t,n){if(e&&t)if(e.forEach&&e.forEach===le)e.forEach(t,n);else if(e.length===+e.length)for(var r=0,i=e.length;r<i;r++)t.call(n,e[r],r,e);else for(var a in e)e.hasOwnProperty(a)&&t.call(n,e[a],a,e)}function U(e,t,n){if(!e)return[];if(!t)return Le(e);if(e.map&&e.map===I)return e.map(t,n);for(var r=[],i=0,a=e.length;i<a;i++)r.push(t.call(n,e[i],i,e));return r}function xe(e,t,n,r){if(e&&t){for(var i=0,a=e.length;i<a;i++)n=t.call(r,n,e[i],i,e);return n}}function Se(e,t,n){if(!e)return[];if(!t)return Le(e);if(e.filter&&e.filter===ue)return e.filter(t,n);for(var r=[],i=0,a=e.length;i<a;i++)t.call(n,e[i],i,e)&&r.push(e[i]);return r}function Ce(e){if(!e)return[];if(Object.keys)return Object.keys(e);var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}function we(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return function(){return e.apply(t,n.concat(F.call(arguments)))}}var W=fe&&K(fe.bind)?fe.call.bind(fe.bind):we;function Te(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return function(){return e.apply(this,t.concat(F.call(arguments)))}}function G(e){return Array.isArray?Array.isArray(e):se.call(e)===`[object Array]`}function K(e){return typeof e==`function`}function q(e){return typeof e==`string`}function Ee(e){return se.call(e)===`[object String]`}function De(e){return typeof e==`number`}function J(e){var t=typeof e;return t===`function`||!!e&&t===`object`}function Oe(e){return!!ae[se.call(e)]}function ke(e){return!!oe[se.call(e)]}function Ae(e){return typeof e==`object`&&typeof e.nodeType==`number`&&typeof e.ownerDocument==`object`}function je(e){return e.colorStops!=null}function Me(e){return e.image!=null}function Ne(e){return se.call(e)===`[object RegExp]`}function Pe(e){return e!==e}function Fe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0,r=e.length;n<r;n++)if(e[n]!=null)return e[n]}function Y(e,t){return e??t}function Ie(e,t,n){return e??t??n}function Le(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return F.apply(e,t)}function Re(e){if(typeof e==`number`)return[e,e,e,e];var t=e.length;return t===2?[e[0],e[1],e[0],e[1]]:t===3?[e[0],e[1],e[2],e[1]]:e}function X(e,t){if(!e)throw Error(t)}function ze(e){return e==null?null:typeof e.trim==`function`?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``)}var Be=`__ec_primitive__`;function Ve(e){e[Be]=!0}function He(e){return e[Be]}var Ue=function(){function e(){this.data={}}return e.prototype.delete=function(e){var t=this.has(e);return t&&delete this.data[e],t},e.prototype.has=function(e){return this.data.hasOwnProperty(e)},e.prototype.get=function(e){return this.data[e]},e.prototype.set=function(e,t){return this.data[e]=t,this},e.prototype.keys=function(){return Ce(this.data)},e.prototype.forEach=function(e){var t=this.data;for(var n in t)t.hasOwnProperty(n)&&e(t[n],n)},e}(),We=typeof Map==`function`;function Ge(){return We?new Map:new Ue}var Ke=function(){function e(t){var n=G(t);this.data=Ge();var r=this;t instanceof e?t.each(i):t&&H(t,i);function i(e,t){n?r.set(e,t):r.set(t,e)}}return e.prototype.hasKey=function(e){return this.data.has(e)},e.prototype.get=function(e){return this.data.get(e)},e.prototype.set=function(e,t){return this.data.set(e,t),t},e.prototype.each=function(e,t){this.data.forEach(function(n,r){e.call(t,n,r)})},e.prototype.keys=function(){var e=this.data.keys();return We?Array.from(e):e},e.prototype.removeKey=function(e){this.data.delete(e)},e}();function Z(e){return new Ke(e)}function qe(e,t){for(var n=new e.constructor(e.length+t.length),r=0;r<e.length;r++)n[r]=e[r];for(var i=e.length,r=0;r<t.length;r++)n[r+i]=t[r];return n}function Je(e,t){var n;if(Object.create)n=Object.create(e);else{var r=function(){};r.prototype=e,n=new r}return t&&z(n,t),n}function Ye(e){var t=e.style;t.webkitUserSelect=`none`,t.userSelect=`none`,t.webkitTapHighlightColor=`rgba(0,0,0,0)`,t[`-webkit-touch-callout`]=`none`}function Xe(e,t){return e.hasOwnProperty(t)}function Ze(){}var Qe=180/Math.PI,$e=function(){function e(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1}return e}(),et=new(function(){function e(){this.browser=new $e,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow=typeof window<`u`}return e}());typeof wx==`object`&&typeof wx.getSystemInfoSync==`function`?(et.wxa=!0,et.touchEventsSupported=!0):typeof document>`u`&&typeof self<`u`?et.worker=!0:!et.hasGlobalWindow||`Deno`in window?(et.node=!0,et.svgSupported=!0):tt(navigator.userAgent,et);function tt(e,t){var n=t.browser,r=e.match(/Firefox\/([\d.]+)/),i=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),a=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);r&&(n.firefox=!0,n.version=r[1]),i&&(n.ie=!0,n.version=i[1]),a&&(n.edge=!0,n.version=a[1],n.newEdge=+a[1].split(`.`)[0]>18),o&&(n.weChat=!0),t.svgSupported=typeof SVGRect<`u`,t.touchEventsSupported=`ontouchstart`in window&&!n.ie&&!n.edge,t.pointerEventsSupported=`onpointerdown`in window&&(n.edge||n.ie&&+n.version>=11),t.domSupported=typeof document<`u`;var s=document.documentElement.style;t.transform3dSupported=(n.ie&&`transition`in s||n.edge||`WebKitCSSMatrix`in window&&`m11`in new WebKitCSSMatrix||`MozPerspective`in s)&&!(`OTransition`in s),t.transformSupported=t.transform3dSupported||n.ie&&+n.version>=9}var Q=et,nt=`.`,rt=`___EC__COMPONENT__CONTAINER___`,it=`___EC__EXTENDED_CLASS___`;function at(e){var t={main:``,sub:``};if(e){var n=e.split(nt);t.main=n[0]||``,t.sub=n[1]||``}return t}function ot(e){X(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),`componentType "`+e+`" illegal`)}function st(e){return!!(e&&e[it])}function ct(e,t){e.$constructor=e,e.extend=function(e){process.env.NODE_ENV!==`production`&&H(t,function(t){e[t]||console.warn("Method `"+t+"` should be implemented"+(e.type?` in `+e.type:``)+`.`)});var n=this,r;return lt(n)?r=function(e){A(t,e);function t(){return e.apply(this,arguments)||this}return t}(n):(r=function(){(e.$constructor||n).apply(this,arguments)},ve(r,this)),z(r.prototype,e),r[it]=!0,r.extend=this.extend,r.superCall=pt,r.superApply=mt,r.superClass=n,r}}function lt(e){return K(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function ut(e,t){e.extend=t.extend}var dt=Math.round(Math.random()*10);function ft(e){var t=[`__\0is_clz`,dt++].join(`_`);e.prototype[t]=!0,process.env.NODE_ENV!==`production`&&X(!e.isInstance,`The method "is" can not be defined.`),e.isInstance=function(e){return!!(e&&e[t])}}function pt(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return this.superClass.prototype[t].apply(e,n)}function mt(e,t,n){return this.superClass.prototype[t].apply(e,n)}function ht(e){var t={};e.registerClass=function(e){var r=e.type||e.prototype.type;if(r){ot(r),e.prototype.type=r;var i=at(r);if(!i.sub)process.env.NODE_ENV!==`production`&&t[i.main]&&console.warn(i.main+` exists.`),t[i.main]=e;else if(i.sub!==rt){var a=n(i);a[i.sub]=e}}return e},e.getClass=function(e,n,r){var i=t[e];if(i&&i[rt]&&(i=n?i[n]:null),r&&!i)throw Error(n?`Component `+e+`.`+(n||``)+` is used but not imported.`:e+`.type should be specified.`);return i},e.getClassesByMainType=function(e){var n=at(e),r=[],i=t[n.main];return i&&i[rt]?H(i,function(e,t){t!==rt&&r.push(e)}):r.push(i),r},e.hasClass=function(e){return!!t[at(e).main]},e.getAllClassMainTypes=function(){var e=[];return H(t,function(t,n){e.push(n)}),e},e.hasSubTypes=function(e){var n=t[at(e).main];return n&&n[rt]};function n(e){var n=t[e.main];return(!n||!n[rt])&&(n=t[e.main]={},n[rt]=!0),n}}function gt(e,t){for(var n=0;n<e.length;n++)e[n][1]||(e[n][1]=e[n][0]);return t=t||!1,function(n,r,i){for(var a={},o=0;o<e.length;o++){var s=e[o][1];if(!(r&&V(r,s)>=0||i&&V(i,s)<0)){var c=n.getShallow(s,t);c!=null&&(a[e[o][0]]=c)}}return a}}var _t=[[`fill`,`color`],[`shadowBlur`],[`shadowOffsetX`],[`shadowOffsetY`],[`opacity`],[`shadowColor`]],vt=gt(_t),yt=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return vt(this,e,t)},e}(),bt=function(){function e(e){this.value=e}return e}(),xt=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new bt(e);return this.insertEntry(t),t},e.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},e.prototype.remove=function(e){var t=e.prev,n=e.next;t?t.next=n:this.head=n,n?n.prev=t:this.tail=t,e.next=e.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),St=function(){function e(e){this._list=new xt,this._maxSize=10,this._map={},this._maxSize=e}return e.prototype.put=function(e,t){var n=this._list,r=this._map,i=null;if(r[e]==null){var a=n.len(),o=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=n.head;n.remove(s),delete r[s.key],i=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new bt(t),o.key=e,n.insertEntry(o),r[e]=o}return i},e.prototype.get=function(e){var t=this._map[e],n=this._list;if(t!=null)return t!==n.tail&&(n.remove(t),n.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),Ct=St,wt=new Ct(50);function Tt(e){if(typeof e==`string`){var t=wt.get(e);return t&&t.image}else return e}function Et(e,t,n,r,i){if(e)if(typeof e==`string`){if(t&&t.__zrImageSrc===e||!n)return t;var a=wt.get(e),o={hostEl:n,cb:r,cbPayload:i};return a?(t=a.image,!Ot(t)&&a.pending.push(o)):(t=ie.loadImage(e,Dt,Dt),t.__zrImageSrc=e,wt.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}else return e;else return t}function Dt(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;t<e.pending.length;t++){var n=e.pending[t],r=n.cb;r&&r(this,n.cbPayload),n.hostEl.dirty()}e.pending.length=0}function Ot(e){return e&&e.width&&e.height}function kt(){return[1,0,0,1,0,0]}function At(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}function jt(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Mt(e,t,n){var r=t[0]*n[0]+t[2]*n[1],i=t[1]*n[0]+t[3]*n[1],a=t[0]*n[2]+t[2]*n[3],o=t[1]*n[2]+t[3]*n[3],s=t[0]*n[4]+t[2]*n[5]+t[4],c=t[1]*n[4]+t[3]*n[5]+t[5];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e}function Nt(e,t,n){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4]+n[0],e[5]=t[5]+n[1],e}function Pt(e,t,n,r){r===void 0&&(r=[0,0]);var i=t[0],a=t[2],o=t[4],s=t[1],c=t[3],l=t[5],u=Math.sin(n),d=Math.cos(n);return e[0]=i*d+s*u,e[1]=-i*u+s*d,e[2]=a*d+c*u,e[3]=-a*u+d*c,e[4]=d*(o-r[0])+u*(l-r[1])+r[0],e[5]=d*(l-r[1])-u*(o-r[0])+r[1],e}function Ft(e,t,n){var r=n[0],i=n[1];return e[0]=t[0]*r,e[1]=t[1]*i,e[2]=t[2]*r,e[3]=t[3]*i,e[4]=t[4]*r,e[5]=t[5]*i,e}function It(e,t){var n=t[0],r=t[2],i=t[4],a=t[1],o=t[3],s=t[5],c=n*o-a*r;return c?(c=1/c,e[0]=o*c,e[1]=-a*c,e[2]=-r*c,e[3]=n*c,e[4]=(r*s-o*i)*c,e[5]=(a*i-n*s)*c,e):null}var Lt=function(){function e(e,t){this.x=e||0,this.y=t||0}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.set=function(e,t){return this.x=e,this.y=t,this},e.prototype.equal=function(e){return e.x===this.x&&e.y===this.y},e.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},e.prototype.scale=function(e){this.x*=e,this.y*=e},e.prototype.scaleAndAdd=function(e,t){this.x+=e.x*t,this.y+=e.y*t},e.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},e.prototype.dot=function(e){return this.x*e.x+this.y*e.y},e.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},e.prototype.normalize=function(){var e=this.len();return this.x/=e,this.y/=e,this},e.prototype.distance=function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)},e.prototype.distanceSquare=function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},e.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.prototype.transform=function(e){if(e){var t=this.x,n=this.y;return this.x=e[0]*t+e[2]*n+e[4],this.y=e[1]*t+e[3]*n+e[5],this}},e.prototype.toArray=function(e){return e[0]=this.x,e[1]=this.y,e},e.prototype.fromArray=function(e){this.x=e[0],this.y=e[1]},e.set=function(e,t,n){e.x=t,e.y=n},e.copy=function(e,t){e.x=t.x,e.y=t.y},e.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},e.lenSquare=function(e){return e.x*e.x+e.y*e.y},e.dot=function(e,t){return e.x*t.x+e.y*t.y},e.add=function(e,t,n){e.x=t.x+n.x,e.y=t.y+n.y},e.sub=function(e,t,n){e.x=t.x-n.x,e.y=t.y-n.y},e.scale=function(e,t,n){e.x=t.x*n,e.y=t.y*n},e.scaleAndAdd=function(e,t,n,r){e.x=t.x+n.x*r,e.y=t.y+n.y*r},e.lerp=function(e,t,n,r){var i=1-r;e.x=i*t.x+r*n.x,e.y=i*t.y+r*n.y},e}(),Rt=Lt,zt=Math.min,Bt=Math.max,Vt=new Rt,Ht=new Rt,Ut=new Rt,Wt=new Rt,Gt=new Rt,Kt=new Rt,qt=function(){function e(e,t,n,r){n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),this.x=e,this.y=t,this.width=n,this.height=r}return e.prototype.union=function(e){var t=zt(e.x,this.x),n=zt(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Bt(e.x+e.width,this.x+this.width)-t:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=Bt(e.y+e.height,this.y+this.height)-n:this.height=e.height,this.x=t,this.y=n},e.prototype.applyTransform=function(t){e.applyTransform(this,this,t)},e.prototype.calculateTransform=function(e){var t=this,n=e.width/t.width,r=e.height/t.height,i=kt();return Nt(i,i,[-t.x,-t.y]),Ft(i,i,[n,r]),Nt(i,i,[e.x,e.y]),i},e.prototype.intersect=function(t,n){if(!t)return!1;t instanceof e||(t=e.create(t));var r=this,i=r.x,a=r.x+r.width,o=r.y,s=r.y+r.height,c=t.x,l=t.x+t.width,u=t.y,d=t.y+t.height,f=!(a<c||l<i||s<u||d<o);if(n){var p=1/0,m=0,h=Math.abs(a-c),g=Math.abs(l-i),_=Math.abs(s-u),v=Math.abs(d-o),y=Math.min(h,g),b=Math.min(_,v);a<c||l<i?y>m&&(m=y,h<g?Rt.set(Kt,-h,0):Rt.set(Kt,g,0)):y<p&&(p=y,h<g?Rt.set(Gt,h,0):Rt.set(Gt,-g,0)),s<u||d<o?b>m&&(m=b,_<v?Rt.set(Kt,0,-_):Rt.set(Kt,0,v)):y<p&&(p=y,_<v?Rt.set(Gt,0,_):Rt.set(Gt,0,-v))}return n&&Rt.copy(n,f?Gt:Kt),f},e.prototype.contain=function(e,t){var n=this;return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(t){e.copy(this,t)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t.x,t.y,t.width,t.height)},e.copy=function(e,t){e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height},e.applyTransform=function(t,n,r){if(!r){t!==n&&e.copy(t,n);return}if(r[1]<1e-5&&r[1]>-1e-5&&r[2]<1e-5&&r[2]>-1e-5){var i=r[0],a=r[3],o=r[4],s=r[5];t.x=n.x*i+o,t.y=n.y*a+s,t.width=n.width*i,t.height=n.height*a,t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height);return}Vt.x=Ut.x=n.x,Vt.y=Wt.y=n.y,Ht.x=Wt.x=n.x+n.width,Ht.y=Ut.y=n.y+n.height,Vt.transform(r),Wt.transform(r),Ht.transform(r),Ut.transform(r),t.x=zt(Vt.x,Ht.x,Ut.x,Wt.x),t.y=zt(Vt.y,Ht.y,Ut.y,Wt.y);var c=Bt(Vt.x,Ht.x,Ut.x,Wt.x),l=Bt(Vt.y,Ht.y,Ut.y,Wt.y);t.width=c-t.x,t.height=l-t.y},e}(),$=qt,Jt={};function Yt(e,t){t=t||N;var n=Jt[t];n||(n=Jt[t]=new Ct(500));var r=n.get(e);return r??(r=ie.measureText(e,t).width,n.put(e,r)),r}function Xt(e,t,n,r){var i=Yt(e,t),a=en(t);return new $(Qt(0,i,n),$t(0,a,r),i,a)}function Zt(e,t,n,r){var i=((e||``)+``).split(`
|
|
5
|
+
`))}}catch{return{event:t}}},g=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],_=e=>new Promise(t=>setTimeout(t,e)),v={agentName:`Accurix`,agentAvatarUrl:``,widgetModule:`assistant`,assistantMediaUrl:`https://images.unsplash.com/photo-1494790108377-be9c29b29330`,assistantMediaKind:`image`,assistantPrivacyUrl:`https://accurix.tech/privacy`,soundEnabled:!0,voiceOutputEnabled:!1,talkbackMode:`avatar`,avatarProvider:`demo`,avatarId:`accurix-demo`,greeting:`Hi! I'm Accurix, the AI assistant for Accurix. Ask me anything about products, pricing, or documentation — or book a demo.`,allowVoiceInput:!1,memoryEnabled:!0,memoryRetentionDays:30,memoryMessageCap:50,availableActions:[`public_book_demo`,`public_capture_contact`,`public_submit_inquiry`],agentDescription:`I help with Accurix products, pricing, and documentation.`,welcomeSubtitle:`Ask me anything — most answers are instant.`,disclaimerText:`Accurix is an AI assistant; answers may be imperfect.`,starterQuestions:[`What can Accurix help with?`,`How do I get started?`,`What's your pricing?`],featuredLinks:[{label:`Accurix founders`,url:`https://accurix.tech/about`},{label:`Pricing`,url:`https://accurix.tech/pricing`}]},y=[{match:/demo chart|monthly orders|orders by status/i,result:{answer:`Orders moved in different directions by status in the latest month. The chart below shows one line for submitted, approved, and fulfilled orders.`,sources:[],suggestedReplies:[`Show a demo KPI`,`Show a demo table`],handoffOffered:!1,visualization:{version:1,presentation:`chart`,type:`line`,title:`Monthly orders by status`,columns:[`month`,`status`,`order_count`],rows:[{month:`2025-01-01`,status:`Submitted`,order_count:12},{month:`2025-01-01`,status:`Approved`,order_count:16},{month:`2025-01-01`,status:`Fulfilled`,order_count:14},{month:`2025-02-01`,status:`Submitted`,order_count:14},{month:`2025-02-01`,status:`Approved`,order_count:15},{month:`2025-02-01`,status:`Fulfilled`,order_count:15},{month:`2025-03-01`,status:`Submitted`,order_count:13},{month:`2025-03-01`,status:`Approved`,order_count:17},{month:`2025-03-01`,status:`Fulfilled`,order_count:16},{month:`2025-04-01`,status:`Submitted`,order_count:15},{month:`2025-04-01`,status:`Approved`,order_count:16},{month:`2025-04-01`,status:`Fulfilled`,order_count:17},{month:`2025-05-01`,status:`Submitted`,order_count:16},{month:`2025-05-01`,status:`Approved`,order_count:18},{month:`2025-05-01`,status:`Fulfilled`,order_count:17},{month:`2025-06-01`,status:`Submitted`,order_count:17},{month:`2025-06-01`,status:`Approved`,order_count:17},{month:`2025-06-01`,status:`Fulfilled`,order_count:18},{month:`2025-07-01`,status:`Submitted`,order_count:18},{month:`2025-07-01`,status:`Approved`,order_count:19},{month:`2025-07-01`,status:`Fulfilled`,order_count:18},{month:`2025-08-01`,status:`Submitted`,order_count:19},{month:`2025-08-01`,status:`Approved`,order_count:18},{month:`2025-08-01`,status:`Fulfilled`,order_count:19}],rowCount:24,timezone:`UTC`,columnMetadata:[{key:`month`,label:`Order month`,dataType:`date`,semanticRole:`date`},{key:`status`,label:`Status`,dataType:`text`,semanticRole:`dimension`},{key:`order_count`,label:`Distinct order count`,dataType:`number`,semanticRole:`measure`,aggregation:`count_distinct`}],chartRecommendation:{type:`line`,mode:`time_series`,categoryField:`month`,valueFields:[`order_count`],seriesField:`status`},expandable:!0,tableAvailable:!1,explanation:{headline:`The latest results moved in different directions by status.`,summary:`Submitted and fulfilled orders increased, while approved orders decreased.`,evidence:[`Submitted orders increased from 18 in July to 19 in August.`,`Approved orders decreased from 19 in July to 18 in August.`,`Fulfilled orders increased from 18 in July to 19 in August.`],businessMeaning:`Overall order activity is steady, but the small approval decline is worth watching if it continues.`,followUps:[`Which status changed the most?`,`How does this compare with the prior quarter?`],source:`governed_result`}}}},{match:/demo kpi|active accounts/i,result:{answer:`There are 5,632 active accounts in the current demo result.`,sources:[],suggestedReplies:[`Show a demo chart`,`Show a demo table`],handoffOffered:!1,visualization:{version:1,presentation:`kpi`,type:`kpi`,title:`Active accounts`,columns:[`active_accounts`],value:`active_accounts`,rows:[{active_accounts:5632}],rowCount:1,columnMetadata:[{key:`active_accounts`,label:`Active accounts`,dataType:`number`,semanticRole:`measure`,aggregation:`count_distinct`}],explanation:{headline:`Active accounts are 5,632.`,summary:`This is the latest value in the demo result.`,evidence:[`The displayed active-account count is 5,632.`],source:`governed_result`}}}},{match:/demo table|account health/i,result:{answer:`Nine accounts are included in this governed result. The table shows a compact preview and can be expanded to inspect every permitted row.`,sources:[],suggestedReplies:[`Show a demo chart`,`Test the hidden table response`],handoffOffered:!1,visualization:{version:1,presentation:`table`,type:`table`,title:`Account health`,columns:[`account_name`,`region`,`health_score`,`renewal_month`],rows:[{account_name:`Northstar Industries`,region:`West`,health_score:94,renewal_month:`August`},{account_name:`Apex Group`,region:`East`,health_score:91,renewal_month:`September`},{account_name:`Summit Retail`,region:`North`,health_score:88,renewal_month:`August`},{account_name:`Harbor Logistics`,region:`South`,health_score:86,renewal_month:`October`},{account_name:`Brightline Media`,region:`West`,health_score:84,renewal_month:`November`},{account_name:`Redwood Labs`,region:`East`,health_score:82,renewal_month:`September`},{account_name:`Atlas Foods`,region:`North`,health_score:79,renewal_month:`December`},{account_name:`Cedar Health`,region:`South`,health_score:77,renewal_month:`October`},{account_name:`Bluewave Energy`,region:`West`,health_score:74,renewal_month:`December`}],rowCount:9,columnMetadata:[{key:`account_name`,label:`Account`,dataType:`text`,semanticRole:`dimension`},{key:`region`,label:`Region`,dataType:`text`,semanticRole:`geography`},{key:`health_score`,label:`Health score`,dataType:`number`,semanticRole:`measure`},{key:`renewal_month`,label:`Renewal month`,dataType:`text`,semanticRole:`date`}],expandable:!0,tableAvailable:!0,downloadAvailable:!0,explanation:{headline:`Nine accounts are available for review.`,summary:`Health scores range from 74 to 94 across four regions.`,evidence:[`Northstar Industries has the highest health score at 94.`],source:`governed_result`}}}},{match:/hidden table|table response/i,result:{answer:`Three accounts need attention. The public widget explains the result without exposing its underlying rows.`,sources:[],suggestedReplies:[`Show a demo chart`,`Show a demo KPI`],handoffOffered:!1,visualization:{version:1,presentation:`table`,type:`table`,columns:[`account_name`,`risk_score`],rows:[{account_name:`Private account A`,risk_score:91},{account_name:`Private account B`,risk_score:87},{account_name:`Private account C`,risk_score:82}],rowCount:3,tableAvailable:!1,explanation:{headline:`Three accounts need attention.`,summary:`The written result is available without displaying a public data table.`,evidence:[`Three accounts matched the approved attention rule.`],source:`governed_result`}}}},{match:/^\s*(hi+|hey+|hello|yo|sup|howdy|hola|thanks|thank you|thx|good (morning|afternoon|evening))\b/i,result:{answer:`Hello! 👋 How can I help you today?`,sources:[],suggestedReplies:[`How do I track a shipment?`,`How does customs work?`],handoffOffered:!1}},{match:/track|shipment|where|status/i,result:{answer:`Centrinfo can answer from your indexed knowledge base, public website, connected files, and approved organization tools. It keeps answers grounded in your configured sources and can hand a conversation to your team when the AI is not enough.`,sources:[{title:`Centrinfo public widget`,url:`https://accurix.tech/centrinfo`}],suggestedReplies:[`How does the widget work?`,`Can a human take over?`],handoffOffered:!1}},{match:/custom|clear|duty|tariff|import/i,result:{answer:`Accurix connects your organization knowledge, channels, integrations, and public widget in one place. You can configure which sources the AI can use, which tools visitors can trigger, and when your team should take over live chat.`,sources:[{title:`Accurix documentation`,url:`https://accurix.tech/docs`}],suggestedReplies:[`Which tools can I connect?`,`How do permissions work?`],handoffOffered:!1}},{match:/price|cost|pricing|plan|quote/i,result:{answer:`Accurix uses a usage-based pricing model. Organizations keep an active subscription and spend credits as the AI answers, searches, and uses tools. Credit top-ups can extend usage when the subscription grant runs low.`,sources:[{title:`Pricing`,url:`https://accurix.tech/pricing`}],suggestedReplies:[`How do credits work?`,`Can I top up credits?`],handoffOffered:!1}}],b={answer:`That's a great question — I don't have a confident answer from Accurix's published docs yet. Want me to pass it to the team so a human can follow up? You can also book a quick demo.`,sources:[],suggestedReplies:[`What can you help with?`],handoffOffered:!0},x=e=>y.find(t=>t.match.test(e))?.result??b;var S=class{async history(){return{conversations:[]}}async bootstrap(){return await _(180),v}async stream(e,t,n){await _(550);let r=x(e),i=r.answer.split(/(\s+)/);for(let e of i){if(n.signal?.aborted)break;n.onChunk(e),await _(18+Math.min(40,e.length*6))}return{...r,availableActions:v.availableActions}}async liveEvents(){return{mode:`ai`,conversationEnded:!1,events:[]}}async typing(){await _(20)}async action(e,t){return await _(450),{ok:!0,note:{"book-demo":`Demo requested — we'll email you a few times that work. 📅`,contact:`Got it — saved your details. ✅`,"contact-support":`Support has been notified and can join this conversation. ✅`,inquiry:`Thanks! We'll get back to you shortly. ✉️`,"request-callback":`We'll call you back soon. 📞`,"subscribe-newsletter":`You're subscribed. 🎉`}[e]}}async speak(){return await _(120),{providerReady:!1,message:`Demo voice provider is not connected.`}}async transcribe(e,t,n,r){return await _(700),`How do I track a shipment?`}async extract(e,t,n){return await _(600),`[Attached file${n?`: ${n}`:``}] Invoice #4821 — 3 pallets, Rotterdam → Lagos, ETA 12 days.`}async identify(e,t){await _(50)}async endConversation(e){await _(50)}async sendFeedback(){await _(50)}async demoSlots(e,t){return await _(150),{taken:[[11,0],[15,0]].map(([e,t])=>{let n=new Date;return n.setHours(e,t,0,0),n.toISOString()}),busy:[]}}async searchGifs(e){await _(280);let t=e.trim().toLowerCase(),n=t?E.filter(e=>e.alt.includes(t)||e.tags.some(e=>e.includes(t)||t.includes(e))):E;return(n.length>0?n:E).map(e=>({id:e.id,url:T(e.emoji,e.anim),preview:T(e.emoji,e.anim),alt:e.alt}))}};const C=`<animateTransform attributeName='transform' attributeType='XML' type='translate' values='0 0;0 -16;0 0' dur='0.7s' repeatCount='indefinite'/>`,w=`<animateTransform attributeName='transform' attributeType='XML' type='rotate' values='-14 64 110;14 64 110;-14 64 110' dur='0.9s' repeatCount='indefinite'/>`,T=(e,t)=>{let n=`<svg xmlns='http://www.w3.org/2000/svg' width='128' height='128'><rect width='128' height='128' rx='14' fill='#eef1f4'/><text x='64' y='88' font-size='64' text-anchor='middle'>${e}${t}</text></svg>`;return`data:image/svg+xml,${encodeURIComponent(n)}`},E=[{id:`g1`,emoji:`👍`,alt:`thumbs up`,tags:[`thumbs`,`yes`,`ok`,`great`,`good`],anim:C},{id:`g2`,emoji:`🎉`,alt:`celebrate`,tags:[`party`,`yay`,`congrats`,`celebrate`],anim:w},{id:`g3`,emoji:`👋`,alt:`wave hello`,tags:[`hi`,`hello`,`hey`,`wave`,`bye`],anim:w},{id:`g4`,emoji:`❤️`,alt:`heart`,tags:[`love`,`thanks`,`heart`],anim:C},{id:`g5`,emoji:`🤔`,alt:`thinking`,tags:[`hmm`,`think`,`thinking`],anim:w},{id:`g6`,emoji:`😂`,alt:`laughing`,tags:[`lol`,`funny`,`haha`,`laugh`],anim:C},{id:`g7`,emoji:`🔥`,alt:`fire`,tags:[`fire`,`hot`,`lit`,`awesome`],anim:C},{id:`g8`,emoji:`🚀`,alt:`rocket`,tags:[`rocket`,`launch`,`fast`,`go`],anim:w}],D=e=>new Promise(t=>setTimeout(t,e));var O=class{constructor(e,t){this.real=e,this.strings=t}bootstrap(){return this.real.bootstrap()}async history(){return{conversations:[]}}async stream(e,t,n){await D(300);for(let e of this.strings.previewReply.split(/(\s+)/)){if(n.signal?.aborted)break;n.onChunk(e),await D(16)}return{answer:this.strings.previewReply,sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1}}async liveEvents(){return{mode:`ai`,conversationEnded:!1,events:[]}}async typing(){}async action(){return await D(250),{ok:!0,note:this.strings.previewActionNote}}async speak(){return{providerReady:!1,message:`Preview voice provider is not connected.`}}async identify(){}async endConversation(){}async sendFeedback(){}async transcribe(e,t,n,r){return``}async extract(){return``}async searchGifs(){return[]}async demoSlots(){return{taken:[],busy:[]}}},k=function(e,t){return k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},k(e,t)};function A(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);k(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var j=12,M=`sans-serif`,N=j+`px `+M,P=20,ee=100,te=`007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N`;function ne(e){var t={};if(typeof JSON>`u`)return t;for(var n=0;n<e.length;n++){var r=String.fromCharCode(n+32);t[r]=(e.charCodeAt(n)-P)/ee}return t}var re=ne(te),ie={createCanvas:function(){return typeof document<`u`&&document.createElement(`canvas`)},measureText:(function(){var e,t;return function(n,r){if(!e){var i=ie.createCanvas();e=i&&i.getContext(`2d`)}if(e)return t!==r&&(t=e.font=r||N),e.measureText(n);n=n||``,r=r||N;var a=/((?:\d+)?\.?\d*)px/.exec(r),o=a&&+a[1]||j,s=0;if(r.indexOf(`mono`)>=0)s=o*n.length;else for(var c=0;c<n.length;c++){var l=re[n[c]];s+=l==null?o:l*o}return{width:s}}})(),loadImage:function(e,t,n){var r=new Image;return r.onload=t,r.onerror=n,r.src=e,r}},ae=xe([`Function`,`RegExp`,`Date`,`Error`,`CanvasGradient`,`CanvasPattern`,`Image`,`Canvas`],function(e,t){return e[`[object `+t+`]`]=!0,e},{}),oe=xe([`Int8`,`Uint8`,`Uint8Clamped`,`Int16`,`Uint16`,`Int32`,`Uint32`,`Float32`,`Float64`],function(e,t){return e[`[object `+t+`Array]`]=!0,e},{}),se=Object.prototype.toString,ce=Array.prototype,le=ce.forEach,ue=ce.filter,F=ce.slice,I=ce.map,de=function(){}.constructor,fe=de?de.prototype:null,pe=`__proto__`,me=2311;function he(){return me++}function ge(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];typeof console<`u`&&console.error.apply(console,e)}function L(e){if(typeof e!=`object`||!e)return e;var t=e,n=se.call(e);if(n===`[object Array]`){if(!He(e)){t=[];for(var r=0,i=e.length;r<i;r++)t[r]=L(e[r])}}else if(oe[n]){if(!He(e)){var a=e.constructor;if(a.from)t=a.from(e);else{t=new a(e.length);for(var r=0,i=e.length;r<i;r++)t[r]=e[r]}}}else if(!ae[n]&&!He(e)&&!Ae(e))for(var o in t={},e)e.hasOwnProperty(o)&&o!==pe&&(t[o]=L(e[o]));return t}function R(e,t,n){if(!J(t)||!J(e))return n?L(t):e;for(var r in t)if(t.hasOwnProperty(r)&&r!==pe){var i=e[r],a=t[r];J(a)&&J(i)&&!G(a)&&!G(i)&&!Ae(a)&&!Ae(i)&&!Oe(a)&&!Oe(i)&&!He(a)&&!He(i)?R(i,a,n):(n||!(r in e))&&(e[r]=L(t[r]))}return e}function z(e,t){if(Object.assign)Object.assign(e,t);else for(var n in t)t.hasOwnProperty(n)&&n!==pe&&(e[n]=t[n]);return e}function B(e,t,n){for(var r=Ce(t),i=0,a=r.length;i<a;i++){var o=r[i];(n?t[o]!=null:e[o]==null)&&(e[o]=t[o])}return e}var _e=ie.createCanvas;function V(e,t){if(e){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n}return-1}function ve(e,t){var n=e.prototype;function r(){}for(var i in r.prototype=t.prototype,e.prototype=new r,n)n.hasOwnProperty(i)&&(e.prototype[i]=n[i]);e.prototype.constructor=e,e.superClass=t}function ye(e,t,n){if(e=`prototype`in e?e.prototype:e,t=`prototype`in t?t.prototype:t,Object.getOwnPropertyNames)for(var r=Object.getOwnPropertyNames(t),i=0;i<r.length;i++){var a=r[i];a!==`constructor`&&(n?t[a]!=null:e[a]==null)&&(e[a]=t[a])}else B(e,t,n)}function be(e){return!e||typeof e==`string`?!1:typeof e.length==`number`}function H(e,t,n){if(e&&t)if(e.forEach&&e.forEach===le)e.forEach(t,n);else if(e.length===+e.length)for(var r=0,i=e.length;r<i;r++)t.call(n,e[r],r,e);else for(var a in e)e.hasOwnProperty(a)&&t.call(n,e[a],a,e)}function U(e,t,n){if(!e)return[];if(!t)return Le(e);if(e.map&&e.map===I)return e.map(t,n);for(var r=[],i=0,a=e.length;i<a;i++)r.push(t.call(n,e[i],i,e));return r}function xe(e,t,n,r){if(e&&t){for(var i=0,a=e.length;i<a;i++)n=t.call(r,n,e[i],i,e);return n}}function Se(e,t,n){if(!e)return[];if(!t)return Le(e);if(e.filter&&e.filter===ue)return e.filter(t,n);for(var r=[],i=0,a=e.length;i<a;i++)t.call(n,e[i],i,e)&&r.push(e[i]);return r}function Ce(e){if(!e)return[];if(Object.keys)return Object.keys(e);var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}function we(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return function(){return e.apply(t,n.concat(F.call(arguments)))}}var W=fe&&K(fe.bind)?fe.call.bind(fe.bind):we;function Te(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return function(){return e.apply(this,t.concat(F.call(arguments)))}}function G(e){return Array.isArray?Array.isArray(e):se.call(e)===`[object Array]`}function K(e){return typeof e==`function`}function q(e){return typeof e==`string`}function Ee(e){return se.call(e)===`[object String]`}function De(e){return typeof e==`number`}function J(e){var t=typeof e;return t===`function`||!!e&&t===`object`}function Oe(e){return!!ae[se.call(e)]}function ke(e){return!!oe[se.call(e)]}function Ae(e){return typeof e==`object`&&typeof e.nodeType==`number`&&typeof e.ownerDocument==`object`}function je(e){return e.colorStops!=null}function Me(e){return e.image!=null}function Ne(e){return se.call(e)===`[object RegExp]`}function Pe(e){return e!==e}function Fe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0,r=e.length;n<r;n++)if(e[n]!=null)return e[n]}function Y(e,t){return e??t}function Ie(e,t,n){return e??t??n}function Le(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return F.apply(e,t)}function Re(e){if(typeof e==`number`)return[e,e,e,e];var t=e.length;return t===2?[e[0],e[1],e[0],e[1]]:t===3?[e[0],e[1],e[2],e[1]]:e}function X(e,t){if(!e)throw Error(t)}function ze(e){return e==null?null:typeof e.trim==`function`?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``)}var Be=`__ec_primitive__`;function Ve(e){e[Be]=!0}function He(e){return e[Be]}var Ue=function(){function e(){this.data={}}return e.prototype.delete=function(e){var t=this.has(e);return t&&delete this.data[e],t},e.prototype.has=function(e){return this.data.hasOwnProperty(e)},e.prototype.get=function(e){return this.data[e]},e.prototype.set=function(e,t){return this.data[e]=t,this},e.prototype.keys=function(){return Ce(this.data)},e.prototype.forEach=function(e){var t=this.data;for(var n in t)t.hasOwnProperty(n)&&e(t[n],n)},e}(),We=typeof Map==`function`;function Ge(){return We?new Map:new Ue}var Ke=function(){function e(t){var n=G(t);this.data=Ge();var r=this;t instanceof e?t.each(i):t&&H(t,i);function i(e,t){n?r.set(e,t):r.set(t,e)}}return e.prototype.hasKey=function(e){return this.data.has(e)},e.prototype.get=function(e){return this.data.get(e)},e.prototype.set=function(e,t){return this.data.set(e,t),t},e.prototype.each=function(e,t){this.data.forEach(function(n,r){e.call(t,n,r)})},e.prototype.keys=function(){var e=this.data.keys();return We?Array.from(e):e},e.prototype.removeKey=function(e){this.data.delete(e)},e}();function Z(e){return new Ke(e)}function qe(e,t){for(var n=new e.constructor(e.length+t.length),r=0;r<e.length;r++)n[r]=e[r];for(var i=e.length,r=0;r<t.length;r++)n[r+i]=t[r];return n}function Je(e,t){var n;if(Object.create)n=Object.create(e);else{var r=function(){};r.prototype=e,n=new r}return t&&z(n,t),n}function Ye(e){var t=e.style;t.webkitUserSelect=`none`,t.userSelect=`none`,t.webkitTapHighlightColor=`rgba(0,0,0,0)`,t[`-webkit-touch-callout`]=`none`}function Xe(e,t){return e.hasOwnProperty(t)}function Ze(){}var Qe=180/Math.PI,$e=function(){function e(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1}return e}(),et=new(function(){function e(){this.browser=new $e,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow=typeof window<`u`}return e}());typeof wx==`object`&&typeof wx.getSystemInfoSync==`function`?(et.wxa=!0,et.touchEventsSupported=!0):typeof document>`u`&&typeof self<`u`?et.worker=!0:!et.hasGlobalWindow||`Deno`in window?(et.node=!0,et.svgSupported=!0):tt(navigator.userAgent,et);function tt(e,t){var n=t.browser,r=e.match(/Firefox\/([\d.]+)/),i=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),a=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);r&&(n.firefox=!0,n.version=r[1]),i&&(n.ie=!0,n.version=i[1]),a&&(n.edge=!0,n.version=a[1],n.newEdge=+a[1].split(`.`)[0]>18),o&&(n.weChat=!0),t.svgSupported=typeof SVGRect<`u`,t.touchEventsSupported=`ontouchstart`in window&&!n.ie&&!n.edge,t.pointerEventsSupported=`onpointerdown`in window&&(n.edge||n.ie&&+n.version>=11),t.domSupported=typeof document<`u`;var s=document.documentElement.style;t.transform3dSupported=(n.ie&&`transition`in s||n.edge||`WebKitCSSMatrix`in window&&`m11`in new WebKitCSSMatrix||`MozPerspective`in s)&&!(`OTransition`in s),t.transformSupported=t.transform3dSupported||n.ie&&+n.version>=9}var Q=et,nt=`.`,rt=`___EC__COMPONENT__CONTAINER___`,it=`___EC__EXTENDED_CLASS___`;function at(e){var t={main:``,sub:``};if(e){var n=e.split(nt);t.main=n[0]||``,t.sub=n[1]||``}return t}function ot(e){X(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),`componentType "`+e+`" illegal`)}function st(e){return!!(e&&e[it])}function ct(e,t){e.$constructor=e,e.extend=function(e){process.env.NODE_ENV!==`production`&&H(t,function(t){e[t]||console.warn("Method `"+t+"` should be implemented"+(e.type?` in `+e.type:``)+`.`)});var n=this,r;return lt(n)?r=function(e){A(t,e);function t(){return e.apply(this,arguments)||this}return t}(n):(r=function(){(e.$constructor||n).apply(this,arguments)},ve(r,this)),z(r.prototype,e),r[it]=!0,r.extend=this.extend,r.superCall=pt,r.superApply=mt,r.superClass=n,r}}function lt(e){return K(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function ut(e,t){e.extend=t.extend}var dt=Math.round(Math.random()*10);function ft(e){var t=[`__\0is_clz`,dt++].join(`_`);e.prototype[t]=!0,process.env.NODE_ENV!==`production`&&X(!e.isInstance,`The method "is" can not be defined.`),e.isInstance=function(e){return!!(e&&e[t])}}function pt(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return this.superClass.prototype[t].apply(e,n)}function mt(e,t,n){return this.superClass.prototype[t].apply(e,n)}function ht(e){var t={};e.registerClass=function(e){var r=e.type||e.prototype.type;if(r){ot(r),e.prototype.type=r;var i=at(r);if(!i.sub)process.env.NODE_ENV!==`production`&&t[i.main]&&console.warn(i.main+` exists.`),t[i.main]=e;else if(i.sub!==rt){var a=n(i);a[i.sub]=e}}return e},e.getClass=function(e,n,r){var i=t[e];if(i&&i[rt]&&(i=n?i[n]:null),r&&!i)throw Error(n?`Component `+e+`.`+(n||``)+` is used but not imported.`:e+`.type should be specified.`);return i},e.getClassesByMainType=function(e){var n=at(e),r=[],i=t[n.main];return i&&i[rt]?H(i,function(e,t){t!==rt&&r.push(e)}):r.push(i),r},e.hasClass=function(e){return!!t[at(e).main]},e.getAllClassMainTypes=function(){var e=[];return H(t,function(t,n){e.push(n)}),e},e.hasSubTypes=function(e){var n=t[at(e).main];return n&&n[rt]};function n(e){var n=t[e.main];return(!n||!n[rt])&&(n=t[e.main]={},n[rt]=!0),n}}function gt(e,t){for(var n=0;n<e.length;n++)e[n][1]||(e[n][1]=e[n][0]);return t=t||!1,function(n,r,i){for(var a={},o=0;o<e.length;o++){var s=e[o][1];if(!(r&&V(r,s)>=0||i&&V(i,s)<0)){var c=n.getShallow(s,t);c!=null&&(a[e[o][0]]=c)}}return a}}var _t=[[`fill`,`color`],[`shadowBlur`],[`shadowOffsetX`],[`shadowOffsetY`],[`opacity`],[`shadowColor`]],vt=gt(_t),yt=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return vt(this,e,t)},e}(),bt=function(){function e(e){this.value=e}return e}(),xt=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new bt(e);return this.insertEntry(t),t},e.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},e.prototype.remove=function(e){var t=e.prev,n=e.next;t?t.next=n:this.head=n,n?n.prev=t:this.tail=t,e.next=e.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),St=function(){function e(e){this._list=new xt,this._maxSize=10,this._map={},this._maxSize=e}return e.prototype.put=function(e,t){var n=this._list,r=this._map,i=null;if(r[e]==null){var a=n.len(),o=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=n.head;n.remove(s),delete r[s.key],i=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new bt(t),o.key=e,n.insertEntry(o),r[e]=o}return i},e.prototype.get=function(e){var t=this._map[e],n=this._list;if(t!=null)return t!==n.tail&&(n.remove(t),n.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),Ct=St,wt=new Ct(50);function Tt(e){if(typeof e==`string`){var t=wt.get(e);return t&&t.image}else return e}function Et(e,t,n,r,i){if(e)if(typeof e==`string`){if(t&&t.__zrImageSrc===e||!n)return t;var a=wt.get(e),o={hostEl:n,cb:r,cbPayload:i};return a?(t=a.image,!Ot(t)&&a.pending.push(o)):(t=ie.loadImage(e,Dt,Dt),t.__zrImageSrc=e,wt.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}else return e;else return t}function Dt(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;t<e.pending.length;t++){var n=e.pending[t],r=n.cb;r&&r(this,n.cbPayload),n.hostEl.dirty()}e.pending.length=0}function Ot(e){return e&&e.width&&e.height}function kt(){return[1,0,0,1,0,0]}function At(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}function jt(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Mt(e,t,n){var r=t[0]*n[0]+t[2]*n[1],i=t[1]*n[0]+t[3]*n[1],a=t[0]*n[2]+t[2]*n[3],o=t[1]*n[2]+t[3]*n[3],s=t[0]*n[4]+t[2]*n[5]+t[4],c=t[1]*n[4]+t[3]*n[5]+t[5];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e}function Nt(e,t,n){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4]+n[0],e[5]=t[5]+n[1],e}function Pt(e,t,n,r){r===void 0&&(r=[0,0]);var i=t[0],a=t[2],o=t[4],s=t[1],c=t[3],l=t[5],u=Math.sin(n),d=Math.cos(n);return e[0]=i*d+s*u,e[1]=-i*u+s*d,e[2]=a*d+c*u,e[3]=-a*u+d*c,e[4]=d*(o-r[0])+u*(l-r[1])+r[0],e[5]=d*(l-r[1])-u*(o-r[0])+r[1],e}function Ft(e,t,n){var r=n[0],i=n[1];return e[0]=t[0]*r,e[1]=t[1]*i,e[2]=t[2]*r,e[3]=t[3]*i,e[4]=t[4]*r,e[5]=t[5]*i,e}function It(e,t){var n=t[0],r=t[2],i=t[4],a=t[1],o=t[3],s=t[5],c=n*o-a*r;return c?(c=1/c,e[0]=o*c,e[1]=-a*c,e[2]=-r*c,e[3]=n*c,e[4]=(r*s-o*i)*c,e[5]=(a*i-n*s)*c,e):null}var Lt=function(){function e(e,t){this.x=e||0,this.y=t||0}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.set=function(e,t){return this.x=e,this.y=t,this},e.prototype.equal=function(e){return e.x===this.x&&e.y===this.y},e.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},e.prototype.scale=function(e){this.x*=e,this.y*=e},e.prototype.scaleAndAdd=function(e,t){this.x+=e.x*t,this.y+=e.y*t},e.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},e.prototype.dot=function(e){return this.x*e.x+this.y*e.y},e.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},e.prototype.normalize=function(){var e=this.len();return this.x/=e,this.y/=e,this},e.prototype.distance=function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)},e.prototype.distanceSquare=function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},e.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.prototype.transform=function(e){if(e){var t=this.x,n=this.y;return this.x=e[0]*t+e[2]*n+e[4],this.y=e[1]*t+e[3]*n+e[5],this}},e.prototype.toArray=function(e){return e[0]=this.x,e[1]=this.y,e},e.prototype.fromArray=function(e){this.x=e[0],this.y=e[1]},e.set=function(e,t,n){e.x=t,e.y=n},e.copy=function(e,t){e.x=t.x,e.y=t.y},e.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},e.lenSquare=function(e){return e.x*e.x+e.y*e.y},e.dot=function(e,t){return e.x*t.x+e.y*t.y},e.add=function(e,t,n){e.x=t.x+n.x,e.y=t.y+n.y},e.sub=function(e,t,n){e.x=t.x-n.x,e.y=t.y-n.y},e.scale=function(e,t,n){e.x=t.x*n,e.y=t.y*n},e.scaleAndAdd=function(e,t,n,r){e.x=t.x+n.x*r,e.y=t.y+n.y*r},e.lerp=function(e,t,n,r){var i=1-r;e.x=i*t.x+r*n.x,e.y=i*t.y+r*n.y},e}(),Rt=Lt,zt=Math.min,Bt=Math.max,Vt=new Rt,Ht=new Rt,Ut=new Rt,Wt=new Rt,Gt=new Rt,Kt=new Rt,qt=function(){function e(e,t,n,r){n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),this.x=e,this.y=t,this.width=n,this.height=r}return e.prototype.union=function(e){var t=zt(e.x,this.x),n=zt(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Bt(e.x+e.width,this.x+this.width)-t:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=Bt(e.y+e.height,this.y+this.height)-n:this.height=e.height,this.x=t,this.y=n},e.prototype.applyTransform=function(t){e.applyTransform(this,this,t)},e.prototype.calculateTransform=function(e){var t=this,n=e.width/t.width,r=e.height/t.height,i=kt();return Nt(i,i,[-t.x,-t.y]),Ft(i,i,[n,r]),Nt(i,i,[e.x,e.y]),i},e.prototype.intersect=function(t,n){if(!t)return!1;t instanceof e||(t=e.create(t));var r=this,i=r.x,a=r.x+r.width,o=r.y,s=r.y+r.height,c=t.x,l=t.x+t.width,u=t.y,d=t.y+t.height,f=!(a<c||l<i||s<u||d<o);if(n){var p=1/0,m=0,h=Math.abs(a-c),g=Math.abs(l-i),_=Math.abs(s-u),v=Math.abs(d-o),y=Math.min(h,g),b=Math.min(_,v);a<c||l<i?y>m&&(m=y,h<g?Rt.set(Kt,-h,0):Rt.set(Kt,g,0)):y<p&&(p=y,h<g?Rt.set(Gt,h,0):Rt.set(Gt,-g,0)),s<u||d<o?b>m&&(m=b,_<v?Rt.set(Kt,0,-_):Rt.set(Kt,0,v)):y<p&&(p=y,_<v?Rt.set(Gt,0,_):Rt.set(Gt,0,-v))}return n&&Rt.copy(n,f?Gt:Kt),f},e.prototype.contain=function(e,t){var n=this;return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(t){e.copy(this,t)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t.x,t.y,t.width,t.height)},e.copy=function(e,t){e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height},e.applyTransform=function(t,n,r){if(!r){t!==n&&e.copy(t,n);return}if(r[1]<1e-5&&r[1]>-1e-5&&r[2]<1e-5&&r[2]>-1e-5){var i=r[0],a=r[3],o=r[4],s=r[5];t.x=n.x*i+o,t.y=n.y*a+s,t.width=n.width*i,t.height=n.height*a,t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height);return}Vt.x=Ut.x=n.x,Vt.y=Wt.y=n.y,Ht.x=Wt.x=n.x+n.width,Ht.y=Ut.y=n.y+n.height,Vt.transform(r),Wt.transform(r),Ht.transform(r),Ut.transform(r),t.x=zt(Vt.x,Ht.x,Ut.x,Wt.x),t.y=zt(Vt.y,Ht.y,Ut.y,Wt.y);var c=Bt(Vt.x,Ht.x,Ut.x,Wt.x),l=Bt(Vt.y,Ht.y,Ut.y,Wt.y);t.width=c-t.x,t.height=l-t.y},e}(),$=qt,Jt={};function Yt(e,t){t=t||N;var n=Jt[t];n||(n=Jt[t]=new Ct(500));var r=n.get(e);return r??(r=ie.measureText(e,t).width,n.put(e,r)),r}function Xt(e,t,n,r){var i=Yt(e,t),a=en(t);return new $(Qt(0,i,n),$t(0,a,r),i,a)}function Zt(e,t,n,r){var i=((e||``)+``).split(`
|
|
6
6
|
`);if(i.length===1)return Xt(i[0],t,n,r);for(var a=new $(0,0,0,0),o=0;o<i.length;o++){var s=Xt(i[o],t,n,r);o===0?a.copy(s):a.union(s)}return a}function Qt(e,t,n){return n===`right`?e-=t:n===`center`&&(e-=t/2),e}function $t(e,t,n){return n===`middle`?e-=t/2:n===`bottom`&&(e-=t),e}function en(e){return Yt(`国`,e)}function tn(e,t){return typeof e==`string`?e.lastIndexOf(`%`)>=0?parseFloat(e)/100*t:parseFloat(e):e}function nn(e,t,n){var r=t.position||`inside`,i=t.distance==null?5:t.distance,a=n.height,o=n.width,s=a/2,c=n.x,l=n.y,u=`left`,d=`top`;if(r instanceof Array)c+=tn(r[0],n.width),l+=tn(r[1],n.height),u=null,d=null;else switch(r){case`left`:c-=i,l+=s,u=`right`,d=`middle`;break;case`right`:c+=i+o,l+=s,d=`middle`;break;case`top`:c+=o/2,l-=i,u=`center`,d=`bottom`;break;case`bottom`:c+=o/2,l+=a+i,u=`center`;break;case`inside`:c+=o/2,l+=s,u=`center`,d=`middle`;break;case`insideLeft`:c+=i,l+=s,d=`middle`;break;case`insideRight`:c+=o-i,l+=s,u=`right`,d=`middle`;break;case`insideTop`:c+=o/2,l+=i,u=`center`;break;case`insideBottom`:c+=o/2,l+=a-i,u=`center`,d=`bottom`;break;case`insideTopLeft`:c+=i,l+=i;break;case`insideTopRight`:c+=o-i,l+=i,u=`right`;break;case`insideBottomLeft`:c+=i,l+=a-i,d=`bottom`;break;case`insideBottomRight`:c+=o-i,l+=a-i,u=`right`,d=`bottom`;break}return e=e||{},e.x=c,e.y=l,e.align=u,e.verticalAlign=d,e}var rn=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function an(e,t,n,r,i,a){if(!n){e.text=``,e.isTruncated=!1;return}var o=(t+``).split(`
|
|
7
7
|
`);a=on(n,r,i,a);for(var s=!1,c={},l=0,u=o.length;l<u;l++)sn(c,o[l],a),o[l]=c.textLine,s=s||c.isTruncated;e.text=o.join(`
|
|
8
8
|
`),e.isTruncated=s}function on(e,t,n,r){r=r||{};var i=z({},r);i.font=t,n=Y(n,`...`),i.maxIterations=Y(r.maxIterations,2);var a=i.minChar=Y(r.minChar,0);i.cnCharWidth=Yt(`国`,t);var o=i.ascCharWidth=Yt(`a`,t);i.placeholder=Y(r.placeholder,``);for(var s=e=Math.max(0,e-1),c=0;c<a&&s>=o;c++)s-=o;var l=Yt(n,t);return l>s&&(n=``,l=0),s=e-l,i.ellipsis=n,i.ellipsisWidth=l,i.contentWidth=s,i.containerWidth=e,i}function sn(e,t,n){var r=n.containerWidth,i=n.font,a=n.contentWidth;if(!r){e.textLine=``,e.isTruncated=!1;return}var o=Yt(t,i);if(o<=r){e.textLine=t,e.isTruncated=!1;return}for(var s=0;;s++){if(o<=a||s>=n.maxIterations){t+=n.ellipsis;break}var c=s===0?cn(t,a,n.ascCharWidth,n.cnCharWidth):o>0?Math.floor(t.length*a/o):0;t=t.substr(0,c),o=Yt(t,i)}t===``&&(t=n.placeholder),e.textLine=t,e.isTruncated=!0}function cn(e,t,n,r){for(var i=0,a=0,o=e.length;a<o&&i<t;a++){var s=e.charCodeAt(a);i+=0<=s&&s<=127?n:r}return a}function ln(e,t){e!=null&&(e+=``);var n=t.overflow,r=t.padding,i=t.font,a=n===`truncate`,o=en(i),s=Y(t.lineHeight,o),c=!!t.backgroundColor,l=t.lineOverflow===`truncate`,u=!1,d=t.width,f=d!=null&&(n===`break`||n===`breakAll`)?e?vn(e,t.font,d,n===`breakAll`,0).lines:[]:e?e.split(`
|
|
@@ -26,11 +26,11 @@ echarts.use([`+c+`]);`:`Unknown series `+s))}return}if(t===`tooltip`){if(f){proc
|
|
|
26
26
|
`:`<br/>`,m=l.join(p);this._showOrMove(a,function(){this._updateContentNotChangedOnAxis(e,s)?this._updatePosition(a,d,i[0],i[1],this._tooltipContent,s):this._showTooltipContent(a,m,s,Math.random()+``,i[0],i[1],d,null,u)})},t.prototype._showSeriesItemTooltip=function(e,t,n){var r=this._ecModel,i=ec(t),a=i.seriesIndex,o=r.getSeriesByIndex(a),s=i.dataModel||o,c=i.dataIndex,l=i.dataType,u=s.getData(l),d=this._renderMode,f=e.positionDefault,p=LA([u.getItemModel(c),s,o&&(o.coordinateSystem||{}).model],this._tooltipModel,f?{position:f}:null),m=p.get(`trigger`);if(!(m!=null&&m!==`item`)){var h=s.getDataParams(c,l),g=new Yg;h.marker=g.makeTooltipMarker(`item`,zh(h.color),d);var _=dg(s.formatTooltip(c,!1,l)),v=p.get(`order`),y=p.get(`valueFormatter`),b=_.frag,x=b?Bg(y?z({valueFormatter:y},b):b,g,d,v,r.get(`useUTC`),p.get(`textStyle`)):_.text,S=`item_`+s.name+`_`+c;this._showOrMove(p,function(){this._showTooltipContent(p,x,h,S,e.offsetX,e.offsetY,e.position,e.target,g)}),n({type:`showTip`,dataIndexInside:c,dataIndex:u.getRawIndex(c),seriesIndex:a,from:this.uid})}},t.prototype._showComponentItemTooltip=function(e,t,n){var r=this._renderMode===`html`,i=ec(t),a=i.tooltipConfig.option||{},o=a.encodeHTMLContent;if(q(a)){var s=a;a={content:s,formatter:s},o=!0}o&&r&&a.content&&(a=L(a),a.content=Bm(a.content));var c=[a],l=this._ecModel.getComponent(i.componentMainType,i.componentIndex);l&&c.push(l),c.push({formatter:a.content});var u=e.positionDefault,d=LA(c,this._tooltipModel,u?{position:u}:null),f=d.get(`content`),p=Math.random()+``,m=new Yg;this._showOrMove(d,function(){var n=L(d.get(`formatterParams`)||{});this._showTooltipContent(d,f,n,p,e.offsetX,e.offsetY,e.position,t,m)}),n({type:`showTip`,from:this.uid})},t.prototype._showTooltipContent=function(e,t,n,r,i,a,o,s,c){if(this._ticket=``,!(!e.get(`showContent`)||!e.get(`show`))){var l=this._tooltipContent;l.setEnterable(e.get(`enterable`));var u=e.get(`formatter`);o=o||e.get(`position`);var d=t,f=this._getNearestPoint([i,a],n,e.get(`trigger`),e.get(`borderColor`)).color;if(u)if(q(u)){var p=e.ecModel.get(`useUTC`),m=G(n)?n[0]:n,h=m&&m.axisType&&m.axisType.indexOf(`time`)>=0;d=u,h&&(d=ph(m.axisValue,d,p)),d=Lh(d,n,!0)}else if(K(u)){var g=W(function(t,r){t===this._ticket&&(l.setContent(r,c,e,f,o),this._updatePosition(e,o,i,a,l,n,s))},this);this._ticket=r,d=u(n,r,g)}else d=u;l.setContent(d,c,e,f,o),l.show(e,f),this._updatePosition(e,o,i,a,l,n,s)}},t.prototype._getNearestPoint=function(e,t,n,r){if(n===`axis`||G(t))return{color:r||(this._renderMode===`html`?`#fff`:`none`)};if(!G(t))return{color:r||t.color||t.borderColor}},t.prototype._updatePosition=function(e,t,n,r,i,a,o){var s=this._api.getWidth(),c=this._api.getHeight();t=t||e.get(`position`);var l=i.getSize(),u=e.get(`align`),d=e.get(`verticalAlign`),f=o&&o.getBoundingRect().clone();if(o&&f.applyTransform(o.transform),K(t)&&(t=t([n,r],a,i.el,f,{viewSize:[s,c],contentSize:l.slice()})),G(t))n=Ho(t[0],s),r=Ho(t[1],c);else if(J(t)){var p=t;p.width=l[0],p.height=l[1];var m=qh(p,{width:s,height:c});n=m.x,r=m.y,u=null,d=null}else if(q(t)&&o){var h=VA(t,f,l,e.get(`borderWidth`));n=h[0],r=h[1]}else{var h=zA(n,r,i,s,c,u?null:20,d?null:20);n=h[0],r=h[1]}if(u&&(n-=HA(u)?l[0]/2:u===`right`?l[0]:0),d&&(r-=HA(d)?l[1]/2:d===`bottom`?l[1]:0),fA(e)){var h=BA(n,r,i,s,c);n=h[0],r=h[1]}i.moveTo(n,r)},t.prototype._updateContentNotChangedOnAxis=function(e,t){var n=this._lastDataByCoordSys,r=this._cbParamsList,i=!!n&&n.length===e.length;return i&&H(n,function(n,a){var o=n.dataByAxis||[],s=(e[a]||{}).dataByAxis||[];i=i&&o.length===s.length,i&&H(o,function(e,n){var a=s[n]||{},o=e.seriesDataIndices||[],c=a.seriesDataIndices||[];i=i&&e.value===a.value&&e.axisType===a.axisType&&e.axisId===a.axisId&&o.length===c.length,i&&H(o,function(e,t){var n=c[t];i=i&&e.seriesIndex===n.seriesIndex&&e.dataIndex===n.dataIndex}),r&&H(e.seriesDataIndices,function(e){var n=e.seriesIndex,a=t[n],o=r[n];a&&o&&o.data!==a.data&&(i=!1)})})}),this._lastDataByCoordSys=e,this._cbParamsList=t,!!i},t.prototype._hide=function(e){this._lastDataByCoordSys=null,e({type:`hideTip`,from:this.uid})},t.prototype.dispose=function(e,t){Q.node||!t.getDom()||(ry(this,`_updatePosition`),this._tooltipContent.dispose(),Ck(`itemTooltip`,t))},t.type=`tooltip`,t}(yS);function LA(e,t,n){var r=t.ecModel,i;n?(i=new df(n,r,r),i=new df(t.option,i,r)):i=t;for(var a=e.length-1;a>=0;a--){var o=e[a];o&&(o instanceof df&&(o=o.get(`tooltip`,!0)),q(o)&&(o={formatter:o}),o&&(i=new df(o,i,r)))}return i}function RA(e,t){return e.dispatchAction||W(t.dispatchAction,t)}function zA(e,t,n,r,i,a,o){var s=n.getSize(),c=s[0],l=s[1];return a!=null&&(e+c+a+2>r?e-=c+a:e+=a),o!=null&&(t+l+o>i?t-=l+o:t+=o),[e,t]}function BA(e,t,n,r,i){var a=n.getSize(),o=a[0],s=a[1];return e=Math.min(e+o,r)-o,t=Math.min(t+s,i)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function VA(e,t,n,r){var i=n[0],a=n[1],o=Math.ceil(Math.SQRT2*r)+8,s=0,c=0,l=t.width,u=t.height;switch(e){case`inside`:s=t.x+l/2-i/2,c=t.y+u/2-a/2;break;case`top`:s=t.x+l/2-i/2,c=t.y-a-o;break;case`bottom`:s=t.x+l/2-i/2,c=t.y+u+o;break;case`left`:s=t.x-i-o,c=t.y+u/2-a/2;break;case`right`:s=t.x+l+o,c=t.y+u/2-a/2}return[s,c]}function HA(e){return e===`center`||e===`middle`}function UA(e,t,n){var r=Ks(e).queryOptionMap,i=r.keys()[0];if(!(!i||i===`series`)){var a=Ys(t,i,r.get(i),{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];if(a){var o=n.getViewOfComponentModel(a),s;if(o.group.traverse(function(t){var n=ec(t).tooltipConfig;if(n&&n.name===e.name)return s=t,!0}),s)return{componentMainType:i,componentIndex:a.componentIndex,el:s}}}}var WA=IA;function GA(e){BT(zk),e.registerComponentModel(dA),e.registerComponentView(WA),e.registerAction({type:`showTip`,event:`showTip`,update:`tooltip:manuallyShowTip`},Ze),e.registerAction({type:`hideTip`,event:`hideTip`,update:`tooltip:manuallyHideTip`},Ze)}var KA=function(e,t){if(t===`all`)return{type:`all`,title:e.getLocaleModel().get([`legend`,`selector`,`all`])};if(t===`inverse`)return{type:`inverse`,title:e.getLocaleModel().get([`legend`,`selector`,`inverse`])}},qA=function(e){A(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.layoutMode={type:`box`,ignoreSize:!0},n}return t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n),e.selected=e.selected||{},this._updateSelector(e)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),this._updateSelector(t)},t.prototype._updateSelector=function(e){var t=e.selector,n=this.ecModel;t===!0&&(t=e.selector=[`all`,`inverse`]),G(t)&&H(t,function(e,r){q(e)&&(e={type:e}),t[r]=R(e,KA(n,e.type))})},t.prototype.optionUpdated=function(){this._updateData(this.ecModel);var e=this._data;if(e[0]&&this.get(`selectedMode`)===`single`){for(var t=!1,n=0;n<e.length;n++){var r=e[n].get(`name`);if(this.isSelected(r)){this.select(r),t=!0;break}}!t&&this.select(e[0].get(`name`))}},t.prototype._updateData=function(e){var t=[],n=[];e.eachRawSeries(function(r){var i=r.name;n.push(i);var a;if(r.legendVisualProvider){var o=r.legendVisualProvider.getAllNames();e.isSeriesFiltered(r)||(n=n.concat(o)),o.length?t=t.concat(o):a=!0}else a=!0;a&&Rs(r)&&t.push(r.name)}),this._availableNames=n;var r=this.get(`data`)||t,i=Z();this._data=Se(U(r,function(e){return(q(e)||De(e))&&(e={name:e}),i.get(e.name)?null:(i.set(e.name,!0),new df(e,this,this.ecModel))},this),function(e){return!!e})},t.prototype.getData=function(){return this._data},t.prototype.select=function(e){var t=this.option.selected;if(this.get(`selectedMode`)===`single`){var n=this._data;H(n,function(e){t[e.get(`name`)]=!1})}t[e]=!0},t.prototype.unSelect=function(e){this.get(`selectedMode`)!==`single`&&(this.option.selected[e]=!1)},t.prototype.toggleSelected=function(e){var t=this.option.selected;t.hasOwnProperty(e)||(t[e]=!0),this[t[e]?`unSelect`:`select`](e)},t.prototype.allSelect=function(){var e=this._data,t=this.option.selected;H(e,function(e){t[e.get(`name`,!0)]=!0})},t.prototype.inverseSelect=function(){var e=this._data,t=this.option.selected;H(e,function(e){var n=e.get(`name`,!0);t.hasOwnProperty(n)||(t[n]=!0),t[n]=!t[n]})},t.prototype.isSelected=function(e){var t=this.option.selected;return!(t.hasOwnProperty(e)&&!t[e])&&V(this._availableNames,e)>=0},t.prototype.getOrient=function(){return this.get(`orient`)===`vertical`?{index:1,name:`vertical`}:{index:0,name:`horizontal`}},t.type=`legend.plain`,t.dependencies=[`series`],t.defaultOption={z:4,show:!0,orient:`horizontal`,left:`center`,top:0,align:`auto`,backgroundColor:`rgba(0,0,0,0)`,borderColor:`#ccc`,borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:`inherit`,symbolKeepAspect:!0,inactiveColor:`#ccc`,inactiveBorderColor:`#ccc`,inactiveBorderWidth:`auto`,itemStyle:{color:`inherit`,opacity:`inherit`,borderColor:`inherit`,borderWidth:`auto`,borderCap:`inherit`,borderJoin:`inherit`,borderDashOffset:`inherit`,borderMiterLimit:`inherit`},lineStyle:{width:`auto`,color:`inherit`,inactiveColor:`#ccc`,inactiveWidth:2,opacity:`inherit`,type:`inherit`,cap:`inherit`,join:`inherit`,dashOffset:`inherit`,miterLimit:`inherit`},textStyle:{color:`#333`},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:`sans-serif`,color:`#666`,borderWidth:1,borderColor:`#666`},emphasis:{selectorLabel:{show:!0,color:`#eee`,backgroundColor:`#666`}},selectorPosition:`auto`,selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},t}(tg),JA=qA,YA=Te,XA=H,ZA=Il,QA=function(e){A(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!1,n}return t.prototype.init=function(){this.group.add(this._contentGroup=new ZA),this.group.add(this._selectorGroup=new ZA),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(e,t,n){var r=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),e.get(`show`,!0)){var i=e.get(`align`),a=e.get(`orient`);(!i||i===`auto`)&&(i=e.get(`left`)===`right`&&a===`vertical`?`right`:`left`);var o=e.get(`selector`,!0),s=e.get(`selectorPosition`,!0);o&&(!s||s===`auto`)&&(s=a===`horizontal`?`end`:`start`),this.renderInner(i,e,t,n,o,a,s);var c=e.getBoxLayoutParams(),l={width:n.getWidth(),height:n.getHeight()},u=e.get(`padding`),d=qh(c,l,u),f=this.layoutInner(e,i,d,r,o,s),p=qh(B({width:f.width,height:f.height},c),l,u);this.group.x=p.x-f.x,this.group.y=p.y-f.y,this.group.markRedraw(),this.group.add(this._backgroundEl=lA(f,e))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(e,t,n,r,i,a,o){var s=this.getContentGroup(),c=Z(),l=t.get(`selectedMode`),u=[];n.eachRawSeries(function(e){!e.get(`legendHoverLink`)&&u.push(e.id)}),XA(t.getData(),function(i,a){var o=i.get(`name`);if(!this.newlineDisabled&&(o===``||o===`
|
|
27
27
|
`)){var d=new ZA;d.newline=!0,s.add(d);return}var f=n.getSeriesByName(o)[0];if(!c.get(o)){if(f){var p=f.getData(),m=p.getVisual(`legendLineStyle`)||{},h=p.getVisual(`legendIcon`),g=p.getVisual(`style`),_=this._createItem(f,o,a,i,t,e,m,g,h,l,r);_.on(`click`,YA(tj,o,null,r,u)).on(`mouseover`,YA(rj,f.name,null,r,u)).on(`mouseout`,YA(ij,f.name,null,r,u)),n.ssr&&_.eachChild(function(e){var t=ec(e);t.seriesIndex=f.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),c.set(o,!0)}else n.eachRawSeries(function(s){if(!c.get(o)&&s.legendVisualProvider){var d=s.legendVisualProvider;if(!d.containName(o))return;var f=d.indexOfName(o),p=d.getItemVisual(f,`style`),m=d.getItemVisual(f,`legendIcon`),h=Pr(p.fill);h&&h[3]===0&&(h[3]=.2,p=z(z({},p),{fill:Rr(h,`rgba`)}));var g=this._createItem(s,o,a,i,t,e,{},p,m,l,r);g.on(`click`,YA(tj,null,o,r,u)).on(`mouseover`,YA(rj,null,o,r,u)).on(`mouseout`,YA(ij,null,o,r,u)),n.ssr&&g.eachChild(function(e){var t=ec(e);t.seriesIndex=s.seriesIndex,t.dataIndex=a,t.ssrType=`legend`}),c.set(o,!0)}},this);process.env.NODE_ENV!==`production`&&(c.get(o)||console.warn(o+` series not exists. Legend data should be same with series name or data name.`))}},this),i&&this._createSelector(i,t,r,a,o)},t.prototype._createSelector=function(e,t,n,r,i){var a=this.getSelectorGroup();XA(e,function(e){var r=e.type,i=new Lo({style:{x:0,y:0,align:`center`,verticalAlign:`middle`},onclick:function(){n.dispatchAction({type:r===`all`?`legendAllSelect`:`legendInverseSelect`,legendId:t.id})}});a.add(i),zd(i,{normal:t.getModel(`selectorLabel`),emphasis:t.getModel([`emphasis`,`selectorLabel`])},{defaultText:e.title}),el(i)})},t.prototype._createItem=function(e,t,n,r,i,a,o,s,c,l,u){var d=e.visualDrawType,f=i.get(`itemWidth`),p=i.get(`itemHeight`),m=i.isSelected(t),h=r.get(`symbolRotate`),g=r.get(`symbolKeepAspect`),_=r.get(`icon`);c=_||c||`roundRect`;var v=$A(c,r,o,s,d,m,u),y=new ZA,b=r.getModel(`textStyle`);if(K(e.getLegendIcon)&&(!_||_===`inherit`))y.add(e.getLegendIcon({itemWidth:f,itemHeight:p,icon:c,iconRotate:h,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}));else{var x=_===`inherit`&&e.getData().getVisual(`symbol`)?h===`inherit`?e.getData().getVisual(`symbolRotate`):h:0;y.add(ej({itemWidth:f,itemHeight:p,icon:c,iconRotate:x,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:g}))}var S=a===`left`?f+5:-5,C=a,w=i.get(`formatter`),T=t;q(w)&&w?T=w.replace(`{name}`,t??``):K(w)&&(T=w(t));var E=m?b.getTextColor():r.get(`inactiveColor`);y.add(new Lo({style:Vd(b,{text:T,x:S,y:p/2,fill:E,align:C,verticalAlign:`middle`},{inheritColor:E})}));var D=new yo({shape:y.getBoundingRect(),style:{fill:`transparent`}}),O=r.getModel(`tooltip`);return O.get(`show`)&&Nd({el:D,componentModel:i,itemName:t,itemTooltipOption:O.option}),y.add(D),y.eachChild(function(e){e.silent=!0}),D.silent=!l,this.getContentGroup().add(y),el(y),y.__legendDataIndex=n,y},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getContentGroup(),s=this.getSelectorGroup();Wh(e.get(`orient`),o,e.get(`itemGap`),n.width,n.height);var c=o.getBoundingRect(),l=[-c.x,-c.y];if(s.markRedraw(),o.markRedraw(),i){Wh(`horizontal`,s,e.get(`selectorItemGap`,!0));var u=s.getBoundingRect(),d=[-u.x,-u.y],f=e.get(`selectorButtonGap`,!0),p=e.getOrient().index,m=p===0?`width`:`height`,h=p===0?`height`:`width`,g=p===0?`y`:`x`;a===`end`?d[p]+=c[m]+f:l[p]+=u[m]+f,d[1-p]+=c[h]/2-u[h]/2,s.x=d[0],s.y=d[1],o.x=l[0],o.y=l[1];var _={x:0,y:0};return _[m]=c[m]+f+u[m],_[h]=Math.max(c[h],u[h]),_[g]=Math.min(0,u[g]+d[1-p]),_}else return o.x=l[0],o.y=l[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type=`legend.plain`,t}(yS);function $A(e,t,n,r,i,a,o){function s(e,t){e.lineWidth===`auto`&&(e.lineWidth=t.lineWidth>0?2:0),XA(e,function(n,r){e[r]===`inherit`&&(e[r]=t[r])})}var c=t.getModel(`itemStyle`),l=c.getItemStyle(),u=e.lastIndexOf(`empty`,0)===0?`fill`:`stroke`,d=c.getShallow(`decal`);l.decal=!d||d===`inherit`?r.decal:$C(d,o),l.fill===`inherit`&&(l.fill=r[i]),l.stroke===`inherit`&&(l.stroke=r[u]),l.opacity===`inherit`&&(l.opacity=(i===`fill`?r:n).opacity),s(l,r);var f=t.getModel(`lineStyle`),p=f.getLineStyle();if(s(p,n),l.fill===`auto`&&(l.fill=r.fill),l.stroke===`auto`&&(l.stroke=r.fill),p.stroke===`auto`&&(p.stroke=r.fill),!a){var m=t.get(`inactiveBorderWidth`),h=l[u];l.lineWidth=m===`auto`?r.lineWidth>0&&h?2:0:l.lineWidth,l.fill=t.get(`inactiveColor`),l.stroke=t.get(`inactiveBorderColor`),p.stroke=f.get(`inactiveColor`),p.lineWidth=f.get(`inactiveWidth`)}return{itemStyle:l,lineStyle:p}}function ej(e){var t=e.icon||`roundRect`,n=b_(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);return n.setStyle(e.itemStyle),n.rotation=(e.iconRotate||0)*Math.PI/180,n.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf(`empty`)>-1&&(n.style.stroke=n.style.fill,n.style.fill=`#fff`,n.style.lineWidth=2),n}function tj(e,t,n,r){ij(e,t,n,r),n.dispatchAction({type:`legendToggleSelect`,name:e??t}),rj(e,t,n,r)}function nj(e){for(var t=e.getZr().storage.getDisplayList(),n,r=0,i=t.length;r<i&&!(n=t[r].states.emphasis);)r++;return n&&n.hoverLayer}function rj(e,t,n,r){nj(n)||n.dispatchAction({type:`highlight`,seriesName:e,name:t,excludeSeriesId:r})}function ij(e,t,n,r){nj(n)||n.dispatchAction({type:`downplay`,seriesName:e,name:t,excludeSeriesId:r})}var aj=QA;function oj(e){var t=e.findComponents({mainType:`legend`});t&&t.length&&e.filterSeries(function(e){for(var n=0;n<t.length;n++)if(!t[n].isSelected(e.name))return!1;return!0})}function sj(e,t,n){var r=e===`allSelect`||e===`inverseSelect`,i={},a=[];n.eachComponent({mainType:`legend`,query:t},function(n){r?n[e]():n[e](t.name),cj(n,i),a.push(n.componentIndex)});var o={};return n.eachComponent(`legend`,function(e){H(i,function(t,n){e[t?`select`:`unSelect`](n)}),cj(e,o)}),r?{selected:o,legendIndex:a}:{name:t.name,selected:o}}function cj(e,t){var n=t||{};return H(e.getData(),function(t){var r=t.get(`name`);if(!(r===`
|
|
28
28
|
`||r===``)){var i=e.isSelected(r);Xe(n,r)?n[r]=n[r]&&i:n[r]=i}}),n}function lj(e){e.registerAction(`legendToggleSelect`,`legendselectchanged`,Te(sj,`toggleSelected`)),e.registerAction(`legendAllSelect`,`legendselectall`,Te(sj,`allSelect`)),e.registerAction(`legendInverseSelect`,`legendinverseselect`,Te(sj,`inverseSelect`)),e.registerAction(`legendSelect`,`legendselected`,Te(sj,`select`)),e.registerAction(`legendUnSelect`,`legendunselected`,Te(sj,`unSelect`))}function uj(e){e.registerComponentModel(JA),e.registerComponentView(aj),e.registerProcessor(e.PRIORITY.PROCESSOR.SERIES_FILTER,oj),e.registerSubTypeDefaulter(`legend`,function(){return`plain`}),lj(e)}var dj=function(e){A(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.prototype.setScrollDataIndex=function(e){this.option.scrollDataIndex=e},t.prototype.init=function(t,n,r){var i=Xh(t);e.prototype.init.call(this,t,n,r),fj(this,t,i)},t.prototype.mergeOption=function(t,n){e.prototype.mergeOption.call(this,t,n),fj(this,this.option,t)},t.type=`legend.scroll`,t.defaultOption=Dm(JA.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:`end`,pageFormatter:`{current}/{total}`,pageIcons:{horizontal:[`M0,0L12,-10L12,10z`,`M0,0L-12,-10L-12,10z`],vertical:[`M0,0L20,0L10,-20z`,`M0,0L20,0L10,20z`]},pageIconColor:`#2f4554`,pageIconInactiveColor:`#aaa`,pageIconSize:15,pageTextStyle:{color:`#333`},animationDurationUpdate:800}),t}(JA);function fj(e,t,n){var r=e.getOrient(),i=[1,1];i[r.index]=0,Yh(t,n,{type:`box`,ignoreSize:!!i})}var pj=dj,mj=Il,hj=[`width`,`height`],gj=[`x`,`y`],_j=function(e){A(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!0,n._currentIndex=0,n}return t.prototype.init=function(){e.prototype.init.call(this),this.group.add(this._containerGroup=new mj),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new mj)},t.prototype.resetInner=function(){e.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},t.prototype.renderInner=function(t,n,r,i,a,o,s){var c=this;e.prototype.renderInner.call(this,t,n,r,i,a,o,s);var l=this._controllerGroup,u=n.get(`pageIconSize`,!0),d=G(u)?u:[u,u];p(`pagePrev`,0);var f=n.getModel(`pageTextStyle`);l.add(new Lo({name:`pageText`,style:{text:`xx/xx`,fill:f.getTextColor(),font:f.getFont(),verticalAlign:`middle`,align:`center`},silent:!0})),p(`pageNext`,1);function p(e,t){var r=e+`DataIndex`,a=Od(n.get(`pageIcons`,!0)[n.getOrient().name][t],{onclick:W(c._pageGo,c,r,n,i)},{x:-d[0]/2,y:-d[1]/2,width:d[0],height:d[1]});a.name=e,l.add(a)}},t.prototype.layoutInner=function(e,t,n,r,i,a){var o=this.getSelectorGroup(),s=e.getOrient().index,c=hj[s],l=gj[s],u=hj[1-s],d=gj[1-s];i&&Wh(`horizontal`,o,e.get(`selectorItemGap`,!0));var f=e.get(`selectorButtonGap`,!0),p=o.getBoundingRect(),m=[-p.x,-p.y],h=L(n);i&&(h[c]=n[c]-p[c]-f);var g=this._layoutContentAndController(e,r,h,s,c,u,d,l);if(i){if(a===`end`)m[s]+=g[c]+f;else{var _=p[c]+f;m[s]-=_,g[l]-=_}g[c]+=p[c]+f,m[1-s]+=g[d]+g[u]/2-p[u]/2,g[u]=Math.max(g[u],p[u]),g[d]=Math.min(g[d],p[d]+m[1-s]),o.x=m[0],o.y=m[1],o.markRedraw()}return g},t.prototype._layoutContentAndController=function(e,t,n,r,i,a,o,s){var c=this.getContentGroup(),l=this._containerGroup,u=this._controllerGroup;Wh(e.get(`orient`),c,e.get(`itemGap`),r?n.width:null,r?null:n.height),Wh(`horizontal`,u,e.get(`pageButtonItemGap`,!0));var d=c.getBoundingRect(),f=u.getBoundingRect(),p=this._showController=d[i]>n[i],m=[-d.x,-d.y];t||(m[r]=c[s]);var h=[0,0],g=[-f.x,-f.y],_=Y(e.get(`pageButtonGap`,!0),e.get(`itemGap`,!0));p&&(e.get(`pageButtonPosition`,!0)===`end`?g[r]+=n[i]-f[i]:h[r]+=f[i]+_),g[1-r]+=d[a]/2-f[a]/2,c.setPosition(m),l.setPosition(h),u.setPosition(g);var v={x:0,y:0};if(v[i]=p?n[i]:d[i],v[a]=Math.max(d[a],f[a]),v[o]=Math.min(0,f[o]+g[1-r]),l.__rectSize=n[i],p){var y={x:0,y:0};y[i]=Math.max(n[i]-f[i]-_,0),y[a]=v[a],l.setClipPath(new yo({shape:y})),l.__rectSize=y[i]}else u.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return b.pageIndex!=null&&Xu(c,{x:b.contentPosition[0],y:b.contentPosition[1]},p?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var r=this._getPageInfo(t)[e];r!=null&&n.dispatchAction({type:`legendScroll`,scrollDataIndex:r,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;H([`pagePrev`,`pageNext`],function(r){var i=t[r+`DataIndex`]!=null,a=n.childOfName(r);a&&(a.setStyle(`fill`,i?e.get(`pageIconColor`,!0):e.get(`pageIconInactiveColor`,!0)),a.cursor=i?`pointer`:`default`)});var r=n.childOfName(`pageText`),i=e.get(`pageFormatter`),a=t.pageIndex,o=a==null?0:a+1,s=t.pageCount;r&&i&&r.setStyle(`text`,q(i)?i.replace(`{current}`,o==null?``:o+``).replace(`{total}`,s==null?``:s+``):i({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get(`scrollDataIndex`,!0),n=this.getContentGroup(),r=this._containerGroup.__rectSize,i=e.getOrient().index,a=hj[i],o=gj[i],s=this._findTargetItemIndex(t),c=n.children(),l=c[s],u=c.length,d=u?1:0,f={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!l)return f;var p=v(l);f.contentPosition[i]=-p.s;for(var m=s+1,h=p,g=p,_=null;m<=u;++m)_=v(c[m]),(!_&&g.e>h.s+r||_&&!y(_,h.s))&&(h=g.i>h.i?g:_,h&&(f.pageNextDataIndex??(f.pageNextDataIndex=h.i),++f.pageCount)),g=_;for(var m=s-1,h=p,g=p,_=null;m>=-1;--m)_=v(c[m]),(!_||!y(g,_.s))&&h.i<g.i&&(g=h,f.pagePrevDataIndex??(f.pagePrevDataIndex=h.i),++f.pageCount,++f.pageIndex),h=_;return f;function v(e){if(e){var t=e.getBoundingRect(),n=t[o]+e[o];return{s:n,e:n+t[a],i:e.__legendDataIndex}}}function y(e,t){return e.e>=t&&e.s<=t+r}},t.prototype._findTargetItemIndex=function(e){if(!this._showController)return 0;var t,n=this.getContentGroup(),r;return n.eachChild(function(n,i){var a=n.__legendDataIndex;r==null&&a!=null&&(r=i),a===e&&(t=i)}),t??r},t.type=`legend.scroll`,t}(aj),vj=_j;function yj(e){e.registerAction(`legendScroll`,`legendscroll`,function(e,t){var n=e.scrollDataIndex;n!=null&&t.eachComponent({mainType:`legend`,subType:`scroll`,query:e},function(e){e.setScrollDataIndex(n)})})}function bj(e){BT(uj),e.registerComponentModel(pj),e.registerComponentView(vj),yj(e)}function xj(e){BT(uj),BT(bj)}var Sj=function(e){A(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n}return t.type=`dataZoom.inside`,t.defaultOption=Dm(Xk.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(Xk),Cj=Sj,wj=Us();function Tj(e,t,n){wj(e).coordSysRecordMap.each(function(e){var r=e.dataZoomInfoMap.get(t.uid);r&&(r.getRange=n)})}function Ej(e,t){for(var n=wj(e).coordSysRecordMap,r=n.keys(),i=0;i<r.length;i++){var a=r[i],o=n.get(a),s=o.dataZoomInfoMap;if(s){var c=t.uid;s.get(c)&&(s.removeKey(c),s.keys().length||Dj(n,o))}}}function Dj(e,t){if(t){e.removeKey(t.model.uid);var n=t.controller;n&&n.dispose()}}function Oj(e,t){var n={model:t,containsPoint:Te(Aj,t),dispatchAction:Te(kj,e),dataZoomInfoMap:null,controller:null},r=n.controller=new BO(e.getZr());return H([`pan`,`zoom`,`scrollMove`],function(e){r.on(e,function(t){var r=[];n.dataZoomInfoMap.each(function(i){if(t.isAvailableBehavior(i.model.option)){var a=(i.getRange||{})[e],o=a&&a(i.dzReferCoordSysInfo,n.model.mainType,n.controller,t);!i.model.get(`disabled`,!0)&&o&&r.push({dataZoomId:i.model.id,start:o[0],end:o[1]})}}),r.length&&n.dispatchAction(r)})}),n}function kj(e,t){e.isDisposed()||e.dispatchAction({type:`dataZoom`,animation:{easing:`cubicOut`,duration:100},batch:t})}function Aj(e,t,n,r){return e.coordinateSystem.containPoint([n,r])}function jj(e){var t,n=`type_`,r={type_true:2,type_move:1,type_false:0,type_undefined:-1},i=!0;return e.each(function(e){var a=e.model,o=a.get(`disabled`,!0)?!1:a.get(`zoomLock`,!0)?`move`:!0;r[n+o]>r[n+t]&&(t=o),i=i&&a.get(`preventDefaultMouseMove`,!0)}),{controlType:t,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!i}}}function Mj(e){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,function(e,t){var n=wj(t),r=n.coordSysRecordMap||(n.coordSysRecordMap=Z());r.each(function(e){e.dataZoomInfoMap=null}),e.eachComponent({mainType:`dataZoom`,subType:`inside`},function(e){H(Kk(e).infoList,function(n){var i=n.model.uid,a=r.get(i)||r.set(i,Oj(t,n.model));(a.dataZoomInfoMap||(a.dataZoomInfoMap=Z())).set(e.uid,{dzReferCoordSysInfo:n,model:e,getRange:null})})}),r.each(function(e){var t=e.controller,n,i=e.dataZoomInfoMap;if(i){var a=i.keys()[0];a!=null&&(n=i.get(a))}if(!n){Dj(r,e);return}var o=jj(i);t.enable(o.controlType,o.opt),t.setPointerChecker(e.containsPoint),ny(e,`dispatchAction`,n.model.get(`throttle`,!0),`fixRate`)})})}var Nj=function(e){A(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=`dataZoom.inside`,t}return t.prototype.render=function(t,n,r){if(e.prototype.render.apply(this,arguments),t.noTarget()){this._clear();return}this.range=t.getPercentRange(),Tj(r,t,{pan:W(Pj.pan,this),zoom:W(Pj.zoom,this),scrollMove:W(Pj.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){Ej(this.api,this.dataZoomModel),this.range=null},t.type=`dataZoom.inside`,t}(Qk),Pj={zoom:function(e,t,n,r){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=Ij[t](null,[r.originX,r.originY],o,n,e),c=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],l=Math.max(1/r.scale,0);a[0]=(a[0]-c)*l+c,a[1]=(a[1]-c)*l+c;var u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(VO(0,a,[0,100],0,u.minSpan,u.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:Fj(function(e,t,n,r,i,a){var o=Ij[r]([a.oldX,a.oldY],[a.newX,a.newY],t,i,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:Fj(function(e,t,n,r,i,a){return Ij[r]([0,0],[a.scrollDelta,a.scrollDelta],t,i,n).signal*(e[1]-e[0])*a.scrollDelta})};function Fj(e){return function(t,n,r,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s&&(VO(e(o,s,t,n,r,i),o,[0,100],`all`),this.range=o,a[0]!==o[0]||a[1]!==o[1]))return o}}var Ij={grid:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem.getRect();return e=e||[0,0],a.dim===`x`?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(e,t,n,r,i){var a=n.axis,o={},s=i.model.coordinateSystem,c=s.getRadiusAxis().getExtent(),l=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),n.mainType===`radiusAxis`?(o.pixel=t[0]-e[0],o.pixelLength=c[1]-c[0],o.pixelStart=c[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,n,r,i){var a=n.axis,o=i.model.coordinateSystem.getRect(),s={};return e=e||[0,0],a.orient===`horizontal`?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}},Lj=Nj;function Rj(e){cA(e),e.registerComponentModel(Cj),e.registerComponentView(Lj),Mj(e)}var zj={label:{enabled:!0},decal:{show:!1}},Bj=Us(),Vj={};function Hj(e,t){var n=e.getModel(`aria`);if(!n.get(`enabled`))return;var r=L(zj);R(r.label,e.getLocaleModel().get(`aria`),!1),R(n.option,r,!1),i(),a();function i(){if(n.getModel(`decal`).get(`show`)){var t=Z();e.eachSeries(function(e){if(!e.isColorBySeries()){var n=t.get(e.type);n||(n={},t.set(e.type,n)),Bj(e).scope=n}}),e.eachRawSeries(function(t){if(e.isSeriesFiltered(t))return;if(K(t.enableAriaDecal)){t.enableAriaDecal();return}var n=t.getData();if(t.isColorBySeries()){var r=ag(t.ecModel,t.name,Vj,e.getSeriesCount()),i=n.getVisual(`decal`);n.setVisual(`decal`,l(i,r))}else{var a=t.getRawData(),o={},s=Bj(t).scope;n.each(function(e){var t=n.getRawIndex(e);o[t]=e});var c=a.count();a.each(function(e){var r=o[e],i=a.getName(e)||e+``,u=ag(t.ecModel,i,s,c),d=n.getItemVisual(r,`decal`);n.setItemVisual(r,`decal`,l(d,u))})}function l(e,t){var n=e?z(z({},t),e):t;return n.dirty=!0,n}})}}function a(){var r=t.getZr().dom;if(r){var i=e.getLocaleModel().get(`aria`),a=n.getModel(`label`);if(a.option=B(a.option,i),a.get(`enabled`)){if(r.setAttribute(`role`,`img`),a.get(`description`)){r.setAttribute(`aria-label`,a.get(`description`));return}var l=e.getSeriesCount(),u=a.get([`data`,`maxCount`])||10,d=a.get([`series`,`maxCount`])||10,f=Math.min(l,d),p;if(!(l<1)){var m=s();p=m?o(a.get([`general`,`withTitle`]),{title:m}):a.get([`general`,`withoutTitle`]);var h=[],g=l>1?a.get([`series`,`multiple`,`prefix`]):a.get([`series`,`single`,`prefix`]);p+=o(g,{seriesCount:l}),e.eachSeries(function(e,t){if(t<f){var n=void 0,r=e.get(`name`)?`withName`:`withoutName`;n=l>1?a.get([`series`,`multiple`,r]):a.get([`series`,`single`,r]),n=o(n,{seriesId:e.seriesIndex,seriesName:e.get(`name`),seriesType:c(e.subType)});var i=e.getData();if(i.count()>u){var s=a.get([`data`,`partialData`]);n+=o(s,{displayCnt:u})}else n+=a.get([`data`,`allData`]);for(var d=a.get([`data`,`separator`,`middle`]),p=a.get([`data`,`separator`,`end`]),m=a.get([`data`,`excludeDimensionId`]),g=[],_=0;_<i.count();_++)if(_<u){var v=i.getName(_),y=m?Se(i.getValues(_),function(e,t){return V(m,t)===-1}):i.getValues(_),b=a.get([`data`,v?`withName`:`withoutName`]);g.push(o(b,{name:v,value:y.join(d)}))}n+=g.join(d)+p,h.push(n)}});var _=a.getModel([`series`,`multiple`,`separator`]),v=_.get(`middle`),y=_.get(`end`);p+=h.join(v)+y,r.setAttribute(`aria-label`,p)}}}}function o(e,t){if(!q(e))return e;var n=e;return H(t,function(e,t){n=n.replace(RegExp(`\\{\\s*`+t+`\\s*\\}`,`g`),e)}),n}function s(){var t=e.get(`title`);return t&&t.length&&(t=t[0]),t&&t.text}function c(t){var n=e.getLocaleModel().get([`series`,`typeNames`]);return n[t]||n.chart}}function Uj(e){if(!(!e||!e.aria)){var t=e.aria;t.show!=null&&(t.enabled=t.show),t.label=t.label||{},H([`description`,`general`,`series`,`data`],function(e){t[e]!=null&&(t.label[e]=t[e])})}}function Wj(e){e.registerPreprocessor(Uj),e.registerVisual(e.PRIORITY.VISUAL.ARIA,Hj)}function Gj(e,t,n){var r=ie.createCanvas(),i=t.getWidth(),a=t.getHeight(),o=r.style;return o&&(o.position=`absolute`,o.left=`0`,o.top=`0`,o.width=i+`px`,o.height=a+`px`,r.setAttribute(`data-zr-dom-id`,e)),r.width=i*n,r.height=a*n,r}var Kj=function(e){A(t,e);function t(t,n,r){var i=e.call(this)||this;i.motionBlur=!1,i.lastFrameAlpha=.7,i.dpr=1,i.virtual=!1,i.config={},i.incremental=!1,i.zlevel=0,i.maxRepaintRectCount=5,i.__dirty=!0,i.__firstTimePaint=!0,i.__used=!1,i.__drawIndex=0,i.__startIndex=0,i.__endIndex=0,i.__prevStartIndex=null,i.__prevEndIndex=null;var a;r=r||vi,typeof t==`string`?a=Gj(t,n,r):J(t)&&(a=t,t=a.id),i.id=t,i.dom=a;var o=a.style;return o&&(Ye(a),a.onselectstart=function(){return!1},o.padding=`0`,o.margin=`0`,o.borderWidth=`0`),i.painter=n,i.dpr=r,i}return t.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},t.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},t.prototype.initContext=function(){this.ctx=this.dom.getContext(`2d`),this.ctx.dpr=this.dpr},t.prototype.setUnpainted=function(){this.__firstTimePaint=!0},t.prototype.createBackBuffer=function(){var e=this.dpr;this.domBack=Gj(`back-`+this.id,this.painter,e),this.ctxBack=this.domBack.getContext(`2d`),e!==1&&this.ctxBack.scale(e,e)},t.prototype.createRepaintRects=function(e,t,n,r){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var i=[],a=this.maxRepaintRectCount,o=!1,s=new $(0,0,0,0);function c(e){if(!(!e.isFinite()||e.isZero()))if(i.length===0){var t=new $(0,0,0,0);t.copy(e),i.push(t)}else{for(var n=!1,r=1/0,c=0,l=0;l<i.length;++l){var u=i[l];if(u.intersect(e)){var d=new $(0,0,0,0);d.copy(u),d.union(e),i[l]=d,n=!0;break}else if(o){s.copy(e),s.union(u);var f=e.width*e.height,p=u.width*u.height,m=s.width*s.height-f-p;m<r&&(r=m,c=l)}}if(o&&(i[c].union(e),n=!0),!n){var t=new $(0,0,0,0);t.copy(e),i.push(t)}o||(o=i.length>=a)}}for(var l=this.__startIndex;l<this.__endIndex;++l){var u=e[l];if(u){var d=u.shouldBePainted(n,r,!0,!0),f=u.__isRendered&&(u.__dirty&Ci||!d)?u.getPrevPaintRect():null;f&&c(f);var p=d&&(u.__dirty&Ci||!u.__isRendered)?u.getPaintRect():null;p&&c(p)}}for(var l=this.__prevStartIndex;l<this.__prevEndIndex;++l){var u=t[l],d=u&&u.shouldBePainted(n,r,!0,!0);if(u&&(!d||!u.__zr)&&u.__isRendered){var f=u.getPrevPaintRect();f&&c(f)}}var m;do{m=!1;for(var l=0;l<i.length;){if(i[l].isZero()){i.splice(l,1);continue}for(var h=l+1;h<i.length;)i[l].intersect(i[h])?(m=!0,i[l].union(i[h]),i.splice(h,1)):h++;l++}}while(m);return this._paintRects=i,i},t.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},t.prototype.resize=function(e,t){var n=this.dpr,r=this.dom,i=r.style,a=this.domBack;i&&(i.width=e+`px`,i.height=t+`px`),r.width=e*n,r.height=t*n,a&&(a.width=e*n,a.height=t*n,n!==1&&this.ctxBack.scale(n,n))},t.prototype.clear=function(e,t,n){var r=this.dom,i=this.ctx,a=r.width,o=r.height;t=t||this.clearColor;var s=this.motionBlur&&!e,c=this.lastFrameAlpha,l=this.dpr,u=this;s&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation=`copy`,this.ctxBack.drawImage(r,0,0,a/l,o/l));var d=this.domBack;function f(e,n,r,a){if(i.clearRect(e,n,r,a),t&&t!==`transparent`){var o=void 0;je(t)?(o=(t.global||t.__width===r&&t.__height===a)&&t.__canvasGradient||gC(i,t,{x:0,y:0,width:r,height:a}),t.__canvasGradient=o,t.__width=r,t.__height=a):Me(t)&&(t.scaleX=t.scaleX||l,t.scaleY=t.scaleY||l,o=OC(i,t,{dirty:function(){u.setUnpainted(),u.painter.refresh()}})),i.save(),i.fillStyle=o||t,i.fillRect(e,n,r,a),i.restore()}s&&(i.save(),i.globalAlpha=c,i.drawImage(d,e,n,r,a),i.restore())}!n||s?f(0,0,a,o):n.length&&H(n,function(e){f(e.x*l,e.y*l,e.width*l,e.height*l)})},t}(gi),qj=Kj,Jj=1e5,Yj=314159,Xj=.01,Zj=.001;function Qj(e){return e?e.__builtin__?!0:!(typeof e.resize!=`function`||typeof e.refresh!=`function`):!1}function $j(e,t){var n=document.createElement(`div`);return n.style.cssText=[`position:relative`,`width:`+e+`px`,`height:`+t+`px`,`padding:0`,`margin:0`,`border-width:0`].join(`;`)+`;`,n}var eM=function(){function e(e,t,n,r){this.type=`canvas`,this._zlevelList=[],this._prevDisplayList=[],this._layers={},this._layerConfig={},this._needsManuallyCompositing=!1,this.type=`canvas`;var i=!e.nodeName||e.nodeName.toUpperCase()===`CANVAS`;this._opts=n=z({},n||{}),this.dpr=n.devicePixelRatio||vi,this._singleCanvas=i,this.root=e,e.style&&(Ye(e),e.innerHTML=``),this.storage=t;var a=this._zlevelList;this._prevDisplayList=[];var o=this._layers;if(i){var s=e,c=s.width,l=s.height;n.width!=null&&(c=n.width),n.height!=null&&(l=n.height),this.dpr=n.devicePixelRatio||1,s.width=c*this.dpr,s.height=l*this.dpr,this._width=c,this._height=l;var u=new qj(s,this,this.dpr);u.__builtin__=!0,u.initContext(),o[Yj]=u,u.zlevel=Yj,a.push(Yj),this._domRoot=e}else{this._width=yC(e,0,n),this._height=yC(e,1,n);var d=this._domRoot=$j(this._width,this._height);e.appendChild(d)}}return e.prototype.getType=function(){return`canvas`},e.prototype.isSingleCanvas=function(){return this._singleCanvas},e.prototype.getViewportRoot=function(){return this._domRoot},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.refresh=function(e){var t=this.storage.getDisplayList(!0),n=this._prevDisplayList,r=this._zlevelList;this._redrawId=Math.random(),this._paintList(t,n,e,this._redrawId);for(var i=0;i<r.length;i++){var a=r[i],o=this._layers[a];if(!o.__builtin__&&o.refresh){var s=i===0?this._backgroundColor:null;o.refresh(s)}}return this._opts.useDirtyRect&&(this._prevDisplayList=t.slice()),this},e.prototype.refreshHover=function(){this._paintHoverList(this.storage.getDisplayList(!1))},e.prototype._paintHoverList=function(e){var t=e.length,n=this._hoverlayer;if(n&&n.clear(),t){for(var r={inHover:!0,viewWidth:this._width,viewHeight:this._height},i,a=0;a<t;a++){var o=e[a];o.__inHover&&(n||(n=this._hoverlayer=this.getLayer(Jj)),i||(i=n.ctx,i.save()),JC(i,o,r,a===t-1))}i&&i.restore()}},e.prototype.getHoverLayer=function(){return this.getLayer(Jj)},e.prototype.paintOne=function(e,t){qC(e,t)},e.prototype._paintList=function(e,t,n,r){if(this._redrawId===r){n=n||!1,this._updateLayerStatus(e);var i=this._doPaintList(e,t,n),a=i.finished,o=i.needsRefreshHover;if(this._needsManuallyCompositing&&this._compositeManually(),o&&this._paintHoverList(e),a)this.eachLayer(function(e){e.afterBrush&&e.afterBrush()});else{var s=this;Fb(function(){s._paintList(e,t,n,r)})}}},e.prototype._compositeManually=function(){var e=this.getLayer(Yj).ctx,t=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,t,n),this.eachBuiltinLayer(function(r){r.virtual&&e.drawImage(r.dom,0,0,t,n)})},e.prototype._doPaintList=function(e,t,n){for(var r=this,i=[],a=this._opts.useDirtyRect,o=0;o<this._zlevelList.length;o++){var s=this._zlevelList[o],c=this._layers[s];c.__builtin__&&c!==this._hoverlayer&&(c.__dirty||n)&&i.push(c)}for(var l=!0,u=!1,d=function(o){var s=i[o],c=s.ctx,d=a&&s.createRepaintRects(e,t,f._width,f._height),p=n?s.__startIndex:s.__drawIndex,m=!n&&s.incremental&&Date.now,h=m&&Date.now(),g=s.zlevel===f._zlevelList[0]?f._backgroundColor:null;if(s.__startIndex===s.__endIndex)s.clear(!1,g,d);else if(p===s.__startIndex){var _=e[p];(!_.incremental||!_.notClear||n)&&s.clear(!1,g,d)}p===-1&&(console.error(`For some unknown reason. drawIndex is -1`),p=s.__startIndex);var v,y=function(t){var n={inHover:!1,allClipped:!1,prevEl:null,viewWidth:r._width,viewHeight:r._height};for(v=p;v<s.__endIndex;v++){var i=e[v];if(i.__inHover&&(u=!0),r._doPaintEl(i,s,a,t,n,v===s.__endIndex-1),m&&Date.now()-h>15)break}n.prevElClipPaths&&c.restore()};if(d)if(d.length===0)v=s.__endIndex;else for(var b=f.dpr,x=0;x<d.length;++x){var S=d[x];c.save(),c.beginPath(),c.rect(S.x*b,S.y*b,S.width*b,S.height*b),c.clip(),y(S),c.restore()}else c.save(),y(),c.restore();s.__drawIndex=v,s.__drawIndex<s.__endIndex&&(l=!1)},f=this,p=0;p<i.length;p++)d(p);return Q.wxa&&H(this._layers,function(e){e&&e.ctx&&e.ctx.draw&&e.ctx.draw()}),{finished:l,needsRefreshHover:u}},e.prototype._doPaintEl=function(e,t,n,r,i,a){var o=t.ctx;if(n){var s=e.getPaintRect();(!r||s&&s.intersect(r))&&(JC(o,e,i,a),e.setPrevPaintRect(s))}else JC(o,e,i,a)},e.prototype.getLayer=function(e,t){this._singleCanvas&&!this._needsManuallyCompositing&&(e=Yj);var n=this._layers[e];return n||(n=new qj(`zr_`+e,this,this.dpr),n.zlevel=e,n.__builtin__=!0,this._layerConfig[e]?R(n,this._layerConfig[e],!0):this._layerConfig[e-Xj]&&R(n,this._layerConfig[e-Xj],!0),t&&(n.virtual=t),this.insertLayer(e,n),n.initContext()),n},e.prototype.insertLayer=function(e,t){var n=this._layers,r=this._zlevelList,i=r.length,a=this._domRoot,o=null,s=-1;if(n[e]){process.env.NODE_ENV!==`production`&&ge(`ZLevel `+e+` has been used already`);return}if(!Qj(t)){process.env.NODE_ENV!==`production`&&ge(`Layer of zlevel `+e+` is not valid`);return}if(i>0&&e>r[0]){for(s=0;s<i-1&&!(r[s]<e&&r[s+1]>e);s++);o=n[r[s]]}if(r.splice(s+1,0,e),n[e]=t,!t.virtual)if(o){var c=o.dom;c.nextSibling?a.insertBefore(t.dom,c.nextSibling):a.appendChild(t.dom)}else a.firstChild?a.insertBefore(t.dom,a.firstChild):a.appendChild(t.dom);t.painter||(t.painter=this)},e.prototype.eachLayer=function(e,t){for(var n=this._zlevelList,r=0;r<n.length;r++){var i=n[r];e.call(t,this._layers[i],i)}},e.prototype.eachBuiltinLayer=function(e,t){for(var n=this._zlevelList,r=0;r<n.length;r++){var i=n[r],a=this._layers[i];a.__builtin__&&e.call(t,a,i)}},e.prototype.eachOtherLayer=function(e,t){for(var n=this._zlevelList,r=0;r<n.length;r++){var i=n[r],a=this._layers[i];a.__builtin__||e.call(t,a,i)}},e.prototype.getLayers=function(){return this._layers},e.prototype._updateLayerStatus=function(e){this.eachBuiltinLayer(function(e,t){e.__dirty=e.__used=!1});function t(e){i&&(i.__endIndex!==e&&(i.__dirty=!0),i.__endIndex=e)}if(this._singleCanvas)for(var n=1;n<e.length;n++){var r=e[n];if(r.zlevel!==e[n-1].zlevel||r.incremental){this._needsManuallyCompositing=!0;break}}var i=null,a=0,o,s;for(s=0;s<e.length;s++){var r=e[s],c=r.zlevel,l=void 0;o!==c&&(o=c,a=0),r.incremental?(l=this.getLayer(c+Zj,this._needsManuallyCompositing),l.incremental=!0,a=1):l=this.getLayer(c+(a>0?Xj:0),this._needsManuallyCompositing),l.__builtin__||ge(`ZLevel `+c+` has been used by unkown layer `+l.id),l!==i&&(l.__used=!0,l.__startIndex!==s&&(l.__dirty=!0),l.__startIndex=s,l.incremental?l.__drawIndex=-1:l.__drawIndex=s,t(s),i=l),r.__dirty&Ci&&!r.__inHover&&(l.__dirty=!0,l.incremental&&l.__drawIndex<0&&(l.__drawIndex=s))}t(s),this.eachBuiltinLayer(function(e,t){!e.__used&&e.getElementCount()>0&&(e.__dirty=!0,e.__startIndex=e.__endIndex=e.__drawIndex=0),e.__dirty&&e.__drawIndex<0&&(e.__drawIndex=e.__startIndex)})},e.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},e.prototype._clearLayer=function(e){e.clear()},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e,H(this._layers,function(e){e.setUnpainted()})},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?R(n[e],t,!0):n[e]=t;for(var r=0;r<this._zlevelList.length;r++){var i=this._zlevelList[r];if(i===e||i===e+Xj){var a=this._layers[i];R(a,n[e],!0)}}}},e.prototype.delLayer=function(e){var t=this._layers,n=this._zlevelList,r=t[e];r&&(r.dom.parentNode.removeChild(r.dom),delete t[e],n.splice(V(n,e),1))},e.prototype.resize=function(e,t){if(this._domRoot.style){var n=this._domRoot;n.style.display=`none`;var r=this._opts,i=this.root;if(e!=null&&(r.width=e),t!=null&&(r.height=t),e=yC(i,0,r),t=yC(i,1,r),n.style.display=``,this._width!==e||t!==this._height){for(var a in n.style.width=e+`px`,n.style.height=t+`px`,this._layers)this._layers.hasOwnProperty(a)&&this._layers[a].resize(e,t);this.refresh(!0)}this._width=e,this._height=t}else{if(e==null||t==null)return;this._width=e,this._height=t,this.getLayer(Yj).resize(e,t)}return this},e.prototype.clearLayer=function(e){var t=this._layers[e];t&&t.clear()},e.prototype.dispose=function(){this.root.innerHTML=``,this.root=this.storage=this._domRoot=this._layers=null},e.prototype.getRenderedCanvas=function(e){if(e=e||{},this._singleCanvas&&!this._compositeManually)return this._layers[Yj].dom;var t=new qj(`image`,this,e.pixelRatio||this.dpr);t.initContext(),t.clear(!1,e.backgroundColor||this._backgroundColor);var n=t.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var r=t.dom.width,i=t.dom.height;this.eachLayer(function(e){e.__builtin__?n.drawImage(e.dom,0,0,r,i):e.renderToCanvas&&(n.save(),e.renderToCanvas(n),n.restore())})}else for(var a={inHover:!1,viewWidth:this._width,viewHeight:this._height},o=this.storage.getDisplayList(!0),s=0,c=o.length;s<c;s++){var l=o[s];JC(n,l,a,s===c-1)}return t.dom},e.prototype.getWidth=function(){return this._width},e.prototype.getHeight=function(){return this._height},e}(),tM=eM;function nM(e){e.registerPainter(`canvas`,tM)}const rM=4;BT([Wj,Ly,nM,Rj,Bk,xj,Pv,GA]);const iM={background:`#ffffff`,border:`#dce4e9`,muted:`#5b7186`,surface:`#ffffff`,text:`#0f1e2a`,colors:[`#2f7f55`,`#2563eb`,`#d97706`,`#7c3aed`]},aM=`cf-widget-category-zoom`,oM=.68,sM=2,cM=e=>({startIndex:0,endIndex:Math.max(0,e-1)}),lM=(e,t)=>{if(t<=0)return cM(0);let n=t-1,r=Math.max(0,Math.min(n,Math.floor(Math.min(e.startIndex,e.endIndex))));return{startIndex:r,endIndex:Math.max(r,Math.min(n,Math.floor(Math.max(e.startIndex,e.endIndex))))}},uM=(e,t,n)=>{let r=lM(e,n);if(n<=2)return cM(n);let i=r.endIndex-r.startIndex+1,a=t===`in`?Math.max(2,Math.floor(i*oM)):Math.min(n,Math.ceil(i/oM));if(a===i)return r;let o=(r.startIndex+r.endIndex)/2,s=n-a,c=Math.max(0,Math.min(s,Math.round(o-(a-1)/2)));return{startIndex:c,endIndex:c+a-1}},dM=(e,t)=>{let n=e.length;if(n===0)return`No chart points`;let r=lM(t,n);if(r.startIndex===0&&r.endIndex===n-1)return`All ${n} ${n===1?`point`:`points`}`;let i=r.endIndex-r.startIndex+1;return`${e[r.startIndex]} – ${e[r.endIndex]} · ${i} of ${n} points`},fM=e=>{let t=e.replaceAll(`_`,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).trim();return t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:`Value`},pM=e=>{let t=new Set,n=[];return e.forEach(e=>{let r=e?.trim();!r||t.has(r)||(t.add(r),n.push(r))}),n},mM=e=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`&&e.trim()){let t=Number(e);if(Number.isFinite(t))return t}return null},hM=e=>{if(e===null)return`null:`;if(e===void 0)return`undefined:`;if(typeof e==`object`)try{return`object:${JSON.stringify(e)}`}catch{return`object:`}return`${typeof e}:${String(e)}`},gM=(e,t)=>t?e.columnMetadata?.find(e=>e.key===t):void 0,_M=(e,t)=>gM(e,t)?.label?.trim()||fM(t),vM=(e,t,n)=>{if(n==null||n===``)return`Not set`;let r=gM(e,t);if(r?.dataType===`boolean`){let e=String(n).trim().toLowerCase();return n===!1||n===0||[`0`,`false`,`no`].includes(e)?`No`:`Yes`}if(r?.dataType===`date`||r?.dataType===`datetime`){let t=new Date(n);if(!Number.isNaN(t.getTime()))try{return new Intl.DateTimeFormat(void 0,{month:`short`,year:`numeric`,timeZone:e.timezone||`UTC`}).format(t)}catch{return new Intl.DateTimeFormat(void 0,{month:`short`,year:`numeric`,timeZone:`UTC`}).format(t)}}return String(n)},yM=(e,t,n,r=!1)=>{if(t?.dataType===`currency`){let i=t.currencyCode||n?.currency?.code;if(i)return new Intl.NumberFormat(void 0,{style:`currency`,currency:i,notation:r&&Math.abs(e)>=1e4?`compact`:`standard`,maximumFractionDigits:2}).format(e)}return t?.dataType===`percent`?new Intl.NumberFormat(void 0,{style:`percent`,maximumFractionDigits:2}).format(Math.abs(e)>1?e/100:e):new Intl.NumberFormat(void 0,{notation:r&&Math.abs(e)>=1e4?`compact`:`standard`,maximumFractionDigits:2}).format(e)},bM=(e,t)=>{if(e.presentation===`table`||e.presentation===`kpi`)return null;if(t)return t;let n=e.chartRecommendation?.type;return n===`line`||n===`bar`||n===`stacked_bar`?n:e.type===`line`||e.type===`bar`||e.type===`stacked_bar`?e.type:null},xM=e=>e.chartRecommendation?.categoryField?.trim()||e.label?.trim()||e.columnMetadata?.find(e=>[`date`,`dimension`,`geography`,`boolean`].includes(e.semanticRole))?.key||e.columns?.[0],SM=e=>e.chartRecommendation?.seriesField?.trim()||e.seriesField?.trim()||e.series?.trim()||void 0,CM=(e,t,n)=>{let r=pM([...e.chartRecommendation?.valueFields??[],...e.valueFields??[],e.value,...e.columnMetadata?.filter(e=>e.semanticRole===`measure`).map(e=>e.key)??[]]),i=new Set([...e.columns??[],...e.columnMetadata?.map(e=>e.key)??[],...Object.keys(e.rows?.[0]??{})]);return r.filter(e=>e!==t&&e!==n&&i.has(e)).filter(t=>e.rows?.some(e=>mM(e[t])!==null))},wM=(e,t,n,r,i)=>{let a=i?` Showing 4 of ${r.length+i} series.`:``;if(t===`line`){let t=n.length-1,i=r.map(n=>{let r=n.values[t];return r==null?null:`${n.name}: ${yM(r,n.valueColumn,e)}`}).filter(e=>!!e);return i.length?`Latest (${n[t]}): ${i.join(`; `)}.${a}`:`No numeric trend values are available.${a}`}let o;return r.forEach(e=>{e.values.forEach((t,r)=>{t===null||o&&t<=o.value||(o={category:n[r]??`Not set`,series:e,value:t})})}),o?`Highest: ${o.category}, ${o.series.name} ${yM(o.value,o.series.valueColumn,e)}.${a}`:`No numeric comparison values are available.${a}`},TM=(e,t)=>{let n=bM(e,t),r=xM(e),i=e.rows??[];if(!n||!r||i.length===0)return null;let a=SM(e),o=CM(e,r,a);if(o.length===0)return null;let s=o.length===1?a:void 0,c=[],l=new Set;i.forEach(t=>{let n=hM(t[r]);l.has(n)||(l.add(n),c.push({key:n,label:vM(e,r,t[r])}))});let u=c.map(e=>e.label),d=0,f;if(s){let t=[],n=new Set;i.forEach(r=>{let i=hM(r[s]);n.has(i)||(n.add(i),t.push({key:i,label:vM(e,s,r[s])}))});let a=t.slice(0,4);d=Math.max(0,t.length-a.length);let l=o[0];f=a.map(t=>{let n=new Map;return i.forEach(e=>{if(hM(e[s])!==t.key)return;let i=hM(e[r]);n.has(i)||n.set(i,mM(e[l]))}),{field:l,name:t.label,values:c.map(e=>n.get(e.key)??null),valueColumn:gM(e,l)}})}else d=Math.max(0,o.length-4),f=o.slice(0,4).map(t=>({field:t,name:_M(e,t),values:i.map(e=>mM(e[t])),valueColumn:gM(e,t)}));if(f.length===0)return null;let p=_M(e,r),m=`Values`;return s?m=_M(e,o[0]):f.length===1&&(m=f[0].name),{type:n,title:e.title?.trim()||`${m} by ${p}`,xAxisTitle:p,yAxisTitle:m,categories:u,series:f,omittedSeriesCount:d,summary:wM(e,n,u,f,d)}},EM=e=>{if(e.presentation===`table`||e.presentation===`kpi`)return[];let t=TM(e);if(!t)return[];let n=[{type:`line`,label:`Line`},{type:`bar`,label:`Bar`}];return t.series.length>1&&n.push({type:`stacked_bar`,label:`Stacked bar`}),n},DM=(e,{expanded:t=!1,reducedMotion:n=!1,theme:r=iM,zoomWindow:i=cM(e.categories.length)}={})=>{let a=e.series.length>1,o=e.type===`stacked_bar`,s=e.categories.length>2,c=lM(i,e.categories.length);return{animation:!n,animationDuration:n?0:260,aria:{enabled:!0,decal:{show:!0},label:{description:`${e.title}. ${e.summary}`}},backgroundColor:`transparent`,color:r.colors,textStyle:{color:r.text,fontFamily:`inherit`},grid:{top:a?t?48:42:14,right:12,bottom:t?18:10,left:10,containLabel:!0},legend:{show:a,type:`scroll`,top:0,left:`center`,itemWidth:12,itemHeight:8,textStyle:{color:r.muted,fontSize:t?11:10}},tooltip:{trigger:`axis`,triggerOn:`mousemove|click`,confine:!0,backgroundColor:r.surface,borderColor:r.border,borderWidth:1,textStyle:{color:r.text,fontSize:12},axisPointer:{type:`line`,lineStyle:{color:r.muted,opacity:.5}}},dataZoom:s?[{id:aM,type:`inside`,xAxisIndex:0,startValue:c.startIndex,endValue:c.endIndex,minValueSpan:1,filterMode:`filter`,disabled:!0}]:void 0,xAxis:{type:`category`,data:e.categories,name:e.xAxisTitle,nameLocation:`middle`,nameGap:t?38:32,nameTextStyle:{color:r.muted,fontSize:t?11:10},axisLine:{lineStyle:{color:r.border}},axisTick:{show:!1},axisLabel:{color:r.muted,fontSize:t?11:9,hideOverlap:!0,interval:`auto`,rotate:!t&&e.categories.length>5?28:0,formatter:e=>e.length>(t?18:11)?`${e.slice(0,t?16:9)}…`:e}},yAxis:{type:`value`,name:e.yAxisTitle,nameLocation:`middle`,nameGap:t?52:44,nameTextStyle:{color:r.muted,fontSize:t?11:10},axisLabel:{color:r.muted,fontSize:t?11:9,formatter:t=>yM(t,e.series[0]?.valueColumn,void 0,!0)},axisLine:{show:!1},axisTick:{show:!1},splitNumber:4,splitLine:{lineStyle:{color:r.border,opacity:.75}}},series:e.series.map(n=>({type:e.type===`line`?`line`:`bar`,name:n.name,data:n.values,stack:o?`total`:void 0,connectNulls:!1,showSymbol:e.type===`line`&&e.categories.length<=18,symbol:`circle`,symbolSize:t?7:6,smooth:!1,maxBarWidth:t?38:28,lineStyle:e.type===`line`?{width:t?3:2.5}:void 0,itemStyle:e.type===`line`?{borderColor:r.background,borderWidth:2}:{borderRadius:o?0:[4,4,0,0]},emphasis:{focus:`series`},tooltip:{valueFormatter:e=>yM(e,n.valueColumn)}}))}},OM=e=>{let t=getComputedStyle(e),n=(e,n)=>t.getPropertyValue(e).trim()||n,r=n(`--cf-accent`,iM.colors[0]);return{background:n(`--cf-bg`,iM.background),border:n(`--cf-border`,iM.border),muted:n(`--cf-muted`,iM.muted),surface:n(`--cf-surface`,iM.surface),text:n(`--cf-text`,iM.text),colors:[r,`#2563eb`,`#d97706`,`#7c3aed`]}},kM=({model:e,expanded:t=!1})=>{let n=(0,r.useRef)(null),a=(0,r.useRef)(null),[o,s]=(0,r.useState)(()=>({model:e,window:cM(e.categories.length)})),[c,l]=(0,r.useState)(!1),u=o.model===e?lM(o.window,e.categories.length):cM(e.categories.length),d=(0,r.useRef)(u);d.current=u;let f=t=>{let n=lM(t,e.categories.length);d.current=n,s({model:e,window:n}),a.current?.dispatchAction({type:`dataZoom`,dataZoomId:aM,startValue:n.startIndex,endValue:n.endIndex})};(0,r.useEffect)(()=>{let e=n.current;if(!(!e||typeof navigator<`u`&&navigator.userAgent.toLowerCase().includes(`jsdom`)))try{let t=xT(e,null,{renderer:`canvas`,devicePixelRatio:Math.min(window.devicePixelRatio||1,2)});a.current=t;let n=()=>t.resize(),r=typeof ResizeObserver>`u`?null:new ResizeObserver(n);return r?.observe(e),r||window.addEventListener(`resize`,n,{passive:!0}),()=>{r?.disconnect(),r||window.removeEventListener(`resize`,n),t.dispose(),a.current=null}}catch{l(!0);return}},[]),(0,r.useEffect)(()=>{let r=n.current,i=a.current;if(!r||!i)return;let o=typeof matchMedia<`u`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches;i.setOption(DM(e,{expanded:t,reducedMotion:o,theme:OM(r),zoomWindow:d.current}),{lazyUpdate:!0,notMerge:!0}),i.resize()},[t,e]);let p=!c&&e.categories.length>2,m=u.endIndex-u.startIndex+1,h=u.startIndex===0&&u.endIndex===e.categories.length-1,g=p&&m>2,_=p&&!h;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{ref:n,class:`cf-analytics-echart${t?` is-expanded`:``}`,role:`img`,"aria-label":`${e.title}. ${e.summary}`,"data-chart-status":c?`fallback`:`ready`,children:c?(0,i.jsx)(`span`,{class:`cf-analytics-echart__fallback`,children:e.summary}):null}),p?(0,i.jsxs)(`div`,{class:`cf-analytics-zoom`,children:[(0,i.jsx)(`span`,{class:`cf-analytics-zoom__range`,"aria-live":`polite`,"aria-atomic":`true`,children:dM(e.categories,u)}),(0,i.jsxs)(`div`,{class:`cf-analytics-zoom__controls`,role:`group`,"aria-label":`Chart zoom controls`,children:[(0,i.jsx)(`button`,{type:`button`,"aria-label":`Zoom out chart`,title:`Zoom out`,disabled:!_,onClick:()=>f(uM(d.current,`out`,e.categories.length)),children:`−`}),(0,i.jsx)(`button`,{type:`button`,class:`cf-analytics-zoom__reset`,"aria-label":`Reset chart zoom`,title:`Reset zoom`,disabled:h,onClick:()=>f(cM(e.categories.length)),children:`Reset`}),(0,i.jsx)(`button`,{type:`button`,"aria-label":`Zoom in chart`,title:`Zoom in`,disabled:!g,onClick:()=>f(uM(d.current,`in`,e.categories.length)),children:`+`})]})]}):null]})},AM=e=>{let t=e.replaceAll(`_`,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).trim();return t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:`Value`},jM=(e,t)=>(t?.length?t:Object.keys(e[0]??{})).map(e=>typeof e==`string`?{key:e,label:AM(e)}:{...e,label:e.label?.trim()||AM(e.key)}),MM=(e,t,n)=>{if(e==null||e===``)return`—`;if((n?.dataType===`date`||n?.dataType===`datetime`)&&typeof e==`string`){let r=new Date(e);if(!Number.isNaN(r.getTime()))return new Intl.DateTimeFormat(t,{dateStyle:`medium`,...n.dataType===`datetime`?{timeStyle:`short`}:{}}).format(r)}return n?.dataType===`currency`&&typeof e==`number`?new Intl.NumberFormat(t,{style:`currency`,currency:n.currencyCode||`USD`,maximumFractionDigits:2}).format(e):typeof e==`number`&&Number.isFinite(e)?new Intl.NumberFormat(t,{maximumFractionDigits:4}).format(e):typeof e==`boolean`?e?`Yes`:`No`:String(e)},NM=e=>{let t=String(e??``);return/[",\r\n]/.test(t)?`"${t.replaceAll(`"`,`""`)}"`:t},PM=(e,t)=>{let n=jM(e,t);return[n.map(e=>NM(e.label)).join(`,`),...e.map(e=>n.map(t=>NM(e[t.key])).join(`,`))].join(`\r
|
|
29
|
-
`)},FM=({rows:e,columns:t,maxRows:n=6,locale:r,expanded:a=!1,classNames:o,emptyLabel:s=`No rows returned.`})=>{let c=jM(e,t),l=a?e:e.slice(0,Math.max(1,n));return e.length===0||c.length===0?(0,i.jsx)(`div`,{class:o?.note,children:s}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{class:o?.wrap,role:`region`,"aria-label":`Result table with ${e.length} ${e.length===1?`row`:`rows`}`,tabIndex:0,children:(0,i.jsxs)(`table`,{class:o?.table,children:[(0,i.jsxs)(`caption`,{style:`position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)`,children:[`Result table with `,e.length,` `,e.length===1?`row`:`rows`]}),(0,i.jsx)(`thead`,{children:(0,i.jsx)(`tr`,{children:c.map(e=>(0,i.jsx)(`th`,{scope:`col`,children:e.label},e.key))})}),(0,i.jsx)(`tbody`,{children:l.map((e,t)=>(0,i.jsx)(`tr`,{children:c.map(t=>(0,i.jsx)(`td`,{children:MM(e[t.key],r,t)},t.key))},t))})]})}),!a&&e.length>l.length?(0,i.jsxs)(`div`,{class:o?.note,children:[`Showing `,l.length,` of `,e.length,` rows. Expand to view all rows.`]}):null]})},IM=({rows:e,columns:t,maxRows:n=100,locale:a,expanded:o=!1,classPrefix:s=`cr`,pageSize:c=10})=>{let l=(0,r.useMemo)(()=>jM(e,t),[t,e]),u=l.map(e=>e.key).join(`\0`),[d,f]=(0,r.useState)(()=>l.map(e=>e.key)),[p,m]=(0,r.useState)(``),[h,g]=(0,r.useState)(),[_,v]=(0,r.useState)(`asc`),[y,b]=(0,r.useState)([]),[x,S]=(0,r.useState)(`table`),[C,w]=(0,r.useState)(1),[T,E]=(0,r.useState)(c);(0,r.useEffect)(()=>{f(l.map(e=>e.key)),g(void 0),b([]),w(1)},[u]);let D=l.filter(e=>d.includes(e.key)),O=(0,r.useMemo)(()=>{let t=p.toLocaleLowerCase(a),n=e.map((e,t)=>({row:e,index:t})).filter(({row:e})=>D.some(n=>MM(e[n.key],a,n).toLocaleLowerCase(a).includes(t)));return h?n.sort((e,t)=>{let n=e.row[h],r=t.row[h],i=typeof n==`number`?n:NaN,o=typeof r==`number`?r:NaN,s=!Number.isNaN(i)&&!Number.isNaN(o)?i-o:String(n??``).localeCompare(String(r??``),a,{numeric:!0,sensitivity:`base`});return _===`asc`?s:-s}):n},[D,a,p,e,_,h]),k=O.slice(0,Math.max(1,n)),A=Math.max(1,Math.ceil(k.length/T)),j=Math.min(C,A),M=o?k:k.slice((j-1)*T,j*T),N=M.length>0&&M.every(({index:e})=>y.includes(e)),P=e=>`${s}-${e}`;if(e.length===0||l.length===0)return(0,i.jsx)(`div`,{class:P(`table-note`),children:`No rows returned.`});let ee=e=>{let t=new Set(M.map(({index:e})=>e));b(n=>e?[...new Set([...n,...t])]:n.filter(e=>!t.has(e)))};return(0,i.jsxs)(`section`,{class:P(`data-table`),children:[(0,i.jsxs)(`div`,{class:P(`table-fields`),children:[(0,i.jsx)(`strong`,{children:`Fields`}),(0,i.jsx)(`div`,{class:P(`field-list`),children:l.map(e=>(0,i.jsx)(`span`,{class:P(`field-chip`),children:e.label},e.key))}),(0,i.jsxs)(`span`,{class:P(`table-field-count`),children:[e.length.toLocaleString(a),` rows`]})]}),(0,i.jsxs)(`div`,{class:P(`table-controls`),children:[(0,i.jsxs)(`label`,{class:P(`table-search`),children:[(0,i.jsx)(`span`,{"aria-hidden":`true`,children:`⌕`}),(0,i.jsx)(`input`,{type:`search`,value:p,placeholder:`Search this result...`,"aria-label":`Search this result`,onInput:e=>{m(e.currentTarget.value.trim()),w(1)}})]}),(0,i.jsx)(`div`,{class:P(`table-modes`),role:`group`,"aria-label":`Table display mode`,children:[`table`,`matrix`].map(e=>(0,i.jsx)(`button`,{type:`button`,class:`${P(`segment`)}${x===e?` is-active`:``}`,"aria-pressed":x===e,onClick:()=>S(e),children:e===`table`?`Table`:`Matrix`},e))})]}),(0,i.jsx)(`div`,{class:P(`table-column-bar`),children:(0,i.jsxs)(`details`,{class:P(`column-picker`),children:[(0,i.jsx)(`summary`,{children:`Columns`}),(0,i.jsx)(`div`,{class:P(`column-menu`),children:l.map(e=>(0,i.jsxs)(`label`,{children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:d.includes(e.key),onChange:t=>{let n=t.currentTarget.checked;f(t=>n?[...new Set([...t,e.key])]:t.length>1?t.filter(t=>t!==e.key):t)}}),(0,i.jsx)(`span`,{children:e.label})]},e.key))})]})}),(0,i.jsx)(`div`,{class:P(`table-wrap`),role:`region`,"aria-label":`Scrollable result table`,tabIndex:0,children:(0,i.jsxs)(`table`,{class:`${P(`table`)}${x===`matrix`?` is-matrix`:``}`,children:[(0,i.jsxs)(`caption`,{class:P(`visually-hidden`),children:[`Result table with `,O.length,` `,O.length===1?`row`:`rows`]}),(0,i.jsx)(`thead`,{children:(0,i.jsxs)(`tr`,{children:[(0,i.jsx)(`th`,{class:P(`select-cell`),children:(0,i.jsx)(`input`,{type:`checkbox`,"aria-label":`Select all visible rows`,checked:N,onChange:e=>ee(e.currentTarget.checked)})}),D.map(e=>(0,i.jsx)(`th`,{scope:`col`,children:(0,i.jsxs)(`button`,{type:`button`,class:P(`table-sort`),"aria-label":`Sort by ${e.label}`,onClick:()=>{h===e.key?v(e=>e===`asc`?`desc`:`asc`):(g(e.key),v(`asc`)),w(1)},children:[(0,i.jsx)(`span`,{children:e.label}),(0,i.jsx)(`span`,{class:P(`sort-direction`),"aria-hidden":`true`,children:h===e.key?_===`asc`?`↑`:`↓`:`↕`})]})},e.key))]})}),(0,i.jsx)(`tbody`,{children:M.map(({row:e,index:t})=>(0,i.jsxs)(`tr`,{class:y.includes(t)?`is-selected`:void 0,children:[(0,i.jsx)(`td`,{class:P(`select-cell`),children:(0,i.jsx)(`input`,{type:`checkbox`,"aria-label":`Select row ${t+1}`,checked:y.includes(t),onChange:e=>b(n=>e.currentTarget.checked?[...new Set([...n,t])]:n.filter(e=>e!==t))})}),D.map(t=>(0,i.jsx)(`td`,{children:MM(e[t.key],a,t)},t.key))]},t))})]})}),(0,i.jsxs)(`div`,{class:P(`table-summary`),children:[(0,i.jsx)(`span`,{children:k.length?`${((j-1)*T+1).toLocaleString(a)}-${Math.min(j*T,k.length).toLocaleString(a)} of ${O.length.toLocaleString(a)}`:`0 of ${O.length.toLocaleString(a)}`}),o?(0,i.jsx)(`span`,{children:e.length>n?`First ${n.toLocaleString(a)} rows available`:`All returned rows loaded`}):(0,i.jsxs)(`div`,{class:P(`table-pagination`),"aria-label":`Table pagination`,children:[(0,i.jsxs)(`label`,{children:[(0,i.jsx)(`span`,{children:`Rows`}),(0,i.jsx)(`select`,{"aria-label":`Rows per page`,value:T,onChange:e=>{E(Number(e.currentTarget.value)),w(1)},children:[10,25,50].map(e=>(0,i.jsx)(`option`,{value:e,children:e},e))})]}),(0,i.jsx)(`button`,{type:`button`,"aria-label":`Previous page`,disabled:j<=1,onClick:()=>w(e=>Math.max(1,e-1)),children:`‹`}),(0,i.jsxs)(`span`,{children:[j,` / `,A]}),(0,i.jsx)(`button`,{type:`button`,"aria-label":`Next page`,disabled:j>=A,onClick:()=>w(e=>Math.min(A,e+1)),children:`›`})]})]})]})},LM={openChat:`Open chat`,closeChat:`Close chat`,muteSounds:`Mute sounds`,unmuteSounds:`Unmute sounds`,statusOnline:`Online · replies instantly`,statusOffline:`Away · leave a message`,composerPlaceholder:`Type your message…`,send:`Send message`,emoji:`Emoji`,gifs:`GIFs`,attachFile:`Attach a file`,recordVoice:`Record a voice message`,stopRecording:`Stop recording`,stop:`Stop`,copy:`Copy`,copied:`Copied`,retry:`Retry`,clearChat:`Clear conversation`,clearChatConfirm:`Clear this conversation?`,clearChatConfirmBody:`This clears the messages on this device and starts a fresh chat.`,clearConfirmCta:`Clear chat`,endChat:`End conversation`,endChatConfirm:`End this conversation?`,endChatConfirmBody:`You won't be able to send more messages in this chat, but you can start a new one anytime.`,endConfirmCta:`End conversation`,conversationEnded:`This conversation has ended.`,startNewChat:`Start a new conversation`,pastConversations:`Past conversations`,viewingPast:`Viewing a past conversation (read-only)`,backToChat:`Back to current chat`,historyEnded:`ended`,feedbackHelpful:`Helpful`,feedbackNotHelpful:`Not helpful`,feedbackThanks:`Thanks for the feedback`,csatPrompt:`How was this chat?`,feedbackCommentPlaceholder:`What went wrong? (optional)`,feedbackSend:`Send`,cancel:`Cancel`,newMessages:`New messages`,poweredBy:`Powered by`,searchGifs:`Search GIFs…`,searchingGifs:`Searching…`,noGifs:`No GIFs found`,assistantTyping:`Assistant is typing`,emptyReply:`Sorry, I couldn't generate a reply.`,errorGeneric:`Something went wrong reaching the assistant. Please try again.`,errorRateLimit:`You’re sending messages a little fast — give it a second and try again.`,attaching:`Reading file…`,attachTooLarge:`That file is too large (max 8 MB).`,attachFailed:`Couldn’t read that file — try another.`,handoffTitle:`Want our team to follow up?`,handoffName:`Name (optional)`,handoffEmail:`Your email`,handoffNotify:`Notify the team`,sending:`Sending…`,handoffShared:`I’ve shared this with our team — they’ll get back to you at {email}.`,formThanks:`Thanks! We’ll be in touch.`,formError:`Something went wrong — please try again.`,bookingPickTime:`What time works best?`,bookingDuration:`30-minute demo`,bookingRequested:`Requested for {when} — we’ll confirm by email.`,bookingConfirmed:`You’re booked for {when}! A calendar invite is on its way. 📅`,bookingSlotTaken:`That time was just taken — please pick another.`,bookingViaProvider:`Pick a time that works for you on {provider}.`,bookingOpenScheduler:`Open the scheduler`,bookingLinkOpened:`Opening the scheduler — pick a time that suits you. 📅`,bookingMeetingLink:`Meeting link`,previewReply:`👋 This is a preview — replies here are samples. Publish the widget on your site to chat with the live AI.`,previewActionNote:`Preview — nothing was actually sent. This works for real once you publish.`,previewBanner:`Preview — sample replies, no AI`},RM=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??``),zM=e=>e?{...LM,...e}:LM,BM=(0,n.createContext)(LM),VM=BM.Provider,HM=()=>(0,r.useContext)(BM),UM=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[[^\]]+\]\(https?:\/\/[^\s)]+\))|(https?:\/\/[^\s)]+)/g,WM=e=>e.replace(/([^\n])\s+((?:[-*•]|\d+\.)\s+)(?=(?:\*\*[^*\n]{1,80}\*\*|[A-Z][A-Za-z0-9/& -]{1,50}:))/g,`$1
|
|
30
|
-
$2`),
|
|
29
|
+
`)},FM=({rows:e,columns:t,maxRows:n=6,locale:r,expanded:a=!1,classNames:o,emptyLabel:s=`No rows returned.`})=>{let c=jM(e,t),l=a?e:e.slice(0,Math.max(1,n));return e.length===0||c.length===0?(0,i.jsx)(`div`,{class:o?.note,children:s}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{class:o?.wrap,role:`region`,"aria-label":`Result table with ${e.length} ${e.length===1?`row`:`rows`}`,tabIndex:0,children:(0,i.jsxs)(`table`,{class:o?.table,children:[(0,i.jsxs)(`caption`,{style:`position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)`,children:[`Result table with `,e.length,` `,e.length===1?`row`:`rows`]}),(0,i.jsx)(`thead`,{children:(0,i.jsx)(`tr`,{children:c.map(e=>(0,i.jsx)(`th`,{scope:`col`,children:e.label},e.key))})}),(0,i.jsx)(`tbody`,{children:l.map((e,t)=>(0,i.jsx)(`tr`,{children:c.map(t=>(0,i.jsx)(`td`,{children:MM(e[t.key],r,t)},t.key))},t))})]})}),!a&&e.length>l.length?(0,i.jsxs)(`div`,{class:o?.note,children:[`Showing `,l.length,` of `,e.length,` rows. Expand to view all rows.`]}):null]})},IM=({rows:e,columns:t,maxRows:n=100,locale:a,expanded:o=!1,classPrefix:s=`cr`,pageSize:c=10})=>{let l=(0,r.useMemo)(()=>jM(e,t),[t,e]),u=l.map(e=>e.key).join(`\0`),[d,f]=(0,r.useState)(()=>l.map(e=>e.key)),[p,m]=(0,r.useState)(``),[h,g]=(0,r.useState)(),[_,v]=(0,r.useState)(`asc`),[y,b]=(0,r.useState)([]),[x,S]=(0,r.useState)(`table`),[C,w]=(0,r.useState)(1),[T,E]=(0,r.useState)(c);(0,r.useEffect)(()=>{f(l.map(e=>e.key)),g(void 0),b([]),w(1)},[u]);let D=l.filter(e=>d.includes(e.key)),O=(0,r.useMemo)(()=>{let t=p.toLocaleLowerCase(a),n=e.map((e,t)=>({row:e,index:t})).filter(({row:e})=>D.some(n=>MM(e[n.key],a,n).toLocaleLowerCase(a).includes(t)));return h?n.sort((e,t)=>{let n=e.row[h],r=t.row[h],i=typeof n==`number`?n:NaN,o=typeof r==`number`?r:NaN,s=!Number.isNaN(i)&&!Number.isNaN(o)?i-o:String(n??``).localeCompare(String(r??``),a,{numeric:!0,sensitivity:`base`});return _===`asc`?s:-s}):n},[D,a,p,e,_,h]),k=O.slice(0,Math.max(1,n)),A=Math.max(1,Math.ceil(k.length/T)),j=Math.min(C,A),M=o?k:k.slice((j-1)*T,j*T),N=M.length>0&&M.every(({index:e})=>y.includes(e)),P=e=>`${s}-${e}`;if(e.length===0||l.length===0)return(0,i.jsx)(`div`,{class:P(`table-note`),children:`No rows returned.`});let ee=e=>{let t=new Set(M.map(({index:e})=>e));b(n=>e?[...new Set([...n,...t])]:n.filter(e=>!t.has(e)))};return(0,i.jsxs)(`section`,{class:P(`data-table`),children:[(0,i.jsxs)(`div`,{class:P(`table-fields`),children:[(0,i.jsx)(`strong`,{children:`Fields`}),(0,i.jsx)(`div`,{class:P(`field-list`),children:l.map(e=>(0,i.jsx)(`span`,{class:P(`field-chip`),children:e.label},e.key))}),(0,i.jsxs)(`span`,{class:P(`table-field-count`),children:[e.length.toLocaleString(a),` rows`]})]}),(0,i.jsxs)(`div`,{class:P(`table-controls`),children:[(0,i.jsxs)(`label`,{class:P(`table-search`),children:[(0,i.jsx)(`span`,{"aria-hidden":`true`,children:`⌕`}),(0,i.jsx)(`input`,{type:`search`,value:p,placeholder:`Search this result...`,"aria-label":`Search this result`,onInput:e=>{m(e.currentTarget.value.trim()),w(1)}})]}),(0,i.jsx)(`div`,{class:P(`table-modes`),role:`group`,"aria-label":`Table display mode`,children:[`table`,`matrix`].map(e=>(0,i.jsx)(`button`,{type:`button`,class:`${P(`segment`)}${x===e?` is-active`:``}`,"aria-pressed":x===e,onClick:()=>S(e),children:e===`table`?`Table`:`Matrix`},e))})]}),(0,i.jsx)(`div`,{class:P(`table-column-bar`),children:(0,i.jsxs)(`details`,{class:P(`column-picker`),children:[(0,i.jsx)(`summary`,{children:`Columns`}),(0,i.jsx)(`div`,{class:P(`column-menu`),children:l.map(e=>(0,i.jsxs)(`label`,{children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:d.includes(e.key),onChange:t=>{let n=t.currentTarget.checked;f(t=>n?[...new Set([...t,e.key])]:t.length>1?t.filter(t=>t!==e.key):t)}}),(0,i.jsx)(`span`,{children:e.label})]},e.key))})]})}),(0,i.jsx)(`div`,{class:P(`table-wrap`),role:`region`,"aria-label":`Scrollable result table`,tabIndex:0,children:(0,i.jsxs)(`table`,{class:`${P(`table`)}${x===`matrix`?` is-matrix`:``}`,children:[(0,i.jsxs)(`caption`,{class:P(`visually-hidden`),children:[`Result table with `,O.length,` `,O.length===1?`row`:`rows`]}),(0,i.jsx)(`thead`,{children:(0,i.jsxs)(`tr`,{children:[(0,i.jsx)(`th`,{class:P(`select-cell`),children:(0,i.jsx)(`input`,{type:`checkbox`,"aria-label":`Select all visible rows`,checked:N,onChange:e=>ee(e.currentTarget.checked)})}),D.map(e=>(0,i.jsx)(`th`,{scope:`col`,children:(0,i.jsxs)(`button`,{type:`button`,class:P(`table-sort`),"aria-label":`Sort by ${e.label}`,onClick:()=>{h===e.key?v(e=>e===`asc`?`desc`:`asc`):(g(e.key),v(`asc`)),w(1)},children:[(0,i.jsx)(`span`,{children:e.label}),(0,i.jsx)(`span`,{class:P(`sort-direction`),"aria-hidden":`true`,children:h===e.key?_===`asc`?`↑`:`↓`:`↕`})]})},e.key))]})}),(0,i.jsx)(`tbody`,{children:M.map(({row:e,index:t})=>(0,i.jsxs)(`tr`,{class:y.includes(t)?`is-selected`:void 0,children:[(0,i.jsx)(`td`,{class:P(`select-cell`),children:(0,i.jsx)(`input`,{type:`checkbox`,"aria-label":`Select row ${t+1}`,checked:y.includes(t),onChange:e=>b(n=>e.currentTarget.checked?[...new Set([...n,t])]:n.filter(e=>e!==t))})}),D.map(t=>(0,i.jsx)(`td`,{children:MM(e[t.key],a,t)},t.key))]},t))})]})}),(0,i.jsxs)(`div`,{class:P(`table-summary`),children:[(0,i.jsx)(`span`,{children:k.length?`${((j-1)*T+1).toLocaleString(a)}-${Math.min(j*T,k.length).toLocaleString(a)} of ${O.length.toLocaleString(a)}`:`0 of ${O.length.toLocaleString(a)}`}),o?(0,i.jsx)(`span`,{children:e.length>n?`First ${n.toLocaleString(a)} rows available`:`All returned rows loaded`}):(0,i.jsxs)(`div`,{class:P(`table-pagination`),"aria-label":`Table pagination`,children:[(0,i.jsxs)(`label`,{children:[(0,i.jsx)(`span`,{children:`Rows`}),(0,i.jsx)(`select`,{"aria-label":`Rows per page`,value:T,onChange:e=>{E(Number(e.currentTarget.value)),w(1)},children:[10,25,50].map(e=>(0,i.jsx)(`option`,{value:e,children:e},e))})]}),(0,i.jsx)(`button`,{type:`button`,"aria-label":`Previous page`,disabled:j<=1,onClick:()=>w(e=>Math.max(1,e-1)),children:`‹`}),(0,i.jsxs)(`span`,{children:[j,` / `,A]}),(0,i.jsx)(`button`,{type:`button`,"aria-label":`Next page`,disabled:j>=A,onClick:()=>w(e=>Math.min(A,e+1)),children:`›`})]})]})]})},LM=[`audio/webm;codecs=opus`,`audio/webm`,`audio/ogg;codecs=opus`,`audio/ogg`],RM=()=>{if(typeof navigator>`u`||!navigator.mediaDevices?.getSupportedConstraints)return{};try{return navigator.mediaDevices.getSupportedConstraints()}catch{return{}}},zM=(e=``,t=RM())=>{let n={...e?{deviceId:{exact:e}}:{}};return t.echoCancellation&&(n.echoCancellation={ideal:!0}),t.noiseSuppression&&(n.noiseSuppression={ideal:!0}),t.autoGainControl&&(n.autoGainControl={ideal:!0}),t.channelCount&&(n.channelCount={ideal:1}),t.voiceIsolation&&(n.voiceIsolation={ideal:!0}),n},BM=(e={})=>{let t=Math.max(2,e.calibrationSamples??6),n=Math.max(t,e.ambientWindowSamples??72),r=Math.min(.5,Math.max(0,e.ambientPercentile??.2)),i=Math.min(1,Math.max(.01,e.smoothing??.22)),a=Math.max(2**-52,e.minimumNoiseFloor??5e-4),o=Math.max(1.1,e.speechToNoiseRatio??2.7),s=Math.min(o,Math.max(1,e.quietToNoiseRatio??1.55)),c=Math.max(250,e.minimumEndSilenceMs??650),l=Math.max(c,e.maximumEndSilenceMs??1100),u=[],d=a,f=d*o,p=0;return{observe:e=>{let m=Number.isFinite(e)?Math.max(0,e):0;if(u.length<t||m<=f){u.push(m),u.length>n&&u.shift();let e=[...u].sort((e,t)=>e-t),t=Math.min(e.length-1,Math.floor((e.length-1)*r)),o=Math.max(a,e[t]??a);d+=(o-d)*i}f=d*o;let h=d*s,g=u.length>=t,_=g&&m>=f;_&&(p=Math.max(p,m/Math.max(d,a)));let v=Math.min(1,Math.max(0,(p-o)/o)),y=Math.round(l-(l-c)*v);return{speech:_,quiet:g&&m<=h,calibrated:g,noiseFloor:d,speechThreshold:f,quietThreshold:h,endOfSpeechDelayMs:y}},reset:()=>{u=[],d=a,f=d*o,p=0}}},VM=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result??``).split(`,`)[1]??``),r.onerror=()=>n(r.error),r.readAsDataURL(e)}),HM=e=>{let t=globalThis.MediaRecorder;if(typeof t?.isTypeSupported==`function`){for(let n of LM)if(t.isTypeSupported(n))try{return new t(e,{mimeType:n})}catch{}}return new t(e)},UM=e=>{if(!(!e||e.state!==`recording`)){try{e.requestData()}catch{}e.stop()}},WM={openChat:`Open chat`,closeChat:`Close chat`,closeHistory:`Close conversation history`,unreadMessage:`1 unread message`,unreadMessages:`{count} unread messages`,muteSounds:`Mute sounds`,unmuteSounds:`Unmute sounds`,statusOnline:`Online · replies instantly`,statusOffline:`Away · leave a message`,liveSupport:`Live support`,waitingForTeam:`Waiting for the team`,assistantName:`Assistant`,chatName:`Chat`,welcomeLabel:`{name} welcome`,welcomeEyebrow:`Ready when you are`,welcomePrompt:`Ask a question, leave a message, or book a demo.`,agentTyping:`{name} is typing…`,expandedAnalyticsResult:`Expanded analytics result`,privacyAndData:`Privacy and local data`,muteMicrophone:`Mute microphone`,unmuteMicrophone:`Unmute microphone`,chooseMicrophone:`Choose microphone`,defaultMicrophone:`Default microphone`,microphone:`Microphone`,talkNow:`Talk now`,expandView:`Expand view`,exitExpandedView:`Exit expanded view`,minimizeVoiceChat:`Minimize voice chat`,endVoiceChat:`End voice chat`,restoreVoiceChat:`Restore voice chat`,reopenVoiceChat:`Reopen voice chat with {name}`,voiceConnecting:`Connecting…`,voiceListening:`Listening…`,voiceProcessing:`Thinking…`,voiceSpeaking:`Speaking…`,voiceNoise:`Background noise detected`,voiceMisunderstood:`I could not understand that audio`,voiceDenied:`Microphone access is unavailable`,composerPlaceholder:`Type your message…`,send:`Send message`,emoji:`Emoji`,gifs:`GIFs`,attachFile:`Attach a file`,recordVoice:`Record a voice message`,stopRecording:`Stop recording`,actionTestMode:`Test mode`,stop:`Stop`,copy:`Copy`,copied:`Copied`,retry:`Retry`,clearChat:`Clear conversation`,clearChatConfirm:`Clear this conversation?`,clearChatConfirmBody:`This clears the messages on this device and starts a fresh chat.`,clearConfirmCta:`Clear chat`,endChat:`End conversation`,endChatConfirm:`End this conversation?`,endChatConfirmBody:`You won't be able to send more messages in this chat, but you can start a new one anytime.`,endConfirmCta:`End conversation`,conversationEnded:`This conversation has ended.`,startNewChat:`Start a new conversation`,pastConversations:`Past conversations`,viewingPast:`Viewing a past conversation (read-only)`,backToChat:`Back to current chat`,historyEnded:`ended`,feedbackHelpful:`Helpful`,feedbackNotHelpful:`Not helpful`,feedbackThanks:`Thanks for the feedback`,csatPrompt:`How was this chat?`,feedbackCommentPlaceholder:`What went wrong? (optional)`,feedbackSend:`Send`,cancel:`Cancel`,newMessages:`New messages`,poweredBy:`Powered by`,searchGifs:`Search GIFs…`,searchingGifs:`Searching…`,noGifs:`No GIFs found`,assistantTyping:`Assistant is typing`,emptyReply:`Sorry, I couldn't generate a reply.`,errorGeneric:`Something went wrong reaching the assistant. Please try again.`,errorRateLimit:`You’re sending messages a little fast — give it a second and try again.`,attaching:`Reading file…`,attachTooLarge:`That file is too large (max 8 MB).`,attachFailed:`Couldn’t read that file — try another.`,removeAttachment:`Remove attachment`,dropFileHere:`Drop the file here`,clearDeviceData:`Clear conversations from this device`,clearDeviceDataBody:`This removes locally stored conversations and visitor details from this browser. It cannot be undone.`,clearDeviceDataCta:`Clear this device`,handoffTitle:`Want our team to follow up?`,handoffName:`Name (optional)`,handoffEmail:`Your email`,handoffNotify:`Notify the team`,sending:`Sending…`,handoffShared:`I’ve shared this with our team — they’ll get back to you at {email}.`,formThanks:`Thanks! We’ll be in touch.`,formError:`Something went wrong — please try again.`,actionContactOptions:`Contact options`,actionGetInTouch:`Get in touch`,actionMore:`+{count} more`,actionNeedHelp:`Need help?`,actionChoose:`Choose what you want to do`,actionFooter:`We’ll ask for your full name and the best email or phone so the team can reach you.`,actionCategorySupport:`Support`,actionCategorySales:`Talk to sales`,actionCategoryMarketing:`Stay in touch`,actionClose:`Close`,actionAs:`as {identity}`,bookingPickTime:`What time works best?`,bookingPickDay:`Pick a day`,bookingPickTimeLabel:`Pick a time`,bookingDuration:`{count}-minute demo`,bookingTimezone:`Times shown in {timezone}`,bookingSchedulerFallback:`the scheduler`,bookingCheckingAvailability:`Checking calendar availability…`,bookingNoSlots:`No available times were found in this booking window.`,bookingAvailabilityUnavailable:`Calendar availability is temporarily unavailable. Please try again shortly.`,bookingEarlierToday:`Earlier today`,bookingCalendarBusy:`Busy on the calendar`,bookingAlreadyBooked:`Already booked`,bookingNotOffered:`Not offered by the calendar`,bookingRequested:`Requested for {when} — we’ll confirm by email.`,bookingConfirmed:`You’re booked for {when}! A calendar invite is on its way. 📅`,bookingSlotTaken:`That time was just taken — please pick another.`,bookingViaProvider:`Pick a time that works for you on {provider}.`,bookingOpenScheduler:`Open the scheduler`,bookingLinkOpened:`Opening the scheduler — pick a time that suits you. 📅`,bookingMeetingLink:`Meeting link`,previewReply:`👋 This is a preview — replies here are samples. Publish the widget on your site to chat with the live AI.`,previewActionNote:`Preview — nothing was actually sent. This works for real once you publish.`,previewBanner:`Preview — sample replies, no AI`},GM=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??``),KM=e=>e?{...WM,...e}:WM,qM=(0,n.createContext)(WM),JM=qM.Provider,YM=()=>(0,r.useContext)(qM),XM=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[[^\]]+\]\(https?:\/\/[^\s)]+\))|(https?:\/\/[^\s)]+)/g,ZM=e=>e.replace(/([^\n])\s+((?:[-*•]|\d+\.)\s+)(?=(?:\*\*[^*\n]{1,80}\*\*|[A-Z][A-Za-z0-9/& -]{1,50}:))/g,`$1
|
|
30
|
+
$2`),QM=e=>{let t=[],n=0,r=0,a;for(XM.lastIndex=0;(a=XM.exec(e))!==null;){a.index>n&&t.push(e.slice(n,a.index));let o=a[0];if(o.startsWith("`"))t.push((0,i.jsx)(`code`,{class:`cf-md-code`,children:o.slice(1,-1)},r++));else if(o.startsWith(`**`))t.push((0,i.jsx)(`strong`,{children:o.slice(2,-2)},r++));else if(o.startsWith(`[`)){let e=/^\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)$/.exec(o),n=e?e[1]:o,a=e?e[2]:`#`;t.push((0,i.jsx)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer nofollow`,children:n},r++))}else t.push((0,i.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer nofollow`,children:o},r++));n=a.index+o.length}return n<e.length&&t.push(e.slice(n)),t},$M=/^(```|#{1,6}\s|\s*[-*•]\s|\s*\d+\.\s)/,eN=(e,t,n)=>{let r=`cf-md-h cf-md-h--${Math.min(e,6)}`;return e<=2?(0,i.jsx)(`h3`,{class:r,children:t},n):e===3?(0,i.jsx)(`h4`,{class:r,children:t},n):(0,i.jsx)(`h5`,{class:r,children:t},n)},tN=e=>{let t=ZM(e.replace(/\r\n/g,`
|
|
31
31
|
`)).split(`
|
|
32
32
|
`),n=[],r=0,a=0;for(;a<t.length;){let e=t[a];if(e.trim().startsWith("```")){let e=[];for(a++;a<t.length&&!t[a].trim().startsWith("```");)e.push(t[a]),a++;a++,n.push((0,i.jsx)(`pre`,{class:`cf-md-pre`,children:(0,i.jsx)(`code`,{children:e.join(`
|
|
33
|
-
`)})},r++));continue}if(e.trim()===``){a++;continue}let o=/^(#{1,6})\s+(.*)$/.exec(e);if(o){n.push(
|
|
33
|
+
`)})},r++));continue}if(e.trim()===``){a++;continue}let o=/^(#{1,6})\s+(.*)$/.exec(e);if(o){n.push(eN(o[1].length,QM(o[2]),r++)),a++;continue}if(/^\s*[-*•]\s+/.test(e)){let e=[];for(;a<t.length&&/^\s*[-*•]\s+/.test(t[a]);)e.push((0,i.jsx)(`li`,{children:QM(t[a].replace(/^\s*[-*•]\s+/,``))},e.length)),a++;n.push((0,i.jsx)(`ul`,{class:`cf-md-list`,children:e},r++));continue}if(/^\s*\d+\.\s+/.test(e)){let e=[];for(;a<t.length&&/^\s*\d+\.\s+/.test(t[a]);)e.push((0,i.jsx)(`li`,{children:QM(t[a].replace(/^\s*\d+\.\s+/,``))},e.length)),a++;n.push((0,i.jsx)(`ol`,{class:`cf-md-list`,children:e},r++));continue}let s=[e];for(a++;a<t.length&&t[a].trim()!==``&&!$M.test(t[a]);)s.push(t[a]),a++;let c=s.join(` `);if(/:\s*$/.test(c)&&a<t.length&&/^(?:\s*[-*•]\s+|\s*\d+\.\s+)/.test(t[a])){let e=/^(.*[.!?])\s+([^.!?]{2,120}:)$/.exec(c);e&&n.push((0,i.jsx)(`p`,{children:QM(e[1])},r++)),n.push((0,i.jsx)(`p`,{class:`cf-md-list-intro`,children:QM(e?.[2]??c)},r++))}else n.push((0,i.jsx)(`p`,{children:QM(c)},r++))}return n};let nN=!0,rN=null;const iN=e=>{nN=e},aN=()=>{let e=typeof window<`u`?window.AudioContext??window.webkitAudioContext:void 0;if(!e)return null;if(!rN)try{rN=new e}catch{return null}return rN.state===`suspended`&&rN.resume(),rN},oN=(e,t,n,r,i,a)=>{let o=e.createOscillator(),s=e.createGain();o.type=i,o.frequency.setValueAtTime(t,n),o.connect(s),s.connect(e.destination),s.gain.setValueAtTime(1e-4,n),s.gain.exponentialRampToValueAtTime(a,n+.012),s.gain.exponentialRampToValueAtTime(1e-4,n+r),o.start(n),o.stop(n+r+.03)},sN=e=>{if(!nN)return;let t=aN();if(!t)return;let n=t.currentTime;try{e===`open`?(oN(t,523,n,.12,`sine`,.05),oN(t,784,n+.08,.16,`sine`,.05)):e===`send`?oN(t,660,n,.08,`triangle`,.04):e===`receive`&&(oN(t,880,n,.1,`sine`,.045),oN(t,1175,n+.09,.14,`sine`,.045))}catch{}},cN=(e,t)=>e?.status===429?t.errorRateLimit:t.errorGeneric,lN=()=>typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),uN=(e,t)=>{let n=lN(),r={stage:e,durationMs:Math.max(0,n-t)};try{performance.measure(`centrinfo-widget:${e}`,{start:t,end:n})}catch{}return typeof window<`u`&&typeof CustomEvent<`u`&&window.dispatchEvent(new CustomEvent(`centrinfo:performance`,{detail:r})),r},dN=/!?\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,fN=/https?:\/\/[^\s)]+/g,pN=e=>e.replace(/```[\s\S]*?```/g,e=>e.replace(/^```[^\n]*\n?/,``).replace(/```$/,``).trim()),mN=e=>pN(e).replace(dN,`$1`).replace(/`([^`]+)`/g,`$1`).replace(/\*\*([^*]+)\*\*/g,`$1`).replace(/__([^_]+)__/g,`$1`).replace(/(^|[\s([{])\*([^*\n]{1,120})\*(?=[\s.,;:!?)}\]]|$)/g,`$1$2`).replace(/(^|[\s([{])_([^_\n]{1,120})_(?=[\s.,;:!?)}\]]|$)/g,`$1$2`).replace(/^\s{0,3}#{1,6}\s+/gm,``).replace(/^\s{0,3}[-*+]\s+/gm,``).replace(/^\s{0,3}\d+\.\s+/gm,``).replace(/\s+\*/g,` `).replace(/\*\s+/g,` `).replace(/[*_]{2,}/g,``).replace(fN,e=>e.replace(/^https?:\/\//,``).replace(/^www\./,``).replace(/\/$/,``)).replace(/[ \t]+\n/g,`
|
|
34
34
|
`).replace(/\n{3,}/g,`
|
|
35
35
|
|
|
36
|
-
`).replace(/[ \t]{2,}/g,` `).trim(),oN=()=>typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.round(Math.random()*1e9)}`,sN=(e,t)=>{typeof console>`u`||console.warn(`[centrinfo-widget] ${e}`,t??{})},cN=(e,t,n,r,i=1,a,o=!1,s,c)=>{e.current?.pause(),e.current=null,typeof window<`u`&&`speechSynthesis`in window&&window.speechSynthesis.cancel(),t.current=null;let l=()=>{let e=a?.trim();if(!o||!e||typeof window>`u`||!(`speechSynthesis`in window)||typeof SpeechSynthesisUtterance>`u`)return!1;let n=new SpeechSynthesisUtterance(e),r=!1,l=()=>{r||(r=!0,t.current===n&&(t.current=null,c?.()))};return n.rate=i,n.lang=typeof navigator<`u`&&(navigator.languages?.[0]||navigator.language)||`en-US`,n.onend=l,n.onerror=l,t.current=n,s?.(),window.speechSynthesis.cancel(),window.speechSynthesis.speak(n),!0};if(!n||typeof Audio>`u`)return l();let u=new Audio(`data:${r||`audio/mpeg`};base64,${n}`),d=!1,f=()=>{d||(d=!0,e.current===u&&(e.current=null,c?.()))};return u.playbackRate=i,u.onended=f,u.onerror=f,e.current=u,u.play().then(()=>{if(e.current!==u){f();return}s?.(Number.isFinite(u.duration)?u.duration*1e3:void 0)}).catch(()=>{l()||f()}),!0},lN=e=>{try{return e===`none`?null:e===`session`?sessionStorage:localStorage}catch{return null}},uN=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)},dN=e=>{try{let t=e?.split(`.`)[1];if(!t)return;let n=t.replace(/-/g,`+`).replace(/_/g,`/`),r=JSON.parse(atob(n.padEnd(Math.ceil(n.length/4)*4,`=`)));for(let e of[`sub`,`external_user_id`,`user_id`]){let t=r[e];if(typeof t==`string`&&t.trim())return t.trim()}}catch{}},fN=e=>{let t=e.user?.externalId?.trim()||e.user?.userId?.trim()||e.user?.email?.trim().toLowerCase()||dN(e.identityToken)||(e.identityToken||e.getIdentityToken?`authenticated`:`anonymous`);return`${e.token.slice(0,12)}:${e.chatSurface}:${uN(t)}`},pN=e=>`${e.chatSurface}:${oN()}`,mN=e=>e.slice(0,12),hN=e=>`centrinfo:session:${e}`,gN=e=>`centrinfo:visitor:${e}`,_N=(e,t)=>`centrinfo:chat:${e}:${t}`,vN=e=>`centrinfo:history:${e}`,yN=20,bN=720*60*60*1e3,xN=1440*60*1e3,SN=(e,t)=>{try{return JSON.parse(e?.getItem(gN(t))||`{}`)}catch{return{}}},CN=(e,t,n)=>{if(!e)return pN(n);try{let r=hN(t),i=e.getItem(r);if(i)return i;let a=pN(n);return e.setItem(r,a),a}catch{return pN(n)}},wN=(e,t,n)=>{if(!e)return{};try{let r=e.getItem(_N(t,n));return r?JSON.parse(r):{}}catch{return{}}},TN=(e,t,n)=>{let{ts:r,expiresAt:i,messages:a}=wN(e,t,n);return!Array.isArray(a)||typeof i==`number`&&Date.now()>i||typeof r==`number`&&Date.now()-r>bN?[]:a},EN=(e,t,n)=>{let{ts:r,expiresAt:i,messages:a,ended:o}=wN(e,t,n);return!Array.isArray(a)||a.length===0||typeof i==`number`&&Date.now()>i||typeof r==`number`&&Date.now()-r>bN?!1:o===!0||typeof r==`number`&&Date.now()-r>864e5},DN=e=>Number.isFinite(e??NaN)?Math.max(5,Math.min(200,Math.round(e))):50,ON=e=>Number.isFinite(e??NaN)?Math.max(1,Math.min(365,Math.round(e)))*24*60*60*1e3:bN,kN=(e,t,n,r,i,a,o,s)=>{if(e)try{if(!a){e.removeItem(_N(t,n));return}let c=r.filter(e=>!e.pending).slice(-o);if(c.length===0)return;let l=Date.now();e.setItem(_N(t,n),JSON.stringify({ts:l,expiresAt:l+s,messages:c,ended:i}))}catch{}},AN=(e,t)=>{if(!e)return[];try{let n=e.getItem(vN(t)),r=n?JSON.parse(n):[];return Array.isArray(r)?r:[]}catch{return[]}},jN=(e,t,n)=>{if(e)try{e.setItem(vN(t),JSON.stringify(n.slice(0,20)))}catch{}},MN=(e,t)=>{if(e)try{let n=`centrinfo:chat:${t}:`,r=new Set([hN(t),gN(t),vN(t)]),i=[];for(let t=0;t<e.length;t++){let a=e.key(t);a&&(r.has(a)||a.startsWith(n))&&i.push(a)}i.forEach(t=>e.removeItem(t))}catch{}},NN=e=>{let t=(e.find(e=>e.role===`user`&&e.content.trim())?.content||e.find(e=>e.content.trim())?.content||``).trim().replace(/\s+/g,` `);return t.length>60?t.slice(0,60)+`…`:t||`Conversation`},PN=e=>({id:`live:${e.id}`,role:e.type===`chat`||e.type===`ai_resume`?`assistant`:`system`,content:e.content,authorName:e.authorName,liveEventType:e.type,createdAt:e.createdAt}),FN=(e,t,n=!0)=>{let i=(0,r.useRef)(lN(t.persistence)).current,a=fN(t),o=(0,r.useRef)(CN(i,a,t)),s=(0,r.useRef)(null),c=(0,r.useRef)(null),l=(0,r.useRef)(null),u=(0,r.useRef)(void 0),d=(0,r.useRef)(null),f=(0,r.useRef)({}),[p,m]=(0,r.useState)(null),[h,g]=(0,r.useState)(()=>TN(i,a,o.current)),_=(0,r.useRef)(h.length>0),v=(0,r.useRef)(h.some(e=>e.role===`user`)),[y,b]=(0,r.useState)(!1),[x,S]=(0,r.useState)(!1),[C,w]=(0,r.useState)(()=>EN(i,a,o.current)),[T,E]=(0,r.useState)(()=>SN(i,a)),[D,O]=(0,r.useState)(()=>AN(i,a)),[k,A]=(0,r.useState)(null),[j,M]=(0,r.useState)([]),[N,P]=(0,r.useState)(`ai`),[ee,te]=(0,r.useState)(void 0),[ne,re]=(0,r.useState)(void 0),ie=(0,r.useRef)(new Date().toISOString()),ae=(0,r.useRef)(void 0),oe=(0,r.useRef)(!1),se=(0,r.useRef)(0),ce=(0,r.useRef)(T);(0,r.useEffect)(()=>{ce.current=T},[T]);let le=p?.memoryEnabled!==!1,ue=DN(p?.memoryMessageCap),F=ON(p?.memoryRetentionDays),I=(0,r.useCallback)(()=>{s.current?.abort(),MN(i,a),MN(i,mN(t.token));let e=pN(t);o.current=e;try{i?.setItem(hN(a),e)}catch{}A(null),M([]),w(!1),O([]),E({}),P(`ai`),te(void 0),re(void 0),ie.current=new Date().toISOString(),g(p?[{id:oN(),role:`assistant`,content:p.greeting,availableActions:p.availableActions}]:[])},[i,a,t.token,p]),de=(0,r.useCallback)(e=>{try{i?.setItem(gN(a),JSON.stringify(e))}catch{}},[i,a]),fe=(0,r.useCallback)(t=>{let n=(t.email??``).trim().toLowerCase(),r=(ce.current.email??``).trim().toLowerCase();n&&r&&n!==r&&I();let i={};t.email?.trim()&&(i.email=t.email.trim()),t.phone?.trim()&&(i.phone=t.phone.trim());let a=[t.firstName,t.lastName].filter(e=>!!e?.trim()).join(` `).trim()||t.name?.trim()||``;a&&(i.name=a),Object.keys(i).length>0&&E(e=>{let t={...i,...e};return de(t),t}),e.identify(o.current,t).catch(()=>{})},[e,de,I]),pe=(0,r.useCallback)(e=>{m(e),g(t=>{if(t.length===0)return[{id:oN(),role:`assistant`,content:e.greeting,availableActions:e.availableActions}];let n=t.some(e=>e.role===`user`),r=t[0];return!n&&r?.role===`assistant`?[{...r,content:e.greeting,availableActions:e.availableActions},...t.slice(1)]:t})},[]);(0,r.useEffect)(()=>{if(p?.memoryEnabled===!1){try{i?.removeItem(_N(a,o.current))}catch{}jN(i,a,[]),O([]),A(null),M([]),g(e=>_.current?(_.current=!1,p?[{id:oN(),role:`assistant`,content:p.greeting,availableActions:p.availableActions}]:[]):e)}},[p,i,a]);let me=(0,r.useCallback)(async()=>{pe(await e.bootstrap())},[pe,e]);(0,r.useEffect)(()=>{let t=!0,n=e=>e.messages.map(e=>({id:e.id,role:e.role,content:e.content,authorName:e.authorName,liveEventType:e.messageType,sources:e.sources,visualization:e.visualization,createdAt:e.createdAt}));return e.history().then(e=>{if(!t||e.conversations.length===0)return;let r=e.conversations.map(e=>({sessionId:e.sessionId,ts:Date.parse(e.lastSeenAt)||Date.now(),title:e.title,ended:e.ended}));for(let t of e.conversations)kN(i,a,t.sessionId,n(t),t.ended,!0,ue,F);jN(i,a,r),O(r);let s=e.conversations.find(t=>t.sessionId===e.activeSessionId);if(!s||v.current)return;let c=n(s);o.current=s.sessionId,_.current=c.length>0;try{i?.setItem(hN(a),s.sessionId)}catch{}let l=c[c.length-1]?.createdAt;l&&(ie.current=l),w(s.ended),g(c)}).catch(()=>{}),()=>{t=!1}},[ue,F,a,i,e]),(0,r.useEffect)(()=>{let n=!0;return e.bootstrap().then(e=>{n&&pe(e)}),t.user&&fe(t.user),()=>{n=!1}},[pe,e]),(0,r.useEffect)(()=>{let e=t.configRefreshSeconds;if(!n||e<=0||typeof window>`u`)return;let r=!0,i=!1,a=Math.max(10,e)*1e3,o=()=>typeof document>`u`||document.visibilityState!==`hidden`,s=async()=>{if(!(!r||i||!o())){i=!0;try{await me()}catch{}finally{i=!1}}};s();let c=window.setInterval(s,a),l=()=>void s(),u=()=>void s();return window.addEventListener(`focus`,l),document?.addEventListener?.(`visibilitychange`,u),()=>{r=!1,window.clearInterval(c),window.removeEventListener(`focus`,l),document?.removeEventListener?.(`visibilitychange`,u)}},[n,t.configRefreshSeconds,me]),(0,r.useEffect)(()=>{kN(i,a,o.current,h,C,le,ue,F)},[h,C,i,a,le,ue,F]),(0,r.useEffect)(()=>{if(C||k)return;let n=!0,r=!1,i=async()=>{if(!r){r=!0;try{let r=await e.liveEvents(o.current,ie.current);if(!n)return;if(P(r.mode),te(r.assignedAgentName||void 0),re(r.agentTyping?r.agentTypingName||r.assignedAgentName||`Agent`:void 0),r.conversationEnded){w(!0),P(`ai`),te(void 0),re(void 0),g(e=>e.some(e=>e.id===`live:conversation-ended`)?e:[...e,{id:`live:conversation-ended`,role:`system`,content:t.strings.conversationEnded,liveEventType:`conversation_ended`,createdAt:new Date().toISOString()}]);return}if(r.events.length>0){let e=ie.current,t=Date.parse(e),n=r.events.map(n=>{let r=Date.parse(n.createdAt);return Number.isFinite(r)&&r>t&&(t=r,e=n.createdAt),PN(n)});ie.current=e,g(e=>{let t=new Set(e.map(e=>e.id)),r=n.filter(e=>!t.has(e.id));return r.length>0?[...e,...r]:e}),n.some(e=>e.role===`assistant`)&&eN(`receive`)}}catch{}finally{r=!1}}};i();let a=window.setInterval(i,2200);return()=>{n=!1,window.clearInterval(a)}},[t.strings.conversationEnded,e,C,k]),(0,r.useEffect)(()=>{if(!le){jN(i,a,[]),O(e=>e.length>0?[]:e);return}h.some(e=>e.role===`user`)&&O(e=>{let t=o.current,n=[{sessionId:t,ts:Date.now(),title:NN(h),ended:C},...e.filter(e=>e.sessionId!==t)];return jN(i,a,n),n.slice(0,20)})},[h,C,i,a,le]);let he=(0,r.useCallback)((e,t)=>{g(n=>n.map(n=>n.id===e?{...n,...t}:n))},[]),ge=(0,r.useCallback)(()=>{u.current!==void 0&&typeof window<`u`&&window.clearInterval(u.current),u.current=void 0},[]),L=(0,r.useCallback)((e,t)=>{ge(),d.current===e&&(d.current=null),he(e,{content:t,pending:!1,streaming:!1})},[ge,he]),R=(0,r.useCallback)((e,t,n)=>{let r=t.trim();if(!r||typeof window>`u`){L(e,r);return}ge(),d.current=e;let i=r.match(/\S+\s*/g)??[r],a=n&&n>0?n:i.length*95,o=Math.max(28,Math.min(150,a/Math.max(i.length,1))),s=0;he(e,{content:``,pending:!1,streaming:!0}),u.current=window.setInterval(()=>{s+=1,he(e,{content:i.slice(0,s).join(``),pending:!1,streaming:s<i.length}),s>=i.length&&(ge(),d.current===e&&(d.current=null),he(e,{content:r,pending:!1,streaming:!1}))},o)},[ge,L,he]),z=(0,r.useCallback)(()=>{let e=d.current;ge(),d.current=null,e&&he(e,{pending:!1,streaming:!1})},[ge,he]),B=(0,r.useCallback)(t=>{if(C||k||N===`ai`||typeof window>`u`)return;if(ae.current!==void 0&&window.clearTimeout(ae.current),!t){if(!oe.current)return;oe.current=!1,se.current=0,e.typing(o.current,!1).catch(()=>{});return}let n=Date.now();(!oe.current||n-se.current>2500)&&(oe.current=!0,se.current=n,e.typing(o.current,!0).catch(()=>{})),ae.current=window.setTimeout(()=>{oe.current&&(oe.current=!1,se.current=0,e.typing(o.current,!1).catch(()=>{}))},1600)},[e,C,k,N]);(0,r.useEffect)(()=>()=>{ae.current!==void 0&&typeof window<`u`&&window.clearTimeout(ae.current)},[]),(0,r.useEffect)(()=>()=>ge(),[ge]);let _e=(0,r.useCallback)((n,r,i={})=>{z(),b(!0);let a=new AbortController;s.current=a;let u=!!(p?.allowVoiceInput&&p?.voiceOutputEnabled&&p.talkbackMode!==`text`),d=!!(i.forceVoicePlayback&&u);e.stream(n,o.current,{voicePlaybackRequested:!!i.forceVoicePlayback,signal:a.signal,onChunk:e=>{d||(i.forceVoicePlayback&&e&&(f.current[r]=!0),g(t=>t.map(t=>t.id===r?{...t,content:t.content+e,pending:!1,streaming:!0}:t)))}}).then(e=>{if(e.liveMode&&(P(e.liveMode),te(e.assignedAgentName||void 0)),e.liveMode&&e.liveMode!==`ai`&&!e.answer.trim()){g(e=>e.filter(e=>e.id!==r));return}let n=!!f.current[r];delete f.current[r];let a=!!(i.forceVoicePlayback&&u&&e.audioBase64&&e.answer.trim()&&!n);if(g(n=>n.map(n=>n.id===r?{...n,content:a?``:e.answer||n.content||t.strings.emptyReply,pending:!1,streaming:a,error:!1,retryText:void 0,sources:e.sources,suggestedReplies:e.suggestedReplies,availableActions:e.availableActions,handoffOffered:e.handoffOffered,requestedContactFields:e.requestedContactFields,visualization:e.visualization}:n)),eN(`receive`),i.forceVoicePlayback&&!e.audioBase64&&sN(u?`Talkback expected backend TTS audio, but the chat response did not include audioBase64.`:`Talkback voice was requested, but the loaded widget token config does not enable provider TTS.`,{voiceOutputEnabled:p?.voiceOutputEnabled,talkbackMode:p?.talkbackMode,voiceProvider:p?.voiceProvider,hasAudioBase64:!!e.audioBase64}),i.forceVoicePlayback){let t=cN(c,l,e.audioBase64,e.mimeType,p?.voiceSpeed??1,e.answer,!0,t=>{S(!0),a&&R(r,e.answer,t)},()=>{S(!1),a&&L(r,e.answer)});a&&!t&&L(r,e.answer)}e.answer&&t.onMessage?.({role:`assistant`,content:e.answer}),e.handoffOffered&&t.onHandoff?.(),e.conversationEnded&&w(!0)}).catch(e=>{if(a.signal.aborted){delete f.current[r],he(r,{pending:!1,streaming:!1});return}delete f.current[r],he(r,{content:tN(e,t.strings),pending:!1,streaming:!1,error:!0,retryText:n})}).finally(()=>{delete f.current[r],b(!1),s.current=null})},[e,t,he,p?.allowVoiceInput,p?.talkbackMode,p?.voiceOutputEnabled,p?.voiceSpeed,z]),V=(0,r.useCallback)((e,n={})=>{let r=e.trim(),{imageUrl:i,attachmentName:a,attachmentText:o,forceVoicePlayback:s,userMessageId:c}=n;if(!r&&!i&&!o||y||C)return;v.current=!0;let l=r;o?l=`${r}\n\n[Attached file${a?` "${a}"`:``}]:\n${o}`.trim():!l&&i&&(l=i);let u={id:c||oN(),role:`user`,content:r,imageUrl:i,attachmentName:a},d=oN();g(e=>[...c&&e.some(e=>e.id===c)?e.map(e=>e.id===c?{...e,content:r,pending:!1,streaming:!1,imageUrl:i,attachmentName:a}:e):[...e,u],{id:d,role:`assistant`,content:``,pending:!0}]),eN(`send`),t.onMessage?.({role:`user`,content:l}),_e(l,d,{forceVoicePlayback:s})},[y,C,t,_e]),ve=(0,r.useCallback)(()=>s.current?.abort(),[]),ye=(0,r.useCallback)(()=>{z(),c.current?.pause(),c.current=null,typeof window<`u`&&`speechSynthesis`in window&&window.speechSynthesis.cancel(),l.current=null,S(!1)},[z]),be=(0,r.useCallback)(t=>{let n=aN(t);if(!n)return Promise.resolve(!1);let r=!!(p?.allowVoiceInput&&p?.voiceOutputEnabled&&p.talkbackMode!==`text`),i=(e,t)=>new Promise(r=>{let i=!1;cN(c,l,e,t,p?.voiceSpeed??1,n,!0,()=>{i=!0,S(!0)},()=>{S(!1),r(i)})||(S(!1),r(!1))});return r?e.speak(n).then(e=>e.audioBase64?i(e.audioBase64,e.mimeType):(sN(`Talkback prompt TTS did not return provider audio.`,{providerReady:e.providerReady,message:e.message,voiceProvider:p?.voiceProvider,voiceOutputEnabled:p?.voiceOutputEnabled,talkbackMode:p?.talkbackMode}),i())).catch(e=>(sN(`Talkback prompt TTS request failed before audio playback.`,{error:e instanceof Error?e.message:String(e),voiceProvider:p?.voiceProvider,voiceOutputEnabled:p?.voiceOutputEnabled,talkbackMode:p?.talkbackMode}),i())):(sN(`Talkback prompt wanted voice, but the loaded widget token config has provider TTS disabled.`,{voiceOutputEnabled:p?.voiceOutputEnabled,talkbackMode:p?.talkbackMode,voiceProvider:p?.voiceProvider}),i())},[p?.allowVoiceInput,p?.talkbackMode,p?.voiceOutputEnabled,p?.voiceSpeed,e]),H=(0,r.useCallback)((e,t)=>{y||C||!t||(he(e,{content:``,pending:!0,streaming:!1,error:!1}),eN(`send`),_e(t,e))},[y,C,he,_e]),U=(0,r.useCallback)((t,n,r)=>{he(t,{feedback:n});let i=h.findIndex(e=>e.id===t),a=i>=0?h[i]?.content:void 0,s;for(let e=i-1;e>=0;e--)if(h[e]?.role===`user`){s=h[e]?.content;break}e.sendFeedback({sessionId:o.current,messageId:t,rating:n,comment:r,question:s,answer:a}).catch(()=>{})},[e,he,h]),xe=(0,r.useCallback)(async(n,r,i={})=>{t.onAction?.(n);let a=await e.action(n,{sessionId:o.current,...r}),s={};return i.name?.trim()&&(s.name=i.name.trim()),i.email?.trim()&&(s.email=i.email.trim()),i.phone?.trim()&&(s.phone=i.phone.trim()),Object.keys(s).length>0&&(E(e=>{let t={...e,...s};return de(t),t}),s.email&&n!==`contact`&&e.action(`contact`,{sessionId:o.current,...s}).catch(()=>{})),eN(`receive`),a},[e,t,de]),Se=(0,r.useCallback)(e=>{let t=e.trim();t&&g(e=>e.some(e=>e.role===`assistant`&&e.content===t)?e:[...e,{id:oN(),role:`assistant`,content:t}])},[]),Ce=(0,r.useCallback)(e=>{v.current=!0;let t=oN();return g(n=>[...n,{id:t,role:`user`,content:e.trim(),pending:!0}]),t},[]),we=(0,r.useCallback)((e,t)=>{g(n=>n.map(n=>n.id===e?{...n,...t}:n))},[]),W=(0,r.useCallback)(e=>{g(t=>t.filter(t=>t.id!==e))},[]),Te=(0,r.useCallback)((t,n)=>{e.sendFeedback({sessionId:o.current,messageId:`__csat__`,rating:t,comment:n}).catch(()=>{})},[e]),G=(0,r.useCallback)((t,n,r,i)=>e.transcribe(t,n,r,i),[e]),K=(0,r.useCallback)((t,n,r)=>e.extract(t,n,r),[e]),q=(0,r.useCallback)(t=>e.searchGifs(t),[e]),Ee=(0,r.useCallback)((t,n)=>e.demoSlots(t,n),[e]),De=(0,r.useCallback)(e=>V(``,{imageUrl:e}),[V]),J=t.demo||!!t.gifApiKey,Oe=(0,r.useCallback)(()=>{s.current?.abort(),w(!0),e.endConversation(o.current).catch(()=>{})},[e]),ke=(0,r.useCallback)(()=>{s.current?.abort();let e=pN(t);o.current=e;try{i?.setItem(hN(a),e)}catch{}A(null),M([]),w(!1),P(`ai`),te(void 0),re(void 0),ie.current=new Date().toISOString(),g(p?[{id:oN(),role:`assistant`,content:p.greeting,availableActions:p.availableActions}]:[])},[i,a,p]),Ae=(0,r.useCallback)(e=>{if(le){if(e===o.current){A(null);return}M(TN(i,a,e)),A(e)}},[i,a,le]),je=(0,r.useCallback)(()=>{A(null),M([])},[]);return{persona:p,messages:h,sending:y,assistantSpeaking:x,visitor:T,starters:t.starters.length>0?t.starters:p?.starterQuestions??[],featuredLinks:p?.featuredLinks??[],hasEmail:!!T.email,liveMode:N,assignedAgentName:ee,agentTypingName:ne,send:V,sendGif:De,notifyTyping:B,stop:ve,retry:H,rateMessage:U,injectAssistant:Se,appendUserDraft:Ce,patchMessage:we,removeMessage:W,submitCsat:Te,submitForm:xe,transcribe:G,extract:K,searchGifs:q,demoSlots:Ee,gifEnabled:J,identify:fe,ended:C,endConversation:Oe,startNew:ke,history:le?D:[],viewingSessionId:k,viewMessages:j,openConversation:Ae,closeHistoryView:je,shutdown:I,stopSpeaking:ye,speakAssistantText:be}},IN=`https://api.accurixtech.com`,LN=e=>{if(!e||typeof e.token!=`string`||e.token.length===0)throw Error("[centrinfo-widget] `token` is required — pass your pub_* token to Centrinfo.init({ token }).");return{token:e.token,chatSurface:e.chatSurface??`floating`,analyticsContextToken:e.analyticsContextToken,identityToken:e.identityToken,getIdentityToken:e.getIdentityToken,apiBaseUrl:(e.apiBaseUrl??`https://api.accurixtech.com`).replace(/\/$/,``),accentColor:e.accentColor,themeTokens:e.themeTokens,agentName:e.agentName?.trim()||void 0,agentAvatarUrl:e.agentAvatarUrl?.trim()||void 0,launcherIcon:e.launcherIcon,gifApiKey:e.gifApiKey,theme:e.theme??`auto`,openByDefault:e.openByDefault??!1,sound:e.sound??!0,starters:e.starters??[],strings:zM(e.labels),persistence:e.persistence??`local`,attachments:e.attachments??!0,zIndex:e.zIndex??2147483e3,demo:e.demo??!1,preview:e.preview??!1,alignment:e.alignment===`left`?`left`:`right`,horizontalPadding:typeof e.horizontalPadding==`number`?e.horizontalPadding:20,verticalPadding:typeof e.verticalPadding==`number`?e.verticalPadding:20,hideDefaultLauncher:e.hideDefaultLauncher??!1,customLauncherSelector:e.customLauncherSelector,sessionDurationMinutes:typeof e.sessionDurationMinutes==`number`?e.sessionDurationMinutes:0,configRefreshSeconds:typeof e.configRefreshSeconds==`number`?e.configRefreshSeconds:30,proactiveMessage:e.proactiveMessage,proactiveDelaySeconds:typeof e.proactiveDelaySeconds==`number`?e.proactiveDelaySeconds:5,proactiveOnPaths:e.proactiveOnPaths,csat:e.csat??!0,user:e.user,onOpen:e.onOpen,onClose:e.onClose,onShow:e.onShow,onHide:e.onHide,onUnreadChange:e.onUnreadChange,onMessage:e.onMessage,onAction:e.onAction,onHandoff:e.onHandoff}};Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return JM}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return HM}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return MM}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return PM}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return EM}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return yM}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return ZM}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return IM}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return TM}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return FN}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return VM}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return kM}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return eN}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return RM}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return LN}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return FM}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return d}});
|
|
36
|
+
`).replace(/[ \t]{2,}/g,` `).trim(),hN=()=>typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.round(Math.random()*1e9)}`,gN=(e,t)=>{typeof console>`u`||console.warn(`[centrinfo-widget] ${e}`,t??{})},_N=(e,t,n,r,i=1,a,o=!1,s,c)=>{e.current?.pause(),e.current=null,typeof window<`u`&&`speechSynthesis`in window&&window.speechSynthesis.cancel(),t.current=null;let l=()=>{let e=a?.trim();if(!o||!e||typeof window>`u`||!(`speechSynthesis`in window)||typeof SpeechSynthesisUtterance>`u`)return!1;let n=new SpeechSynthesisUtterance(e),r=!1,l=()=>{r||(r=!0,t.current===n&&(t.current=null,c?.()))};return n.rate=i,n.lang=typeof navigator<`u`&&(navigator.languages?.[0]||navigator.language)||`en-US`,n.onend=l,n.onerror=l,t.current=n,s?.(),window.speechSynthesis.cancel(),window.speechSynthesis.speak(n),!0};if(!n||typeof Audio>`u`)return l();let u=new Audio(`data:${r||`audio/mpeg`};base64,${n}`),d=!1,f=()=>{d||(d=!0,e.current===u&&(e.current=null,c?.()))};return u.playbackRate=i,u.onended=f,u.onerror=f,e.current=u,u.play().then(()=>{if(e.current!==u){f();return}s?.(Number.isFinite(u.duration)?u.duration*1e3:void 0)}).catch(()=>{l()||f()}),!0},vN=e=>{try{return e===`none`?null:e===`session`?sessionStorage:localStorage}catch{return null}},yN=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)},bN=e=>{try{let t=e?.split(`.`)[1];if(!t)return;let n=t.replace(/-/g,`+`).replace(/_/g,`/`),r=JSON.parse(atob(n.padEnd(Math.ceil(n.length/4)*4,`=`)));for(let e of[`sub`,`external_user_id`,`user_id`]){let t=r[e];if(typeof t==`string`&&t.trim())return t.trim()}}catch{}},xN=e=>{let t=e.user?.externalId?.trim()||e.user?.userId?.trim()||e.user?.email?.trim().toLowerCase()||bN(e.identityToken)||(e.identityToken||e.getIdentityToken?`authenticated`:`anonymous`);return`${e.token.slice(0,12)}:${e.chatSurface}:${yN(t)}`},SN=e=>`${e.chatSurface}:${hN()}`,CN=e=>e.slice(0,12),wN=e=>`centrinfo:session:${e}`,TN=e=>`centrinfo:visitor:${e}`,EN=(e,t)=>`centrinfo:chat:${e}:${t}`,DN=e=>`centrinfo:history:${e}`,ON=20,kN=720*60*60*1e3,AN=1440*60*1e3,jN=(e,t)=>{try{return JSON.parse(e?.getItem(TN(t))||`{}`)}catch{return{}}},MN=(e,t,n)=>{if(!e)return SN(n);try{let r=wN(t),i=e.getItem(r);if(i)return i;let a=SN(n);return e.setItem(r,a),a}catch{return SN(n)}},NN=(e,t,n)=>{if(!e)return{};try{let r=e.getItem(EN(t,n));return r?JSON.parse(r):{}}catch{return{}}},PN=(e,t,n)=>{let{ts:r,expiresAt:i,messages:a}=NN(e,t,n);return!Array.isArray(a)||typeof i==`number`&&Date.now()>i||typeof r==`number`&&Date.now()-r>kN?[]:a},FN=(e,t,n)=>{let{ts:r,expiresAt:i,messages:a,ended:o}=NN(e,t,n);return!Array.isArray(a)||a.length===0||typeof i==`number`&&Date.now()>i||typeof r==`number`&&Date.now()-r>kN?!1:o===!0||typeof r==`number`&&Date.now()-r>864e5},IN=e=>Number.isFinite(e??NaN)?Math.max(5,Math.min(200,Math.round(e))):50,LN=e=>Number.isFinite(e??NaN)?Math.max(1,Math.min(365,Math.round(e)))*24*60*60*1e3:kN,RN=(e,t,n,r,i,a,o,s)=>{if(e)try{if(!a){e.removeItem(EN(t,n));return}let c=r.filter(e=>!e.pending).slice(-o);if(c.length===0)return;let l=Date.now();e.setItem(EN(t,n),JSON.stringify({ts:l,expiresAt:l+s,messages:c,ended:i}))}catch{}},zN=(e,t)=>{if(!e)return[];try{let n=e.getItem(DN(t)),r=n?JSON.parse(n):[];return Array.isArray(r)?r:[]}catch{return[]}},BN=(e,t,n)=>{if(e)try{e.setItem(DN(t),JSON.stringify(n.slice(0,20)))}catch{}},VN=(e,t)=>{if(e)try{let n=`centrinfo:chat:${t}:`,r=new Set([wN(t),TN(t),DN(t)]),i=[];for(let t=0;t<e.length;t++){let a=e.key(t);a&&(r.has(a)||a.startsWith(n))&&i.push(a)}i.forEach(t=>e.removeItem(t))}catch{}},HN=e=>{let t=(e.find(e=>e.role===`user`&&e.content.trim())?.content||e.find(e=>e.content.trim())?.content||``).trim().replace(/\s+/g,` `);return t.length>60?t.slice(0,60)+`…`:t||`Conversation`},UN=e=>({id:`live:${e.id}`,role:e.type===`chat`||e.type===`ai_resume`?`assistant`:`system`,content:e.content,authorName:e.authorName,liveEventType:e.type,createdAt:e.createdAt}),WN=(e,t,n=!0)=>{let i=(0,r.useRef)(vN(t.persistence)).current,a=xN(t),o=(0,r.useRef)(MN(i,a,t)),s=(0,r.useRef)(null),c=(0,r.useRef)(null),l=(0,r.useRef)(null),u=(0,r.useRef)(void 0),d=(0,r.useRef)(null),f=(0,r.useRef)({}),[p,m]=(0,r.useState)(null),[h,g]=(0,r.useState)(()=>PN(i,a,o.current)),_=(0,r.useRef)(h.length>0),v=(0,r.useRef)(h.some(e=>e.role===`user`)),[y,b]=(0,r.useState)(!1),[x,S]=(0,r.useState)(!1),[C,w]=(0,r.useState)(()=>FN(i,a,o.current)),[T,E]=(0,r.useState)(()=>jN(i,a)),[D,O]=(0,r.useState)(()=>zN(i,a)),[k,A]=(0,r.useState)(null),[j,M]=(0,r.useState)([]),[N,P]=(0,r.useState)(`ai`),[ee,te]=(0,r.useState)(void 0),[ne,re]=(0,r.useState)(void 0),ie=(0,r.useRef)(new Date().toISOString()),ae=(0,r.useRef)(void 0),oe=(0,r.useRef)(!1),se=(0,r.useRef)(0),ce=(0,r.useRef)(T);(0,r.useEffect)(()=>{ce.current=T},[T]);let le=p?.memoryEnabled!==!1,ue=IN(p?.memoryMessageCap),F=LN(p?.memoryRetentionDays),I=(0,r.useCallback)(()=>{s.current?.abort(),VN(i,a),VN(i,CN(t.token));let e=SN(t);o.current=e;try{i?.setItem(wN(a),e)}catch{}A(null),M([]),w(!1),O([]),E({}),P(`ai`),te(void 0),re(void 0),ie.current=new Date().toISOString(),g(p?[{id:hN(),role:`assistant`,content:p.greeting,availableActions:p.availableActions,actions:p.actions}]:[])},[i,a,t.token,p]),de=(0,r.useCallback)(e=>{try{i?.setItem(TN(a),JSON.stringify(e))}catch{}},[i,a]),fe=(0,r.useCallback)(t=>{let n=(t.email??``).trim().toLowerCase(),r=(ce.current.email??``).trim().toLowerCase();n&&r&&n!==r&&I();let i={};t.email?.trim()&&(i.email=t.email.trim()),t.phone?.trim()&&(i.phone=t.phone.trim());let a=[t.firstName,t.lastName].filter(e=>!!e?.trim()).join(` `).trim()||t.name?.trim()||``;a&&(i.name=a),Object.keys(i).length>0&&E(e=>{let t={...i,...e};return de(t),t}),e.identify(o.current,t).catch(()=>{})},[e,de,I]),pe=(0,r.useCallback)(e=>{m(e),g(t=>{if(t.length===0)return[{id:hN(),role:`assistant`,content:e.greeting,availableActions:e.availableActions,actions:e.actions}];let n=t.some(e=>e.role===`user`),r=t[0];return!n&&r?.role===`assistant`?[{...r,content:e.greeting,availableActions:e.availableActions,actions:e.actions},...t.slice(1)]:t})},[]);(0,r.useEffect)(()=>{if(p?.memoryEnabled===!1){try{i?.removeItem(EN(a,o.current))}catch{}BN(i,a,[]),O([]),A(null),M([]),g(e=>_.current?(_.current=!1,p?[{id:hN(),role:`assistant`,content:p.greeting,availableActions:p.availableActions,actions:p.actions}]:[]):e)}},[p,i,a]);let me=(0,r.useCallback)(async()=>{pe(await e.bootstrap())},[pe,e]);(0,r.useEffect)(()=>{let t=!0,n=e=>e.messages.map(e=>({id:e.id,role:e.role,content:e.content,authorName:e.authorName,liveEventType:e.messageType,sources:e.sources,visualization:e.visualization,artifacts:e.artifacts,createdAt:e.createdAt}));return e.history().then(e=>{if(!t||e.conversations.length===0)return;let r=e.conversations.map(e=>({sessionId:e.sessionId,ts:Date.parse(e.lastSeenAt)||Date.now(),title:e.title,ended:e.ended}));for(let t of e.conversations)RN(i,a,t.sessionId,n(t),t.ended,!0,ue,F);BN(i,a,r),O(r);let s=e.conversations.find(t=>t.sessionId===e.activeSessionId);if(!s||v.current)return;let c=n(s);o.current=s.sessionId,_.current=c.length>0;try{i?.setItem(wN(a),s.sessionId)}catch{}let l=c[c.length-1]?.createdAt;l&&(ie.current=l),w(s.ended),g(c)}).catch(()=>{}),()=>{t=!1}},[ue,F,a,i,e]),(0,r.useEffect)(()=>{let n=!0;return e.bootstrap().then(e=>{n&&pe(e)}),t.user&&fe(t.user),()=>{n=!1}},[pe,e]),(0,r.useEffect)(()=>{let e=t.configRefreshSeconds;if(!n||e<=0||typeof window>`u`)return;let r=!0,i=!1,a=Math.max(10,e)*1e3,o=()=>typeof document>`u`||document.visibilityState!==`hidden`,s=async()=>{if(!(!r||i||!o())){i=!0;try{await me()}catch{}finally{i=!1}}};s();let c=window.setInterval(s,a),l=()=>void s(),u=()=>void s();return window.addEventListener(`focus`,l),document?.addEventListener?.(`visibilitychange`,u),()=>{r=!1,window.clearInterval(c),window.removeEventListener(`focus`,l),document?.removeEventListener?.(`visibilitychange`,u)}},[n,t.configRefreshSeconds,me]),(0,r.useEffect)(()=>{RN(i,a,o.current,h,C,le,ue,F)},[h,C,i,a,le,ue,F]),(0,r.useEffect)(()=>{if(C||k)return;let n=!0,r=!1,i=async()=>{if(!r){r=!0;try{let r=await e.liveEvents(o.current,ie.current);if(!n)return;if(P(r.mode),te(r.assignedAgentName||void 0),re(r.agentTyping?r.agentTypingName||r.assignedAgentName||`Agent`:void 0),r.conversationEnded){w(!0),P(`ai`),te(void 0),re(void 0),g(e=>e.some(e=>e.id===`live:conversation-ended`)?e:[...e,{id:`live:conversation-ended`,role:`system`,content:t.strings.conversationEnded,liveEventType:`conversation_ended`,createdAt:new Date().toISOString()}]);return}if(r.events.length>0){let e=ie.current,t=Date.parse(e),n=r.events.map(n=>{let r=Date.parse(n.createdAt);return Number.isFinite(r)&&r>t&&(t=r,e=n.createdAt),UN(n)});ie.current=e,g(e=>{let t=new Set(e.map(e=>e.id)),r=n.filter(e=>!t.has(e.id));return r.length>0?[...e,...r]:e}),n.some(e=>e.role===`assistant`)&&sN(`receive`)}}catch{}finally{r=!1}}};i();let a=window.setInterval(i,2200);return()=>{n=!1,window.clearInterval(a)}},[t.strings.conversationEnded,e,C,k]),(0,r.useEffect)(()=>{if(!le){BN(i,a,[]),O(e=>e.length>0?[]:e);return}h.some(e=>e.role===`user`)&&O(e=>{let t=o.current,n=[{sessionId:t,ts:Date.now(),title:HN(h),ended:C},...e.filter(e=>e.sessionId!==t)];return BN(i,a,n),n.slice(0,20)})},[h,C,i,a,le]);let he=(0,r.useCallback)((e,t)=>{g(n=>n.map(n=>n.id===e?{...n,...t}:n))},[]),ge=(0,r.useCallback)(()=>{u.current!==void 0&&typeof window<`u`&&window.clearInterval(u.current),u.current=void 0},[]),L=(0,r.useCallback)((e,t)=>{ge(),d.current===e&&(d.current=null),he(e,{content:t,pending:!1,streaming:!1})},[ge,he]),R=(0,r.useCallback)((e,t,n)=>{let r=t.trim();if(!r||typeof window>`u`){L(e,r);return}ge(),d.current=e;let i=r.match(/\S+\s*/g)??[r],a=n&&n>0?n:i.length*95,o=Math.max(28,Math.min(150,a/Math.max(i.length,1))),s=0;he(e,{content:``,pending:!1,streaming:!0}),u.current=window.setInterval(()=>{s+=1,he(e,{content:i.slice(0,s).join(``),pending:!1,streaming:s<i.length}),s>=i.length&&(ge(),d.current===e&&(d.current=null),he(e,{content:r,pending:!1,streaming:!1}))},o)},[ge,L,he]),z=(0,r.useCallback)(()=>{let e=d.current;ge(),d.current=null,e&&he(e,{pending:!1,streaming:!1})},[ge,he]),B=(0,r.useCallback)(t=>{if(C||k||N===`ai`||typeof window>`u`)return;if(ae.current!==void 0&&window.clearTimeout(ae.current),!t){if(!oe.current)return;oe.current=!1,se.current=0,e.typing(o.current,!1).catch(()=>{});return}let n=Date.now();(!oe.current||n-se.current>2500)&&(oe.current=!0,se.current=n,e.typing(o.current,!0).catch(()=>{})),ae.current=window.setTimeout(()=>{oe.current&&(oe.current=!1,se.current=0,e.typing(o.current,!1).catch(()=>{}))},1600)},[e,C,k,N]);(0,r.useEffect)(()=>()=>{ae.current!==void 0&&typeof window<`u`&&window.clearTimeout(ae.current)},[]),(0,r.useEffect)(()=>()=>ge(),[ge]);let _e=(0,r.useCallback)((n,r,i={})=>{z(),b(!0);let a=lN(),u=!1,d=new AbortController;s.current=d;let m=!!(p?.allowVoiceInput&&p?.voiceOutputEnabled&&p.talkbackMode!==`text`),h=!!(i.forceVoicePlayback&&m);e.stream(n,o.current,{voicePlaybackRequested:!!i.forceVoicePlayback,signal:d.signal,onChunk:e=>{e&&!u&&(u=!0,uN(`data-first-chunk`,a)),!h&&(i.forceVoicePlayback&&e&&(f.current[r]=!0),g(t=>t.map(t=>t.id===r?{...t,content:t.content+e,pending:!1,streaming:!0}:t)))}}).then(e=>{if(e.liveMode&&(P(e.liveMode),te(e.assignedAgentName||void 0)),e.liveMode&&e.liveMode!==`ai`&&!e.answer.trim()){g(e=>e.filter(e=>e.id!==r));return}let n=!!f.current[r];delete f.current[r];let a=!!(i.forceVoicePlayback&&m&&e.audioBase64&&e.answer.trim()&&!n);if(g(n=>n.map(n=>n.id===r?{...n,content:a?``:e.answer||n.content||t.strings.emptyReply,pending:!1,streaming:a,error:!1,retryText:void 0,sources:e.sources,suggestedReplies:e.suggestedReplies,availableActions:e.availableActions,actions:e.actions,selectedAction:e.selectedAction,handoffOffered:e.handoffOffered,requestedContactFields:e.requestedContactFields,visualization:e.visualization,artifacts:e.artifacts}:n)),sN(`receive`),i.forceVoicePlayback&&!e.audioBase64&&gN(m?`Talkback expected backend TTS audio, but the chat response did not include audioBase64.`:`Talkback voice was requested, but the loaded widget token config does not enable provider TTS.`,{voiceOutputEnabled:p?.voiceOutputEnabled,talkbackMode:p?.talkbackMode,voiceProvider:p?.voiceProvider,hasAudioBase64:!!e.audioBase64}),i.forceVoicePlayback){let t=_N(c,l,e.audioBase64,e.mimeType,p?.voiceSpeed??1,e.answer,!0,t=>{S(!0),a&&R(r,e.answer,t)},()=>{S(!1),a&&L(r,e.answer)});a&&!t&&L(r,e.answer)}e.answer&&t.onMessage?.({role:`assistant`,content:e.answer}),e.handoffOffered&&t.onHandoff?.(),e.conversationEnded&&w(!0)}).catch(e=>{if(d.signal.aborted){delete f.current[r],he(r,{pending:!1,streaming:!1});return}delete f.current[r],he(r,{content:cN(e,t.strings),pending:!1,streaming:!1,error:!0,retryText:n})}).finally(()=>{uN(`data-complete`,a),delete f.current[r],b(!1),s.current=null})},[e,t,he,p?.allowVoiceInput,p?.talkbackMode,p?.voiceOutputEnabled,p?.voiceSpeed,z]),V=(0,r.useCallback)((e,n={})=>{let r=e.trim(),{imageUrl:i,attachmentName:a,attachmentText:o,forceVoicePlayback:s,userMessageId:c}=n;if(!r&&!i&&!o||y||C)return;v.current=!0;let l=r;o?l=`${r}\n\n[Attached file${a?` "${a}"`:``}]:\n${o}`.trim():!l&&i&&(l=i);let u={id:c||hN(),role:`user`,content:r,imageUrl:i,attachmentName:a},d=hN();g(e=>[...c&&e.some(e=>e.id===c)?e.map(e=>e.id===c?{...e,content:r,pending:!1,streaming:!1,imageUrl:i,attachmentName:a}:e):[...e,u],{id:d,role:`assistant`,content:``,pending:!0}]),sN(`send`),t.onMessage?.({role:`user`,content:l}),_e(l,d,{forceVoicePlayback:s})},[y,C,t,_e]),ve=(0,r.useCallback)(()=>s.current?.abort(),[]),ye=(0,r.useCallback)(()=>{z(),c.current?.pause(),c.current=null,typeof window<`u`&&`speechSynthesis`in window&&window.speechSynthesis.cancel(),l.current=null,S(!1)},[z]),be=(0,r.useCallback)(t=>{let n=mN(t);if(!n)return Promise.resolve(!1);let r=!!(p?.allowVoiceInput&&p?.voiceOutputEnabled&&p.talkbackMode!==`text`),i=(e,t)=>new Promise(r=>{let i=!1;_N(c,l,e,t,p?.voiceSpeed??1,n,!0,()=>{i=!0,S(!0)},()=>{S(!1),r(i)})||(S(!1),r(!1))});return r?e.speak(n).then(e=>e.audioBase64?i(e.audioBase64,e.mimeType):(gN(`Talkback prompt TTS did not return provider audio.`,{providerReady:e.providerReady,message:e.message,voiceProvider:p?.voiceProvider,voiceOutputEnabled:p?.voiceOutputEnabled,talkbackMode:p?.talkbackMode}),i())).catch(e=>(gN(`Talkback prompt TTS request failed before audio playback.`,{error:e instanceof Error?e.message:String(e),voiceProvider:p?.voiceProvider,voiceOutputEnabled:p?.voiceOutputEnabled,talkbackMode:p?.talkbackMode}),i())):(gN(`Talkback prompt wanted voice, but the loaded widget token config has provider TTS disabled.`,{voiceOutputEnabled:p?.voiceOutputEnabled,talkbackMode:p?.talkbackMode,voiceProvider:p?.voiceProvider}),i())},[p?.allowVoiceInput,p?.talkbackMode,p?.voiceOutputEnabled,p?.voiceSpeed,e]),H=(0,r.useCallback)((e,t)=>{y||C||!t||(he(e,{content:``,pending:!0,streaming:!1,error:!1}),sN(`send`),_e(t,e))},[y,C,he,_e]),U=(0,r.useCallback)((t,n,r)=>{he(t,{feedback:n});let i=h.findIndex(e=>e.id===t),a=i>=0?h[i]?.content:void 0,s;for(let e=i-1;e>=0;e--)if(h[e]?.role===`user`){s=h[e]?.content;break}e.sendFeedback({sessionId:o.current,messageId:t,rating:n,comment:r,question:s,answer:a}).catch(()=>{})},[e,he,h]),xe=(0,r.useCallback)(async(n,r,i={},a)=>{t.onAction?.(n);let s=await e.action(n,{sessionId:o.current,...r},a),c={};return i.name?.trim()&&(c.name=i.name.trim()),i.email?.trim()&&(c.email=i.email.trim()),i.phone?.trim()&&(c.phone=i.phone.trim()),Object.keys(c).length>0&&(E(e=>{let t={...e,...c};return de(t),t}),c.email&&n!==`contact`&&e.action(`contact`,{sessionId:o.current,...c}).catch(()=>{})),sN(`receive`),s},[e,t,de]),Se=(0,r.useCallback)(e=>{let t=e.trim();t&&g(e=>e.some(e=>e.role===`assistant`&&e.content===t)?e:[...e,{id:hN(),role:`assistant`,content:t}])},[]),Ce=(0,r.useCallback)(e=>{v.current=!0;let t=hN();return g(n=>[...n,{id:t,role:`user`,content:e.trim(),pending:!0}]),t},[]),we=(0,r.useCallback)((e,t)=>{g(n=>n.map(n=>n.id===e?{...n,...t}:n))},[]),W=(0,r.useCallback)(e=>{g(t=>t.filter(t=>t.id!==e))},[]),Te=(0,r.useCallback)((t,n)=>{e.sendFeedback({sessionId:o.current,messageId:`__csat__`,rating:t,comment:n}).catch(()=>{})},[e]),G=(0,r.useCallback)(async(t,n,r,i)=>{let a=lN();try{if(typeof t!=`string`&&e.transcribeAudio)return await e.transcribeAudio(t,n,r,i);let a=typeof t==`string`?t:await VM(t);return await e.transcribe(a,n,r,i)}finally{uN(`voice-transcription`,a)}},[e]),K=(0,r.useCallback)((t,n,r)=>e.extract(t,n,r),[e]),q=(0,r.useCallback)(t=>e.searchGifs(t),[e]),Ee=(0,r.useCallback)((t,n)=>e.demoSlots(t,n),[e]),De=(0,r.useCallback)(e=>V(``,{imageUrl:e}),[V]),J=t.demo||!!t.gifApiKey,Oe=(0,r.useCallback)(()=>{s.current?.abort(),w(!0),e.endConversation(o.current).catch(()=>{})},[e]),ke=(0,r.useCallback)(()=>{s.current?.abort();let e=SN(t);o.current=e;try{i?.setItem(wN(a),e)}catch{}A(null),M([]),w(!1),P(`ai`),te(void 0),re(void 0),ie.current=new Date().toISOString(),g(p?[{id:hN(),role:`assistant`,content:p.greeting,availableActions:p.availableActions,actions:p.actions}]:[])},[i,a,p]),Ae=(0,r.useCallback)(e=>{if(le){if(e===o.current){A(null);return}M(PN(i,a,e)),A(e)}},[i,a,le]),je=(0,r.useCallback)(()=>{A(null),M([])},[]);return{persona:p,messages:h,sending:y,assistantSpeaking:x,visitor:T,starters:t.starters.length>0?t.starters:p?.starterQuestions??[],featuredLinks:p?.featuredLinks??[],hasEmail:!!T.email,liveMode:N,assignedAgentName:ee,agentTypingName:ne,send:V,sendGif:De,notifyTyping:B,stop:ve,retry:H,rateMessage:U,injectAssistant:Se,appendUserDraft:Ce,patchMessage:we,removeMessage:W,submitCsat:Te,submitForm:xe,transcribe:G,extract:K,searchGifs:q,demoSlots:Ee,gifEnabled:J,identify:fe,ended:C,endConversation:Oe,startNew:ke,history:le?D:[],viewingSessionId:k,viewMessages:j,openConversation:Ae,closeHistoryView:je,shutdown:I,stopSpeaking:ye,speakAssistantText:be}},GN=`https://api.accurixtech.com`,KN=()=>typeof navigator<`u`&&(navigator.languages?.[0]||navigator.language)||`en`,qN=(e,t)=>{if(!e)return;let n=t.trim().toLowerCase(),r=n.split(`-`)[0]??n,i=Object.entries(e);return i.find(([e])=>e.toLowerCase()===n)?.[1]??i.find(([e])=>e.toLowerCase()===r)?.[1]},JN=e=>{if(!e||typeof e.token!=`string`||e.token.length===0)throw Error("[centrinfo-widget] `token` is required — pass your pub_* token to Centrinfo.init({ token }).");let t=e.locale?.trim()||KN(),n=qN(e.translations,t);return{token:e.token,chatSurface:e.chatSurface??`floating`,analyticsContextToken:e.analyticsContextToken,identityToken:e.identityToken,getIdentityToken:e.getIdentityToken,apiBaseUrl:(e.apiBaseUrl??`https://api.accurixtech.com`).replace(/\/$/,``),accentColor:e.accentColor,themeTokens:e.themeTokens,agentName:e.agentName?.trim()||void 0,agentAvatarUrl:e.agentAvatarUrl?.trim()||void 0,launcherIcon:e.launcherIcon,gifApiKey:e.gifApiKey,theme:e.theme??`auto`,openByDefault:e.openByDefault??!1,sound:e.sound??!0,starters:e.starters??[],strings:KM({...n?.labels,...e.labels}),locale:t,actionTranslations:n?.actions??{},persistence:e.persistence??`local`,attachments:e.attachments??!0,zIndex:e.zIndex??2147483e3,styleNonce:e.styleNonce?.trim()??``,demo:e.demo??!1,preview:e.preview??!1,alignment:e.alignment===`left`?`left`:`right`,horizontalPadding:typeof e.horizontalPadding==`number`?e.horizontalPadding:20,verticalPadding:typeof e.verticalPadding==`number`?e.verticalPadding:20,hideDefaultLauncher:e.hideDefaultLauncher??!1,customLauncherSelector:e.customLauncherSelector,sessionDurationMinutes:typeof e.sessionDurationMinutes==`number`?e.sessionDurationMinutes:0,configRefreshSeconds:typeof e.configRefreshSeconds==`number`?e.configRefreshSeconds:30,proactiveMessage:e.proactiveMessage,proactiveDelaySeconds:typeof e.proactiveDelaySeconds==`number`?e.proactiveDelaySeconds:5,proactiveOnPaths:e.proactiveOnPaths,csat:e.csat??!0,user:e.user,onOpen:e.onOpen,onClose:e.onClose,onShow:e.onShow,onHide:e.onHide,onUnreadChange:e.onUnreadChange,onMessage:e.onMessage,onAction:e.onAction,onHandoff:e.onHandoff}};Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return kM}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return tN}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return EM}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return YM}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return zM}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return UM}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return PM}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return MM}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return iN}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return BM}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return FM}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return WN}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return JM}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return IM}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return sN}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return GM}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return JN}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return HM}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return TM}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return yM}});
|